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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA flag that this is a "custom" shapestatic final StringThe color of the borderstatic final StringThe opacity of the borderstatic final StringThe thickness of the borderstatic final StringThe fill color of the shapestatic final StringThe opacity of the shape fillstatic final StringThe height of the shapestatic final StringThe shape typestatic final StringThe 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.doubleGet the border (stroke) opacity.doubleGet the border (stroke) width.Get the fill color.doubleReturn the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque).getShape()Get the current shape as aShapeobjectGet the current shape type as a StringGet the list of supported shapes.voidsetBorderColor(Paint border) Set the border (stroke) color.voidsetBorderOpacity(double opacity) Set the border (stroke) opacity.voidsetBorderWidth(double width) Set the border (stroke) width.voidsetCustomShape(Shape shape) Set a custom shape to be drawn.voidsetCustomShape(String shape) Set a custom shape to be drawn.voidsetFillColor(Paint fill) Set the fill color.voidsetFillOpacity(double opacity) Set the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque).voidsetShapeType(String type) Set the current shape typevoidsetSize(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 aShapeobject- Returns:
- the current shape
-