Class Diagram


  • public class Diagram
    extends java.lang.Object
    Author:
    Efstathios Sideris
    • Constructor Detail

      • 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:

        1. Copy the grid into a work grid and remove all type-on-line and point markers from the work grid
        2. Split grid into distinct shapes by plotting the grid onto an AbstractionGrid and its getDistinctShapes() method.
        3. 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).
        4. Remove duplicate boundaries.
        5. Remove obsolete boundaries. Obsolete boundaries are the ones that are the sum of their parts when plotted as filled shapes. (see method removeObsoleteShapes())
        6. Seperate the found boundary sets to open, closed or mixed (See CellSet class on how its done).
        7. 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.
        8. 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:

        1. Create closed shapes.
        2. 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.
        3. Assign color codes to closed shapes.
        4. Assing extended markup tags to closed shapes.

        5. Create arrowheads.

        6. Create point markers.

        Finally, the text processing occurs: [pending]

        Parameters:
        grid -
        cellWidth -
        cellHeight -
    • Method Detail

      • getAllDiagramShapes

        public java.util.ArrayList getAllDiagramShapes()
        Returns a list of all DiagramShapes in the Diagram, including the ones within CompositeDiagramShapes
        Returns:
      • getMinimumOfCellDimension

        public float getMinimumOfCellDimension()
      • getShapesIterator

        public java.util.Iterator getShapesIterator()
      • getHeight

        public int getHeight()
        Returns:
      • getWidth

        public int getWidth()
        Returns:
      • getCellWidth

        public int getCellWidth()
        Returns:
      • getCellHeight

        public int getCellHeight()
        Returns:
      • getCompositeShapes

        public java.util.ArrayList getCompositeShapes()
        Returns:
      • getShapes

        public java.util.ArrayList getShapes()
        Returns:
      • getCellMinX

        public static int getCellMinX​(TextGrid.Cell cell,
                                      int cellXSize)
      • getCellMidX

        public static int getCellMidX​(TextGrid.Cell cell,
                                      int cellXSize)
      • getCellMaxX

        public static int getCellMaxX​(TextGrid.Cell cell,
                                      int cellXSize)
      • getCellMinY

        public static int getCellMinY​(TextGrid.Cell cell,
                                      int cellYSize)
      • getCellMidY

        public static int getCellMidY​(TextGrid.Cell cell,
                                      int cellYSize)
      • getCellMaxY

        public static int getCellMaxY​(TextGrid.Cell cell,
                                      int cellYSize)
      • getTextObjects

        public java.util.ArrayList getTextObjects()
        Returns: