Commit Graph

29 Commits

Author SHA1 Message Date
Éric Lemoine
b8a0112a91 Merge pull request #930 from elemoine/externs
Use @exportSymbol instead of @exportClass|Function
2013-12-12 23:40:44 -08:00
ahocevar
c4ec53bbdb Unnest loops
Reusing the iterator in a nested loop is not a good idea. And in
this case it is better to not have nested loops at all, because
we only have to create one array.
2013-12-12 17:57:14 +01:00
Éric Lemoine
315c42f0a7 Use olx namespace for options types in source code
sed command used: find src/ol -name '*.js' -exec sed -ri 's/\{ol(\.(\w|\.)+Options\=?\})/{olx\1/' \{\} \;
2013-12-12 15:02:03 +01:00
ahocevar
211e288f33 Remove original handling on ol.Feature
This is another attempt to bring master closer to the
vector-api branch. In anticipation of the ability to keep track
of modifications on ol.Object through a beforechange event
(d7e4be0), we will be able to manage originals on the
application level or in a separate component outside of
ol.Feature.
2013-12-09 18:33:34 +01:00
ahocevar
8d55e14986 Safeguard against the case where no features are modifiable 2013-12-09 13:25:14 +01:00
Tim Schaub
8cc4ae8dbd Separate load requests from feature requests
This separates the action of requesting an extent to be loaded from the action of requesting cached features.  The renderer (or any other consumer of a vector source) calls load to request a data extent.  A `featureload` event fires when new features are loaded.  The renderer (or any other consumer) separately asks for cached features given an extent.  This vector source only loads features once, but this separation will also work with sources that make multiple requests for data in different extents.

This also removes the `data` option from the vector source in favor of a `features` option.  Since we no longer have shared data structures for geometries, people can manually create features and pass them to a vector source.  The `addFeatures` method is exported as well.  This is used to add features to a source that don't have a representation on the "remote" (or server).
2013-11-27 12:22:32 -07:00
Tim Schaub
ec02e09ce8 Move render intent enum to feature 2013-11-27 12:22:32 -07:00
Tim Schaub
2000b0af78 Vector layer/source refactor
This moves the feature cache from ol.layer.Vector to ol.source.Vector.  These are the minimum changes required to maintain the existing functionality and make tests pass.  More refactoring to come.
2013-11-27 12:20:42 -07:00
Tom Payne
c00d748384 Update ol.interaction.Modify to use ol.structs.RTree#getAllInExtent 2013-11-27 15:11:42 +01:00
ahocevar
137f797bee Use ol.structs.RBush in ol.interaction.Modify
This is one more step to bring the master and vector-api
branches closer together. I am well aware that the current
Modify interaction will probably be rewritten as part of the
vector-api effort, but with changes like this we will eventually
be able to remove ol.structs.RTree from master.
2013-11-27 14:48:06 +01:00
ahocevar
cf5e9ecd4f Segment distance calculation fails when modifying points
By providing a segment even for points, we have less distinction
points between points and other geometry types, and are able to
do the segment distance calculation also for points.
2013-11-23 11:49:42 +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