Class DiagramShape
java.lang.Object
org.stathissideris.ascii2image.graphics.DiagramComponent
org.stathissideris.ascii2image.graphics.DiagramShape
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<ShapePoint>static final floatThe slope of side lines on trapezoids (mo, tr) and parallelograms (io).protected intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToPoints(ShapePoint point) doubleSee http://mathworld.wolfram.com/PolygonArea.htmlvoidconnectEndsToAnchors(TextGrid grid, Diagram diagram) booleancontains(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) booleanbooleangetCellEdgePointBetween(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.getCellEdgeProjectionPointBetween(ShapePoint pointInCell, ShapePoint otherPoint, Diagram diagram) Returns C, if A is point in cell and B is otherPoint:getEdges()getPoint(int i) intgetType()booleanintersects(Rectangle2D rect) booleanisClosed()booleanisEmpty()booleanisFilled()booleanisPointLinesEnd(ShapePoint point) booleanbooleanisSmallerThan(DiagramShape other) Crude way to determine which of the two shapes is smaller, based just on their bounding boxes.booleanstatic voidmakeIntoRenderPath(Diagram diagram, RenderingOptions options) makeMarkerPath(Diagram diagram) voidmoveEndsToCellEdges(TextGrid grid, Diagram diagram) voidvoidscale(float factor) voidsetClosed(boolean b) voidsetDefinition(CustomShapeDefinition definition) voidsetFillColor(Color color) voidvoidsetPoint(int i, ShapePoint point) voidsetStrokeColor(Color color) voidsetStrokeDashed(boolean b) voidsetType(int i) toString()Methods inherited from class org.stathissideris.ascii2image.graphics.DiagramComponent
createClosedFromBoundaryCells, createClosedFromBoundaryCells, makePointForCell
-
Field Details
-
TYPE_SIMPLE
public static final int TYPE_SIMPLE- See Also:
-
TYPE_ARROWHEAD
public static final int TYPE_ARROWHEAD- See Also:
-
TYPE_POINT_MARKER
public static final int TYPE_POINT_MARKER- See Also:
-
TYPE_DOCUMENT
public static final int TYPE_DOCUMENT- See Also:
-
TYPE_STORAGE
public static final int TYPE_STORAGE- See Also:
-
TYPE_IO
public static final int TYPE_IO- See Also:
-
TYPE_DECISION
public static final int TYPE_DECISION- See Also:
-
TYPE_MANUAL_OPERATION
public static final int TYPE_MANUAL_OPERATION- See Also:
-
TYPE_TRAPEZOID
public static final int TYPE_TRAPEZOID- See Also:
-
TYPE_ELLIPSE
public static final int TYPE_ELLIPSE- See Also:
-
TYPE_CUSTOM
public static final int TYPE_CUSTOM- See Also:
-
SHAPE_SLOPE
public static final float SHAPE_SLOPEThe slope of side lines on trapezoids (mo, tr) and parallelograms (io).- See Also:
-
type
protected int type -
points
-
-
Constructor Details
-
DiagramShape
public DiagramShape()
-
-
Method Details
-
main
-
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
-
getPointsIterator
-
scale
public void scale(float factor) -
isEmpty
public boolean isEmpty() -
isFilled
public boolean isFilled() -
setIsNotFilled
public void setIsNotFilled() -
isPointLinesEnd
-
isRectangle
public boolean isRectangle() -
isSmallerThan
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
- Returns:
-
getStrokeColor
- Returns:
-
setFillColor
- Parameters:
color-
-
setStrokeColor
- Parameters:
color-
-
isClosed
public boolean isClosed()- Returns:
-
setClosed
public void setClosed(boolean b) - Parameters:
b-
-
printDebug
public void printDebug() -
getPoints
- Returns:
-
getPoint
-
setPoint
-
equals
-
makeIntoPath
-
makeMarkerPath
-
getBounds
-
makeIntoRenderPath
-
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-- 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
-
contains
-
intersects
-
dropsShadow
public boolean dropsShadow() -
getType
public int getType()- Returns:
-
setType
public void setType(int i) - Parameters:
i-
-
moveEndsToCellEdges
-
connectEndsToAnchors
-
toString
-
isStrokeDashed
public boolean isStrokeDashed()- Returns:
-
setStrokeDashed
public void setStrokeDashed(boolean b) - Parameters:
b-
-
getDefinition
-
setDefinition
-
calculateArea
public double calculateArea()See http://mathworld.wolfram.com/PolygonArea.html- Returns:
- the overall area of the shape
-