Class DiagramShape
- java.lang.Object
-
- org.stathissideris.ascii2image.graphics.DiagramComponent
-
- org.stathissideris.ascii2image.graphics.DiagramShape
-
public class DiagramShape extends DiagramComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayListpointsprotected inttypestatic intTYPE_ARROWHEADstatic intTYPE_CUSTOMstatic intTYPE_DECISIONstatic intTYPE_DOCUMENTstatic intTYPE_ELLIPSEstatic intTYPE_IOstatic intTYPE_MANUAL_OPERATIONstatic intTYPE_POINT_MARKERstatic intTYPE_SIMPLEstatic intTYPE_STORAGEstatic intTYPE_TRAPEZOID
-
Constructor Summary
Constructors Constructor Description DiagramShape()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToPoints(ShapePoint point)voidconnectEndsToAnchors(TextGrid grid, Diagram diagram)booleancontains(java.awt.geom.Rectangle2D rect)booleancontains(ShapePoint point)static DiagramShapecreateArrowhead(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)static DiagramShapecreateSmallLine(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)booleandropsShadow()booleanequals(java.lang.Object object)java.awt.RectanglegetBounds()ShapePointgetCellEdgePointBetween(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.ShapePointgetCellEdgeProjectionPointBetween(ShapePoint pointInCell, ShapePoint otherPoint, Diagram diagram)Returns C, if A is point in cell and B is otherPoint:CustomShapeDefinitiongetDefinition()java.util.ArrayListgetEdges()java.awt.ColorgetFillColor()ShapePointgetPoint(int i)java.util.ArrayListgetPoints()java.util.IteratorgetPointsIterator()java.awt.ColorgetStrokeColor()intgetType()booleanintersects(java.awt.geom.Rectangle2D rect)booleanisClosed()booleanisEmpty()booleanisFilled()booleanisPointLinesEnd(ShapePoint point)booleanisRectangle()booleanisSmallerThan(DiagramShape other)Crude way to determine which of the two shapes is smaller, based just on their bounding boxes.booleanisStrokeDashed()static voidmain(java.lang.String[] args)java.awt.geom.GeneralPathmakeIntoPath()java.awt.geom.GeneralPathmakeIntoRenderPath(Diagram diagram)java.awt.geom.GeneralPathmakeMarkerPath(Diagram diagram)voidmoveEndsToCellEdges(TextGrid grid, Diagram diagram)voidprintDebug()voidscale(float factor)voidsetClosed(boolean b)voidsetDefinition(CustomShapeDefinition definition)voidsetFillColor(java.awt.Color color)voidsetIsNotFilled()voidsetPoint(int i, ShapePoint point)voidsetStrokeColor(java.awt.Color color)voidsetStrokeDashed(boolean b)voidsetType(int i)java.lang.StringtoString()-
Methods inherited from class org.stathissideris.ascii2image.graphics.DiagramComponent
createClosedFromBoundaryCells, createClosedFromBoundaryCells, makePointForCell
-
-
-
-
Field Detail
-
TYPE_SIMPLE
public static final int TYPE_SIMPLE
- See Also:
- Constant Field Values
-
TYPE_ARROWHEAD
public static final int TYPE_ARROWHEAD
- See Also:
- Constant Field Values
-
TYPE_POINT_MARKER
public static final int TYPE_POINT_MARKER
- See Also:
- Constant Field Values
-
TYPE_DOCUMENT
public static final int TYPE_DOCUMENT
- See Also:
- Constant Field Values
-
TYPE_STORAGE
public static final int TYPE_STORAGE
- See Also:
- Constant Field Values
-
TYPE_IO
public static final int TYPE_IO
- See Also:
- Constant Field Values
-
TYPE_DECISION
public static final int TYPE_DECISION
- See Also:
- Constant Field Values
-
TYPE_MANUAL_OPERATION
public static final int TYPE_MANUAL_OPERATION
- See Also:
- Constant Field Values
-
TYPE_TRAPEZOID
public static final int TYPE_TRAPEZOID
- See Also:
- Constant Field Values
-
TYPE_ELLIPSE
public static final int TYPE_ELLIPSE
- See Also:
- Constant Field Values
-
TYPE_CUSTOM
public static final int TYPE_CUSTOM
- See Also:
- Constant Field Values
-
type
protected int type
-
points
protected java.util.ArrayList points
-
-
Method Detail
-
main
public static void main(java.lang.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 java.util.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 java.awt.Color getFillColor()
- Returns:
-
getStrokeColor
public java.awt.Color getStrokeColor()
- Returns:
-
setFillColor
public void setFillColor(java.awt.Color color)
- Parameters:
color-
-
setStrokeColor
public void setStrokeColor(java.awt.Color color)
- Parameters:
color-
-
isClosed
public boolean isClosed()
- Returns:
-
setClosed
public void setClosed(boolean b)
- Parameters:
b-
-
printDebug
public void printDebug()
-
getPoints
public java.util.ArrayList getPoints()
- Returns:
-
getPoint
public ShapePoint getPoint(int i)
-
setPoint
public void setPoint(int i, ShapePoint point)
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equalsin classjava.lang.Object
-
makeIntoPath
public java.awt.geom.GeneralPath makeIntoPath()
-
makeMarkerPath
public java.awt.geom.GeneralPath makeMarkerPath(Diagram diagram)
-
getBounds
public java.awt.Rectangle getBounds()
-
makeIntoRenderPath
public java.awt.geom.GeneralPath makeIntoRenderPath(Diagram diagram)
-
getEdges
public java.util.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(java.awt.geom.Rectangle2D rect)
-
intersects
public boolean intersects(java.awt.geom.Rectangle2D rect)
-
dropsShadow
public boolean dropsShadow()
-
getType
public int getType()
- Returns:
-
setType
public void setType(int i)
- Parameters:
i-
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isStrokeDashed
public boolean isStrokeDashed()
- Returns:
-
setStrokeDashed
public void setStrokeDashed(boolean b)
- Parameters:
b-
-
getDefinition
public CustomShapeDefinition getDefinition()
-
setDefinition
public void setDefinition(CustomShapeDefinition definition)
-
-