Package com.anylogic.engine
- Field Summary
- Method Summary
- Method Details
- stop
- moveTo
- moveTo
- moveToInTime
- moveToInTime
- moveToStraight
- moveToStraightInTime
- moveToStraightInTime
- moveTo
- moveToInTime
- moveToInTime
- moveToInTime
- moveToInTime
- jumpTo
- jumpTo
- jumpTo
- setArrivalCallback
- moveToNearestAgent
- moveToNearestAgent
- getNearestAgent
- agentsInRange
- agentsInRange
- setAutomaticHorizontalRotation
- isAutomaticHorizontalRotation
- getTargetX
- getTargetY
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- distanceTo
- isMoving
- setVelocity
- getVelocity
- setSpeed
- setSpeed
- getSpeed
- getSpeed
- timeToArrival
- timeToArrival
- updatePosition
- getLevel
- setLevel
- getNetwork
- setNetwork
- setNetworkInternal
- getNetworkNode
- setNetworkNode
- setNetworkNode
- getSpaceType
- getRouteProvider
- setRouteProvider
- All Superinterfaces:
AgentExtension
,ExtAnimationParams
,Serializable
- All Known Subinterfaces:
ExtAgentContinuous
,ExtAgentGIS
,ExtEntity
- All Known Implementing Classes:
ExtAgentContinuousDelegate
,ExtAgentWithSpatialMetricsDelegate
,ExtEntityContinuousDelegate
,ExtEntityDelegate
@AnyLogicInternalAPI public interface ExtAgentWithSpatialMetrics extends ExtAnimationParams
Modifier and Type | Method | Description |
---|---|---|
<T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
<T extends Agent> | agentsInRange |
Returns the unsorted list of agents from the given collection which are within the given
distance from this agent |
double | distanceTo |
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e.
|
double | distanceTo |
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e.
|
double | distanceTo |
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type. |
double | distanceTo |
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type. |
Level | getLevel() |
Returns the level this agent lives in, actual for agents in continuous space.
|
<T extends Agent> | getNearestAgent |
Returns the nearest agent from the given collection
|
INetwork | getNetwork() |
Returns the network this agent lives in, actual for agents in continuous space.
|
INode | getNetworkNode() |
Returns the network node this agent currently is located in, actual for agents in continuous space.
|
IRouteProvider | getRouteProvider() |
Returns the provider of routes for agent movement
|
SpaceType | getSpaceType() |
Returns the type of space this agent lives in, one of
SPACE_CONTINUOUS, SPACE_GIS |
double | getSpeed() |
Returns the current value of the agent speed (measured in m/s).
|
double | getSpeed |
Returns the current value of the agent speed.
|
double | getTargetX() |
Returns the x of the target location if moving, otherwise current x.
The exact behavior of this method depends on the underlying space type. |
double | getTargetY() |
Returns the y of the target location if moving, otherwise current y.
The exact behavior of this method depends on the underlying space type. |
double | getVelocity() |
Deprecated.
|
boolean | isAutomaticHorizontalRotation() |
Returns
true if agent is set to be rotated (in horizontal
plane) during movement, false otherwise |
boolean | isMoving() |
Tests if the agent is currently moving.
|
void | jumpTo |
Instantly moves the agent to a given location (without changes to Z-coordinate, if any).
|
void | jumpTo |
Instantly moves the agent to a given network location.
|
void | jumpTo |
Instantly moves the agent to a given location.
|
void | moveTo |
Starts movement in the direction of the given target location.
|
void | moveTo |
Starts movement to the given network node.
"On arrival" code is executed when movement is finished. |
void | moveTo |
Starts movement in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement in the direction of the given target location.
|
void | moveToInTime |
Starts movement in the direction of the given target location.
|
void | moveToInTime |
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | moveToInTime |
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | moveToNearestAgent |
Starts movement to the nearest agent from the given collection.
|
void | moveToNearestAgent |
Starts movement to the nearest agent from the given collection.
|
void | moveToStraight |
Starts straight movement in the direction of the given target location.
"On arrival" code is executed when movement is finished. |
void | moveToStraightInTime |
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | moveToStraightInTime |
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in tripTime
model time units."On arrival" code is executed when movement is finished. |
void | setArrivalCallback |
This method is designed for advanced users and library developers,
for general purpose arrival processing please use "On arrival" action which
can be found on the properties of Agent Type.
Sets the listener which will be notified when the agent arrives (onArrival) or when the agent movement is cancelled or redirected (onCancel). |
void | setAutomaticHorizontalRotation |
Tells agent to rotate automatically (in horizontal plane) during movements.
|
void | setLevel |
Sets this agent to live in the level, actual for agents in continuous space.
|
void | setNetwork |
Sets this agent to live in the network, actual for agents in continuous space.
|
void | setNetworkInternal | |
void | setNetworkNode |
Sets the current network location for the agent
|
void | setNetworkNode |
Deprecated.
|
void | setRouteProvider |
Stops agent If it is moving.
|
void | setSpeed |
Changes speed of the agent (measured in m/s).
If the agent is moving, it continues moving with the new speed. |
void | setSpeed |
Changes speed of the agent
(the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed. |
void | setVelocity |
Deprecated.
|
void | stop() |
Stops movement, if any.
|
double | timeToArrival() |
Returns the time to arrival to the target location, in model-time units.
If the agent is not moving, returns 0. |
double | timeToArrival |
Returns the time to arrival to the target location, in time units.
If the agent is not moving, returns 0. |
void | updatePosition() |
Updates agent coordinates
|
void stop()
Stops movement, if any.
void moveTo(double x, double y)
Starts movement in the direction of the given target location.
Z coordinate of target is the same as the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target location
void moveTo(Point location)
Starts movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
location
- the target location
void moveToInTime(Point location, double tripTime)
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
location
- the target locationtripTime
- the time of the movement trip
void moveToInTime(Point location, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
void moveToStraight(Point location)
Starts straight movement in the direction of the given target location.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
location
- the target location- Since:
- 7.1
void moveToStraightInTime(Point location, double tripTime)
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
location
- the target locationtripTime
- the time of the movement trip- Since:
- 7.1
void moveToStraightInTime(Point location, double tripTime, TimeUnits units)
Starts straight movement in the direction of the given target location.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
location
- the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
void moveTo(INode node, Point location)
Starts movement to the given network node.
"On arrival" code is executed when movement is finished.
"On arrival" code is executed when movement is finished.
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
void moveToInTime(double x, double y, double tripTime)
Starts movement in the direction of the given target location.
(in case of 3D space, Z coordinate of target is the same as
the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationtripTime
- the time of the movement trip
void moveToInTime(double x, double y, double tripTime, TimeUnits units)
Starts movement in the direction of the given target location.
(in case of 3D space, Z coordinate of target is the same as
the current agent's Z coordinate.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
"On arrival" code is executed when movement is finished.
The exact behavior of this method depends on the underlying space type.
- Parameters:
x
- the x coordinate of the target locationy
- the y coordinate of the target locationtripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
void moveToInTime(INode node, Point location, double tripTime)
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
tripTime
- the time of the movement trip
void moveToInTime(INode node, Point location, double tripTime, TimeUnits units)
Starts movement to the given network node.
Changes the speed of the agent in order to reach target in
"On arrival" code is executed when movement is finished.
Changes the speed of the agent in order to reach target in
tripTime
model time units."On arrival" code is executed when movement is finished.
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
tripTime
- the time of the movement tripunits
- the time units- Since:
- 7.1
void jumpTo(double x, double y)
Instantly moves the agent to a given location (without changes to Z-coordinate, if any).
Terminates any movement.
The exact behavior of this method depends on the underlying space type.
Doesn't call "on arrival" code
The exact behavior of this method depends on the underlying space type.
Doesn't call "on arrival" code
- Parameters:
x
- the x coordinate of the new locationy
- the y coordinate of the new location
void jumpTo(Point location)
Instantly moves the agent to a given location.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
location
- the new location
void jumpTo(INode node, Point location)
Instantly moves the agent to a given network location.
Terminates any movement.
Doesn't call "on arrival" code
Doesn't call "on arrival" code
- Parameters:
node
- the network node.location
- (optional) location within node, may benull
void setArrivalCallback(ArrivalCallback arrivalCallback)
This method is designed for advanced users and library developers,
for general purpose arrival processing please use "On arrival" action which
can be found on the properties of Agent Type.
Sets the listener which will be notified when the agent arrives (onArrival) or when the agent movement is cancelled or redirected (onCancel). The agent should be stopped at the time this method is called and should have no arrival callback set, otherwise this method will throw an error.
The arrival callback is automatically forgotten once notified.
Sets the listener which will be notified when the agent arrives (onArrival) or when the agent movement is cancelled or redirected (onCancel). The agent should be stopped at the time this method is called and should have no arrival callback set, otherwise this method will throw an error.
The arrival callback is automatically forgotten once notified.
- Parameters:
arrivalCallback
- the listener which will be notified about agent's arrival
void moveToNearestAgent(Iterable<? extends Agent> agents)
Starts movement to the nearest agent from the given collection.
Stops any current movement.
- Parameters:
agents
- the collection of agents
void moveToNearestAgent(Iterable<? extends Agent> agents, double tripTime)
Starts movement to the nearest agent from the given collection.
Stops any current movement.
Changes the speed of the agent in order to reach target in
Changes the speed of the agent in order to reach target in
tripTime
model time units.- Parameters:
agents
- the collection of agentstripTime
- the time of the movement trip
<T extends Agent> T getNearestAgent(Iterable<T> agents)
Returns the nearest agent from the given collection
- Parameters:
agents
- the collection of agents- Returns:
- the nearest agent (never
this
one) ornull
if the collection is empty
<T extends Agent> List<T> agentsInRange(Iterable<T> agents, double distance)
Returns the unsorted list of agents from the given collection which are within the given
distance
from this agent- Parameters:
agents
- the collection of agents- Returns:
- the list of agents within the given
distance
, unsorted
<T extends Agent> List<T> agentsInRange(Iterable<T> agents, double distance, LengthUnits units)
Returns the unsorted list of agents from the given collection which are within the given
distance
from this agent- Parameters:
agents
- the collection of agents- Returns:
- the list of agents within the given
distance
, unsorted
void setAutomaticHorizontalRotation(boolean yes)
Tells agent to rotate automatically (in horizontal plane) during movements.
- Parameters:
yes
-true
- agent will be rotated during movement,false
- rotation will not be changed- See Also:
boolean isAutomaticHorizontalRotation()
Returns
true
if agent is set to be rotated (in horizontal
plane) during movement, false
otherwise- Returns:
true
if agent is set to be rotated during movement- See Also:
double getTargetX()
Returns the x of the target location if moving, otherwise current x.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Returns:
- the x of the target location if moving, otherwise current x
double getTargetY()
Returns the y of the target location if moving, otherwise current y.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Returns:
- the y of the target location if moving, otherwise current y
double distanceTo(Agent other)
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Parameters:
other
- another agent- Returns:
- the distance to the other agent
double distanceTo(Agent other, LengthUnits units)
Calculates the distance from this agent to another one.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Parameters:
other
- another agentunits
- the units of length- Returns:
- the distance to the other agent
double distanceTo(Point point)
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Parameters:
point
-- Returns:
- the distance to the point
double distanceTo(Point point, LengthUnits units)
Calculates the distance from this agent to the point.
The exact behavior of this method depends on the underlying space type.
The exact behavior of this method depends on the underlying space type.
- Parameters:
point
-units
- the units of length- Returns:
- the distance to the point
double distanceTo(double x, double y)
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e. agent's Z coordinate isn't
used in the calculation).
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the point- Returns:
- the distance of Agent's projection (on the plane Z=0) to the point (x,y)
double distanceTo(double x, double y, LengthUnits units)
Calculates the distance from this agent to a given point in the
projection to the horizontal plane (i.e. agent's Z coordinate isn't
used in the calculation).
- Parameters:
x
- the x coordinate of the pointy
- the y coordinate of the pointunits
- the units of lengths- Returns:
- the distance of Agent's projection (on the plane Z=0) to the point (x,y)
- Since:
- 7.1
boolean isMoving()
Tests if the agent is currently moving.
- Returns:
true
if the agent is moving,false
otherwise
@Deprecated void setVelocity(double v)
Deprecated.
Changes speed of the agent
(the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
- Parameters:
v
- the new speed
@Deprecated double getVelocity()
Deprecated.
Returns the current value of the agent speed.
The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Returns:
- the current value of agent speed
void setSpeed(double speedInMPS)
Changes speed of the agent (measured in m/s).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
- Parameters:
s
- the new speed, meters per second- Since:
- 7.1
void setSpeed(double s, SpeedUnits units)
Changes speed of the agent
(the units of the value depend on the specific space type).
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
If the agent is moving, it continues moving with the new speed. Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo() is called.
- Parameters:
s
- the new speedunits
- the units of speed- Since:
- 7.1
double getSpeed()
Returns the current value of the agent speed (measured in m/s).
The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Returns:
- the current value of agent speed, meters per second
- Since:
- 7.1
double getSpeed(SpeedUnits units)
Returns the current value of the agent speed.
The units of the returned value depend on the specific space type.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
Note that nonzero speed does not mean the agent is moving - it starts moving only after moveTo is called.
- Parameters:
units
- the units of speed- Returns:
- the current value of agent speed
- Since:
- 7.1
double timeToArrival()
Returns the time to arrival to the target location, in model-time units.
If the agent is not moving, returns 0.
If the agent is not moving, returns 0.
- Returns:
- the time to arrival to the target location, or 0
double timeToArrival(TimeUnits units)
Returns the time to arrival to the target location, in time units.
If the agent is not moving, returns 0.
If the agent is not moving, returns 0.
- Parameters:
unit
- the time units- Returns:
- the time to arrival to the target location, or 0
- Since:
- 7.1
void updatePosition()
Updates agent coordinates
Level getLevel()
Returns the level this agent lives in, actual for agents in continuous space.
- Returns:
- the level this agent lives in
void setLevel(Level level)
Sets this agent to live in the level, actual for agents in continuous space.
- Parameters:
level
- the level this agent will live in
INetwork getNetwork()
Returns the network this agent lives in, actual for agents in continuous space.
- Returns:
- the network this agent lives in
void setNetwork(INetwork network)
Sets this agent to live in the network, actual for agents in continuous space.
- Parameters:
network
- the network this agent will live in
@AnyLogicInternalAPI void setNetworkInternal(INetwork network, INode node, Position location)
INode getNetworkNode()
Returns the network node this agent currently is located in, actual for agents in continuous space.
- Returns:
- the network node this agent currently is located in
@Deprecated void setNetworkNode(INode node, Point position)
Deprecated.
Sets the current network location for the agent
- Parameters:
node
- the network nodeposition
- (optional) location within node, may benull
void setNetworkNode(INode node)
Sets the current network location for the agent
- Parameters:
node
- the network node
SpaceType getSpaceType()
Returns the type of space this agent lives in, one of
SPACE_CONTINUOUS, SPACE_GIS
- Returns:
- one of
SPACE_CONTINUOUS, SPACE_GIS
IRouteProvider getRouteProvider()
Returns the provider of routes for agent movement
- Returns:
- the route provider
void setRouteProvider(IRouteProvider routeProvider)
Stops agent If it is moving. Sets the route provider for agent movement.
Route provider has several implementations: network, straight movement,
specific movement in GIS space such as movement by roads.
- Parameters:
routeProvider
- the route provider