Class RMEditorProxGuide


  • public class RMEditorProxGuide
    extends java.lang.Object
    This class offers some methods to provide "proximity guides" for RMEditor. This feature draws lines indicating when dragged shapes share alignments with some of their neighboring shapes (and also snaps to these alignments, too).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clearGuidelines​(RMEditor anEditor)
      Empties the guideline list and marks the old guideline region for repaint
      static void createGuidelines​(RMEditor anEditor)
      Calculate guidelines for the bounds of the selected shapes against all other superselected shapes.
      static void createGuidelines​(RMEditor anEditor, RMShape parent, RMRect bounds, java.util.List candidateShapes)
      Recalculates all the proximity guides and marks dirty region in editor for old & new guide regions.
      static java.util.List getCandidateShapes​(RMEditor anEditor)
      Returns the list of shapes to be included in the proximity check.
      static boolean isEnabled()
      Returns whether proximity guides are enabled.
      static void markGuidelinesDirty​(RMEditor anEditor)
      Runs through the guideline list and asks the editor to repaint the enclosing rect.
      static void paintProximityGuides​(RMEditor anEditor, java.awt.Graphics2D g)
      Called by the editor to paint all the guidelines in the guideline list
      static RMPoint pointSnappedToProximityGuides​(RMEditor anEditor, RMPoint aPoint)
      Returns the given point snapped to relevant proximity guides.
      static RMPoint pointSnappedToProximityGuides​(RMEditor anEditor, RMPoint aPoint, int dragMode)
      Returns the given point snapped to relevant proxity guides for a given drag mode.
      static void setEnabled​(boolean aFlag)
      Sets whether proximity guides are enabled.
      static void setIncludesSuperselectedShape​(boolean aFlag)
      If this flag is set, the bounds of the parent shape are also checked for proximity.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RMEditorProxGuide

        public RMEditorProxGuide()
    • Method Detail

      • isEnabled

        public static boolean isEnabled()
        Returns whether proximity guides are enabled.
      • setEnabled

        public static void setEnabled​(boolean aFlag)
        Sets whether proximity guides are enabled.
      • clearGuidelines

        public static void clearGuidelines​(RMEditor anEditor)
        Empties the guideline list and marks the old guideline region for repaint
      • markGuidelinesDirty

        public static void markGuidelinesDirty​(RMEditor anEditor)
        Runs through the guideline list and asks the editor to repaint the enclosing rect.
      • paintProximityGuides

        public static void paintProximityGuides​(RMEditor anEditor,
                                                java.awt.Graphics2D g)
        Called by the editor to paint all the guidelines in the guideline list
      • setIncludesSuperselectedShape

        public static void setIncludesSuperselectedShape​(boolean aFlag)
        If this flag is set, the bounds of the parent shape are also checked for proximity.
      • getCandidateShapes

        public static java.util.List getCandidateShapes​(RMEditor anEditor)
        Returns the list of shapes to be included in the proximity check.
      • createGuidelines

        public static void createGuidelines​(RMEditor anEditor)
        Calculate guidelines for the bounds of the selected shapes against all other superselected shapes.
      • createGuidelines

        public static void createGuidelines​(RMEditor anEditor,
                                            RMShape parent,
                                            RMRect bounds,
                                            java.util.List candidateShapes)
        Recalculates all the proximity guides and marks dirty region in editor for old & new guide regions. Guides are calculated between the bounds rectangle and each of the candidateShapes, within the parent RMShape.
      • pointSnappedToProximityGuides

        public static RMPoint pointSnappedToProximityGuides​(RMEditor anEditor,
                                                            RMPoint aPoint)
        Returns the given point snapped to relevant proximity guides.
      • pointSnappedToProximityGuides

        public static RMPoint pointSnappedToProximityGuides​(RMEditor anEditor,
                                                            RMPoint aPoint,
                                                            int dragMode)
        Returns the given point snapped to relevant proxity guides for a given drag mode.