Interface ShapeAnnotation
- All Superinterfaces:
Annotation
- All Known Subinterfaces:
BoundedTextAnnotation
,ImageAnnotation
A Shape annotation supports annotations that can be drawn and filled
on the graphics canvas. Shape annotations can also be resized and
have separate colors for border and fill.
Module: presentation-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
A flag that this is a "custom" shapestatic final String
The color of the borderstatic final String
The opacity of the borderstatic final String
The thickness of the borderstatic final String
The fill color of the shapestatic final String
The opacity of the shape fillstatic final String
The height of the shapestatic final String
The shape typestatic final String
The width of the shapeFields inherited from interface org.cytoscape.view.presentation.annotations.Annotation
BACKGROUND, CANVAS, FOREGROUND, NAME, ROTATION, X, Y, Z, ZOOM
-
Method Summary
Modifier and TypeMethodDescriptionGet the border (stroke) color.double
Get the border (stroke) opacity.double
Get the border (stroke) width.Get the fill color.double
Return the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque).getShape()
Get the current shape as aShape
objectGet the current shape type as a StringGet the list of supported shapes.void
setBorderColor
(Paint border) Set the border (stroke) color.void
setBorderOpacity
(double opacity) Set the border (stroke) opacity.void
setBorderWidth
(double width) Set the border (stroke) width.void
setCustomShape
(Shape shape) Set a custom shape to be drawn.void
setCustomShape
(String shape) Set a custom shape to be drawn.void
setFillColor
(Paint fill) Set the fill color.void
setFillOpacity
(double opacity) Set the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque).void
setShapeType
(String type) Set the current shape typevoid
setSize
(double width, double height) Set the size of the shape.Methods inherited from interface org.cytoscape.view.presentation.annotations.Annotation
addArrow, getArgMap, getArrows, getBounds, getCanvasName, getName, getNetworkView, getRotatedBounds, getRotation, getSpecificZoom, getUUID, getX, getY, getZ, getZoom, isSelected, moveAnnotation, removeAnnotation, removeArrow, setCanvas, setName, setRotation, setSelected, setSpecificZoom, setZ, setZoom, update
-
Field Details
-
WIDTH
The width of the shape- See Also:
-
HEIGHT
The height of the shape- See Also:
-
EDGECOLOR
The color of the border- See Also:
-
EDGETHICKNESS
The thickness of the border- See Also:
-
EDGEOPACITY
The opacity of the border- See Also:
-
FILLCOLOR
The fill color of the shape- See Also:
-
FILLOPACITY
The opacity of the shape fill- See Also:
-
SHAPETYPE
The shape type- See Also:
-
CUSTOMSHAPE
A flag that this is a "custom" shape- See Also:
-
-
Method Details
-
getSupportedShapes
Get the list of supported shapes. If a shape is not supported, asking for it will result in nothing being displayed on the canvas. This returns a string to facilitate the future addition of new shapes.- Returns:
- list of supported shapes.
-
setSize
void setSize(double width, double height) Set the size of the shape.- Parameters:
width
- the shape widthheight
- the shape height
-
getShapeType
String getShapeType()Get the current shape type as a String- Returns:
- the current shape type
-
setShapeType
Set the current shape type- Parameters:
type
- the shape type
-
getBorderWidth
double getBorderWidth()Get the border (stroke) width.- Returns:
- the border width
-
setBorderWidth
void setBorderWidth(double width) Set the border (stroke) width.- Parameters:
width
- the border width
-
getBorderColor
Paint getBorderColor()Get the border (stroke) color.- Returns:
- the border color
-
getBorderOpacity
double getBorderOpacity()Get the border (stroke) opacity.- Returns:
- the border opacity
-
getFillColor
Paint getFillColor()Get the fill color.- Returns:
- the fill color
-
getFillOpacity
double getFillOpacity()Return the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque). -
setBorderColor
Set the border (stroke) color.- Parameters:
border
- the border color
-
setBorderOpacity
void setBorderOpacity(double opacity) Set the border (stroke) opacity.- Parameters:
opacity
- the border opacity
-
setFillColor
Set the fill color.- Parameters:
fill
- the fill color
-
setFillOpacity
void setFillOpacity(double opacity) Set the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque). -
setCustomShape
Set a custom shape to be drawn. This is optional functionality that will only be funcional when "Custom" is in the list of supported shapes. If custom shapes are supported, setting this parameter will force the shape type to "Custom". If they are not supported, this method is implemented, but ignored.- Parameters:
shape
- the custom shape to be drawn
-
setCustomShape
Set a custom shape to be drawn. This is optional functionality that will only be funcional when "Custom" is in the list of supported shapes. If custom shapes are supported, setting this parameter will force the shape type to "Custom". If they are not supported, this method is implemented, but ignored.- Parameters:
shape
- the custom shape to be drawn
-
getShape
Shape getShape()Get the current shape as aShape
object- Returns:
- the current shape
-