Documentation | Other Specifications | Vector editing
Vector editing features enable a user to create new or modify existing shape geometry using visual tools or coding. Both options are controlled by the TGIS_Editor class , which is responsible for the basic editing functionality. Editing features include:
The features discussed in this article are found in the TGIS_Editor class and in the desktop TatukGIS Editor application.
Editing is closely coupled with the TGIS_Viewer class, responsible for the visual presentation and controlling the editing interaction. Upon activating edit mode in the viewer and selecting a shape for editing, the renderer draws the selected shape using special styling.
During the editing process, the vertices (i.e., points) forming the edited shape are styled using:
Each vertex composing a shape is assigned a number which can be displayed. The Z coordinate values for vertices forming a 3D shape can also be displayed.
The Editor class has many interesting properties that change the visual presentation and behavior during the editing process:
The editing mode determines how new vertices are created relative to existing vertices forming the shape part:
The following properties enable changing the predefined editor styling, such as the presentation colours of lines or points:
For accurate editing vector layer geometries, the snapping feature enables the placement of vertices to the exact locations of already existing vertices, line segments, polygon edges, intersections, or other geometric features, by holding the cursor (or finger or pointer when using a tablet computer) within a distance tolerance to the snap-to feature. The geometry that is snapped to may exist in the layer being edited or in a different layer (or layers), normally positioned below the editing layer. The snap-to layer can contain any geometry (e.g., polygons, lines, points, multi-points), and snapping can simultaneously use multiple snap-to layers. As an example, a user might edit a polygon layer by snapping to polygon features in one snap-to layer and also point or line features in a second snap-to layer.
To use snapping, the user must select one or more snap-to layers, a snap-type mode, and a distance tolerance. The following properties control snapping behavior during the editing process:
When snapping is active, the vertices active for editing, and the snapping points are presented as yellow dots:
The SnapType property additionally tells the editor how to calculate the search for a snap-to point:
The following images illustrate different snapping types:
The snap-to layers are managed the following Editor functionality:
The ShowTracking property presents the tracking path when using the mouse cursor to drag an active point to a new position. A small red rectangle highlights each eligible snap-to location. Depending on the SnapType property, snap-to positions can be vertices, line segment or polygon edge midpoints, shape intersections, etc.
When tracking is enabled, the user can customize the rendering of eligible snap-to locations by:
The Editor class also exposes events for notifying and custom controlling the editing operation before the result is committed to memory, such as:
Shape editing can also be performed using code. The CreateShape method is called to create a new shape. The EditShape method is called to modify an existing shape. After the shape is loaded into the editor, operations can be executed by adding a new vertex, adding a part, or modifying existing vertices. When done with editing a shape, the EndEdit method must be called to finalize the process by committing the editing changes to memory.
The SimpleEdit sample offers additional guidance on using the Editor API.