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 String
A flag that this is a "custom" shapestatic String
The color of the borderstatic String
The opacity of the borderstatic String
The thickness of the borderstatic String
The fill color of the shapestatic String
The opacity of the shape fillstatic String
The height of the shapestatic String
The shape typestatic 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:
- Constant Field Values
-
HEIGHT
The height of the shape- See Also:
- Constant Field Values
-
EDGECOLOR
The color of the border- See Also:
- Constant Field Values
-
EDGETHICKNESS
The thickness of the border- See Also:
- Constant Field Values
-
EDGEOPACITY
The opacity of the border- See Also:
- Constant Field Values
-
FILLCOLOR
The fill color of the shape- See Also:
- Constant Field Values
-
FILLOPACITY
The opacity of the shape fill- See Also:
- Constant Field Values
-
SHAPETYPE
The shape type- See Also:
- Constant Field Values
-
CUSTOMSHAPE
A flag that this is a "custom" shape- See Also:
- Constant Field Values
-
-
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
-