Class SnapSettings
GeometryEditor
.
Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors.
If enabledProperty()
is true and a user edits a geometry interactively, then when the pointer is
close to an existing snappable feature, the position of the interactive edit is adjusted
to coincide with ("snap to") that feature. When the edit position has been adjusted, visual cues show the user
the adjusted edit position, and which aspect of the feature geometry was used as the best candidate for that
adjustment.
To use snapping in the GeometryEditor
:
- Connect a
GeometryEditor
to a map view usingMapView.geometryEditorProperty()
, and ensure theMapView.mapProperty()
and any layers in it are loaded.- Only layers that provide full resolution geometries can be used for snapping.
- Get the
GeometryEditor.snapSettingsProperty()
, setSnapSettings.enabledProperty()
to true, and callsyncSourceSettings()
. - Set
SnapSourceSettings.enabledProperty()
to true for eachSnapSource
that you want users to be able to snap to.- You may wish to enable all the
SnapSourceSettings
, use only select sources, or delegate the choice to your users.
- You may wish to enable all the
- Call
SnapSettings.syncSourceSettings()
to populate the collection of sources. You can also call this method to refresh the collection as required, preserving the state of any existingSnapSourceSettings
. - Call one of the start methods on
GeometryEditor
to allow the end user to create or edit a new geometry by choosing to snap to the specified snapping sources.
You can snap to SnapSource
objects that are contained in the MapView
associated with the
GeometryEditor
, and are visible. As snapping is used to maintain data integrity between different sources of
data, only SnapSource
objects that provide full resolution geometries can be used for snapping. See
SnapSource
for more information.
The visual cues that indicate to a user when snapping has occurred can be customized using
GeometryEditorStyle.snappedToVertexSymbolProperty()
, GeometryEditorStyle.snappedToLineSymbolProperty()
. If there are
multiple potential candidates that could be snapped to for a given pointer position, then
GeometryEditorStyle.multipleSnapCandidatesSymbolProperty()
is used to indicate this.
- Since:
- 200.4.0
- See Also:
-
Property Summary
TypePropertyDescriptionTrue if interactive geometry edits made using theGeometryEditor
should happen using the currentSnapSettings
, false otherwise. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTrue if interactive geometry edits made using theGeometryEditor
should happen using the currentSnapSettings
, false otherwise.Defines the collection of snapping sources and whether or not each is enabled for snapping.boolean
Gets the value of theenabled
property.void
setEnabled
(boolean isEnabled) Sets the value of theenabled
property.void
Synchronizes thegetSourceSettings()
collection based onSnapSource
objects in the currently connectedArcGISMap
.
-
Property Details
-
enabled
True if interactive geometry edits made using theGeometryEditor
should happen using the currentSnapSettings
, false otherwise. Default is false.If
enabledProperty()
is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. The content ofgetSourceSettings()
determines which sources of geometries can be used to snap to.- Since:
- 200.4.0
- See Also:
-
-
Constructor Details
-
SnapSettings
public SnapSettings()Creates a default SnapSettings.- Since:
- 200.4.0
-
-
Method Details
-
enabledProperty
True if interactive geometry edits made using theGeometryEditor
should happen using the currentSnapSettings
, false otherwise. Default is false.If
enabledProperty()
is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. The content ofgetSourceSettings()
determines which sources of geometries can be used to snap to.- Returns:
- the
enabled
property - Since:
- 200.4.0
- See Also:
-
isEnabled
public boolean isEnabled()Gets the value of theenabled
property.- Property description:
- True if interactive geometry edits made using the
GeometryEditor
should happen using the currentSnapSettings
, false otherwise. Default is false.If
enabledProperty()
is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. The content ofgetSourceSettings()
determines which sources of geometries can be used to snap to. - Returns:
- the value of the
enabled
property - Since:
- 200.4.0
- See Also:
-
setEnabled
public void setEnabled(boolean isEnabled) Sets the value of theenabled
property.- Property description:
- True if interactive geometry edits made using the
GeometryEditor
should happen using the currentSnapSettings
, false otherwise. Default is false.If
enabledProperty()
is true and a user edits a geometry interactively, then when the pointer is close to an existing snappable feature, the position of the interactive edit is adjusted to coincide with ("snap to") that feature. The content ofgetSourceSettings()
determines which sources of geometries can be used to snap to. - Parameters:
isEnabled
- the value for theenabled
property- Since:
- 200.4.0
- See Also:
-
getSourceSettings
Defines the collection of snapping sources and whether or not each is enabled for snapping.Call
syncSourceSettings()
to populate this collection with aSnapSourceSettings
for each validSnapSource
present in the connectedArcGISMap
.SnapSettings
is connected to anArcGISMap
viaGeometryEditor.snapSettingsProperty()
,MapView.geometryEditorProperty()
, andMapView.mapProperty()
. If there is no connected map, or the map contains no validSnapSource
objects, then the collection will be empty afterSnapSettings.syncSourceSettings()
returns.The order of
SnapSourceSettings
objects will match the order that the associatedSnapSource
objects appear in theGeoModel.getOperationalLayers()
collection. The collection will not contain aSnapSourceSettings
for anySnapSource
which is not yetLoadStatus.LOADED
whenSnapSettings.syncSourceSettings()
is called.As snapping is used to maintain data integrity between different sources of data, only
SnapSource
objects that provide full resolution geometries are considered valid for creating aSnapSourceSettings
object - seeSnapSource
for more information.- Returns:
- defines the collection of snapping sources and whether or not each is enabled for snapping
- Since:
- 200.4.0
-
syncSourceSettings
public void syncSourceSettings()Synchronizes thegetSourceSettings()
collection based onSnapSource
objects in the currently connectedArcGISMap
.Call this method to populate
SnapSettings.getSourceSettings()
with aSnapSourceSettings
for each validSnapSource
present in theArcGISMap
currently connected to thisSnapSettings
viaGeometryEditor.snapSettingsProperty()
,MapView.geometryEditorProperty()
, andMapView.mapProperty()
. If there is no connectedArcGISMap
, or the map contains noSnapSource
objects valid for snapping, then the collection will be empty after this method returns.The order of
SnapSourceSettings
objects will match the order that the associatedSnapSource
objects appear in theGeoModel.getOperationalLayers()
collection. The collection will not contain aSnapSourceSettings
for anySnapSource
which is not yetLoadStatus.LOADED
whensyncSourceSettings()
is called.Subsequent calls will update the existing collection, accounting for
SnapSource
objects that have been added, removed, or moved since the last call to the same connected map. Any changes made to existingSnapSourceSettings
objects, for example settingSnapSourceSettings.enabledProperty()
, will be preserved.When settings are shared between multiple
GeometryEditor.snapSettingsProperty()
properties, eachGeometryEditor
must be connected to the sameArcGISMap
or an exception is thrown when syncing.- Since:
- 200.4.0
- See Also:
-