Class DiagramShape
- java.lang.Object
-
- org.stathissideris.ascii2image.graphics.DiagramComponent
-
- org.stathissideris.ascii2image.graphics.DiagramShape
-
public class DiagramShape extends DiagramComponent
- Author:
- Efstathios Sideris
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList
points
protected int
type
static int
TYPE_ARROWHEAD
static int
TYPE_CUSTOM
static int
TYPE_DECISION
static int
TYPE_DOCUMENT
static int
TYPE_ELLIPSE
static int
TYPE_IO
static int
TYPE_MANUAL_OPERATION
static int
TYPE_POINT_MARKER
static int
TYPE_SIMPLE
static int
TYPE_STORAGE
static int
TYPE_TRAPEZOID
-
Constructor Summary
Constructors Constructor Description DiagramShape()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addToPoints(ShapePoint point)
void
connectEndsToAnchors(TextGrid grid, Diagram diagram)
boolean
contains(Rectangle2D rect)
boolean
contains(ShapePoint point)
static DiagramShape
createArrowhead(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)
static DiagramShape
createSmallLine(TextGrid grid, TextGrid.Cell cell, int cellXSize, int cellYSize)
boolean
dropsShadow()
boolean
equals(Object object)
Rectangle
getBounds()
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.ShapePoint
getCellEdgeProjectionPointBetween(ShapePoint pointInCell, ShapePoint otherPoint, Diagram diagram)
Returns C, if A is point in cell and B is otherPoint:CustomShapeDefinition
getDefinition()
ArrayList
getEdges()
Color
getFillColor()
ShapePoint
getPoint(int i)
ArrayList
getPoints()
Iterator
getPointsIterator()
Color
getStrokeColor()
int
getType()
boolean
intersects(Rectangle2D rect)
boolean
isClosed()
boolean
isEmpty()
boolean
isFilled()
boolean
isPointLinesEnd(ShapePoint point)
boolean
isRectangle()
boolean
isSmallerThan(DiagramShape other)
Crude way to determine which of the two shapes is smaller, based just on their bounding boxes.boolean
isStrokeDashed()
static void
main(String[] args)
GeneralPath
makeIntoPath()
GeneralPath
makeIntoRenderPath(Diagram diagram)
GeneralPath
makeMarkerPath(Diagram diagram)
void
moveEndsToCellEdges(TextGrid grid, Diagram diagram)
void
printDebug()
void
scale(float factor)
void
setClosed(boolean b)
void
setDefinition(CustomShapeDefinition definition)
void
setFillColor(Color color)
void
setIsNotFilled()
void
setPoint(int i, ShapePoint point)
void
setStrokeColor(Color color)
void
setStrokeDashed(boolean b)
void
setType(int i)
String
toString()
-
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 ArrayList points
-
-
Method Detail
-
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)
-
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
-
-
isStrokeDashed
public boolean isStrokeDashed()
- Returns:
-
setStrokeDashed
public void setStrokeDashed(boolean b)
- Parameters:
b
-
-
getDefinition
public CustomShapeDefinition getDefinition()
-
setDefinition
public void setDefinition(CustomShapeDefinition definition)
-
-