AnyLogic
Expand
Font size

Target line

Target line is used to graphically define the following things in pedestrian dynamics models:

  • Place where pedestrians appear in the simulated space (referred by PedSource or PedEnter)
  • The destination of the pedestrian movement (referred by PedGoTo)
  • The pedestrians waiting location (referred by PedWait)
  • When you model how pedestrians go from one level to another you draw two target lines: one standing for the place where pedestrians leave the current level and another one for the place where pedestrians enter new level. You specify both target lines in the PedChangeLevel flowchart block.

To draw a straight target line

  1. Drag the  Target Line element from the  Space Markup palette to the graphical diagram.

To draw a target line of complex form

  1. Double-click the  Target Line element in the Space Markup section of the  Pedestrian Library palette.
  2. The icon of the element should turn into . It means that the drawing mode is activated and now you can draw target line in the graphical editor point by point.
  3. Click in the graphical editor to put the first point of the target line. Do more clicks where you want to place line’s salient point. Add the last point with double-clicking.

Properties

General

Name — The name of the shape. The name is used to identify and access the shape from code.

Ignore — If selected, the shape is excluded from the model.

Visible on upper agent — If selected, the wall is also visible on the upper agent where this agent lives.

Lock — If selected, the wall shape is locked. Locked shapes do not react to mouse clicks — it is impossible to select them in the graphical editor until you unlock them.

Visible — Here you specify whether the shape is visible on animation at model runtime, or not. Using the control, choose yes or no.

Line color — The line color.

Position and size

Level — Level to which this target line belongs.

X — X-coordinate of the polyline (its start point).

Y — Y-coordinate of the polyline (its start point).

Points

The table located in the Points property section enables users to view and adjust coordinates of target line points. Here you define relative coordinates, not the absolute ones. The first point always has coordinates (0,0) that cannot be changed. Other rows of the table define relative coordinates of the successive points. Coordinates of each point are actually offsets of the corresponding point from the start point along X and Y axes correspondingly.

Advanced

Show in 3D — If selected, the shape will be displayed both in 2D and 3D animation.

Show name — If selected, the shape’s name is displayed on the graphical diagram.

Functions

You can dynamically modify the target line properties at model runtime using the following API.

Position
Function Description
double getX() Returns the X coordinate of the target line.
double getY() Returns the Y coordinate of the target line.
void setPos(double x, double y) Sets new coordinates for the target line.

x — the new value of the X coordinate.
y — the new value of the Y coordinate.
Length, points
Function Description
double length() Returns the length of the target line (in pixels).
int getNPoints() Returns the number of salient points of the target line.
double getPointDx( int i ) Returns the X-coordinate of the particular point of the target line relative to its start point.

i — the index of the point (starting from 0)
double getPointDy( int i ) Returns the Y-coordinate of the particular point of the target line relative to its start point.

i — the index of the point (starting from 0)
Visibility
Function Description
boolean isVisible() Returns true if the target line is visible; returns false otherwise.
void setVisible(boolean v) Sets the visibility of the target line.

v — visibility. If v is true — the target line is set to be visible, if it is false  — not visible.
Color
Function Description
Color getColor() Returns the color of the target line, or null if the target line has no color.
void setColor(Color color) Sets the color of the target line.

color — the new color
Level
Function Description
Level getLevel() Returns the level where this target line is located.
Removal
Function Description
void remove() Removes the target line from the presentation. If the target line is not a part of presentation, the function does nothing. Note, that removal from the presentation does not necessarily mean removing from the model logic, since logical networks and routes may have been created before the removal and survive it.
How can we improve this article?