I have a few queries and would appreciate your guidance:
Overview:
I'm using the Geometry Editor to draw polygons and polylines for waypoints, which is working as expected. Additionally, I can draw circles and rectangles, as demonstrated in the sample application. However, I’m exploring an alternative workflow specifically for drawing rectangles and circles.
case ArcgisMapEnums::Drawings::rectangle:
{
m_geometryEditor->setTool(m_rectangleTool);
m_geometryEditor->start(GeometryType::Polygon);
}
break;
case ArcgisMapEnums::Drawings::circle:
{
m_geometryEditor->setTool(m_ellipseTool);
m_geometryEditor->start(GeometryType::Polygon);
}
break;
Circle and Rectangle Drawing Enhancement
Currently, to draw a circle, I need to click and drag the mouse, which defines the bounding area. Instead, I would like to implement a more precise workflow where:
The same logic should apply to rectangles:
Unified Drawing and Replay Structure
I am also looking for guidance on the structure of my drawing logic. Currently, I am saving all drawn features—such as circles, rectangles, and polygons—into a storage format (e.g., JSON or a custom format). When the user clicks a "Load" button, I want all the drawings to be rendered exactly as they were created, but without requiring user interaction.
After loading, users should be able to edit or delete the shapes just as they would if they had drawn them manually.
Solved! Go to Solution.
The drawn shape must always be a perfect circle (equal radius in all directions), not an oval or something else.
For this part of your question, you can set the tool's scale mode to Uniform, similar to this:
m_ellipse_tool.Configuration.ScaleMode = GeometryEditorScaleMode.Uniform
I'm not sure on the circle/rectangle question. The interaction is baked in for press->drag->release, without any real programmatic hooks exposed, so no ideas are jumping out immediately. I will need to chat with the team to see if there are any potential workarounds, or if we need an enhancement request for it.
As for saving, there are probably a number of ways to do it. Are you looking to save just the geometries, or the rendering and attribute information as well? The solution could be as simple as outputting the geometry JSON for each geometry you create, and then iterating through this and displaying graphics for each. You could also look at using feature collections, which allow for adhoc data creation, similar to graphics, but are persistable. For that, maybe you could take inspiration from this "markup layer" which we implemented in an example app. This layer subclassed feature collection layer and read json data, applied symbology overrides, etc https://github.com/Esri/dynamic-situational-awareness-qt/blob/main/Shared/markup/MarkupLayer.h
You can also create mobile geodatabases in the native SDKs. That might be a bit more than you need, but you can create a new feature table, add it to your geodatabase, and add features with your geometries to your table https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-geodatabase.html#createAsync
Hi swe,
for replaying the edits, it sounds like you want to show each step the user took, rather than just start the GeometryEditor with the geometry from json, like this:
geometry = Geometry.fromJSON(String, SpatialReference)
GeometryEditor.start(geometry)
The drawn shape must always be a perfect circle (equal radius in all directions), not an oval or something else.
For this part of your question, you can set the tool's scale mode to Uniform, similar to this:
m_ellipse_tool.Configuration.ScaleMode = GeometryEditorScaleMode.Uniform