Class ObjectPosition

java.lang.Object
org.cytoscape.view.presentation.property.values.ObjectPosition

public final class ObjectPosition extends Object
ObjectPosition is the value that is used by Position VisualProperties. It includes information about the anchor point of the object itself, the anchor point of the target, the justification, and an x,y offset.

Cytoscape Backwards Compatibility (Final Class): This class is final and therefore can't be extended by users. This means that we may add methods for minor version updates. Methods will only be removed for major version updates.

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

  • Constructor Details

    • ObjectPosition

      public ObjectPosition()
      Creates a new ObjectPosition object.
    • ObjectPosition

      public ObjectPosition(ObjectPosition p)
      Copy constructor
      Parameters:
      p - original position.
    • ObjectPosition

      public ObjectPosition(Position targ, Position lab, Justification just, double x, double y)
      Creates a new ObjectPosition object.
      Parameters:
      targ - the anchor Position of the target (e.g. Node)
      lab - the anchor Position of the label
      just - the Justification of the text
      x - an x offset
      y - a y offset
  • Method Details

    • getAnchor

      public Position getAnchor()
      Return the anchor of the label (or other object).
      Returns:
      object anchor
    • getTargetAnchor

      public Position getTargetAnchor()
      Return the anchor of the target (e.g. Node)
      Returns:
      target anchor
    • getJustify

      public Justification getJustify()
      Return the justification of the label (or other object).
      Returns:
      text justification
    • getOffsetX

      public double getOffsetX()
      Return the X offset of the object
      Returns:
      x offset
    • getOffsetY

      public double getOffsetY()
      Return the Y offset of the object
      Returns:
      Y offset
    • setAnchor

      public void setAnchor(Position p)
      Set the anchor of the label (or other object).
      Parameters:
      p - anchor of the object
    • setTargetAnchor

      public void setTargetAnchor(Position p)
      Set the anchor of the target object (e.g. Node)
    • setJustify

      public void setJustify(Justification j)
      Set the justification of the label (or other object).
      Parameters:
      j - text justification
    • setOffsetX

      public void setOffsetX(double d)
      Set the X offset of the object
      Parameters:
      d - x offset
    • setOffsetY

      public void setOffsetY(double d)
      Set the Y offset of the object
      Parameters:
      d - y offset
    • equals

      public boolean equals(Object lp)
      Compare two ObjectPositions
      Overrides:
      equals in class Object
      Returns:
      true if these are the same
    • toString

      public String toString()
      Return a string representation of this ObjectPosition
      Overrides:
      toString in class Object
      Returns:
      a string representation of this ObjectPosition
    • toSerializableString

      public String toSerializableString()
      Return a String that represents this ObjectPosition, suitable for recreating the ObjectPosition with parse(java.lang.String)
      Returns:
      serialized string
    • parse

      public static ObjectPosition parse(String serializableString)
      Parse a String that has been written by toSerializableString() and create a new ObjectPosition that matches the text description
      Parameters:
      serializableString -
      Returns:
      Never returns null. If invalid, simply returns default.