- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Methods inherited from class com.anylogic.engine.markup.AbstractLevelMarkup
- Methods inherited from class com.anylogic.engine.markup.MarkupShape
- Methods inherited from class com.anylogic.engine.markup.AbstractMarkup
- Methods inherited from class java.lang.Object
- Methods inherited from interface com.anylogic.engine.markup.AggregatableAnimationElement
- Constructor Details
- Method Details
- setOwner
- reset
- getX
- setX
- getY
- setY
- getWidth
- setWidth
- getHeight
- setHeight
- getTransparency
- getType
- setType
- getCalculationBasis
- setCalculationBasis
- setTransparency
- getCriticalDensity
- setCriticalDensity
- setSlidingWindow
- setSlidingWindow
- getSlidingWindow
- getSlidingWindow
- getDensityValue
- setDensityValue
- isEnableAttenuation
- setEnableAttenuation
- isTrackNetworkNodes
- setTrackNetworkNodes
- isTrackNetworkPaths
- setTrackNetworkPaths
- getColorScheme
- setColorScheme
- customColor
- show
- show
- hide
- hide
- isShown
- isShown
- display
- display
- currentDensity
- currentDensity
- currentDensity
- currentDensity
- maximumDensity
- maximumDensity
- maximumDensity
- maximumDensity
- meanDensity
- meanDensity
- meanDensity
- meanDensity
- onDestroy
- prepare
- prepareGridBasedMap
- prepareNetworkBasedMap
- getDataStorage
- contains
- getColor
- getColor
- getOwner
- java.lang.Object
- com.anylogic.engine.markup.AbstractMarkup
- com.anylogic.engine.markup.MarkupShape
- com.anylogic.engine.markup.AbstractLevelMarkup
- com.anylogic.engine.markup.DensityMap
- All Implemented Interfaces:
AggregatableAnimationElement,DensityMapCustomColorProvider,HasLevel,LevelElement,LevelMarkup,SVGElement,UsdElement,Serializable
public class DensityMap extends AbstractLevelMarkup implements DensityMapCustomColorProvider
Having added the Density Map element, you enable showing the density map of the specified type (pedestrian or transporter) for your simulation model. If you have transporters and pedestrians moving on the same level and need to track the density for both, you have to add two Density Map elements: one per type. Note, that the density maps located on one level must be of different types, otherwise an error will occur.
You will see that as pedestrians or transporters move in the simulated space, the layout is gradually painted in different colors. The color of every point of the space corresponds to the current density in this particular area. The density map is constantly repainted according to the actual values: when the density changes in some point, the color changes dynamically to reflect this change. In case of zero density the area is not painted at all. If you have transporters and pedestrians moving in the same area, the density maps won't display the aggregate density, only separate one for each type.
The element itself acts as the color legend for the density map. It displays the correspondence between density values and colors on the map.
- Author:
- AnyLogic North America, LLC https://anylogic.com
- See Also:
- Serialized Form
| Modifier and Type | Class | Description |
|---|---|---|
static interface | DensityMap.DensityMapPreparationSettings | |
static final record | DensityMap.GridBasedDensityMapPreparationSettings | |
static final record | DensityMap.NetworkBasedDensityMapPreparationSettings |
| Constructor | Description |
|---|---|
DensityMap() |
Creates markup object Density Map with default parameters.
|
DensityMap |
Deprecated.
deprecated in version 8.4, will be removed in the future releases
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean | contains |
Test if the shape contains the point with the given coordinates (relative
to this shape's container, i.e.
|
double | currentDensity |
Returns the current density value in the area neighboring the specified point, units/m2.
|
double | currentDensity |
Returns the current density value at the specified density map compatible network element.
|
double | currentDensity |
Returns the current density value in the area neighboring the specified point, units/m2.
|
double | currentDensity |
Returns the current density value at the specified density map compatible network element.
|
Color | customColor |
This method should be overridden to return color in
CUSTOM color
scheme |
void | display |
Shows the density map if
flag == true and hides otherwise. |
void | display |
Shows the density map on
level if flag == true and hides otherwise. |
DensityMapBasisType | getCalculationBasis() |
Returns the calculation basis of the density map.
|
Color | getColor |
Returns the color matching for the specified density value
|
Color | getColor |
Deprecated.
- A possibility to get non-reduced color is eliminated.
|
DensityMapColorScheme | getColorScheme() |
Returns the color scheme of this density map
|
double | getCriticalDensity() |
Returns the critical density for the density map, in selected units / m^2.
|
DensityMapDataStorage | getDataStorage | |
DensityMapDisplayedValue | getDensityValue() |
Returns the 'Displayed density value' parameter.
|
double | getHeight() |
Returns height of the density map legend
|
Agent | getOwner() | |
double | getSlidingWindow() |
Returns sliding window time in model time units.
|
double | getSlidingWindow |
Returns sliding window in specified time units.
|
double | getTransparency() |
Returns the density map transparency
|
DensityMapType | getType() |
Returns the type of density map.
|
double | getWidth() |
Returns width of the density map legend
|
double | getX() |
Returns x coordinate of the density map legend
|
double | getY() |
Returns y coordinate of the density map legend
|
void | hide() |
Hides the density map.
|
void | hide |
Hides the density map on the specified level.
|
boolean | isEnableAttenuation() |
Returns true if the density map is shown with attenuation; returns false otherwise.
|
boolean | isShown() |
Returns whether the density map is shown.
|
boolean | isShown |
Returns whether the density map is shown on the specified level.
|
boolean | isTrackNetworkNodes() |
Returns true if the network-based density map tracks network nodes, false otherwise.
|
boolean | isTrackNetworkPaths() |
Returns true if the network-based density map tracks network paths, false otherwise.
|
double | maximumDensity |
Returns maximum observed density at the specified point
|
double | maximumDensity |
Returns maximum observed density at the specified density map compatible network element
|
double | maximumDensity |
Returns maximum observed density at the specified point
|
double | maximumDensity |
Returns maximum observed density at the specified density map compatible network element
|
double | meanDensity |
Returns mean density at the specified point
|
double | meanDensity |
Returns mean density at the specified density map compatible network element
|
double | meanDensity |
Returns mean density at the specified point
|
double | meanDensity |
Returns mean density at the specified density map compatible network element
|
void | onDestroy() | |
void | prepare |
Prepares density map data storage and density map animator.
|
void | prepareGridBasedMap |
Prepares the density map for the space-based (grid-based) case.
|
void | prepareNetworkBasedMap |
Prepares the density map for the network-based case.
|
void | reset() |
Resets maximum density to current density
|
void | setCalculationBasis |
Sets the density map calculation basis.
|
void | setColorScheme |
Defines the color scheme for density map.
|
void | setCriticalDensity |
Sets the critical density for the density map, in selected units / m^2.
|
void | setDensityValue |
Sets the 'Displayed density value' parameter.
|
void | setEnableAttenuation |
Enables/disables attenuation for the density map.
|
void | setHeight |
Sets height of the density map legend
|
void | setOwner |
Sets the owner of the markup element
|
void | setSlidingWindow |
Enables sliding window with specified time.
|
void | setSlidingWindow |
Enables sliding window with specified time.
|
void | setTrackNetworkNodes |
Sets network nodes tracking for the network-based density map.
|
void | setTrackNetworkPaths |
Sets network paths tracking for the network-based density map.
|
void | setTransparency |
Set the density map transparency.
|
void | setType |
Sets the density map type.
|
void | setWidth |
Sets width of the density map legend
|
void | setX |
Sets x coordinate of the density map legend
|
void | setY |
Sets y coordinate of the density map legend
|
void | show() |
Shows the density map.
|
void | show |
Shows the density map on the specified level.
|
error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isOnly3D, isPublic, onClick, remove, setDrawModediscardOwner, executeUserAction, findSVGElement, getGroupOrOwner, getInspect, getInspectionWindowString, getName, getOrGenerateUSDId, getSVGComponent, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGComponent, resetSVGState, setInspect, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGPropertiespublic DensityMap()
Level.add(LevelMarkup))@Deprecated public DensityMap(Agent owner, ShapeDrawMode drawMode, boolean isPublic, double x, double y, double width, double height, double transparency, double criticalDensity, DensityMapDisplayedValue displayedValue, boolean slidingWindow, double windowTimeMTU, boolean enableAttenuation, DensityMapType type, DensityMapBasisType basisType, DensityMapColorScheme colorScheme)
- Parameters:
owner-drawMode-isPublic-x-y-width-height-transparency-criticalDensity-enableAttenuation-colorScheme-
public void setOwner(Agent owner)
MarkupShape- Overrides:
setOwnerin classMarkupShape- Parameters:
owner- new owner
public void reset()
public double getX()
- Returns:
- x coordinate of the density map legend
public void setX(double x)
- Parameters:
x- - x coordinate of the density map legend
public double getY()
- Returns:
- y coordinate of the density map legend
public void setY(double y)
- Parameters:
y- - y coordinate of the density map legend
public double getWidth()
- Returns:
- width of the density map legend
public void setWidth(double width)
- Parameters:
width- - width of the density map legend
public double getHeight()
- Returns:
- height of the density map legend
public void setHeight(double height)
- Parameters:
height- - height of the density map legend
public double getTransparency()
- Returns:
- the density map transparency
public DensityMapType getType()
- DensityMapType.PEDESTRIAN
- DensityMapType.TRANSPORTER
- DensityMapType.CONVEYOR
- DensityMapType.RAILROAD
- Returns:
- the type of density map
public void setType(DensityMapType type)
- Parameters:
type- - type of density map. Possible values are:- DensityMapType.PEDESTRIAN
- DensityMapType.TRANSPORTER
- DensityMapType.CONVEYOR
- DensityMapType.RAILROAD
public DensityMapBasisType getCalculationBasis()
- Returns:
- the calculation basis of the density map
public void setCalculationBasis(DensityMapBasisType type)
- Parameters:
type- - calculation of density map. Possible values are:
public void setTransparency(double transparency)
- Parameters:
transparency- - defines the transparency of the density map
public double getCriticalDensity()
- Returns:
- the critical density for the density map
public void setCriticalDensity(double criticalDensity)
- Parameters:
criticalDensity- - critical density for the density map
public void setSlidingWindow(double time)
- Parameters:
time- - time in model time units
public void setSlidingWindow(double time, TimeUnits units)
- Parameters:
time- - time in model time unitsunits- - time units
public double getSlidingWindow()
- Returns:
- sliding window time in model time units
public double getSlidingWindow(TimeUnits units)
- Parameters:
units- - time units- Returns:
- sliding window in specified time units.
public DensityMapDisplayedValue getDensityValue()
- DENSITY_VALUE_MEAN
- DENSITY_VALUE_MAX
- Returns:
- the 'Displayed density value' parameter
public void setDensityValue(DensityMapDisplayedValue valueType)
- DENSITY_VALUE_MEAN
- DENSITY_VALUE_MAX
- Parameters:
valueType- a constant defining density value type
public boolean isEnableAttenuation()
- Returns:
- true if the density map is shown with attenuation; returns false otherwise.
public void setEnableAttenuation(boolean enable)
- Parameters:
enable-
@AnyLogicInternalLibraryAPI public boolean isTrackNetworkNodes()
- Returns:
- true if the network-based density map tracks network nodes, false otherwise.
@AnyLogicInternalLibraryAPI public void setTrackNetworkNodes(boolean track)
- Parameters:
track-
@AnyLogicInternalLibraryAPI public boolean isTrackNetworkPaths()
- Returns:
- true if the network-based density map tracks network paths, false otherwise.
@AnyLogicInternalLibraryAPI public void setTrackNetworkPaths(boolean track)
- Parameters:
track-
public DensityMapColorScheme getColorScheme()
- Returns:
- the color scheme of this density map
public void setColorScheme(DensityMapColorScheme colorScheme)
- LINEAR_COLOR_SCHEME - Linear density-color dependency.
- LOGARITHMIC_COLOR_SCHEME - Logarithmic density-color dependency.
- CUSTOM_COLOR_SCHEME - Custom color scheme, defined in
getCustomColordynamic parameter.
- Parameters:
colorScheme- - the color scheme for density map
@AnyLogicInternalCodegenAPI public Color customColor(double density)
CUSTOM color
scheme- Specified by:
customColorin interfaceDensityMapCustomColorProvider
public void show()
public void show(Level level)
- Parameters:
level- - the level to show
public void hide()
public void hide(Level level)
- Parameters:
level- - the level to hide
public boolean isShown()
- Returns:
trueif shown,falseotherwise
public boolean isShown(Level level)
- Parameters:
level- - the level to check- Returns:
trueif shown,falseotherwise
@AnyLogicInternalAPI public void display(boolean flag)
flag == true and hides otherwise.- Parameters:
flag- - defines visibility for density map
@AnyLogicInternalAPI public void display(Level level, boolean flag)
level if flag == true and hides otherwise.- Parameters:
level- - the level on which to change visibilityflag- - defines visibility for density map
public double currentDensity(double x, double y)
- Parameters:
x- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- density at the specified point
public double currentDensity(Level level, double x, double y)
- Parameters:
level- - level where the point is locatedx- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- density at the specified point
public double currentDensity(DensityMapCompatibleNetworkElement element)
- Parameters:
element- - density map compatible network element- Returns:
- density at the specified density map compatible network element
public double currentDensity(Level level, DensityMapCompatibleNetworkElement element)
- Parameters:
level- - level where the element is locatedelement- - density map compatible network element- Returns:
- density at the specified density map compatible network element
- See Also:
public double maximumDensity(double x, double y)
- Parameters:
x- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- maximum density at the specified point
public double maximumDensity(Level level, double x, double y)
- Parameters:
level- - level where the point is locatedx- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- maximum density at the specified point
public double maximumDensity(DensityMapCompatibleNetworkElement element)
- Parameters:
element- - density map compatible network element- Returns:
- maximum density at the specified point
public double maximumDensity(Level level, DensityMapCompatibleNetworkElement element)
- Parameters:
level- - level where the element is locatedelement- - density map compatible network element- Returns:
public double meanDensity(double x, double y)
- Parameters:
x- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- mean density at the specified point
public double meanDensity(Level level, double x, double y)
- Parameters:
level- - level where the point is locatedx- - X coordinate of the pointy- - Y coordinate of the point- Returns:
- mean density at the specified point
public double meanDensity(DensityMapCompatibleNetworkElement element)
- Parameters:
element- - density map compatible network element- Returns:
- mean density at the specified density map compatible network element
public double meanDensity(Level level, DensityMapCompatibleNetworkElement element)
- Parameters:
level- - level where the element is locatedelement- - density map compatible network element- Returns:
- mean density at the specified density map compatible network element
@AnyLogicInternalCodegenAPI public void onDestroy()
@AnyLogicInternalLibraryAPI public void prepare(DensityMap.DensityMapPreparationSettings settings)
- Parameters:
settings-
@AnyLogicInternalLibraryAPI public void prepareGridBasedMap(Level level, double xUpperLeftPx, double yUpperLeftPx, int xCellCount, int yCellCount, double cellSizePx)
- Parameters:
xUpperLeftPx-yUpperLeftPx-xCellCount-yCellCount-cellSizePx-- See Also:
-
prepare(DensityMapPreparationSettings)DensityMap#prepareNetworkBasedMap(Set)
@AnyLogicInternalLibraryAPI public void prepareNetworkBasedMap(Level level, Set<DensityMapCompatibleNetwork> networks)
- Parameters:
networks-- See Also:
-
prepare(DensityMapPreparationSettings)DensityMap#prepareGridBasedMap(double, double, int, int, double)
@AnyLogicInternalLibraryAPI public DensityMapDataStorage getDataStorage(Level level)
public boolean contains(double px, double py)
MarkupShape- Specified by:
containsin classMarkupShape- Parameters:
px- the x coordinate relative to this shape's containerpy- the y coordinate relative to this shape's container- Returns:
trueif the shape contains the point with the given coordinates
public Color getColor(double density)
- Parameters:
density- density value- Returns:
- the color of the specified density value
@AnyLogicInternalAPI @Deprecated public Color getColor(double density, boolean reducePrecision)
@AnyLogicInternalAPI public Agent getOwner()