Class ShapeRegistry

java.lang.Object
org.pathvisio.libgpml.model.shape.ShapeRegistry

public class ShapeRegistry
extends java.lang.Object
The Shape registry stores all arrow heads and shapes at this moment the shape registry initializes itself, by calling registerShape() on BasicShapes, GenMAPPShapes and MIMShapes.
Author:
unknown, finterly
  • Field Summary

    Fields
    Modifier and Type Field Description
    private static java.util.Map<java.lang.String,​AnchorShape> anchorMap  
    private static java.util.Map<java.lang.String,​ArrowShape> arrowMap  
    static IShape DEFAULT_SHAPE  
    private static AnchorShape defaultAnchor  
    private static ArrowShape defaultArrow  
    private static java.awt.Shape defaultShape  
    private static java.util.Map<java.lang.String,​IShape> shapeMap  
  • Constructor Summary

    Constructors
    Constructor Description
    ShapeRegistry()  
  • Method Summary

    Modifier and Type Method Description
    static IShape fromName​(java.lang.String name)
    Returns ShapeType corresponding to given name.
    static AnchorShape getAnchor​(java.lang.String name)
    Returns an anchor shape
    static ArrowShape getArrow​(java.lang.String name)
    Returns a named arrow head.
    static void registerAnchor​(java.lang.String key, java.awt.Shape sh)
    Registers an anchor shape.
    static void registerArrow​(java.lang.String key, java.awt.Shape sh, ArrowShape.FillType fillType)
    Registers an arrow shape (without lineEndingLength parameter).
    static void registerArrow​(java.lang.String key, java.awt.Shape sh, ArrowShape.FillType fillType, int lineEndingLength)
    Registers an arrow shape.
    static void registerShape​(IShape iShape)
    Registers the given IShape.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • defaultShape

      private static java.awt.Shape defaultShape
    • DEFAULT_SHAPE

      public static final IShape DEFAULT_SHAPE
    • defaultArrow

      private static ArrowShape defaultArrow
    • defaultAnchor

      private static AnchorShape defaultAnchor
    • shapeMap

      private static java.util.Map<java.lang.String,​IShape> shapeMap
    • arrowMap

      private static java.util.Map<java.lang.String,​ArrowShape> arrowMap
    • anchorMap

      private static java.util.Map<java.lang.String,​AnchorShape> anchorMap
  • Constructor Details

    • ShapeRegistry

      public ShapeRegistry()
  • Method Details

    • registerShape

      public static void registerShape​(IShape iShape)
      Registers the given IShape.
      Parameters:
      iShape - the IShape.
    • fromName

      public static IShape fromName​(java.lang.String name)
      Returns ShapeType corresponding to given name.
      Parameters:
      name - the string key.
      Returns:
      the IShape.
    • registerArrow

      public static void registerArrow​(java.lang.String key, java.awt.Shape sh, ArrowShape.FillType fillType, int lineEndingLength)
      Registers an arrow shape.
      Parameters:
      key - the key used to identify the arrow shape.
      sh - the shape used to draw the stroke.
      fillType - the fill type, see ArrowShape.
      lineEndingLength - the line ending width.
    • registerArrow

      public static void registerArrow​(java.lang.String key, java.awt.Shape sh, ArrowShape.FillType fillType)
      Registers an arrow shape (without lineEndingLength parameter).
      Parameters:
      key - the key used to identify the arrow shape.
      sh - the shape used to draw the stroke and fill (in case fillType is open or closed).
      fillType - The fill type, see ArrowShape
    • getArrow

      public static ArrowShape getArrow​(java.lang.String name)
      Returns a named arrow head. The shape is normalized so that it fits with a line that goes along the positive x-axis. The tip of the arrow head is in 0,0.
      Parameters:
      name - the string name.
      Returns:
      the arrow shape.
    • registerAnchor

      public static void registerAnchor​(java.lang.String key, java.awt.Shape sh)
      Registers an anchor shape.
      Parameters:
      key - the key used to identify the anchor shape.
      sh - the anchor shape.
    • getAnchor

      public static AnchorShape getAnchor​(java.lang.String name)
      Returns an anchor shape
      Parameters:
      name - the string name.
      Returns:
      the anchor shape.