Class RelativeLocation

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, Locatable, ModelErrorHandler, MoMLExportable, Moveable, Nameable, Settable, Singleton

    public class RelativeLocation
    extends Location
    An attribute used to store a relative visual location. The location is relative to an object specified by the relativeTo attribute, which gives the name of an object that is expected to be contained by the container of the container of this attribute. In addition, the relativeToElementName specifies what kind of object this is relative to (an "entity", "property" (attribute), "port", or "relation").
    Ptolemy II 11.0
    Edward A. Lee, Christian Motika, Miro Spoenemann
    Red (cxh)
    Yellow (cxh)
    • Method Detail

      • getLocation

        public double[] getLocation()
        Get the location in some cartesian coordinate system. This method returns the absolute location of the object. If the relative location was previously attached to an object referenced in the relativeTo property and that object is gone, then the internally stored location is updated so it contains the correct absolute location.
        Specified by:
        getLocation in interface Locatable
        getLocation in class Location
        The location.
        See Also:
      • getRelativeLocation

        public double[] getRelativeLocation()
        Get the relative location, relative to the relativeTo object, if there is one, and otherwise return the absolute location.
        The relative location.
        See Also:
      • getRelativeToNamedObj

        public NamedObj getRelativeToNamedObj()
        If the relativeTo object exists, return it. Otherwise, return null and clear the relativeTo parameter value.
        The relativeTo object, or null if it does not exist.
      • setLocation

        public void setLocation​(double[] location)
                         throws IllegalActionException
        Set the location in some cartesian coordinate system, and notify the container and any value listeners of the new location. Setting the location involves maintaining a local copy of the passed parameter. No notification is done if the location is the same as before. This method propagates the value to any derived objects. If the relative location is attached to an object referenced in the relativeTo property, then only the relative location is stored internally.
        Specified by:
        setLocation in interface Locatable
        setLocation in class Location
        location - The location.
        IllegalActionException - Thrown when attributeChanged() is called.
        See Also: