org.stathissideris.ascii2image.graphics
Class DiagramShape

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

public class DiagramShape
extends DiagramComponent

Author:
Efstathios Sideris

Field Summary
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
DiagramShape()
           
 
Method Summary
 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: Cell +-----+ | A | B C *--*--+------------------* | | +-----+
 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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

DiagramShape

public DiagramShape()
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)

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 -
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)


Copyright © 2013. All Rights Reserved.