com.kuka.nav.fleet.graph.properties
Class NodePosition

java.lang.Object
  extended by com.kuka.nav.fleet.graph.properties.AbstractProperty
      extended by com.kuka.nav.fleet.graph.properties.NodePosition
All Implemented Interfaces:
Property, Serializable

public class NodePosition
extends AbstractProperty

Represents the position of a node.

See Also:
Serialized Form

Constructor Summary
NodePosition()
          Creates a new node position property with value (0,0).
NodePosition(double x, double y)
          Creates a new node position property with value (x, y).
 
Method Summary
 double distanceTo(double x, double y)
          Calculates the distance to another position.
 double distanceTo(NodePosition pos)
          Calculates the distance to another NodePosition.
 com.kuka.nav.Position get()
           
static NodePosition get(PropertyHolder n)
          Helper function to get the NodePosition directly from a graph node.
 Collection<Integer> getAllowedTypes()
          Returns the allowed robot type ids for this property.
 String getValueToDisplay()
          Returns the value(s) in a way to show it in a UI.
 Double getX()
           
 Double getY()
           
static NodePosition parse(String value)
          Parses the node position from the given string.
 void set(double x, double y)
          Sets the coordinates of this position.
static void set(PropertyHolder n, double x, double y)
          Helper funtion to set the NodePosition directly of a graph node.
 void setX(Double x)
           
 void setY(Double y)
           
 String toString()
          
 
Methods inherited from class com.kuka.nav.fleet.graph.properties.AbstractProperty
equals, fireChanged, getId, hashCode, setId, tryGetParamFromString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodePosition

public NodePosition(double x,
                    double y)
Creates a new node position property with value (x, y).

Parameters:
x - The x-coordinate value.
y - The y-coordinate value.

NodePosition

public NodePosition()
Creates a new node position property with value (0,0).

Method Detail

get

public com.kuka.nav.Position get()
Returns:
the position.

getX

public Double getX()
Returns:
The x-coordinate value.

setX

public void setX(Double x)
Parameters:
x - the new x coordinate

getY

public Double getY()
Returns:
The y-coordinate value.

setY

public void setY(Double y)
Parameters:
y - the new y coordinate

set

public void set(double x,
                double y)
Sets the coordinates of this position.

Parameters:
x - the X-coordinate of the new position
y - the Y-coordinate of the new position

toString

public String toString()

Overrides:
toString in class Object

distanceTo

public double distanceTo(NodePosition pos)
Calculates the distance to another NodePosition.

Parameters:
pos - the other NodePosition
Returns:
the distance between this and the other position

distanceTo

public double distanceTo(double x,
                         double y)
Calculates the distance to another position.

Parameters:
x - the x-coordinate of another position
y - the y-coordinate of another position
Returns:
the distance between this position and given coordinates

getAllowedTypes

public Collection<Integer> getAllowedTypes()
Description copied from interface: Property
Returns the allowed robot type ids for this property. Note that the id corresponding to all robot types (PropertyHolder.ROBOTTYPEALL) is considered as a separate robot type. If all possible types are allowed the returned collection is empty.

Specified by:
getAllowedTypes in interface Property
Overrides:
getAllowedTypes in class AbstractProperty
Returns:
the allowed robot type ids

get

public static NodePosition get(PropertyHolder n)
Helper function to get the NodePosition directly from a graph node.

Parameters:
n - the node
Returns:
The NodePosition of the given node if it has none, null otherwise.

set

public static void set(PropertyHolder n,
                       double x,
                       double y)
Helper funtion to set the NodePosition directly of a graph node.

Parameters:
n - the node
x - the X-coordinate of the new position
y - the Y-coordinate of the new position

parse

public static NodePosition parse(String value)
Parses the node position from the given string.

Parameters:
value - The string representing a node position.
Returns:
The node position.

getValueToDisplay

public String getValueToDisplay()
Description copied from interface: Property
Returns the value(s) in a way to show it in a UI.

Returns:
the values


Copyright © 2019. All rights reserved.