Class BpFiguresUtil


  • public final class BpFiguresUtil
    extends Object
    Util methods for BP scheme figures.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.eclipse.draw2d.geometry.Rectangle calculateAnchorableBounds​(org.eclipse.draw2d.IFigure figure)
      Calculates given figure anchorable bounds.
      static org.eclipse.draw2d.IFigure createDummyTargetFigure​(org.eclipse.draw2d.Connection connection, int position)
      Creates dummy target figure.
      static org.eclipse.draw2d.geometry.PointList createShapePolygon​(org.eclipse.draw2d.geometry.PointList template, int templateMaximum, org.eclipse.draw2d.geometry.Rectangle bounds, boolean forOutline)
      Creates polygon from given template and bounds.
      static org.eclipse.draw2d.geometry.Rectangle getAlignedBounds​(org.eclipse.draw2d.geometry.Rectangle bounds, int minWidth, int minHeight)
      Returned aligned to grid bounds.
      static org.eclipse.draw2d.geometry.Point getAlignedLocation​(org.eclipse.draw2d.geometry.Point location)
      Returnes aligned to grid location.
      static List<org.eclipse.draw2d.geometry.PointList> getConnectionsPaths​(List<? extends org.eclipse.draw2d.Connection> connections)
      Returns given connections paths.
      static org.eclipse.swt.graphics.Font getFont​(Font font)
      Returns SWT font of given mcore font.
      static int getHorizontalGridStep()
      Returns horizontal grid step.
      static org.eclipse.swt.graphics.Image getImage​(Picture picture)
      Returns Image of given picture.
      static org.eclipse.swt.graphics.RGB getRGB​(Color color)
      Returns RGB of given color.
      static int getVerticalGridStep()
      Returns vertical grid step.
      static boolean isEqualPaths​(org.eclipse.draw2d.geometry.PointList path, org.eclipse.draw2d.geometry.PointList otherPath)
      Returns true if given paths is equal.
      static int ModelToSWTBorderStyle​(GraphicalSchemeLineType lineType)
      Returns SWT border style depending on given string.
      static void setPictureManager​(IPictureManager pictureManager)
      Sets picture manager.
    • Method Detail

      • setPictureManager

        public static void setPictureManager​(IPictureManager pictureManager)
        Sets picture manager.
        Parameters:
        pictureManager - - picture manager. Can't be null.
      • createShapePolygon

        public static org.eclipse.draw2d.geometry.PointList createShapePolygon​(org.eclipse.draw2d.geometry.PointList template,
                                                                               int templateMaximum,
                                                                               org.eclipse.draw2d.geometry.Rectangle bounds,
                                                                               boolean forOutline)
        Creates polygon from given template and bounds.
        Parameters:
        template - - polygon template. Can't be null.
        templateMaximum - - maximum integer in template. If given value is 0, it will be calculated.
        bounds - - figure bounds. Can't be null.
        forOutline - - true if polygon creating for outlining.
        Returns:
        shape polygon. Can't be null.
      • getAlignedLocation

        public static org.eclipse.draw2d.geometry.Point getAlignedLocation​(org.eclipse.draw2d.geometry.Point location)
        Returnes aligned to grid location. If grid is off, returns copy of given location.
        Parameters:
        location - - location to align. Can't be null.
        Returns:
        aligned to grid location. Can't return null.
      • getAlignedBounds

        public static org.eclipse.draw2d.geometry.Rectangle getAlignedBounds​(org.eclipse.draw2d.geometry.Rectangle bounds,
                                                                             int minWidth,
                                                                             int minHeight)
        Returned aligned to grid bounds. If grid is off returns copy of given bounds.
        Parameters:
        bounds - - bounds to align. Can't be null.
        minWidth - - width of returned rectangle can't be less than given value.
        minHeight - - height of returned rectangle can't be less than given value.
        Returns:
        ligned to grid bounds. Can't return null.
      • getHorizontalGridStep

        public static int getHorizontalGridStep()
        Returns horizontal grid step.
        Returns:
        horizontal grid step.
      • getVerticalGridStep

        public static int getVerticalGridStep()
        Returns vertical grid step.
        Returns:
        vertical grid step.
      • calculateAnchorableBounds

        public static org.eclipse.draw2d.geometry.Rectangle calculateAnchorableBounds​(org.eclipse.draw2d.IFigure figure)
        Calculates given figure anchorable bounds. (Anchor connects to side of returned bounds).
        Parameters:
        figure - - figure to calculate bounds. Can't be null.
        Returns:
        given figure anchorable bounds. (Anchor connects to side of returned bounds). Can't return null.
      • ModelToSWTBorderStyle

        public static int ModelToSWTBorderStyle​(GraphicalSchemeLineType lineType)
        Returns SWT border style depending on given string.
        Parameters:
        lineType - - line type. Can't be null.
        Returns:
        SWT border style. Can't return null.
      • createDummyTargetFigure

        public static org.eclipse.draw2d.IFigure createDummyTargetFigure​(org.eclipse.draw2d.Connection connection,
                                                                         int position)
        Creates dummy target figure.
        Parameters:
        connection - - connection to make dummy target for. Can't be null.
        position - - dummy target position.
        Returns:
        created dummy figure. Can't return null.
      • isEqualPaths

        public static boolean isEqualPaths​(org.eclipse.draw2d.geometry.PointList path,
                                           org.eclipse.draw2d.geometry.PointList otherPath)
        Returns true if given paths is equal.
        Parameters:
        path - - path. Can't be null.
        otherPath - - other path. Can't be null.
        Returns:
        true if given paths is equal.
      • getConnectionsPaths

        public static List<org.eclipse.draw2d.geometry.PointList> getConnectionsPaths​(List<? extends org.eclipse.draw2d.Connection> connections)
        Returns given connections paths. Paths in returned list has same order as connections in given list.
        Parameters:
        connections - - connections to return paths. Can't be null.
        Returns:
        given connections paths. Can't return null.
      • getRGB

        public static org.eclipse.swt.graphics.RGB getRGB​(Color color)
        Returns RGB of given color.
        Parameters:
        color - - color to get rgb. Can't be null.
        Returns:
        RGB of given color. Can't return null.
      • getImage

        public static org.eclipse.swt.graphics.Image getImage​(Picture picture)
        Returns Image of given picture.
        Parameters:
        picture - - picture to get image from. Can't be null.
        Returns:
        Image of given picture. Can't return null.
      • getFont

        public static org.eclipse.swt.graphics.Font getFont​(Font font)
        Returns SWT font of given mcore font.
        Parameters:
        font - - mcore font to get swt font. Can't be null.
        Returns:
        SWT font of given mcore font. Can return null.