Class GeometryEditor
MapView
.
To use a GeometryEditor:
- Set the
MapView.geometryEditorProperty()
. - Call one of the start methods.
- To interactively create new geometries from scratch, call
start(GeometryType)
passing in aGeometryType
to determine the type of geometry created. - For geometry editing workflows, pass an existing
Geometry
intostart(Geometry)
.
- To interactively create new geometries from scratch, call
- You can then edit the geometry directly on the map view using mouse or touch gestures.
- The
toolProperty()
determines how you draw on the map to define the new geometry, for example by adding individual vertices or with a freehand gesture. The default tool isVertexTool
. - If you passed in an initial geometry, it is displayed in the view, and you can interact with the geometry to make changes.
- The
- Call
stop()
to return the geometry and prevent the geometry editor from processing any more interactions.- Geometries are immutable, therefore a new
Geometry
object reflecting the updates is returned fromgeometryProperty()
andGeometryEditor.stop()
each time.
- Geometries are immutable, therefore a new
When started (startedProperty()
is true), you can interact with the different
GeometryEditorElement
objects that compose the representation of the
geometry
in the map view. Depending on what is selected, different types of
GeometryEditorElement
are returned from the selectedElementProperty()
. Tap to select
the different elements and drag to move them. Tap multiple times on an element to select the different types of
GeometryEditorElement
representing vertices, parts, and the entire geometry. You can control which interactions
are possible by changing the InteractionConfiguration
of the current tool
.
For example, you can change the types of element you can tap to select, and whether they can create new vertices or
parts by tapping or dragging on the map. Programmatic changes to the geometryProperty()
or
selectedElementProperty()
(for example selectVertex(long, long)
or
moveSelectedElement(Point)
) are not affected by the settings in InteractionConfiguration
.
The type of the current GeometryEditor.toolProperty()
determines what type of interactions will add new
vertices and parts to the geometry.
Change the appearance of the geometry by using the GeometryEditorStyle
of the current
GeometryEditor.toolProperty() tool
- for example to match the symbology used by the graphic or feature being
edited.
Enabling snapping can help ensure that interactive edits are more accurate, with fewer errors, by allowing you
to create geometries that connect to each other and are coincident. Use snapSettingsProperty()
to
configure snapping behavior.
Programmatic editing methods are also provided so you can augment your interactive geometry editing to support specific user requirements. For example:
- Use
insertVertex(Point)
to add a subsequent vertex based on a GPS location fromLocationDisplay
. - Use
deleteSelectedElement()
to delete the currentselected element
. - Use
moveSelectedElement(Point)
to move the currently selectedGeometryEditorElement
to a specificPoint
, ormoveSelectedElement(double, double)
to nudge it in a specific direction. - Use
replaceGeometry(Geometry)
to take the currentgeometry
, apply an operation such as a union or intersect by usingGeometryEngine
, and then replace the current geometry with the result so you can continue to edit as required. - Use
undo()
andredo()
to undo and redo individual interactive or programmatic edits.
geometryProperty()
and selectedElementProperty()
to be notified when a user interaction or API call has changed the GeometryEditor.selectedElementProperty()
or GeometryEditor.geometryProperty()
.
Changing the geometry state can also change canUndoProperty()
.
- Since:
- 200.1.0
-
Property Summary
TypePropertyDescriptionTrue if there are actions that can be redone on thegeometry
, false otherwise.True if there are actions that can be undone on thegeometry
, false otherwise.The current geometry, updated as you interact with the view.The element that is currently selected in the GeometryEditor, or null if nothing is selected.Configurable options for interactive snapping.True if an editing session is active, false otherwise.The tool defining how you interact with the view to create and edit thegeometry
.True if the geometry is visible in the view, false otherwise. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTrue if there are actions that can be redone on thegeometry
, false otherwise.True if there are actions that can be undone on thegeometry
, false otherwise.void
Clears the current geometry being edited.void
Clears the current selection.void
Deletes the selected element from the currentgeometry
.The current geometry, updated as you interact with the view.boolean
Gets the value of thecanRedo
property.boolean
Gets the value of thecanUndo
property.Gets the value of thegeometry
property.Gets the value of theselectedElement
property.Gets the value of thesnapSettings
property.getTool()
Gets the value of thetool
property.void
insertVertex
(Point point) Creates a new vertex at the specified location and inserts it after the currently selected element, or appends the point if there is nothing selected.boolean
Gets the value of thestarted
property.boolean
Gets the value of thevisible
property.void
moveSelectedElement
(double deltaX, double deltaY) Moves the selected element by the specified distances along the x-axis and y-axis.void
moveSelectedElement
(Point newPoint) Moves the selected element to the specified location.void
redo()
Redoes the last action undone on thegeometry
.void
replaceGeometry
(Geometry geometry) Replaces the currentgeometry
with the specified geometry.void
rotateSelectedElement
(double angle, Point origin) Rotates theselectedElementProperty()
by the specified angle.void
scaleSelectedElement
(double scaleX, double scaleY, Point origin) Scales the selected element by the specified factors.The element that is currently selected in the GeometryEditor, or null if nothing is selected.void
Selects the entiregeometry
.void
selectMidVertex
(long partIndex, long segmentIndex) Selects the mid-vertex with the specified indices.void
selectPart
(long partIndex) Selects the part with the specified index.void
selectVertex
(long partIndex, long vertexIndex) Selects the vertex with the specified indices.void
setSnapSettings
(SnapSettings snapSettings) Sets the value of thesnapSettings
property.void
setTool
(GeometryEditorTool tool) Sets the value of thetool
property.void
setVisible
(boolean isVisible) Sets the value of thevisible
property.Configurable options for interactive snapping.void
Starts a geometry editing session based on the specified geometry.void
start
(GeometryType geometryType) Starts a geometry editing session with an empty geometry of the specifiedGeometryType
.True if an editing session is active, false otherwise.stop()
Stops the editing session by making the GeometryEditor no longer respond to user interaction and clears thegeometry
.The tool defining how you interact with the view to create and edit thegeometry
.void
undo()
Undoes the last action on thegeometry
.True if the geometry is visible in the view, false otherwise.
-
Property Details
-
canRedo
True if there are actions that can be redone on thegeometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for redo actions.The value of the
canRedoProperty()
changes when:- an initial action that can be redone is performed in the GeometryEditor, or
- the last remaining action that can be redone was redone.
- Since:
- 200.1.0
- See Also:
-
canUndo
True if there are actions that can be undone on thegeometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for undo actions.The value of the
canUndoProperty()
changes when:- an initial action that can be undone is performed in the GeometryEditor, or
- the last remaining action that can be undone was undone.
- Since:
- 200.1.0
- See Also:
-
geometry
The current geometry, updated as you interact with the view.The geometry returned depends on the state of the GeometryEditor:
- Returns null while
startedProperty()
is false. - Returns an empty geometry (
Geometry.isEmpty()
is true) immediately after the GeometryEditor was started usingstart(GeometryType)
. - Returns the input geometry immediately after the GeometryEditor was started using
start(Geometry)
. - Returns the current geometry while the GeometryEditor is in use (
startedProperty()
is true).
GeometryEditor.start(Geometry)
, then the geometry is returned in the sameSpatialReference
as the input geometry. If the input geometry spatial reference is null, or the editor was started usingGeometryEditor.start(GeometryType)
, then the geometry is returned in the spatial reference of the associatedMapView
. If no spatial reference is set on either input geometry or via an associated map view, then the spatial reference of the geometry will be null.Editing feature data that is reprojected on the fly can introduce spatial errors into the data. When accuracy is important, best practice is to use a spatial reference for the map view which matches the feature layer geometry you are editing. The ArcGIS Pro editing help topic Introduction to projection on the fly contains further advice.
The value of the
geometryProperty()
changes when:- Starting or stopping the geometry editor - for example using
start(GeometryType)
orstop()
- Performing programmatic edits - for example using
insertVertex(Point)
ordeleteSelectedElement()
- Performing interactive edits - for example adding or moving a vertex
- Undoing or redoing edits - using
undo()
orredo()
.
- Since:
- 200.1.0
- See Also:
- Returns null while
-
started
True if an editing session is active, false otherwise.When true, interactions with the view can affect the state of the
geometryProperty()
orselectedElementProperty()
.- Since:
- 200.1.0
- See Also:
-
visible
True if the geometry is visible in the view, false otherwise.- Since:
- 200.1.0
- See Also:
-
selectedElement
The element that is currently selected in the GeometryEditor, or null if nothing is selected.Clicking or tapping on the different visible elements of a
geometry
in a view allows you to select and unselect them. This property returns a different type ofGeometryEditorElement
depending on what is selected - a vertex (GeometryEditorVertex
), a mid-vertex (GeometryEditorMidVertex
), a part of a polygon or polyline (GeometryEditorPart
), or the entire geometry (GeometryEditorGeometry
). You can change which selection interactions are allowed by using theInteractionConfiguration
of thetool
.You can also programmatically select specific vertices (
selectVertex(long, long)
), mid-vertices (selectMidVertex(long, long)
), parts of polygons or polylines (selectPart(long)
), or the entire geometry (selectGeometry()
). You can clear the selection usingclearSelection()
.The value of
selectedElementProperty()
changes when:- Performing programmatic selection - for example using
selectGeometry()
orselectVertex(long, long)
- Performing interactive selection - for example selecting or unselecting a
GeometryEditorElement
- The location of the selected element changes - for example moving the selected element programmatically or interactively
- Performing edits - for example inserting a vertex interactively or deleting the selected element programmatically
- Since:
- 200.1.0
- See Also:
- Performing programmatic selection - for example using
-
snapSettings
Configurable options for interactive snapping.Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors. Snapping is disabled by default - see
SnapSettings
for information about setting up snapping workflows.Attempting to set the value to null will throw a NullPointerException exception.
- Since:
- 200.4.0
- See Also:
-
tool
The tool defining how you interact with the view to create and edit thegeometry
.The default value is a
VertexTool
with all interactive operations enabled, providing a common way of editing points, multipoints, polygons, and polylines.The tool can be replaced while a GeometryEditor is started (
isStarted()
= true), enabling a combination of tools to be used to edit a geometry.Attempting to set the value to null will throw a NullPointerException.
- Since:
- 200.1.0
- See Also:
-
-
Constructor Details
-
GeometryEditor
public GeometryEditor()Creates a default GeometryEditor.- Since:
- 200.1.0
-
-
Method Details
-
canRedoProperty
True if there are actions that can be redone on thegeometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for redo actions.The value of the
canRedoProperty()
changes when:- an initial action that can be redone is performed in the GeometryEditor, or
- the last remaining action that can be redone was redone.
- Returns:
- the
canRedo
property - Since:
- 200.1.0
- See Also:
-
getCanRedo
public boolean getCanRedo()Gets the value of thecanRedo
property.- Property description:
- True if there are actions that can be redone on the
geometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for redo actions.The value of the
canRedoProperty()
changes when:- an initial action that can be redone is performed in the GeometryEditor, or
- the last remaining action that can be redone was redone.
- Returns:
- the value of the
canRedo
property - Since:
- 200.1.0
- See Also:
-
canUndoProperty
True if there are actions that can be undone on thegeometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for undo actions.The value of the
canUndoProperty()
changes when:- an initial action that can be undone is performed in the GeometryEditor, or
- the last remaining action that can be undone was undone.
- Returns:
- the
canUndo
property - Since:
- 200.1.0
- See Also:
-
getCanUndo
public boolean getCanUndo()Gets the value of thecanUndo
property.- Property description:
- True if there are actions that can be undone on the
geometry
, false otherwise.This applies to both programmatic and interactive changes to the
geometry
and is useful for enabling or disabling a UI control for undo actions.The value of the
canUndoProperty()
changes when:- an initial action that can be undone is performed in the GeometryEditor, or
- the last remaining action that can be undone was undone.
- Returns:
- the value of the
canUndo
property - Since:
- 200.1.0
- See Also:
-
geometryProperty
The current geometry, updated as you interact with the view.The geometry returned depends on the state of the GeometryEditor:
- Returns null while
startedProperty()
is false. - Returns an empty geometry (
Geometry.isEmpty()
is true) immediately after the GeometryEditor was started usingstart(GeometryType)
. - Returns the input geometry immediately after the GeometryEditor was started using
start(Geometry)
. - Returns the current geometry while the GeometryEditor is in use (
startedProperty()
is true).
GeometryEditor.start(Geometry)
, then the geometry is returned in the sameSpatialReference
as the input geometry. If the input geometry spatial reference is null, or the editor was started usingGeometryEditor.start(GeometryType)
, then the geometry is returned in the spatial reference of the associatedMapView
. If no spatial reference is set on either input geometry or via an associated map view, then the spatial reference of the geometry will be null.Editing feature data that is reprojected on the fly can introduce spatial errors into the data. When accuracy is important, best practice is to use a spatial reference for the map view which matches the feature layer geometry you are editing. The ArcGIS Pro editing help topic Introduction to projection on the fly contains further advice.
The value of the
geometryProperty()
changes when:- Starting or stopping the geometry editor - for example using
start(GeometryType)
orstop()
- Performing programmatic edits - for example using
insertVertex(Point)
ordeleteSelectedElement()
- Performing interactive edits - for example adding or moving a vertex
- Undoing or redoing edits - using
undo()
orredo()
.
- Returns:
- the
geometry
property - Since:
- 200.1.0
- See Also:
- Returns null while
-
getGeometry
Gets the value of thegeometry
property.- Property description:
- The current geometry, updated as you interact with the view.
The geometry returned depends on the state of the GeometryEditor:
- Returns null while
startedProperty()
is false. - Returns an empty geometry (
Geometry.isEmpty()
is true) immediately after the GeometryEditor was started usingstart(GeometryType)
. - Returns the input geometry immediately after the GeometryEditor was started using
start(Geometry)
. - Returns the current geometry while the GeometryEditor is in use (
startedProperty()
is true).
GeometryEditor.start(Geometry)
, then the geometry is returned in the sameSpatialReference
as the input geometry. If the input geometry spatial reference is null, or the editor was started usingGeometryEditor.start(GeometryType)
, then the geometry is returned in the spatial reference of the associatedMapView
. If no spatial reference is set on either input geometry or via an associated map view, then the spatial reference of the geometry will be null.Editing feature data that is reprojected on the fly can introduce spatial errors into the data. When accuracy is important, best practice is to use a spatial reference for the map view which matches the feature layer geometry you are editing. The ArcGIS Pro editing help topic Introduction to projection on the fly contains further advice.
The value of the
geometryProperty()
changes when:- Starting or stopping the geometry editor - for example using
start(GeometryType)
orstop()
- Performing programmatic edits - for example using
insertVertex(Point)
ordeleteSelectedElement()
- Performing interactive edits - for example adding or moving a vertex
- Undoing or redoing edits - using
undo()
orredo()
.
- Returns null while
- Returns:
- the value of the
geometry
property - Since:
- 200.1.0
- See Also:
-
startedProperty
True if an editing session is active, false otherwise.When true, interactions with the view can affect the state of the
geometryProperty()
orselectedElementProperty()
.- Returns:
- the
started
property - Since:
- 200.1.0
- See Also:
-
isStarted
public boolean isStarted()Gets the value of thestarted
property.- Property description:
- True if an editing session is active, false otherwise.
When true, interactions with the view can affect the state of the
geometryProperty()
orselectedElementProperty()
. - Returns:
- the value of the
started
property - Since:
- 200.1.0
- See Also:
-
visibleProperty
True if the geometry is visible in the view, false otherwise.- Returns:
- the
visible
property - Since:
- 200.1.0
- See Also:
-
isVisible
public boolean isVisible()Gets the value of thevisible
property.- Property description:
- True if the geometry is visible in the view, false otherwise.
- Returns:
- the value of the
visible
property - Since:
- 200.1.0
- See Also:
-
setVisible
public void setVisible(boolean isVisible) Sets the value of thevisible
property.- Property description:
- True if the geometry is visible in the view, false otherwise.
- Parameters:
isVisible
- the value for thevisible
property- Since:
- 200.1.0
- See Also:
-
selectedElementProperty
The element that is currently selected in the GeometryEditor, or null if nothing is selected.Clicking or tapping on the different visible elements of a
geometry
in a view allows you to select and unselect them. This property returns a different type ofGeometryEditorElement
depending on what is selected - a vertex (GeometryEditorVertex
), a mid-vertex (GeometryEditorMidVertex
), a part of a polygon or polyline (GeometryEditorPart
), or the entire geometry (GeometryEditorGeometry
). You can change which selection interactions are allowed by using theInteractionConfiguration
of thetool
.You can also programmatically select specific vertices (
selectVertex(long, long)
), mid-vertices (selectMidVertex(long, long)
), parts of polygons or polylines (selectPart(long)
), or the entire geometry (selectGeometry()
). You can clear the selection usingclearSelection()
.The value of
selectedElementProperty()
changes when:- Performing programmatic selection - for example using
selectGeometry()
orselectVertex(long, long)
- Performing interactive selection - for example selecting or unselecting a
GeometryEditorElement
- The location of the selected element changes - for example moving the selected element programmatically or interactively
- Performing edits - for example inserting a vertex interactively or deleting the selected element programmatically
- Returns:
- the
selectedElement
property - Since:
- 200.1.0
- See Also:
- Performing programmatic selection - for example using
-
getSelectedElement
Gets the value of theselectedElement
property.- Property description:
- The element that is currently selected in the GeometryEditor, or null if nothing is selected.
Clicking or tapping on the different visible elements of a
geometry
in a view allows you to select and unselect them. This property returns a different type ofGeometryEditorElement
depending on what is selected - a vertex (GeometryEditorVertex
), a mid-vertex (GeometryEditorMidVertex
), a part of a polygon or polyline (GeometryEditorPart
), or the entire geometry (GeometryEditorGeometry
). You can change which selection interactions are allowed by using theInteractionConfiguration
of thetool
.You can also programmatically select specific vertices (
selectVertex(long, long)
), mid-vertices (selectMidVertex(long, long)
), parts of polygons or polylines (selectPart(long)
), or the entire geometry (selectGeometry()
). You can clear the selection usingclearSelection()
.The value of
selectedElementProperty()
changes when:- Performing programmatic selection - for example using
selectGeometry()
orselectVertex(long, long)
- Performing interactive selection - for example selecting or unselecting a
GeometryEditorElement
- The location of the selected element changes - for example moving the selected element programmatically or interactively
- Performing edits - for example inserting a vertex interactively or deleting the selected element programmatically
- Performing programmatic selection - for example using
- Returns:
- the value of the
selectedElement
property - Since:
- 200.1.0
- See Also:
-
snapSettingsProperty
Configurable options for interactive snapping.Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors. Snapping is disabled by default - see
SnapSettings
for information about setting up snapping workflows.Attempting to set the value to null will throw a NullPointerException exception.
- Returns:
- the
snapSettings
property - Since:
- 200.4.0
- See Also:
-
getSnapSettings
Gets the value of thesnapSettings
property.- Property description:
- Configurable options for interactive snapping.
Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors. Snapping is disabled by default - see
SnapSettings
for information about setting up snapping workflows.Attempting to set the value to null will throw a NullPointerException exception.
- Returns:
- the value of the
snapSettings
property - Since:
- 200.4.0
- See Also:
-
setSnapSettings
Sets the value of thesnapSettings
property.- Property description:
- Configurable options for interactive snapping.
Snapping allows you to create geometries that connect to each other and are coincident, so that interactive edits are more accurate, with fewer errors. Snapping is disabled by default - see
SnapSettings
for information about setting up snapping workflows.Attempting to set the value to null will throw a NullPointerException exception.
- Parameters:
snapSettings
- the value for thesnapSettings
property- Since:
- 200.4.0
- See Also:
-
toolProperty
The tool defining how you interact with the view to create and edit thegeometry
.The default value is a
VertexTool
with all interactive operations enabled, providing a common way of editing points, multipoints, polygons, and polylines.The tool can be replaced while a GeometryEditor is started (
isStarted()
= true), enabling a combination of tools to be used to edit a geometry.Attempting to set the value to null will throw a NullPointerException.
- Returns:
- the
tool
property - Since:
- 200.1.0
- See Also:
-
getTool
Gets the value of thetool
property.- Property description:
- The tool defining how you interact with the view to create and edit the
geometry
.The default value is a
VertexTool
with all interactive operations enabled, providing a common way of editing points, multipoints, polygons, and polylines.The tool can be replaced while a GeometryEditor is started (
isStarted()
= true), enabling a combination of tools to be used to edit a geometry.Attempting to set the value to null will throw a NullPointerException.
- Returns:
- the value of the
tool
property - Since:
- 200.1.0
- See Also:
-
setTool
Sets the value of thetool
property.- Property description:
- The tool defining how you interact with the view to create and edit the
geometry
.The default value is a
VertexTool
with all interactive operations enabled, providing a common way of editing points, multipoints, polygons, and polylines.The tool can be replaced while a GeometryEditor is started (
isStarted()
= true), enabling a combination of tools to be used to edit a geometry.Attempting to set the value to null will throw a NullPointerException.
- Parameters:
tool
- the value for thetool
property- Since:
- 200.1.0
- See Also:
-
clearGeometry
public void clearGeometry()Clears the current geometry being edited.The
GeometryType
is maintained - to edit a different type of geometry, restart the GeometryEditor with the required type.- Since:
- 200.1.0
- See Also:
-
clearSelection
public void clearSelection()Clears the current selection.This sets
selectedElementProperty()
to null. It does not change thegeometryProperty()
.- Since:
- 200.1.0
- See Also:
-
deleteSelectedElement
public void deleteSelectedElement()Deletes the selected element from the currentgeometry
.To clear the selection, but leave the state of the
geometry
unchanged, callclearSelection()
instead.- Since:
- 200.1.0
- See Also:
-
insertVertex
Creates a new vertex at the specified location and inserts it after the currently selected element, or appends the point if there is nothing selected.If the
geometry
is empty (Geometry.isEmpty()
is true), the given point is added as the initial vertex, and then selected. If nothing is selected (selectedElementProperty()
is null), the point is appended to the end of the geometry, and then selected. If theselected element
is the first vertex in a part of aMultipart
, the given point is inserted before the currently selected vertex, and then selected.If the
geometry
is a non-emptyPoint
, this method replaces the existing point with the given point and selects it.- Parameters:
point
- the location of the new vertex- Throws:
NullPointerException
- if point is null- Since:
- 200.1.0
- See Also:
-
moveSelectedElement
public void moveSelectedElement(double deltaX, double deltaY) Moves the selected element by the specified distances along the x-axis and y-axis. -
moveSelectedElement
Moves the selected element to the specified location.If
selectedElementProperty()
is aGeometryEditorVertex
, then the location of the vertex is moved to the given point. If theGeometryEditor.selectedElementProperty()
is any other type ofGeometryEditorElement
, then the center of the element is moved to the given point.- Parameters:
newPoint
- the new location for the selected element- Throws:
NullPointerException
- if newPoint is null- Since:
- 200.1.0
- See Also:
-
redo
public void redo()Redoes the last action undone on thegeometry
.- Since:
- 200.1.0
- See Also:
-
replaceGeometry
Replaces the currentgeometry
with the specified geometry.Use this method to make changes to the
geometry
that are not directly supported using other GeometryEditor methods. For example, to start a new part in aPolygon
orPolyline
geometry, get the currentgeometry
, use aMultipartBuilder
to add the required part, and then pass the updatedGeometryBuilder.toGeometry()
to this method.- Parameters:
geometry
- the new geometry to replace the current geometry. TheGeometryType
of these geometries must match.- Throws:
NullPointerException
- if geometry is null- Since:
- 200.1.0
-
rotateSelectedElement
Rotates theselectedElementProperty()
by the specified angle.The angle of rotation is used in the form of the modulo of 360 degrees; for example rotating by 540 degrees is equivalent to rotating by 180 degrees. A positive value corresponds to a counterclockwise rotation.
If the origin
Point
has a differentSpatialReference
than the associatedMapView
, the point will be reprojected before the geometry is rotated, using the default transformation.If
GeometryEditor.selectedElementProperty()
is aGeometryEditorVertex
, or aGeometryEditorGeometry
of typePoint
, and the origin parameter is null (or is at the same location as the selected element), then rotating the selected element has no effect.- Parameters:
angle
- the angle by which to rotate the selected element, counterclockwise, in degreesorigin
- the center of rotation. If null, the center of the extent of theGeometryEditor.selectedElementProperty()
is used.- Since:
- 200.2.0
- See Also:
-
scaleSelectedElement
Scales the selected element by the specified factors.If the origin
Point
has a differentSpatialReference
than the associatedMapView
, the point will be reprojected before the geometry is rotated, using the default transformation.Positive scale factors greater than 1 increase the size of the
geometryProperty()
, and positive factors between 0 and 1 reduce the size of the geometry. Negative scale factors produce a geometry reflected across the axes of the origin point. Negative factors less than -1 both reflect and increase the size of the geometry, and negative factors between -1 and 0 both reflect and reduce the size of the geometry.- Parameters:
scaleX
- the scale factor along the x-axis. It can be positive or negative. It cannot be 0, or a non-numeric value.scaleY
- the scale factor along the y-axis. It can be positive or negative. It cannot be 0, or a non-numeric value.origin
- the point relative to which the geometry will be scaled. If null, orGeometry.isEmpty()
is true, the center of the extent of theselectedElementProperty()
is used.- Since:
- 200.2.0
- See Also:
-
selectGeometry
public void selectGeometry()Selects the entiregeometry
.When the entire geometry is selected it can be edited interactively and programmatically. For example you can move the entire geometry interactively by dragging, or call
moveSelectedElement(Point)
ormoveSelectedElement(double, double)
to move it programmatically.When the entire geometry is selected, the
GeometryEditorGeometry
returned from theselectedElementProperty()
has a geometry equal togeometryProperty()
. If thegeometry
is aPoint
, then aGeometryEditorVertex
is returned from theselectedElementProperty()
instead, which is equivalent to the entire geometry and provides immediate access to the x,y coordinates of the selected point geometry.- Since:
- 200.1.0
- See Also:
-
selectMidVertex
public void selectMidVertex(long partIndex, long segmentIndex) Selects the mid-vertex with the specified indices.Mid-vertices do not exist in the
geometry
. They exist only in the display to serve as a visual cue that new vertices can be inserted between existing vertices. Since they do not exist in the geometry, mid-vertices cannot be programmatically moved or deleted. They can be used to insert a new vertex interactively.When a mid-vertex is selected, a
GeometryEditorMidVertex
is returned from theselectedElementProperty()
.- Parameters:
partIndex
- the index of the part in the geometry editor'sMultipart
geometry that contains the mid-vertex to be selected. Use a value of 0 for non-multipart geometry types -Point
andMultipoint
.segmentIndex
- the index of segment that the mid-vertex to be selected lies on, within the given part of the geometry editor'sMultipart
geometry, or within theMultipoint
geometry. Use a value of 0 forPoint
geometries.- Since:
- 200.1.0
- See Also:
-
selectPart
public void selectPart(long partIndex) Selects the part with the specified index.When a part of a polygon or polyline geometry is selected, a
GeometryEditorPart
is returned from theselectedElementProperty()
. If the polygon or polyline has only onepart
, then aGeometryEditorGeometry
with a shape equivalent to the entire geometry is returned as theselected element
instead, which provides immediate access to the extent (Geometry.getExtent()
) and can be directly used in other geometry operations. If the currentgeometry
is aPoint
orMultipoint
, the entire geometry is selected.When a part of a
Polygon
orPolyline
(Multipart
) geometry is selected it can be edited separately from the other parts of the geometry. For example, you can move only the selected part interactively by dragging, or callmoveSelectedElement(Point)
ormoveSelectedElement(double, double)
to move only the selected part programmatically.- Parameters:
partIndex
- the index of the part in the geometry editor'sMultipart
geometry to be selected. Use a value of 0 forMultipoint
geometries.- Since:
- 200.1.0
- See Also:
-
selectVertex
public void selectVertex(long partIndex, long vertexIndex) Selects the vertex with the specified indices.When a vertex is selected it can be edited while all other vertices of the geometry are unchanged. For example, you can move only the selected vertex interactively by dragging, or call
moveSelectedElement(Point)
ormoveSelectedElement(double, double)
to move the selected vertex programmatically.When a vertex is selected, the
selectedElementProperty()
is aGeometryEditorVertex
.- Parameters:
partIndex
- the index of the part that contains the vertex (point) to be selected, within the geometry editor'sMultipart
geometry. Use a value of 0 forPoint
andMultipoint
(non-multipart geometries).vertexIndex
- the index of the vertex (point) to be selected, within the given part of the geometry editor'sMultipart
geometry, or within theMultipoint
geometry. Use a value of 0 forPoint
geometries.- Since:
- 200.1.0
- See Also:
-
start
Starts a geometry editing session based on the specified geometry.Use this method for data editing workflows, where you have an existing
Geometry
to be updated. After calling this method, the geometry is drawn in the map view, and interactions with the map view will select and edit the geometry, depending on the currenttoolProperty()
and itsInteractionConfiguration
.When the
SpatialReference
of the initial geometry differs from that of the map view, the display will project the geometry to theSpatialReference
of the map view, using the defaultDatumTransformation
, for display and user interactions. Editing feature data that is reprojected on the fly can introduce spatial errors into data. When accuracy is important, best practice is to use a spatial reference for the map view which matches the feature layer geometry you are editing. The ArcGIS Pro editing help topic Introduction to projection on the fly contains further advice.- Parameters:
initialGeometry
- the initialgeometry
to start the editing session with.- Throws:
NullPointerException
- if initialGeometry is null- Since:
- 200.1.0
-
start
Starts a geometry editing session with an empty geometry of the specifiedGeometryType
.Use this method for data creation workflows, where you know the
GeometryType
required but do not have an existing geometry to edit. After calling this method, nothing is drawn on the map view initially - user interactions on the map view will define and edit the geometry, depending on the currenttoolProperty()
.GeometryEditor can be used to create
Point
,Multipoint
,Polygon
, andPolyline
geometries - howeverFreehandTool
, andShapeTool
are suitable for creatingPolygon
, andPolyline
geometries only.The new geometry will have the
SpatialReference
of the map view. You can useGeometryEngine.project(Geometry, SpatialReference)
orGeometryEngine.project(Geometry, SpatialReference, DatumTransformation)
to project the final resultgeometryProperty()
to a different spatial reference if required, for example when editing feature geometry. When accuracy is important, best practice is to use a spatial reference for the map view which matches the feature layer geometry you are creating. The ArcGIS Pro editing help topic Introduction to projection on the fly contains further advice.- Parameters:
geometryType
- thetype
of geometry to edit, must be one of:GeometryType.MULTIPOINT
,GeometryType.POINT
,GeometryType.POLYGON
orGeometryType.POLYLINE
.- Throws:
NullPointerException
- if geometryType is null- Since:
- 200.1.0
-
stop
Stops the editing session by making the GeometryEditor no longer respond to user interaction and clears thegeometry
.- Returns:
- the final geometry before it is cleared. Null if the geometry editor is not started. Returns null if none.
- Since:
- 200.1.0
- See Also:
-
undo
public void undo()Undoes the last action on thegeometry
.- Since:
- 200.1.0
- See Also:
-