Commit Graph

40 Commits

Author SHA1 Message Date
ahocevar
ecddcdd732 Add support for editing interior polygon rings 2014-03-13 01:02:15 +01:00
Andreas Hocevar
1fbdf47e2a Merge pull request #1807 from ahocevar/float-no-zero
Modify interaction sometimes does not allow to create a new vertex
2014-03-13 00:51:43 +01:00
ahocevar
62034e8fb9 Only update the index for the current component 2014-03-12 13:02:52 +01:00
ahocevar
bc79b89c5e Limit shared segment editing
To avoid surprises, we enable shared segment editing only on
segments that have the same vertex coordinates.
2014-03-07 10:52:50 +01:00
ahocevar
42935408fb Keep track of intersecting segments
Because we have nodes sorted by segment distance from the
editing vertex in #handleMouseAtPixel(), it is cheap to create a
hash of intersecting segments there. Now in #handleDragStart(),
we do not need to measure the distance of the vertex to the
segment. Instead, we just test if the segment is in the hash.
2014-03-07 10:52:49 +01:00
Tom Payne
e5ee44f8ad Rename ol.structs.RBush#getAllInExtent to getInExtent 2014-03-06 14:30:56 +01:00
Antoine Abt
ec832bdf6e Modify interaction takes style & features options
Instead of a FeatureOverlay
2014-02-21 12:35:30 +01:00
Éric Lemoine
db83b11eee Modify interaction doesn't need to store styles 2014-02-16 16:15:11 +01:00
Antoine Abt
f8a748d7f4 Fix MultiPoint modify 2014-02-12 15:26:57 +01:00
Antoine Abt
56a1f053ff Check geometry type instead of instanceof 2014-02-12 15:25:47 +01:00
Antoine Abt
03624b5f78 Check segment writers existence 2014-02-11 14:36:54 +01:00
Antoine Abt
f9b6eabfef %s/render.FeaturesOverlay/FeatureOverlay/ 2014-02-10 11:26:14 +01:00
Antoine Abt
0272659118 Remove useless style method 2014-02-10 11:26:14 +01:00
Antoine Abt
72675bf6ad Make interaction ctor only have an option object 2014-02-10 11:26:13 +01:00
Antoine Abt
5325af26d6 Store mouse last position to draw vertex at feature selection 2014-02-10 11:26:13 +01:00
Antoine Abt
e64766f01f Add support for GeometryCollection in modify interaction 2014-02-10 11:26:13 +01:00
Antoine Abt
a60203f931 Move segment writers in their own methods 2014-02-10 11:26:13 +01:00
Antoine Abt
933ef64db1 Force remove vertexFeature when there’s no features left in FeaturesOverlay 2014-02-07 14:52:59 +01:00
Antoine Abt
fb637aedca Move variables declaration at the top 2014-02-07 14:52:59 +01:00
Antoine Abt
a1d20182fe Make modify interaction use FeaturesOverlay
Instead of a whole map.
2014-02-07 14:52:58 +01:00
oterral
3155d681be Add modify feature interaction and its example 2014-02-07 14:52:57 +01:00
Tom Payne
4e65fefc00 Move vector code out of the way 2013-11-20 11:39:21 +01:00
Tim Schaub
15b73ca87e Merge pull request #1293 from tschaub/event-element
Correctly handle layer add/remove in modify interaction.
2013-11-19 09:53:25 -08:00
Tim Schaub
3fbbdb78d5 Call getElement to get layer 2013-11-19 09:52:27 -07:00
ahocevar
936f86568e Merge pull request #1284 from ahocevar/null-vertexfeature
Protect from null vertexFeature
2013-11-18 12:23:00 -08:00
ahocevar
aa5358203e Protect from null vertexFeature
When dragging the map before a vertexFeature was created, it can
be null, so we cannot get its renderIntent.
2013-11-18 10:43:37 +01:00
Tim Schaub
b0362b8c0a Only set interacting hint when modifying the view 2013-11-14 14:21:01 -07:00
ahocevar
f790992a77 Make addLayer and removeLayer methods private 2013-11-13 00:44:39 +01:00
ahocevar
b805a76ae1 layerFilter can no longer be undefined here 2013-11-13 00:44:39 +01:00
ahocevar
4e85322abb Minor stylistic clean-ups and more symmetry 2013-11-13 00:44:38 +01:00
ahocevar
39a5a8e291 Refactoring for better layer management
The only feature on the temporary layer is now the
vertexFeature, and the temporary layer's style is dynamically
changed to the style of the layer whose segment is being edited
(the topmost layer if more than one segment are being edited).
With this simplification, we can also put all segments on a
single RTree. Finally, we no longer rely on structures set on
layers - all we need is now on the instance itself.

This refactoring also changes the way we define layers to
participate in modification - by using an array or a filter
function, or assuming all layers if no layers property is set.
2013-11-13 00:44:38 +01:00
ahocevar
319f78fb94 Using new squaredDistanceToSegment and closestOnSegment 2013-11-13 00:44:37 +01:00
ahocevar
0e673a492a Use accessor for components 2013-11-13 00:44:37 +01:00
ahocevar
c669dda2b1 Do not create a vertexFeature with [NaN, NaN] coordinates
The RTree cannot work with NaN coordinates. So instead of
preparing a vertexFeature before we know a coordinate, we now
lazily create the vertexFeature.
2013-11-13 00:44:37 +01:00
ahocevar
498738d22a Parent information no longer needed
Now that we can do setCoordinates, we no longer need to create
new geometries and assign them to a parent.
2013-11-13 00:44:37 +01:00
ahocevar
1c3b839a6f Use new setCoordinates methods 2013-11-13 00:44:36 +01:00
ahocevar
fec638e8be Write modifications back to the original layer
With the feature's getOriginal() and setOriginal() methods, an
undo tree can be maintained now.
2013-11-13 00:44:36 +01:00
ahocevar
a3b18bf16e Do not split segments while in the loop
In combination with the additional squaredDistanceToSegment
check we can ensure that a future vertex is only created on one
segment per feature, and only on the segment that it appears on.

This change also renames the misleading dragVertices_ member to
dragSegments_.
2013-11-13 00:44:36 +01:00
ahocevar
ff17eb53d4 Separate add listener from method that adds index 2013-11-13 00:44:36 +01:00
ahocevar
292b851a74 Adding ModifyFeature interaction
This is a first draft. The way geometry changes are handled for
now is a bit clumsy. Both updating the feature cache RTree and
making the layer aware of feature and geometry changes could be
handled in a smarter way if these changes would be made through
the layer instead of directly on the geometry or feature.
2013-11-13 00:44:36 +01:00