Package org.pathvisio.libgpml.model.type
Class ShapeType
java.lang.Object
org.pathvisio.libgpml.model.type.ShapeType
- All Implemented Interfaces:
IShape
public class ShapeType extends java.lang.Object implements IShape
This enum class contains extensible enum for Shape type property.
- Author:
- unknown, finterly
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static ShapeType
fromName(java.lang.String name)
Returns the ShapeType from given string name.java.lang.String
getName()
Returns the name key for this ShapeType.static java.lang.String[]
getNames()
Returns the names of all registered ShapeTypes as a list.java.awt.Shape
getShape(double w, double h)
Returns the shape resized given width and height.static ShapeType[]
getValues()
Returns the data node type values of all ShapeTypes as a list.static java.lang.String[]
getVisibleNames()
Returns the names of visible registered ShapeTypes as a list.static ShapeType[]
getVisibleValues()
Returns the data node type values of visible ShapeTypes as a list.boolean
isResizeable()
Returns boolean for whether shape is resizeable.boolean
isRotatable()
Returns boolean for whether shape is rotatable.static ShapeType
register(java.lang.String name, java.awt.Shape shape)
Returns a ShapeType from a given string identifier name.java.lang.String
toString()
Returns a string representation of this ShapeType.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
rectangle
private static java.awt.Shape rectangle -
ellipse
private static java.awt.Shape ellipse -
SHAPETYPE_MAP
-
VISIBLE_VALUES
-
NONE
-
RECTANGLE
-
ROUNDED_RECTANGLE
-
OVAL
-
TRIANGLE
-
PENTAGON
-
HEXAGON
-
OCTAGON
-
EDGE
-
ARC
-
BRACE
-
MITOCHONDRIA
-
SARCOPLASMIC_RETICULUM
-
ENDOPLASMIC_RETICULUM
-
GOLGI_APPARATUS
-
EXTRACELLULAR_REGION
-
CELL
-
NUCLEUS
-
ORGANELLE
-
VESICLE
-
CORONAVIRUS_ICON
-
DNA_ICON
-
RNA_ICON
-
CELL_ICON
-
MEMBRANE_ICON
-
DEGRADATION
-
name
private final java.lang.String name -
shape
private final java.awt.Shape shape -
isResizeable
private final boolean isResizeable -
isRotatable
private final boolean isRotatable
-
-
Constructor Details
-
ShapeType
private ShapeType(java.lang.String name, java.awt.Shape shape, boolean isResizeable, boolean isRotatable)The constructor is private. ShapeType cannot be directly instantiated. Use create() method to instantiate ShapeType.- Parameters:
name
- the string key of this ShapeType.shape
- the shape.isResizeable
- if true object is resizeable.isRotatable
- if true object is rotatable.- Throws:
java.lang.NullPointerException
- if name is null.
-
ShapeType
private ShapeType(java.lang.String name, java.awt.Shape shape)The constructor is private. ShapeType is resizeable and rotatable by default.- Parameters:
name
- the string key of this ShapeType.shape
- the shape.
-
-
Method Details
-
register
Returns a ShapeType from a given string identifier name. If the ShapeType doesn't exist yet, it is created to extend the enum. The method makes sure that the same object is not added twice.- Parameters:
name
- the string key.shape
- the shape.- Returns:
- the ShapeType for given name. If name does not exist, creates and returns a new ShapeType.
-
getName
public java.lang.String getName()Returns the name key for this ShapeType. -
getShape
public java.awt.Shape getShape(double w, double h)Returns the shape resized given width and height. -
isResizeable
public boolean isResizeable()Returns boolean for whether shape is resizeable.- Specified by:
isResizeable
in interfaceIShape
- Returns:
- isResizeable if true shape is resizeable.
-
isRotatable
public boolean isRotatable()Returns boolean for whether shape is rotatable.- Specified by:
isRotatable
in interfaceIShape
- Returns:
- isRotatable if true shape is rotatable.
-
fromName
Returns the ShapeType from given string name.- Parameters:
name
- the string.- Returns:
- the ShapeType with given string name.
-
getNames
public static java.lang.String[] getNames()Returns the names of all registered ShapeTypes as a list.- Returns:
- names the names of all registered ShapeTypes in the order of insertion.
-
getValues
Returns the data node type values of all ShapeTypes as a list.- Returns:
- shapeTypes the list of all registered ShapeTypes.
-
getVisibleNames
public static java.lang.String[] getVisibleNames()Returns the names of visible registered ShapeTypes as a list.- Returns:
- result the names of registered ShapeTypes.
-
getVisibleValues
Returns the data node type values of visible ShapeTypes as a list.- Returns:
- shapeTypes the list of registered ShapeTypes.
-
toString
public java.lang.String toString()Returns a string representation of this ShapeType.- Overrides:
toString
in classjava.lang.Object
- Returns:
- name the identifier of this ShapeType.
-