- All Implemented Interfaces:
PopupSource
Graphics overlays display a collection of graphics on top of all the layers (including reference layers)
in a map view or scene view. Every map view or scene view can contain a collection of graphics overlays
(GeoView.getGraphicsOverlays()
), and each graphics overlay can contain a collection of graphics
(getGraphics()
). The graphics in the first GraphicsOverlay are drawn first, with subsequent
ones on top. The Renderer provided by getRenderer()
defines the symbology of the
getGraphics()
collection.
A graphic's Graphic.getZIndex()
value defines its draw order within the graphics overlay that contains it. The
Graphic.getZIndex()
value applies in a map view, and in a scene view if the scene view drapes the
graphics on the surface (LayerSceneProperties.SurfacePlacement.DRAPED_FLAT
). In other scene view rendering,
the graphic's display order is determined by the distance to the camera rather than by Z-index.
If the Graphic.getZIndex()
value is not set, graphics will render in the order in which they were added to the
graphics overlay. The first added is rendered first and subsequent ones on top. In rare cases, the rendering
algorithm may change the display order to provide more efficient rendering. If ordering is important, set the
Z-index explicitly on Graphics.
To improve view responsiveness, you can set the
rendering mode
to either of these options:
-
GraphicsOverlay.RenderingMode.DYNAMIC
- graphics are updated immediately as theGeoView
is panned or zoomed (default). -
GraphicsOverlay.RenderingMode.STATIC
- graphics are updated once the pan or zoom operation on theGeoView
is finished. This is best for rendering large numbers of graphics.
- Since:
- 100.0.0
- See Also:
-
Property Summary
TypePropertyDescriptionDefines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent change. -
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Rendering modes available for graphics overlays -
Constructor Summary
ConstructorDescriptionCreates a new graphics overlay with default dynamic rendering mode.GraphicsOverlay
(GraphicsOverlay.RenderingMode renderingMode) Creates a new graphics overlay. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deselects all graphics in the graphics overlay.Defines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent change.Calculates and returns the extent of thegetGraphics()
collection.Gets the value of thefeatureReduction
property.Gets a modifiable list of the graphics in this overlay.Gets a modifiable list ofLabelDefinition
objects for this graphics overlay.double
Gets the maximum scale at which to display the graphics overlay.double
Gets the minimum scale at which to display the graphics overlay.float
Gets the opacity for the graphics overlay.Gets the PopupDefinition set viasetPopupDefinition(PopupDefinition)
, or null if one has not been set.Gets the renderer for the graphics overlay.Gets the rendering mode used to display graphics in the overlay.Gets a layer scene properties object for the graphics overlay.Gets a read only list of the currently selected graphics in this overlay.boolean
Indicates if labels are displayed for graphics in this graphics overlay.boolean
Checks if the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.boolean
Gets whether this graphics overlay's symbols and labels honor the map reference scale when displayed in a map view.boolean
Checks if this graphics overlay is visible.void
selectGraphics
(Iterable<Graphic> graphics) Selects the specified graphics.void
setFeatureReduction
(FeatureReduction featureReduction) Sets the value of thefeatureReduction
property.void
setLabelsEnabled
(boolean enabled) Sets whether labels are displayed for graphics in this graphics overlay.void
setMaxScale
(double maxScale) Sets the maximum scale at which to display the graphics overlay.void
setMinScale
(double minScale) Sets the minimum scale at which to display the graphics overlay.void
setOpacity
(float opacity) Sets the opacity for the graphics overlay.void
setPopupDefinition
(PopupDefinition popupDefinition) Sets the PopupDefinition for the GraphicsOverlay, overriding any previous one set.void
setPopupEnabled
(boolean enabled) Sets whether the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.void
setRenderer
(Renderer renderer) Sets a renderer to the graphics overlay.void
setScaleSymbols
(boolean scaleSymbols) Sets whether this graphics overlay's symbols and labels honor the map reference scale when displayed in a map view.void
setVisible
(boolean visible) Sets if this graphics overlay is visible.void
unselectGraphics
(Iterable<Graphic> graphics) Unselects the specified graphics.
-
Property Details
-
featureReduction
Defines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent change.FeatureReduction
is only supported for point graphics in dynamic rendering mode (GraphicsOverlay.RenderingMode.DYNAMIC
) in 2D.FeatureReduction
is ignored and will result in the original point graphics being rendered for a GraphicsOverlay that:- Uses static rendering mode.
- Is added to a
SceneView
. - Uses an unsupported renderer for the
AggregationFeatureReduction.rendererProperty()
. SeeAggregationFeatureReduction.rendererProperty()
for more info.
If this property is explicitly set to null,
FeatureReduction
is removed from the GraphicsOverlay.- Since:
- 200.4.0
- See Also:
-
-
Constructor Details
-
GraphicsOverlay
public GraphicsOverlay()Creates a new graphics overlay with default dynamic rendering mode.- Since:
- 100.0.0
-
GraphicsOverlay
Creates a new graphics overlay.- Parameters:
renderingMode
- the rendering mode to use for this overlay- Throws:
IllegalArgumentException
- if parameter is null- Since:
- 100.0.0
-
-
Method Details
-
getPopupDefinition
Gets the PopupDefinition set viasetPopupDefinition(PopupDefinition)
, or null if one has not been set.- Specified by:
getPopupDefinition
in interfacePopupSource
- Returns:
- the GraphicOverlay's PopupDefinition
- Since:
- 100.0.0
- See Also:
-
setPopupDefinition
Sets the PopupDefinition for the GraphicsOverlay, overriding any previous one set.- Specified by:
setPopupDefinition
in interfacePopupSource
- Parameters:
popupDefinition
- the PopupDefinition to set- Since:
- 100.0.0
- See Also:
-
isPopupEnabled
public boolean isPopupEnabled()Description copied from interface:PopupSource
Checks if the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.- Specified by:
isPopupEnabled
in interfacePopupSource
- Returns:
- true if the pop-up definition is enabled; false otherwise. Will return false if an error occurs.
- See Also:
-
setPopupEnabled
public void setPopupEnabled(boolean enabled) Description copied from interface:PopupSource
Sets whether the pop-up definition returned fromPopupSource.getPopupDefinition()
is enabled or disabled.- Specified by:
setPopupEnabled
in interfacePopupSource
- Parameters:
enabled
- true to enable the PopupDefinition; false otherwise- See Also:
-
getRenderingMode
Gets the rendering mode used to display graphics in the overlay.For more efficient rendering of large numbers of graphics, set the rendering mode to
GraphicsOverlay.RenderingMode.STATIC
. In order to ensure map responsiveness, static rendering does not refresh the display while pan and zoom operations are in progress. The amount of graphics an overlay can handle in this mode is mainly limited by the system memory.- Returns:
- the rendering mode
- Since:
- 100.0.0
-
isVisible
public boolean isVisible()Checks if this graphics overlay is visible.- Returns:
- true if the GraphicsOverlay is visible; false otherwise.
- Since:
- 100.0.0
-
setVisible
public void setVisible(boolean visible) Sets if this graphics overlay is visible.- Parameters:
visible
- true to set the graphics overlay visible- Since:
- 100.0.0
-
getOpacity
public float getOpacity()Gets the opacity for the graphics overlay.Must be a value between 0 and 1 with 1 being solid or opaque and 0 being transparent. The default opacity is 1.
- Returns:
- the opacity
- Since:
- 100.0.0
-
setOpacity
public void setOpacity(float opacity) Sets the opacity for the graphics overlay.Must be a value between 0 and 1 with 1 being solid or opaque and 0 being transparent.
- Parameters:
opacity
- the new opacity- Throws:
IllegalArgumentException
- if opacity is less than 0 or greater than 1- Since:
- 100.0.0
-
getMinScale
public double getMinScale()Gets the minimum scale at which to display the graphics overlay. A large number allows the map to display the layer when zooming further out.This controls the minimum scale at which the graphics overlay is displayed. If the current map scale is larger than the minimum scale, then this graphics overlay will not be displayed.
A scale is usually referred to as 1:X, where X is the scale specified here. This value is the relative scale to the real world, where one inch on the screen is X inches in the real world. Note that this is only an approximation and is dependent on the map's projection that can add some distortion, as well as the system's reported DPI setting which doesn't necessarily match the actual DPI of the screen.
The default value of this property is NaN which makes the layer unbounded by any scale.
- Returns:
- the minimum scale level at which the graphics overlay is displayed.
- Since:
- 100.0.0
-
setMinScale
public void setMinScale(double minScale) Sets the minimum scale at which to display the graphics overlay. A large number allows the map to display the layer when zooming further out.This controls the minimum scale at which the graphics overlay is displayed. If the current map scale is larger than the minimum scale, then this graphics overlay will not be displayed.
A scale is usually referred to as 1:X, where X is the scale specified here. This value is the relative scale to the real world, where one inch on the screen is X inches in the real world. Note that this is only an approximation and is dependent on the map's projection that can add some distortion, as well as the system's reported DPI setting which doesn't necessarily match the actual DPI of the screen.
- Parameters:
minScale
- the new minimum scale- Since:
- 100.0.0
-
getMaxScale
public double getMaxScale()Gets the maximum scale at which to display the graphics overlay. A small number allows the map to display the layer when zooming further in.This controls the maximum scale at which the graphics overlay is displayed. If the current map scale is smaller than the maximum scale, then this graphics overlay will not be displayed.
A scale is usually referred to as 1:X, where X is the scale specified here. This value is the relative scale to the real world, where one inch on the screen is X inches in the real world. Note that this is only an approximation and is dependent on the map's projection that can add some distortion, as well as the system's reported DPI setting which doesn't necessarily match the actual DPI of the screen.
The default value of this property is NaN which makes the layer unbounded by any scale.
- Returns:
- the maximum scale level this graphics overlay will be displayed.
- Since:
- 100.0.0
- See Also:
-
setMaxScale
public void setMaxScale(double maxScale) Sets the maximum scale at which to display the graphics overlay. A small number allows the map to display the layer when zooming further in.This controls the maximum scale at which the graphics overlay is displayed. If the current map scale is smaller than the maximum scale, then this graphics overlay will not be displayed.
A scale is usually referred to as 1:X, where X is the scale specified here. This value is the relative scale to the real world, where one inch on the screen is X inches in the real world. Note that this is only an approximation and is dependent on the map's projection that can add some distortion, as well as the system's reported DPI setting which doesn't necessarily match the actual DPI of the screen.
- Parameters:
maxScale
- the new maximum scale- Since:
- 100.0.0
-
getRenderer
Gets the renderer for the graphics overlay. If any graphic in the graphics overlay has a Symbol set, that will take precedence over this renderer.- Returns:
- the renderer
- Since:
- 100.0.0
-
setRenderer
Sets a renderer to the graphics overlay. If any graphic in the graphics overlay has a Symbol set, that will take precedence over this renderer.- Parameters:
renderer
- the new renderer- Since:
- 100.0.0
-
getGraphics
Gets a modifiable list of the graphics in this overlay. Add or remove graphics from this list to modify what is displayed. The list returned can be empty but not null. You can add listeners to this list to monitor changes to the list.If Z-index for graphics is not set, they will usually render in the order in which they were added to the graphics overlay, the first added is rendered first and subsequent ones on top. In rare cases, the rendering algorithm may change the display order to provide more efficient rendering. If ordering is important, set the Z-index explicitly on graphics by calling
Graphic.setZIndex(int)
. You can also place graphics of the same geometry type in their own graphics overlay and manage the order of the overlays in the view.- Returns:
- a modifiable list of graphics in this graphics overlay
- Since:
- 100.0.0
-
getSelectedGraphics
Gets a read only list of the currently selected graphics in this overlay. The list returned can be empty but not null. The list is a snapshot of the current selected graphics. To change the selection, you call methods on Graphic; a Graphic comes with different methods that alter the list of currently selected Graphics.- Returns:
- a list of selected graphics
- Since:
- 100.0.0
- See Also:
-
clearSelection
public void clearSelection()Deselects all graphics in the graphics overlay.- Since:
- 100.0.0
-
getExtent
Calculates and returns the extent of thegetGraphics()
collection.The extent's
SpatialReference
is that of theGeoView
that contains the overlay. If the overlay is not in a view, returns null. If the overlay is in a view but that view does not yet have a spatial reference, returns null. If the overlay is in a view with a spatial reference, but has no graphics, then an empty envelope will be returned.- Returns:
- the envelope. Can be null.
- Since:
- 100.0.0
-
featureReductionProperty
Defines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent change.FeatureReduction
is only supported for point graphics in dynamic rendering mode (GraphicsOverlay.RenderingMode.DYNAMIC
) in 2D.FeatureReduction
is ignored and will result in the original point graphics being rendered for a GraphicsOverlay that:- Uses static rendering mode.
- Is added to a
SceneView
. - Uses an unsupported renderer for the
AggregationFeatureReduction.rendererProperty()
. SeeAggregationFeatureReduction.rendererProperty()
for more info.
If this property is explicitly set to null,
FeatureReduction
is removed from the GraphicsOverlay.- Returns:
- the
featureReduction
property - Since:
- 200.4.0
- See Also:
-
getFeatureReduction
Gets the value of thefeatureReduction
property.- Property description:
- Defines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent
change.
FeatureReduction
is only supported for point graphics in dynamic rendering mode (GraphicsOverlay.RenderingMode.DYNAMIC
) in 2D.FeatureReduction
is ignored and will result in the original point graphics being rendered for a GraphicsOverlay that:- Uses static rendering mode.
- Is added to a
SceneView
. - Uses an unsupported renderer for the
AggregationFeatureReduction.rendererProperty()
. SeeAggregationFeatureReduction.rendererProperty()
for more info.
If this property is explicitly set to null,
FeatureReduction
is removed from the GraphicsOverlay. - Returns:
- the value of the
featureReduction
property - Since:
- 200.4.0
- See Also:
-
setFeatureReduction
Sets the value of thefeatureReduction
property.- Property description:
- Defines properties for dynamically aggregating and summarizing groups of graphics as the map scale and visible extent
change.
FeatureReduction
is only supported for point graphics in dynamic rendering mode (GraphicsOverlay.RenderingMode.DYNAMIC
) in 2D.FeatureReduction
is ignored and will result in the original point graphics being rendered for a GraphicsOverlay that:- Uses static rendering mode.
- Is added to a
SceneView
. - Uses an unsupported renderer for the
AggregationFeatureReduction.rendererProperty()
. SeeAggregationFeatureReduction.rendererProperty()
for more info.
If this property is explicitly set to null,
FeatureReduction
is removed from the GraphicsOverlay. - Parameters:
featureReduction
- the value for thefeatureReduction
property- Since:
- 200.4.0
- See Also:
-
getSceneProperties
Gets a layer scene properties object for the graphics overlay. The object can be used to make changes to how graphics are displayed in a SceneView.Use scene properties to control how graphics are displayed in a
SceneView
. For example, you can adjust thealtitude offset
or thesurface placement
in theSceneView
.None of these settings are applied if the graphics overlay is added to a
MapView
.- Returns:
- a scene properties object for the graphics overlay
- Since:
- 100.0.0
-
setLabelsEnabled
public void setLabelsEnabled(boolean enabled) Sets whether labels are displayed for graphics in this graphics overlay.- Parameters:
enabled
- true to enable, false to disable labels- Since:
- 100.1.0
-
isLabelsEnabled
public boolean isLabelsEnabled()Indicates if labels are displayed for graphics in this graphics overlay.- Returns:
- true if labels are enabled, false if not
- Since:
- 100.1.0
-
getLabelDefinitions
Gets a modifiable list ofLabelDefinition
objects for this graphics overlay.A
LabelDefinition
defines the text, appearance, and position of labels for thegraphics
. You can manage graphic labeling by defining newLabelDefinition
objects and adding or removing them from this collection.- Returns:
- a modifiable list of
LabelDefinition
objects for this graphics overlay - Since:
- 100.1.0
-
isScaleSymbols
public boolean isScaleSymbols()Gets whether this graphics overlay's symbols and labels honor the map reference scale when displayed in a map view.If the map has a positive reference scale, and the overlay honors it, then symbols and labels will be drawn at their specified size when the viewing scale is the same as the reference scale, and will grow or shrink as the view zooms in or out, to keep the symbol a fixed size on the map. If the map has no reference scale, the reference scale is zero, or the overlay's scaleSymbols property is false, then the symbols and labels will be drawn at their fixed screen size.
ScaleSymbols can only be used when displaying the overlay in a
MapView
. The symbols and labels will be displayed at fixed screen size in aSceneView
.The default value is false.
- Returns:
- true if the symbols and labels honor the map reference scale, false otherwise
- Since:
- 100.7.0
-
setScaleSymbols
public void setScaleSymbols(boolean scaleSymbols) Sets whether this graphics overlay's symbols and labels honor the map reference scale when displayed in a map view.If the map has a positive reference scale, and the overlay honors it, then symbols and labels will be drawn at their specified size when the viewing scale is the same as the reference scale, and will grow or shrink as the view zooms in or out, to keep the symbol a fixed size on the map. If the map has no reference scale, the reference scale is zero, or the overlay's scaleSymbols property is false, then the symbols and labels will be drawn at their fixed screen size.
ScaleSymbols can only be used when displaying the overlay in a
MapView
. The symbols and labels will be displayed at fixed screen size in aSceneView
.- Parameters:
scaleSymbols
- true to make the symbols and labels honor the map reference scale, false otherwise- Since:
- 100.7.0
-
selectGraphics
Selects the specified graphics. Any graphics that are not in this graphics overlay will be ignored.- Parameters:
graphics
- the graphics to be selected- Throws:
IllegalArgumentException
- if graphics is null- Since:
- 100.5.0
-
unselectGraphics
Unselects the specified graphics. Any graphics that are not in this graphics overlay will be ignored.- Parameters:
graphics
- the graphics to be unselected- Throws:
IllegalArgumentException
- if graphics is null- Since:
- 100.5.0
-