Interface ShapeAnnotation

  • All Superinterfaces:
    All Known Subinterfaces:
    BoundedTextAnnotation, ImageAnnotation

    public interface ShapeAnnotation
    extends Annotation
    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:


    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

      • getSupportedShapes

        List<String> 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.
        list of supported shapes.
      • setSize

        void setSize​(double width,
                     double height)
        Set the size of the shape.
        width - the shape width
        height - the shape height
      • getShapeType

        String getShapeType()
        Get the current shape type as a String
        the current shape type
      • setShapeType

        void setShapeType​(String type)
        Set the current shape type
        type - the shape type
      • getBorderWidth

        double getBorderWidth()
        Get the border (stroke) width.
        the border width
      • setBorderWidth

        void setBorderWidth​(double width)
        Set the border (stroke) width.
        width - the border width
      • getBorderColor

        Paint getBorderColor()
        Get the border (stroke) color.
        the border color
      • getBorderOpacity

        double getBorderOpacity()
        Get the border (stroke) opacity.
        the border opacity
      • getFillColor

        Paint getFillColor()
        Get the fill color.
        the fill color
      • getFillOpacity

        double getFillOpacity()
        Return the fill opacity, a value between 0.0 (fully transparent) and 100.0 (fully opaque).
      • setBorderColor

        void setBorderColor​(Paint border)
        Set the border (stroke) color.
        border - the border color
      • setBorderOpacity

        void setBorderOpacity​(double opacity)
        Set the border (stroke) opacity.
        opacity - the border opacity
      • setFillColor

        void setFillColor​(Paint fill)
        Set the fill color.
        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

        void setCustomShape​(Shape shape)
        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.
        shape - the custom shape to be drawn
      • getShape

        Shape getShape()
        Get the current shape as a Shape object
        the current shape