Class DiagramShape

    • Constructor Detail

      • DiagramShape

        public DiagramShape()
    • Method Detail

      • main

        public static void main​(String[] args)
      • addToPoints

        public void addToPoints​(ShapePoint point)
      • getPointsIterator

        public Iterator getPointsIterator()
      • scale

        public void scale​(float factor)
      • isEmpty

        public boolean isEmpty()
      • isFilled

        public boolean isFilled()
      • setIsNotFilled

        public void setIsNotFilled()
      • isPointLinesEnd

        public boolean isPointLinesEnd​(ShapePoint point)
      • isRectangle

        public boolean isRectangle()
      • isSmallerThan

        public boolean isSmallerThan​(DiagramShape other)
        Crude way to determine which of the two shapes is smaller, based just on their bounding boxes. Used in markup assignment precendence.
        Parameters:
        other -
        Returns:
      • getFillColor

        public Color getFillColor()
        Returns:
      • getStrokeColor

        public Color getStrokeColor()
        Returns:
      • setFillColor

        public void setFillColor​(Color color)
        Parameters:
        color -
      • setStrokeColor

        public void setStrokeColor​(Color color)
        Parameters:
        color -
      • isClosed

        public boolean isClosed()
        Returns:
      • setClosed

        public void setClosed​(boolean b)
        Parameters:
        b -
      • printDebug

        public void printDebug()
      • getPoints

        public ArrayList getPoints()
        Returns:
      • getPoint

        public ShapePoint getPoint​(int i)
      • setPoint

        public void setPoint​(int i,
                             ShapePoint point)
      • getCellEdgePointBetween

        public ShapePoint getCellEdgePointBetween​(ShapePoint pointInCell,
                                                  ShapePoint otherPoint,
                                                  Diagram diagram)
        Finds the point that represents the intersection between the cell edge that contains pointInCell and the line connecting pointInCell and otherPoint. Returns C, if A is point in cell and B is otherPoint:
             Cell
            +-----+
            |  A  |C                 B
            |  *--*------------------*
            |     |
            +-----+
        
        Parameters:
        pointInCell -
        otherPoint -
        diagram -
        Returns:
      • getCellEdgeProjectionPointBetween

        public ShapePoint getCellEdgeProjectionPointBetween​(ShapePoint pointInCell,
                                                            ShapePoint otherPoint,
                                                            Diagram diagram)
        Returns C, if A is point in cell and B is otherPoint:
             Cell
            +-----+
            |  A  |                  B
          C *--*--+------------------*
            |     |
            +-----+
         
        Parameters:
        pointInCell -
        otherPoint -
        diagram -
        Returns:
      • contains

        public boolean contains​(ShapePoint point)
      • contains

        public boolean contains​(Rectangle2D rect)
      • intersects

        public boolean intersects​(Rectangle2D rect)
      • dropsShadow

        public boolean dropsShadow()
      • getType

        public int getType()
        Returns:
      • setType

        public void setType​(int i)
        Parameters:
        i -
      • moveEndsToCellEdges

        public void moveEndsToCellEdges​(TextGrid grid,
                                        Diagram diagram)
      • connectEndsToAnchors

        public void connectEndsToAnchors​(TextGrid grid,
                                         Diagram diagram)
      • isStrokeDashed

        public boolean isStrokeDashed()
        Returns:
      • setStrokeDashed

        public void setStrokeDashed​(boolean b)
        Parameters:
        b -