Interface Annotation
- All Known Subinterfaces:
ArrowAnnotation
,BoundedTextAnnotation
,GroupAnnotation
,ImageAnnotation
,ShapeAnnotation
,TextAnnotation
public interface Annotation
This is the base interface for all Annotations. An annotation is a graphical object that
is displayed on the network, but is not part of the graph model. Example annotations are
shapes, text, and images that annotate the contents of the network to elucidate aspects of
the network for presentation or explanatory purposes. In general, annotations are drawn
either on top of the network (
FOREGROUND
) or behind (BACKGROUND
) the network
canvas. Arg map initialization parameters (for AnnotationFactory#createAnnotation()
)
include: ZOOM
, CANVAS
, X
, and Y
.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.
-
Field Summary
Modifier and TypeFieldDescriptionstatic String
The background canvasstatic String
Arg map key to initialize the canvas to draw this annotation onstatic String
The foreground canvasstatic String
Arg map key to initialize the name of this annotationstatic String
Arg map key to initialize the rotation in degrees of this annotationstatic String
Arg map key to initialize the x location for this annotationstatic String
Arg map key to initialize the y location for this annotationstatic String
Arg map key to initialize the z location for this annotation.static String
Deprecated.The zoom should remain at the default of 1.0. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addArrow(ArrowAnnotation arrow)
Add an arrow annotation to this annotation.Get the argument map that is used to serialize this annotation.Get all arrows that are currently linked to this annotation.Returns the bounds of the annotation.Return the canvas that this Annotation is ondefault String
getName()
Get the name for this annotation.Return the view that this Annotation is forReturns the bounds of the annotation, adjusted for rotation.double
Get the rotation (in degrees) for this annotationdouble
Deprecated.getUUID()
Get the UUID of this annotationdefault double
getX()
Get the x position of the annotationdefault double
getY()
Get the y position of the annotationdouble
getZ()
Get the Z order of the annotationdouble
getZoom()
Deprecated.boolean
Return true if this annotation is currently selectedvoid
moveAnnotation(Point2D location)
Move an annotation to the specified locationvoid
Deprecated.UseAnnotationManager#removeAnnotation()
instead.void
removeArrow(ArrowAnnotation arrow)
Remove an arrow from this annotation.void
Set the canvas for this annotation.default void
Set the name for this annotation.void
setRotation(double rotation)
Set the rotation (in degrees) for this annotationvoid
setSelected(boolean selected)
Set the selected state for this annotationvoid
setSpecificZoom(double zoom)
Deprecated.void
setZ(double z)
Reorder annotation.void
setZoom(double zoom)
Deprecated.void
update()
Update the annotation.
-
Field Details
-
BACKGROUND
The background canvas- See Also:
- Constant Field Values
-
FOREGROUND
The foreground canvas- See Also:
- Constant Field Values
-
ZOOM
Deprecated.The zoom should remain at the default of 1.0.Arg map key to initialize the zoom value for this annotation- See Also:
- Constant Field Values
-
CANVAS
Arg map key to initialize the canvas to draw this annotation on- See Also:
- Constant Field Values
-
X
Arg map key to initialize the x location for this annotation- See Also:
- Constant Field Values
-
Y
Arg map key to initialize the y location for this annotation- See Also:
- Constant Field Values
-
Z
Arg map key to initialize the z location for this annotation. Note that the z-order is just a hint. The AnnotationManager is free to set an annotation's z-order according to its placement within an AnnotationGroup.- See Also:
- Constant Field Values
-
NAME
Arg map key to initialize the name of this annotation- See Also:
- Constant Field Values
-
ROTATION
Arg map key to initialize the rotation in degrees of this annotation- See Also:
- Constant Field Values
-
-
Method Details
-
getNetworkView
CyNetworkView getNetworkView()Return the view that this Annotation is for- Returns:
- the network view this annotation is for
-
getCanvasName
String getCanvasName()Return the canvas that this Annotation is on- Returns:
- the canvas this annotation is on
-
setCanvas
Set the canvas for this annotation. This must be one of BACKGROUND or FOREGROUND.
Note: Changing the canvas of a GroupAnnotation will not automatically set its members to the same canvas. Each annotation must have its setCanvas() method called individually.- Parameters:
canvas
- the canvas to move the annotation to
-
getName
Get the name for this annotation. This is useful for applications that want to allow the user to associate a particular annotation with an aspect of an algorithm. -
setName
Set the name for this annotation. This is useful for applications that want to allow the user to associate a particular annotation with an aspect of an algorithm. -
moveAnnotation
Move an annotation to the specified location- Parameters:
location
- the location to move the annotation to
-
getBounds
Rectangle2D getBounds()Returns the bounds of the annotation.- Since:
- 3.9
-
getRotatedBounds
Rectangle2D getRotatedBounds()Returns the bounds of the annotation, adjusted for rotation.- Since:
- 3.9
-
getX
default double getX()Get the x position of the annotation- Returns:
- the x position of the annotation
-
getY
default double getY()Get the y position of the annotation- Returns:
- the y position of the annotation
-
getZ
double getZ()Get the Z order of the annotation- Returns:
- the z position of the annotation
-
setZ
void setZ(double z)Reorder annotation. Set the Z order of the annotation- Parameters:
z
- the z position of the annotation
-
getZoom
Deprecated.Get the current zoom for this annotation- Returns:
- the current zoom value
-
setZoom
Deprecated.Set the current zoom for this annotation- Parameters:
zoom
- the zoom to set
-
getSpecificZoom
Deprecated.Get the specific zoom for this annotation- Returns:
- the current specific zoom for this annotation
-
setSpecificZoom
Deprecated.Set the specific zoom for this annotation- Parameters:
zoom
- the specific zoom for this annotation
-
getRotation
double getRotation()Get the rotation (in degrees) for this annotation- Returns:
- the rotation in degrees
-
setRotation
void setRotation(double rotation)Set the rotation (in degrees) for this annotation- Parameters:
rotation
- the rotation in degrees
-
isSelected
boolean isSelected()Return true if this annotation is currently selected- Returns:
- true if selected
-
setSelected
void setSelected(boolean selected)Set the selected state for this annotation- Parameters:
selected
- select if true
-
addArrow
Add an arrow annotation to this annotation. This will throw an IllegalArgument exception if this is an arrow annotation.- Parameters:
arrow
- the arrow annotation to add
-
removeArrow
Remove an arrow from this annotation.- Parameters:
arrow
- the arrow annotation to remove
-
getArrows
Set<ArrowAnnotation> getArrows()Get all arrows that are currently linked to this annotation.- Returns:
- the set of arrows linked to this annotation
-
getArgMap
Get the argument map that is used to serialize this annotation. This is essentially the inverse of the argMap used inAnnotationFactory#createAnnotation()
.- Returns:
- the argMap
-
getUUID
UUID getUUID()Get the UUID of this annotation- Returns:
- the annotation UUID
-
removeAnnotation
Deprecated.UseAnnotationManager#removeAnnotation()
instead.Remove the annotation. This will remove the annotation from the canvas and the annotation manager. -
update
void update()Update the annotation. This will cause the annotation to redraw on the canvas.
-