org.stathissideris.ascii2image.graphics
Class Diagram
java.lang.Object
org.stathissideris.ascii2image.graphics.Diagram
public class Diagram
- extends Object
- Author:
- Efstathios Sideris
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Diagram
public Diagram(TextGrid grid,
ConversionOptions options,
ProcessingOptions processingOptions)
An outline of the inner workings of this very important (and monstrous)
constructor is presented here. Boundary processing is the first step
of the process:
- Copy the grid into a work grid and remove all type-on-line
and point markers from the work grid
- Split grid into distinct shapes by plotting the grid
onto an AbstractionGrid and its getDistinctShapes() method.
- Find all the possible boundary sets of each of the
distinct shapes. This can produce duplicate shapes (if the boundaries
are the same when filling from the inside and the outside).
- Remove duplicate boundaries.
- Remove obsolete boundaries. Obsolete boundaries are the ones that are
the sum of their parts when plotted as filled shapes. (see method
removeObsoleteShapes())
- Seperate the found boundary sets to open, closed or mixed
(See CellSet class on how its done).
- Are there any closed boundaries?
- YES. Subtract all the closed boundaries from each of the
open ones. That should convert the mixed shapes into open.
- NO. In this (harder) case, we use the method
breakTrulyMixedBoundaries() of CellSet to break boundaries
into open and closed shapes (would work in any case, but it's
probably slower than the other method). This method is based
on tracing from the lines' ends and splitting when we get to
an intersection.
- If we had to eliminate any mixed shapes, we seperate the found
boundary sets again to open, closed or mixed.
At this stage, the boundary processing is all complete and we
proceed with using those boundaries to create the shapes:
- Create closed shapes.
- Create open shapes. That's when the line end corrections are
also applied, concerning the positioning of the ends of lines
see methods connectEndsToAnchors() and moveEndsToCellEdges() of
DiagramShape.
- Assign color codes to closed shapes.
- Assing extended markup tags to closed shapes.
- Create arrowheads.
- Create point markers.
Finally, the text processing occurs: [pending]
- Parameters:
grid
- cellWidth
- cellHeight
-
getAllDiagramShapes
public ArrayList getAllDiagramShapes()
- Returns a list of all DiagramShapes in the Diagram, including
the ones within CompositeDiagramShapes
- Returns:
getMinimumOfCellDimension
public float getMinimumOfCellDimension()
getShapesIterator
public Iterator getShapesIterator()
getHeight
public int getHeight()
- Returns:
getWidth
public int getWidth()
- Returns:
getCellWidth
public int getCellWidth()
- Returns:
getCellHeight
public int getCellHeight()
- Returns:
getCompositeShapes
public ArrayList getCompositeShapes()
- Returns:
getShapes
public ArrayList getShapes()
- Returns:
getCellMinX
public int getCellMinX(TextGrid.Cell cell)
getCellMinX
public static int getCellMinX(TextGrid.Cell cell,
int cellXSize)
getCellMidX
public int getCellMidX(TextGrid.Cell cell)
getCellMidX
public static int getCellMidX(TextGrid.Cell cell,
int cellXSize)
getCellMaxX
public int getCellMaxX(TextGrid.Cell cell)
getCellMaxX
public static int getCellMaxX(TextGrid.Cell cell,
int cellXSize)
getCellMinY
public int getCellMinY(TextGrid.Cell cell)
getCellMinY
public static int getCellMinY(TextGrid.Cell cell,
int cellYSize)
getCellMidY
public int getCellMidY(TextGrid.Cell cell)
getCellMidY
public static int getCellMidY(TextGrid.Cell cell,
int cellYSize)
getCellMaxY
public int getCellMaxY(TextGrid.Cell cell)
getCellMaxY
public static int getCellMaxY(TextGrid.Cell cell,
int cellYSize)
getCellFor
public TextGrid.Cell getCellFor(ShapePoint point)
getTextObjects
public ArrayList getTextObjects()
- Returns:
Copyright © 2013. All Rights Reserved.