Class DiagramShape

java.lang.Object
org.stathissideris.ascii2image.graphics.DiagramComponent
org.stathissideris.ascii2image.graphics.DiagramShape

public class DiagramShape extends DiagramComponent
  • Field Details

  • Constructor Details

    • DiagramShape

      public DiagramShape()
  • Method Details

    • main

      public static void main(String[] args)
    • createArrowhead

      public static DiagramShape createArrowhead(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)
    • createSmallLine

      public static DiagramShape createSmallLine(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)
    • 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)
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • makeIntoPath

      public GeneralPath makeIntoPath()
    • makeMarkerPath

      public GeneralPath makeMarkerPath(Diagram diagram)
    • getBounds

      public Rectangle getBounds()
    • makeIntoRenderPath

      public GeneralPath makeIntoRenderPath(Diagram diagram)
    • getEdges

      public ArrayList getEdges()
    • 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)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isStrokeDashed

      public boolean isStrokeDashed()
      Returns:
    • setStrokeDashed

      public void setStrokeDashed(boolean b)
      Parameters:
      b -
    • getDefinition

      public CustomShapeDefinition getDefinition()
    • setDefinition

      public void setDefinition(CustomShapeDefinition definition)