Commit Graph

3137 Commits

Author SHA1 Message Date
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
Tim Schaub
05b9922861 Tests for draw interaction
The tests revealed that polygons can be drawn with counter-clockwise exterior ring order.  In the polygon constructor, we enforce clockwise winding for exterior rings.  So after drawing, we pass polygon coordinates back to the constructor before adding feature to the target layer.
2013-11-12 16:06:42 -07:00
Tim Schaub
5a898884ec Use geometry type enum for configuring draw interaction
This allows us to cast single-part geometries to multi-part types before adding features to the target layer.  This doesn't yet allow for drawing multi-part geometries with multiple parts.  That can be handled separately.
2013-11-12 11:51:41 -07:00
Tim Schaub
8194ba9f0a Remove setMode method from interaction in favor of add/removeInteraction
This makes the example a bit more awkward, but eventually adding and removing interactions will be the job of an editing control.
2013-11-12 10:30:37 -07:00
Tim Schaub
62b44f3c73 Add click tolerance to allow dragging while drawing 2013-11-12 10:30:37 -07:00
Tim Schaub
e3faa76770 Add method to abort drawing 2013-11-12 10:30:37 -07:00
Tim Schaub
4e98e86b14 Stop dblclick propagation while editing 2013-11-12 10:30:37 -07:00
Tim Schaub
048dec1644 Updated sketch style 2013-11-12 10:30:36 -07:00
Tim Schaub
7c197252ed Ensure drawing is not finished prematurely 2013-11-12 10:30:36 -07:00
Tim Schaub
45ba000df5 Pop off last point from linestring 2013-11-12 10:30:36 -07:00
Tim Schaub
b5cc35ee04 Snap to finish with configurable tolerance 2013-11-12 10:30:32 -07:00
Tim Schaub
ea6500ecd0 Finish lines by clicking last point 2013-11-12 10:29:29 -07:00
Tim Schaub
d821f227ba Add point at head of drawing 2013-11-12 10:29:29 -07:00
Tim Schaub
b3487ad30e Draw interaction 2013-11-12 10:29:21 -07:00
ahocevar
076f1ac194 Merge pull request #1265 from ahocevar/set-style
Allow to set the layer style
2013-11-12 09:15:08 -08:00
ahocevar
16ef1c5b8a Merge pull request #1267 from ahocevar/geom-clone
Deep clone geometry coordinates
2013-11-12 09:08:33 -08:00
Frederic Junod
ca5960666d Be more strict with {Element} types 2013-11-12 13:53:37 +01:00
Frédéric Junod
1560fbace3 Merge pull request #1266 from fredj/input_checked
Set boolean value to HTMLInputElement.checked
2013-11-12 04:51:53 -08:00
ahocevar
ed09173730 Deep clone geometry coordinates
Our geometries are mutable, so they can be modified without
creating garbage by changing coordinates in place and calling
setGeometry afterwards. But this also means that we need to
create a deep clone of the coordinates.
2013-11-12 11:36:40 +01:00
Frederic Junod
7613eaeef1 Export ol.proj.Projection#getCode 2013-11-12 11:17:03 +01:00
Frederic Junod
d3be7d9d18 Set boolean value to HTMLInputElement.checked
See http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#attr-input-checked
2013-11-12 10:24:36 +01:00
ahocevar
1d23229d98 Allow to set the layer style
By firing a simple CHANGE event, we can redraw the layer when
a style is assigned.
2013-11-12 01:47:43 +01:00
Tim Schaub
61741669f6 Unregister for feature events when removing features 2013-11-11 16:17:33 -07:00
ahocevar
382b2707df Merge pull request #1256 from ahocevar/simplify-select
Simplify Select interaction and prepare for programmatic feature selection without interaction
2013-11-11 13:19:57 -08:00
ahocevar
0ed208b710 Make renderIntent private and add a getter 2013-11-11 22:07:18 +01:00
ahocevar
299d729936 Make filter optional 2013-11-11 21:52:19 +01:00
ahocevar
467bcc8b62 Protect from features without geometry 2013-11-11 21:51:58 +01:00
Tim Schaub
85500fb616 Merge pull request #1252 from tschaub/expose-down
Add a getter for the most recent down event.
2013-11-11 11:27:19 -08:00
Bart van den Eijnden
3f7c40b1ad add an example of how to use a WKT string in a vector source 2013-11-11 12:45:06 +01:00
Éric Lemoine
fdad53c619 Merge pull request #1231 from oterral/mouse_events
Fix touch events on IE10
2013-11-10 02:44:12 -08:00
ahocevar
03e20ce6f1 Do not fail on non-vector layers 2013-11-09 16:12:13 +01:00
ahocevar
26c8c954c3 Make selectedFeaturesFilter available to other components 2013-11-09 16:03:30 +01:00
ahocevar
97d38820fb Removing no longer used getFeatureWithUid method 2013-11-09 14:44:40 +01:00
ahocevar
d9fd459654 Do not use a temporary layer for selected features 2013-11-09 14:15:35 +01:00
ahocevar
9fca2c407d Add a getFeatures method on the vector layer 2013-11-09 14:15:35 +01:00
ahocevar
7cf636147b Call setRenderIntent on the feature, not the layer 2013-11-09 14:15:35 +01:00
Olivier Terral
67d3b4527a Modify comments 2013-11-08 17:15:58 +01:00
Olivier Terral
726a04ce3e Forbid right click to trigger singleclick events on IE10 2013-11-08 13:30:58 +01:00
Olivier Terral
d0b0d0470b Fix singleclick and doubleclick on windows Surface 2013-11-08 13:30:58 +01:00
Tim Schaub
009f7b53a1 Make interactions event targets 2013-11-07 16:39:05 -07:00
Frédéric Junod
7fb7a472b7 Merge pull request #1249 from fredj/apidoc_function
More precise {function} jsdoc definition
2013-11-07 13:22:30 -08:00
Tim Schaub
22fb418236 Provide a method to get the most recent down type event
This will allow interactions to conditionally handle later events based on the down event.
2013-11-07 11:21:01 -07:00
Tim Schaub
812cb7fb12 Leave the down_ event set
The other "up" type listeners (for touch and pointer) do not set this to null.  This event can be of use to a click listener that might want to compare the down position to the click event's position.
2013-11-07 11:02:04 -07:00