Skip to content

Rfc3: Snapping while editting

Mark Prins edited this page Jun 23, 2015 · 4 revisions

A snapping control was added in PR 343

Overview

While editting a feature (creating a new one, of editing an existing feature) it is sometimes hard to place the vertices at the correct location. This proposal describes a possible aid to this problem. This problem can be augmented when there are supporting features, to which the current vertex can be snapped. There supporting features come from a attributesource ("Attribuutbron"). Each featuretype which can be edited, can have one or more supporting attribute sources. This can be configured at the configuration page of the edit component. An example from the OpenLayers page: http://dev.openlayers.org/releases/OpenLayers-2.12/examples/snapping.html

Functional changes

In the edit tool it will be possible to snap the current vertex to a supporting layer. This layer will consist of one or more attribute sources. The visualization of the supporting layer will be very basic: a color for points, lines and polygon will be configurable. At last the supporting layer will be active from a certain zoomlevel. This is to prevent too much features in the map, which can cause the browser to work slower (or even crash). The supporting features which will be retrieved are the only ones which are in the current extent. On each extentchange the features will be retrieved and added. The number of features will be limited to 5000 features at maximum (which will be enough to make the browser very slow), but this can be influenced by setting the zoomlevel from which the features will be obtained. Perhaps it's necessary to configure the maximum number of features.

Technical changes

The changes needed for the completion of this functionality are described here.

Affected modules

The modules which are affected by these changes are split in the viewer and viewer-admin

Viewer

In the viewer, the edit tool will be expanded to support a snap tool. This is already available for openlayers, but not for flamingo. Because the performance of flash is very low with regards to drawing vectors, this functionality will not be implemented in the flash motor. Furthermore, the viewer must get some functionality to retrieve features from one or multiple layers when entering the correct zoomlevels.

This snapping tool will be abstracted in a separate component to maintain maximum flexibility and maintainability. This makes it possible to extend this functionality to other components (for example, the cyclorama component getting a "google streetview" like snapping grid). This snap-component will work together with the VectorLayer, which is already available and abstracted for flash and openlayers. The snapping functionality will not be implemented in Flash, but this approach will not make this impossible. Also, this makes it easier when other motors will be supported.

Viewer-admin

The viewer-admin will remain largely untouched. Only the edit-component configuration page will get some extra options. Each layer will get a multi select combobox to select the supporting attributesources. Also, the snapping tool will be configured there: the colors of the vectorlayer, the minimum zoomlevel and perhaps the maximum number of features will be configured here.

Backwards compatibility

We foresee no incompatibility with older version. All the old configurations will be kept and remain functional.

Reference to code

Voting history

Clone this wiki locally