The ArcGIS Runtime for Qt team is excited to announce the SketchEditor API is included within the release of Runtime 100.12! This new API is a powerful yet simple to implement way to create or edit geometries interactively on a map.
The SketchEditor supports a wide array of use cases, and is especially useful when creating quick notes on a map. It can be used in a data collection workflow where a user needs to make use of points, lines, and polygons, such as asset inventory. Similarly, a field worker can create lines and polygons to digitize/delineate wetland areas from aerial imagery as a part of a ground truthing workflow. These created and edited geometries can be backed by a feature service so you can save your edits. You can also draw graphics on the screen to perform various GeometryEngine spatial analyses.
You can add a SketchEditor to your app simply by adding the class/component to an existing MapView and calling start with the desired geometry type or an existing geometry. The user can then tap or click on the map to create vertices, tap existing ones to move them, or (when working with lines or polygons) create new vertices between existing ones. The SketchEditor also supports undo and redo functions to remedy any misclicks. When finished drawing, save the sketch’s geometry and call stop on the SketchEditor and that’s it!
C++
m_sketchEditor = new SketchEditor(this);
m_mapView->setSketchEditor(m_sketchEditor);
m_sketchEditor->start(SketchCreationMode::Polygon);
// user sketches a geometry
Geometry sketchGeometry = m_sketchEditor->geometry();
m_sketchEditor->stop();
QML:
MapView {
id: mapView
SketchEditor {
id: sketchEditor
}
}
Button {
id: polygonStartButton
onClicked: sketchEditor.startWithCreationMode(Enums.SketchCreationModePolygon);
}
Button {
id: stopButton
onClicked: {
geometry = sketchEditor.geometry; // assume geometry is already defined
sketchEditor.stop();
}
}
We're planning updates that will include a freehand draw style that will allow users to place vertices along a continuous path by pressing and holding to draw a line or polygon. Additionally, we plan to add SketchEditor support for the true curves API released in 100.12 (see the CubicBezierSegment API ref here: [C++/QML]).
To try out the SketchEditor for yourself, be sure to check out our newly released sample viewers for Runtime 100.12!
We’re excited to get this into our users’ hands and see how you use this. If you have ideas for how you’ll incorporate this into your own applications, let us know in the comments!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.