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

        double getZoom()
        Get the current zoom for this annotation
        Returns:
        the current zoom value
      • setZoom

        void setZoom​(double zoom)
        Set the current zoom for this annotation
        Parameters:
        zoom - the zoom to set
      • getSpecificZoom

        double getSpecificZoom()
        Get the specific zoom for this annotation
        Returns:
        the current specific zoom for this annotation
      • setSpecificZoom

        void setSpecificZoom​(double zoom)
        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 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.