- 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
- setTransparency
- getCriticalDensity
- setCriticalDensity
- setSlidingWindow
- setSlidingWindow
- getSlidingWindow
- getSlidingWindow
- getDensityValue
- setDensityValue
- isEnableAttenuation
- setEnableAttenuation
- getColorScheme
- setColorScheme
- customColor
- show
- hide
- display
- currentDensity
- maximumDensity
- meanDensity
- onDestroy
- prepareGridBasedMap
- getDataStorage
- contains
- getColor
- getColor
- 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
,HasLevel
,LevelElement
,LevelMarkup
,SVGElement
,UsdElement
,Serializable
public class DensityMap extends AbstractLevelMarkup
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
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.
|
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. |
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
|
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.
|
boolean | isEnableAttenuation() |
Returns true if the density map is shown with attenuation; returns false otherwise.
|
double | maximumDensity |
Returns maximum observed density at the specified point
|
double | meanDensity |
Returns mean density at the specified point
|
void | onDestroy() | |
void | prepareGridBasedMap | |
void | reset() |
Resets maximum density to current density
|
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 | 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.
|
error, getFullName, getOutsideLevelZ, getPresentable, getSpace, initialize, isClickHandled, isPublic, onClick, remove, setDrawMode
discardOwner, executeUserAction, findSVGElement, getName, getOrGenerateUSDId, getSVGId, initializeInternal, isVisible, onAggregatorInitialized, onAggregatorVisibilityChanged, removeSVGFromOwner, resetSVGState, setVisible, updateDynamicProperties, updateDynamicPropertiesStructural, updateSVGProperties
public 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, DensityMapColorScheme colorScheme)
- Parameters:
owner
-drawMode
-isPublic
-x
-y
-width
-height
-transparency
-criticalDensity
-enableAttenuation
-colorScheme
-
public void setOwner(Agent owner)
MarkupShape
- Overrides:
setOwner
in 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
- Returns:
- the type of density map
public void setType(DensityMapType type)
- Parameters:
type
- - type of density map. Possible values are:- DensityMapType.PEDESTRIAN
- DensityMapType.TRANSPORTER
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()
public void setEnableAttenuation(boolean enable)
- Parameters:
enable
-
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
getCustomColor
dynamic parameter.
- Parameters:
colorScheme
- - the color scheme for density map
@AnyLogicInternalCodegenAPI public Color customColor(double density)
CUSTOM
color
schemepublic void show()
public void hide()
public void display(boolean flag)
flag == true
and hides otherwise.- Parameters:
flag
- - 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 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 meanDensity(double x, double y)
- Parameters:
x
- X coordinate of the pointy
- Y coordinate of the point- Returns:
- mean density at the specified point
@AnyLogicInternalCodegenAPI public void onDestroy()
@AnyLogicInternalLibraryAPI public void prepareGridBasedMap(double xUpperLeftPx, double yUpperLeftPx, int xCellCount, int yCellCount, double cellSizePx)
@AnyLogicInternalLibraryAPI public DensityMapDataStorage getDataStorage()
public boolean contains(double px, double py)
MarkupShape
- Specified by:
contains
in classMarkupShape
- Parameters:
px
- the x coordinate relative to this shape's containerpy
- the y coordinate relative to this shape's container- Returns:
true
if 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)