Polygonal Area

Polygonal area is one of two supported types of pedestrian areas in AnyLogic. Use Polygonal area when your area has complex form. If your area is rectangular, use Rectangular area instead.

You can make the area sloped, e.g. to model stairs

This document describes only the specifics of the polygonal area, for the general information on pedestrian areas, please refer here.

 To draw a polygonal area

  1. Double-click the  Polygonal Area 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 area 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 to add more points. Finally you will get the area of the required shape.

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 level – If selected, the area is also visible on the upper level where this agent lives.

Lock – If selected, the area 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.

Attractors... – Click this button to create attractors inside the area. Attractors are the places where the pedestrians will tend to get.

Appearance

Fill color – Shape's fill color. Choose No Fill, if you do not want shape to be filled.

Line color – Outline color. Choose No Line, if you do not want outline to be drawn.

Line width – Outline width.

Line style – [Enabled only if the Show in 3D checkbox is not selected] Outline style. Choose from the drop-down list, whether you want solid, dashed, or dotted outline to be drawn. 

Position and size

Ground – The ground this area belongs to. 

X – X-coordinate of the area's start point.

Y – Y-coordinate of the area's start point.

Z – [Enabled if Show in 3D option is selected] Z-coordinate of the area, in meters. The value is relative to the Z-coordinate of the area's ground. 

Sloped – If selected, this area lies on an inclining plane (e.g. it defines an escalator connecting two floors). To know more about defining inclining areas, please refer here.  

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 can not 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 - Here you can choose whether you want the shape to be shown both in 2D and 3D animation, or in 2D only, or in 3D only.

Show name – If selected, the shape's name is displayed on the graphical diagram.

Functions

You can dynamically modify the area properties at model runtime using the following API.
Attractors

Function

Description

List<Attractor> getAttractors()

Returns the unmodifiable list of attractors inside the area.

Position

Function

Description

double getX()

Returns the X-coordinate of the area.

double getY()

Returns the Y-coordinate of the area.

double getZ()

Returns the Z-coordinate of the area.

double getXMin()

Returns the X-coordinate of the top-left corner of the bounding rectangle for this area.

double getXMax()

Returns the X-coordinate of the bottom-right corner of the bounding rectangle for this area.

double getYMin()

Returns the Y-coordinate of the top-left corner of the bounding rectangle for this area.

double getYMax()

Returns the Y-coordinate of the bottom-right corner of the bounding rectangle for this area.

void setPos(double x, double y, double z)

Sets new coordinates for the area. 

Parameters:
x - the new value of the X-coordinate.
y - the new value of the Y-coordinate.
z - the new value of the Z-coordinate.


Size

Function

Description

double getWidth()

Returns the width of the area (in pixels).

double getHeight()

Returns the height of the area (in pixels).

void setSize
(double width, double height)

Sets the width and height of the area.

Parameters:
width - the new width of the area (in pixels).
height - the new height of the area (in pixels).


Visibility

Function

Description

boolean isVisible()

Returns true if the area is visible; returns false otherwise.

void setVisible(boolean v)

Sets the visibility of the area.

Parameter: v - visibility. If v is true - the area is set to be visible, if it is false - not visible.


Fill color / texture

Function

Description

Color getFillColor()

Returns the fill color of the area, or null if the area has no color or uses a texture (in this case use getFillTexture() to get the area's texture).

Texture getFillTexture()

Returns the fill texture of the area or null if the area has no texture but uses a color (in this case use getFillColor() to get the area's color).

void setFillColor(Color color)

Sets the fill color of the area.

Parameter: color - the new color.

void setFillColor(Paint color)

Sets the fill color (or texture) of the area.

Parameter: color - the new color or texture


Outline appearance

Function

Description

double getLineWidth()

Returns the width of the area outline. 

void setLineWidth(double width)

Sets the width of the area outline; 0 means the thinnest possible outline.

Parameter: width - the new width of the area outline.

Color getLineColor()

Returns the line color of the area, or null if the line has no color or uses a texture (in this case use getLineTexture() to get the line's texture).

Texture getLineTexture()

Returns the line texture of the area or null if the line has no texture but uses a color (in this case use getLineColor() to get the line's color).

void setLineColor(Color color)

Sets the fill color of the area.

Parameter: color - the new color.

void setLineColor(Paint color)

Sets the fill color (or texture) of the area.

Parameter: color - the new color or texture.

LineStyle getLineStyle()

Returns the line style of the area's outline. 

Possible values:
LINE_STYLE_SOLID - solid line.
LINE_STYLE_DOTTED - dotted line.
LINE_STYLE_DASHED - dashed line.

void setLineStyle(LineStyle lineStyle)

Sets the line style of the area's outline. 

Possible values:
LINE_STYLE_SOLID - solid line.
LINE_STYLE_DOTTED - dotted line.
LINE_STYLE_DASHED - dashed line.


Points

Function

Description

double getNearestPoint(double x, double y, Point out)

Calculates the point in this area nearest to the given (x, y) point and writes the result to the output Point object. Returns the square of the distance to the point. All calculations are performed in the horizontal XY-projection (i.e. Z-coordinates are treated as zeros).

Parameters:
x - the X-coordinate of the point.
y
- the Y-coordinate of the point.
out - the output point to write result to.

double getNearestPoint(double x, double y, double z, Point out)

Calculates the point in this area nearest to the given (x, y, z) point and writes the result to the output Point object. Returns the square of the distance to the point.

Parameters:
x - the X-coordinate of the point.
y
- the Y-coordinate of the point.
z
- the Z-coordinate of the point.
out - the output point to write result to.

boolean contains(double px, double py)

Returns true if the point with the given coordinates (relative to the area's container) is located within the area; returns false otherwise.

Parameters:
px - the point's X-coordinate.
py - the point's Y-coordinate.

Point randomPointInside(Random rng, Point out)

Returns the randomly chosen point inside the area; utilises the given Random Number Generator.

Parameters:
rng - the random number generator.
out - the output Point object to write the result to. The object may be null.


Ground

Function

Description

Ground getGround()

Returns the ground where this area is located, or null if the area does not belong to any ground.


Pedestrian queue

Function

Description

List getPeds()

Returns the list of pedestrians currently present in this area.

int size()

Returns the number of pedestrians currently present in this area.



Related topics

Markup for pedestrian simulation

 Service with lines

 Service with area

 Service with a serpentine queue

 API reference: QueueArea class