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

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The background canvas
    static final String
    Arg map key to initialize the canvas to draw this annotation on
    static final String
    The foreground canvas
    static final String
    Arg map key to initialize the name of this annotation
    static final String
    Arg map key to initialize the rotation in degrees of this annotation
    static final String
    Arg map key to initialize the x location for this annotation
    static final String
    Arg map key to initialize the y location for this annotation
    static final String
    Arg map key to initialize the z location for this annotation.
    static final String
    Deprecated.
    The zoom should remain at the default of 1.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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 on
    default String
    Get the name for this annotation.
    Return the view that this Annotation is for
    Returns the bounds of the annotation, adjusted for rotation.
    double
    Get the rotation (in degrees) for this annotation
    double
    Deprecated.
    Get the UUID of this annotation
    default double
    Get the x position of the annotation
    default double
    Get the y position of the annotation
    double
    Get the Z order of the annotation
    double
    Deprecated.
    boolean
    Return true if this annotation is currently selected
    void
    Move an annotation to the specified location
    void
    Deprecated.
    Use AnnotationManager#removeAnnotation() instead.
    void
    Remove an arrow from this annotation.
    void
    setCanvas(String canvas)
    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 annotation
    void
    setSelected(boolean selected)
    Set the selected state for this annotation
    void
    setSpecificZoom(double zoom)
    Deprecated.
    void
    setZ(double z)
    Reorder annotation.
    void
    setZoom(double zoom)
    Deprecated.
    void
    Update the annotation.
  • Field Details

    • BACKGROUND

      static final String BACKGROUND
      The background canvas
      See Also:
    • FOREGROUND

      static final String FOREGROUND
      The foreground canvas
      See Also:
    • 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:
    • CANVAS

      static final String CANVAS
      Arg map key to initialize the canvas to draw this annotation on
      See Also:
    • X

      static final String X
      Arg map key to initialize the x location for this annotation
      See Also:
    • Y

      static final String Y
      Arg map key to initialize the y location for this annotation
      See Also:
    • 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:
    • NAME

      static final String NAME
      Arg map key to initialize the name of this annotation
      See Also:
    • ROTATION

      static final String ROTATION
      Arg map key to initialize the rotation in degrees of this annotation
      See Also:
  • 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

      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
    • 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 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
    • 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

      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 in AnnotationFactory#createAnnotation().
      Returns:
      the argMap
    • getUUID

      UUID getUUID()
      Get the UUID of this annotation
      Returns:
      the annotation UUID
    • removeAnnotation

      @Deprecated void removeAnnotation()
      Deprecated.
      Use AnnotationManager#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.