Interface ShapeAnnotation

All Superinterfaces:
Annotation
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:

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

  • Method Details

    • 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.
      Returns:
      list of supported shapes.
    • setSize

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

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

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

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

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

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

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

      Paint getFillColor()
      Get the fill color.
      Returns:
      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.
      Parameters:
      border - the border color
    • setBorderOpacity

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

      void setFillColor(Paint fill)
      Set the fill color.
      Parameters:
      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.
      Parameters:
      shape - the custom shape to be drawn
    • setCustomShape

      void setCustomShape(String 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.
      Parameters:
      shape - the custom shape to be drawn
    • getShape

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