Class AbstractShapeFigure

    • Constructor Detail

      • AbstractShapeFigure

        protected AbstractShapeFigure()
      • AbstractShapeFigure

        protected AbstractShapeFigure​(Figure.Rank rank,
                                      FigureStyle normalStyle,
                                      FigureStyle selectedStyle)
        Constructor.
        Parameters:
        rank - The rank, must be either Figure.Rank.AREA or Figure.Rank.LINE.
        normalStyle - The style used for the "normal" state of the figure.
        selectedStyle - The style used for the "selected" state of the figure.
    • Method Detail

      • isCollection

        public boolean isCollection()
        Description copied from interface: Figure
        Tests if this figure is a figure collection.
        Specified by:
        isCollection in interface Figure
        Returns:
        true, if so.
      • setRank

        protected void setRank​(Figure.Rank rank)
      • getBounds

        public Rectangle2D getBounds()
        Specified by:
        getBounds in interface Figure
        Returns:
        The figure bounds in model coordinates.
      • draw

        public void draw​(Rendering rendering)
        Description copied from interface: Figure
        Draws this figure using the given rendering.
        Specified by:
        draw in interface Figure
        Parameters:
        rendering - The rendering used to draw the figure.
      • drawShape

        protected void drawShape​(Rendering rendering)
        Draws the shape and other items that are used to graphically represent the figure, for example labels. For convenience, the rendering's drawing context is pre-transformed, so that drawing of the shape can be performed in model coordinates.
        Parameters:
        rendering - The rendering.
      • isCloseTo

        public boolean isCloseTo​(Point2D point,
                                 AffineTransform m2v)
        Description copied from interface: Figure
        Tests if the given point is "close to" this figure.
        Specified by:
        isCloseTo in interface Figure
        Parameters:
        point - Point in model coordinates.
        m2v - Current model-to-view transformation.
        Returns:
        true, if the point is close to this figure.
      • scale

        public void scale​(Point2D refPoint,
                          double sx,
                          double sy)
        Description copied from interface: Figure
        Scales the figure by the given scale factors.
        Specified by:
        scale in interface Figure
        Overrides:
        scale in class AbstractFigure
        Parameters:
        refPoint - The reference point in model coordinates.
        sx - Scale X factor.
        sy - Scale Y factor.
      • move

        public void move​(double dx,
                         double dy)
        Description copied from interface: Figure
        Moves the figure by the given delta in model coordinates.
        Specified by:
        move in interface Figure
        Overrides:
        move in class AbstractFigure
        Parameters:
        dx - Delta X in model coordinates.
        dy - Delta Y in model coordinates.
      • rotate

        public void rotate​(Point2D point,
                           double theta)
        Description copied from interface: Figure
        Rotates the figure by the given angle.
        Specified by:
        rotate in interface Figure
        Overrides:
        rotate in class AbstractFigure
        Parameters:
        point - The reference point in model coordinates.
        theta - The rotation angle in degree.
      • getSegment

        public double[] getSegment​(int index)
        Description copied from interface: Figure
        Gets the segment at the given vertex index.
        Specified by:
        getSegment in interface Figure
        Overrides:
        getSegment in class AbstractFigure
        Parameters:
        index - The vertex index.
        Returns:
        The segment coordinates. X is the first element, Y the second.
      • setSegment

        public void setSegment​(int index,
                               double[] newSeg)
        Description copied from interface: Figure
        Sets the segment at the given vertex index.
        Specified by:
        setSegment in interface Figure
        Overrides:
        setSegment in class AbstractFigure
        Parameters:
        index - The vertex index.
        newSeg - The segment coordinates. X is the first element, Y the second.
      • addSegment

        public void addSegment​(int index,
                               double[] segment)
        Description copied from interface: Figure
        Adds the segment at the given vertex index.
        Specified by:
        addSegment in interface Figure
        Overrides:
        addSegment in class AbstractFigure
        Parameters:
        index - The vertex index.
        segment - The segment coordinates. X is the first element, Y the second.
      • removeSegment

        public void removeSegment​(int index)
        Description copied from interface: Figure
        Removes the segment at the given vertex index.
        Specified by:
        removeSegment in interface Figure
        Overrides:
        removeSegment in class AbstractFigure
        Parameters:
        index - The vertex index.
      • setMemento

        public void setMemento​(Object memento)
        Description copied from class: AbstractFigure
        The default implementation does nothing. Clients should override in order to evaluate the passed in memento. object.
        Specified by:
        setMemento in interface Restorable
        Overrides:
        setMemento in class AbstractFigure
        Parameters:
        memento - A memento object.
      • createHandles

        public Handle[] createHandles​(int selectionStage)
        Description copied from class: AbstractFigure
        The default implementation returns an empty array. Clients should override in order to create an array of handles suitable for the given selection stage.
        Specified by:
        createHandles in interface Figure
        Overrides:
        createHandles in class AbstractFigure
        Parameters:
        selectionStage - The selection stage. 1 <= selectionLevel <= AbstractFigure.getMaxSelectionStage()
        Returns:
        The array of handles.