Package ghidra.service.graph
Class VertexShape
- java.lang.Object
-
- ghidra.service.graph.VertexShape
-
public abstract class VertexShape extends java.lang.ObjectClass for defining shapes to use for rendering vertices in a graph
-
-
Field Summary
Fields Modifier and Type Field Description static VertexShapeDIAMONDstatic VertexShapeELLIPSEstatic VertexShapeHEXAGONstatic VertexShapeOCTAGONstatic VertexShapePENTAGONstatic VertexShapeRECTANGLEstatic VertexShapeSTARstatic VertexShapeTRIANGLE_DOWNstatic VertexShapeTRIANGLE_UP
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract java.awt.ShapecreateShape()booleanequals(java.lang.Object obj)doublegetLabelPosition()Gets the relative amount of margin space to allocate above the label.intgetMaxWidthToHeightRatio()This is a factor to keep some shapes from being so distorted by very long labels that they effectively lose their shape when seen by the userjava.lang.StringgetName()Returns the name of the shapejava.awt.ShapegetShape()Returns theShapefor thisVertexShapeinstancestatic VertexShapegetShape(java.lang.String shapeName)Returns theVertexShapefor the given shape namestatic java.util.List<java.lang.String>getShapeNames()Returns a list of names for all the supportedVertexShapesdoublegetShapeToLabelRatio()Returns the size factor for a shape relative to its label.inthashCode()
-
-
-
Field Detail
-
RECTANGLE
public static VertexShape RECTANGLE
-
ELLIPSE
public static VertexShape ELLIPSE
-
TRIANGLE_UP
public static VertexShape TRIANGLE_UP
-
TRIANGLE_DOWN
public static VertexShape TRIANGLE_DOWN
-
STAR
public static VertexShape STAR
-
DIAMOND
public static VertexShape DIAMOND
-
PENTAGON
public static VertexShape PENTAGON
-
HEXAGON
public static VertexShape HEXAGON
-
OCTAGON
public static VertexShape OCTAGON
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the shape- Returns:
- the name of the shape
-
getShape
public java.awt.Shape getShape()
Returns theShapefor thisVertexShapeinstance- Returns:
- the
Shapefor thisVertexShapeinstance
-
getLabelPosition
public double getLabelPosition()
Gets the relative amount of margin space to allocate above the label. The default is 0.5 which will center the label in the associated shape. A value closer to 0 will move the label closer to the top and a value closer to 1 will move the label closer to the bottom.- Returns:
- the relative amount of margin space to allocate obove the label.s
-
getShapeToLabelRatio
public double getShapeToLabelRatio()
Returns the size factor for a shape relative to its label. Shapes are sized based on the label of a vertex so that the label can fit inside the shape (mostly). Some subclasses will need to override this value to some value > 1 to fit the label in the shape. For example, a rectangle shape does not need to be extended because text naturally fits. But for a shape like a triangle, its bounding box needs to be bigger so that text doesn't "stick out" in the narrow part of the triangle.- Returns:
- the size factor for a shape relatvie to its label
-
getMaxWidthToHeightRatio
public int getMaxWidthToHeightRatio()
This is a factor to keep some shapes from being so distorted by very long labels that they effectively lose their shape when seen by the user- Returns:
- the max width to height ratio
-
createShape
protected abstract java.awt.Shape createShape()
-
getShape
public static VertexShape getShape(java.lang.String shapeName)
Returns theVertexShapefor the given shape name- Parameters:
shapeName- the name of the shape for which to get theVertexShape- Returns:
- the
VertexShapefor the given shape name
-
getShapeNames
public static java.util.List<java.lang.String> getShapeNames()
Returns a list of names for all the supportedVertexShapes- Returns:
- a list of names for all the supported
VertexShapes
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-