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 (forAnnotationFactory#createAnnotation()
) include:ZOOM
,CANVAS
,X
, andY
.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
Fields Modifier and Type Field Description static String
BACKGROUND
The background canvasstatic String
CANVAS
Arg map key to initialize the canvas to draw this annotation onstatic String
FOREGROUND
The foreground canvasstatic String
NAME
Arg map key to initialize the name of this annotationstatic String
X
Arg map key to initialize the x location for this annotationstatic String
Y
Arg map key to initialize the y location for this annotationstatic String
Z
Arg map key to initialize the z location for this annotation.static String
ZOOM
Deprecated.The zoom should remain at the default of 1.0.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
addArrow(ArrowAnnotation arrow)
Add an arrow annotation to this annotation.Map<String,String>
getArgMap()
Get the argument map that is used to serialize this annotation.Set<ArrowAnnotation>
getArrows()
Get all arrows that are currently linked to this annotation.String
getCanvasName()
Return the canvas that this Annotation is ondefault String
getName()
Get the name for this annotation.CyNetworkView
getNetworkView()
Return the view that this Annotation is fordouble
getSpecificZoom()
Deprecated.UUID
getUUID()
Get the UUID of this annotationdouble
getZoom()
Deprecated.boolean
isSelected()
Return true if this annotation is currently selectedvoid
moveAnnotation(Point2D location)
Move an annotation to the specified locationvoid
removeAnnotation()
Deprecated.UseAnnotationManager#removeAnnotation()
instead.void
removeArrow(ArrowAnnotation arrow)
Remove an arrow from this annotation.void
setCanvas(String canvas)
Set the canvas for this annotation.default void
setName(String name)
Set the name for this annotation.void
setSelected(boolean selected)
Set the selected state for this annotationvoid
setSpecificZoom(double zoom)
Deprecated.void
setZoom(double zoom)
Deprecated.void
update()
Update the annotation.
-
-
-
Field Detail
-
BACKGROUND
static final String BACKGROUND
The background canvas- See Also:
- Constant Field Values
-
FOREGROUND
static final String FOREGROUND
The foreground canvas- See Also:
- Constant Field Values
-
ZOOM
@Deprecated static final String 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
static final String CANVAS
Arg map key to initialize the canvas to draw this annotation on- See Also:
- Constant Field Values
-
X
static final String X
Arg map key to initialize the x location for this annotation- See Also:
- Constant Field Values
-
Y
static final String Y
Arg map key to initialize the y location for this annotation- See Also:
- Constant Field Values
-
Z
static final String 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
static final String NAME
Arg map key to initialize the name of this annotation- See Also:
- Constant Field Values
-
-
Method Detail
-
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
void setCanvas(String canvas)
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
default String 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
default void setName(String name)
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
void moveAnnotation(Point2D location)
Move an annotation to the specified location- Parameters:
location
- the location to move the annotation to
-
getZoom
@Deprecated double getZoom()
Deprecated.Get the current zoom for this annotation- Returns:
- the current zoom value
-
setZoom
@Deprecated void setZoom(double zoom)
Deprecated.Set the current zoom for this annotation- Parameters:
zoom
- the zoom to set
-
getSpecificZoom
@Deprecated double getSpecificZoom()
Deprecated.Get the specific zoom for this annotation- Returns:
- the current specific zoom for this annotation
-
setSpecificZoom
@Deprecated void setSpecificZoom(double zoom)
Deprecated.Set the specific zoom for this annotation- Parameters:
zoom
- the specific zoom for this annotation
-
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
void addArrow(ArrowAnnotation arrow)
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
void removeArrow(ArrowAnnotation arrow)
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
Map<String,String> 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 void 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.
-
-