Compare commits

...

228 Commits

Author SHA1 Message Date
Tim Schaub
2b5d6536ca Merge pull request #6710 from openlayers/release-v4.1.0
Release v4.1.0
2017-04-13 21:03:38 -06:00
Tim Schaub
8116d8c11f Update package versions to 4.1.0 2017-04-13 20:51:02 -06:00
Tim Schaub
04a1871ae3 Changelog for v4.1.0 2017-04-13 20:50:05 -06:00
Tim Schaub
41ebe62852 Merge pull request #6675 from tchandelle/translate-cursor
Reset cursor when translate interaction is removed or deactivated
2017-04-13 20:25:20 -06:00
Tim Schaub
51da8ed830 Merge pull request #6707 from tschaub/errors-url
Set version when building ol package
2017-04-13 20:24:36 -06:00
Frédéric Junod
515de3f6ad Merge pull request #6706 from fredj/cluster_getDistance
Add ol.source.Cluster#getDistance function
2017-04-13 15:09:36 +02:00
Tim Schaub
6604172c1c Throw a byte-saving AssertionError 2017-04-13 06:37:42 -06:00
Tim Schaub
4a9114cd4e Set ol.VERSION when creating ol package 2017-04-13 06:32:42 -06:00
Tim Schaub
525fba6405 Assume latest if no ol.VERSION 2017-04-13 06:32:42 -06:00
Tim Schaub
dff5cc63e7 Merge pull request #6695 from tschaub/unique-layers
Unique layers
2017-04-13 06:31:12 -06:00
Tim Schaub
3b83f666c1 Add notes about new duplicate layer behavior 2017-04-13 05:46:46 -06:00
Tim Schaub
9c8a3ba688 Test that resetting via collection.setAt() works 2017-04-13 05:38:49 -06:00
Tim Schaub
64b3302883 Require that map layers are unique 2017-04-13 05:38:49 -06:00
Tim Schaub
d28f50465b Support for unique collections 2017-04-13 05:38:49 -06:00
Frederic Junod
de057ac505 Add ol.source.Cluster#getDistance function 2017-04-13 11:27:21 +02:00
Marc Jansen
8b0e1b638b Merge pull request #6704 from openlayers/include-typedefs
Include typedefs.js in closure compiler tutorial build configurations
2017-04-13 08:27:19 +02:00
Marc Jansen
65103d5bd0 Include typedefs.js in example configurations 2017-04-13 07:51:34 +02:00
Andreas Hocevar
5d038d9d9b Merge pull request #6702 from openlayers/greenkeeper/clean-css-cli-4.0.12
Update clean-css-cli to the latest version 🚀
2017-04-12 22:30:38 +02:00
greenkeeper[bot]
45e8f7d0c9 chore(package): update clean-css-cli to version 4.0.12
https://greenkeeper.io/
2017-04-12 19:14:35 +00:00
Frédéric Junod
2b6e71ff46 Merge pull request #6693 from openlayers/greenkeeper/clean-css-cli-4.0.11
Update clean-css-cli to the latest version 🚀
2017-04-12 08:25:23 +02:00
Frédéric Junod
f206fab268 Merge pull request #6691 from fredj/cleanup
Move eslint globals to to test/.eslintrc
2017-04-12 08:25:01 +02:00
greenkeeper[bot]
4d30781673 chore(package): update clean-css-cli to version 4.0.11
https://greenkeeper.io/
2017-04-11 19:04:36 +00:00
Frédéric Junod
5b162ce2b9 Merge pull request #6689 from fredj/constrainResolution
Add new constrainResolution option to olx.interaction.DefaultsOptions
2017-04-11 13:53:33 +02:00
Andreas Hocevar
f12e0e3ed6 Merge pull request #6692 from ahocevar/scroll-gesture-docs
Improve docs for MouseWheelZoom constrainResolution
2017-04-11 13:50:39 +02:00
Andreas Hocevar
8a0e7439a7 Improve docs for MouseWheelZoom constrainResolution 2017-04-11 13:28:18 +02:00
Frederic Junod
15e6fa454d Add new constrainResolution option to olx.interaction.DefaultsOptions 2017-04-11 13:27:11 +02:00
Frederic Junod
72bb310386 Move eslint globals to to test/.eslintrc 2017-04-11 12:36:39 +02:00
Andreas Hocevar
55f8a2775e Merge pull request #6687 from tchandelle/extent-clip
Clip image only if the layer extent intersects the view extent
2017-04-11 10:07:39 +02:00
Thomas Chandelle
051d5651a5 Complete previous cursor tests
"respects existing cursor value" wasn't actually testing anything
2017-04-11 09:15:02 +02:00
Thomas Chandelle
5c23123b6d Reset cursor when translate interaction is removed or deactivated 2017-04-11 09:15:02 +02:00
Frédéric Junod
80b51d083e Merge pull request #6686 from fredj/removeLastPoint
Update finishCoordinate in ol.interaction.Draw#removeLastPoint
2017-04-11 08:20:30 +02:00
Thomas Chandelle
b301760976 Update composeFrame test with should/shouldn't clip cases 2017-04-10 15:11:11 +02:00
Thomas Chandelle
76ddcd405d Clip image only if the layer extent intersects the view extent 2017-04-10 14:42:57 +02:00
Frederic Junod
d97d5e5164 Update finishCoordinate in ol.interaction.Draw#removeLastPoint
And don't crash if the function is called but no feature is drawn
2017-04-10 12:34:49 +02:00
Andreas Hocevar
55ace18509 Merge pull request #6682 from ahocevar/mouseweel-typedef
Add example, docs and typedef for MouseWheelZoom's constrainResolution option
2017-04-10 10:26:55 +02:00
Andreas Hocevar
cf6cd968ec Add example for constrained wheel zooming 2017-04-10 10:10:33 +02:00
Andreas Hocevar
9a230fcacf Improve documentation 2017-04-10 10:10:26 +02:00
Frédéric Junod
aaf3256279 Merge pull request #6683 from fredj/this_defaultBoxEndCondition
Add this jsdoc tag to ol.interaction.DragBox.defaultBoxEndCondition
2017-04-10 09:29:47 +02:00
Andreas Hocevar
3285c11e9c Add constrainResolution to MouseWheelZoomOptions 2017-04-10 09:23:54 +02:00
Frederic Junod
5e84d806d7 Add this jsdoc tag to ol.interaction.DragBox.defaultBoxEndCondition 2017-04-10 09:08:09 +02:00
Frédéric Junod
fc1a0c6c3d Merge pull request #6681 from fredj/constrainResolution_typedef
Add constrainResolution in olx.interaction.PinchZoomOptions typedef
2017-04-10 08:56:55 +02:00
Andreas Hocevar
07b8d97751 Merge pull request #6671 from kaiCu/master
Add constraintResolution option to MouseWheelZoom for zoom with trackpad
2017-04-10 08:47:30 +02:00
Frederic Junod
639f40cb94 Add constrainResolution in olx.interaction.PinchZoomOptions typedef 2017-04-10 08:44:21 +02:00
Frédéric Junod
a6a0b2c158 Merge pull request #6680 from fredj/rm_ol.DRAG_BOX_HYSTERESIS_PIXELS
Remove ol.DRAG_BOX_HYSTERESIS_PIXELS define and add option
2017-04-10 08:28:28 +02:00
Frederic Junod
5c6c555b62 Remove ol.DRAG_BOX_HYSTERESIS_PIXELS define and add option 2017-04-07 15:31:59 +02:00
Frederic Junod
d767f8545f Fix comment indentation 2017-04-07 15:13:42 +02:00
Frédéric Junod
e7f91cd526 Merge pull request #6666 from fredj/cleanup
Use the optional extent in ol.structs.RBush#getExtent
2017-04-05 09:53:12 +02:00
Andreas Hocevar
c1a5a44dfc Improve documentation of opt_extent 2017-04-05 09:21:01 +02:00
Frédéric Junod
f0506211e2 Merge pull request #6670 from openlayers/greenkeeper/browserify-14.3.0
fix(package): update browserify to version 14.3.0
2017-04-05 08:50:14 +02:00
greenkeeper[bot]
5ca349d0f8 fix(package): update browserify to version 14.3.0
Closes #6669

https://greenkeeper.io/
2017-04-04 23:58:59 +00:00
Kai Culemann
c1adde6a13 Add constraintResolution option to MouseWheelZoom for zoom with trackpad 2017-04-04 15:06:08 +02:00
Frederic Junod
22ed575325 Add optional destination extent in ol.source.Vector#getExtent 2017-04-04 13:55:02 +02:00
Frederic Junod
f7c392342e Use the optional extent in ol.structs.RBush#getExtent 2017-04-04 10:54:33 +02:00
Tim Schaub
350b42ad91 Merge pull request #6664 from openlayers/greenkeeper/async-2.3.0
Update async to the latest version 🚀
2017-04-02 20:38:22 -06:00
greenkeeper[bot]
c74f2a526f fix(package): update async to version 2.3.0
https://greenkeeper.io/
2017-04-02 23:03:06 +00:00
Frédéric Junod
b62c4ec4a2 Merge pull request #6659 from openlayers/icon_examples_crossOrigin
Add crossOrigin to examples using ol.style.Icon
2017-04-01 06:10:04 +02:00
Tim Schaub
d409e5ac18 Merge pull request #6658 from tschaub/raster-fix
Fixes for raster source rendering
2017-03-31 07:15:27 -06:00
Frederic Junod
a9adaf2052 Add crossOrigin to examples using ol.style.Icon 2017-03-31 13:38:28 +02:00
Bart van den Eijnden
ce088d5919 Merge pull request #6620 from Jenselme/fix-gml2-desirializer-3D
Fix the parsing of flat coordinates in GML2 for 3D geometies
2017-03-31 11:45:18 +02:00
Julien Enselme
3a5de5483c Fix the parsing of flat coordinates in GML2 for 3D geometies
The code used to rely on the dimension. However, the dimension can only
be read from a GML3 document. This caused, for 3D geometries:
- An assertion error to be raised since the flatCoordinates list
contains more than 3 elements: "Assertion failed: flatCoordinates should
have a length of 3" The value of flatCoordinates for a 3D point was
something like `[2586394, 1232407, 0, 731, NaN, 0]`
- The value of the Z coordinates to be incorrect and always set to 0

This patch simplifies and correct the parsing of the coordinates:
- Don't parse groups of coords and the coordonates at the same time.
- Detect the dimension for the coordinates.
- If the Z coordinate exists, its value is used, otherwise, we use 0.
- Correct the presentation of test data to make it work with the new
parser.
- Add a test for a 3D point.
2017-03-31 10:46:27 +02:00
Tim Schaub
a65e30fe41 Reworked raster source rendering 2017-03-30 23:00:31 -06:00
Andreas Hocevar
f806670c85 Merge pull request #6657 from openlayers/greenkeeper/coveralls-2.13.0
Update coveralls to the latest version 🚀
2017-03-30 19:32:59 +02:00
greenkeeper[bot]
b51cca4a57 chore(package): update coveralls to version 2.13.0
https://greenkeeper.io/
2017-03-30 16:32:13 +00:00
Tim Schaub
7f74f238fd Merge pull request #6644 from tschaub/view-setters
Allow minZoom and maxZoom to be set on a view
2017-03-28 08:44:31 -06:00
Frédéric Junod
3bb5179e2d Merge pull request #6636 from fredj/scaleline_test
Add test for the metric unit displayed in the scaleline
2017-03-28 15:04:33 +02:00
Frederic Junod
57d39109e3 Add test for the metric unit displayed in the scaleline 2017-03-28 09:06:33 +02:00
Frédéric Junod
b4642903fd Merge pull request #6598 from hajjimurad/feature/micrometer_support
Add support of micrometers to scaleline
2017-03-28 09:04:51 +02:00
Tim Schaub
b1f4e14281 Example demonstrating view.setMinZoom() 2017-03-27 14:24:31 -06:00
Tim Schaub
e9c340b957 Allow min/max zoom to be set on a view 2017-03-27 14:18:16 -06:00
Tim Schaub
a4fabef86c Merge pull request #6643 from tschaub/proj-common
Add common transforms by default
2017-03-27 14:17:12 -06:00
Tim Schaub
4c1bf075c4 Allow options to be reapplied 2017-03-27 10:41:02 -06:00
Tim Schaub
9415899a03 Add common transforms by default 2017-03-27 10:07:00 -06:00
Tim Schaub
03700c0f01 Remove ol.proj dependency from EPSG3857 and EPSG4326 2017-03-27 09:47:03 -06:00
Andreas Hocevar
1316513a1e Merge pull request #6567 from nagytech/master
Overlay visible before updating render position
2017-03-27 10:42:08 +02:00
Andreas Hocevar
db6a5f34cd Merge pull request #6634 from Toilal/feature/yarn-custom-build-fix
Fix custom build when openlayers is installed from yarn package manager
2017-03-26 22:43:21 +02:00
Andreas Hocevar
e5ef1aa5a1 Add missing return annotation 2017-03-26 14:35:58 +02:00
Andreas Hocevar
166ef525f0 Remove lint 2017-03-26 14:26:23 +02:00
Andreas Hocevar
2305b18b18 Merge pull request #6639 from openlayers/greenkeeper/async-2.2.0
Update async to the latest version 🚀
2017-03-25 22:24:14 +01:00
greenkeeper[bot]
28fd5147ae fix(package): update async to version 2.2.0
https://greenkeeper.io/
2017-03-25 20:48:21 +00:00
Frédéric Junod
9d58b006e7 Merge pull request #6635 from Toilal/feature/custom-build-docs-externs
Add missing externs to custom builds examples
2017-03-24 14:09:49 +01:00
Toilal
e5f2e284ba Add missing externs to custom builds examples 2017-03-24 12:32:38 +01:00
Toilal
c4029fb9b6 Fix custom build when openlayers is installed from yarn package manager
This enhance the procedure to find path of jsdoc binary by checking if the file exists.
It also use 2 possible paths to perform this check, one for npm and the other for yarn.

Close #6633
2017-03-24 12:17:06 +01:00
Andreas Hocevar
3bf74f4a33 Merge pull request #6631 from ahocevar/wms-image-size
Fix request image size caclulation
2017-03-24 10:39:09 +01:00
Andreas Hocevar
28fb57ebeb Fix request image size caclulation 2017-03-23 22:26:58 +01:00
Bart van den Eijnden
59ba146463 Merge pull request #6627 from bartvde/unselectable
Change css selector for user-select none
2017-03-22 16:48:22 +01:00
Andreas Hocevar
eef0b8869f Merge pull request #6626 from ahocevar/reprojected-cache-size
Respect cacheSize for reprojected caches
2017-03-22 16:27:11 +01:00
bartvde
c24ca7966a Change css selector for user-select none 2017-03-22 16:23:13 +01:00
Andreas Hocevar
e731ff8118 Merge pull request #6623 from ahocevar/outerwidth-outerheight
Fix outerWidth and outerHeight calculation in IE
2017-03-22 15:52:52 +01:00
Andreas Hocevar
07d4492ece Respect cacheSize for reprojected caches 2017-03-22 15:50:58 +01:00
Andreas Hocevar
5721e27161 Merge pull request #6625 from openlayers/greenkeeper/clean-css-cli-4.0.10
Update clean-css-cli to the latest version 🚀
2017-03-22 15:33:40 +01:00
greenkeeper[bot]
f96a415e80 chore(package): update clean-css-cli to version 4.0.10
https://greenkeeper.io/
2017-03-22 14:13:38 +00:00
Andreas Hocevar
1843698daf Fix outerWidth and outerHeight calculation in IE 2017-03-22 15:07:06 +01:00
Andreas Hocevar
57e67e62bb Merge pull request #6622 from gberaudo/fix_proj4_type
Fix proj4 type
2017-03-22 10:34:42 +01:00
Andreas Hocevar
615f1333d3 Merge pull request #6617 from ahocevar/cache-geoserver
Use GeoServer/GWC caching when possible
2017-03-22 09:58:52 +01:00
Guillaume Beraudo
630d9c5200 Fix proj4 type
Previous typing was confusing the compiler. It could not figure out the
difference between the proj4 property and the constructor, which lead to
errors such as:

- ol.proj.setProj4(proj4)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:8: ERROR - actual parameter 1 of ol.proj.setProj4 does not match formal parameter
ERR! compile found   : function (new:proj4): ?
ERR! compile required: (null|proj4)
ERR! compile   ol.proj.setProj4(proj4);
ERR! compile                    ^^^^^

- ol.proj.proj4.get().defs('EPSG:21781', epsg21781def)
ERR! compile /home/gberaudo/dev/ngeo/src/proj/epsg21781.js:26: ERROR - Property defs never defined on proj4
ERR! compile   ol.proj.proj4.get().defs('EPSG:21781', epsg21781def);
ERR! compile                       ^^^^
2017-03-22 09:47:29 +01:00
Frédéric Junod
f4bf92a488 Merge pull request #6614 from adube/filter-write-util-method
Filter write util method
2017-03-21 16:28:04 +01:00
Andreas Hocevar
2dcecb9d59 Use GeoServer/GWC caching when possible 2017-03-21 16:17:43 +01:00
Frédéric Junod
d65d816ac8 Merge pull request #6616 from fredj/fix_gml_tests
Fix closing tag in gml tests
2017-03-21 15:24:21 +01:00
Alexandre Dubé
827fabc849 Apply reviewer's comments 2017-03-21 10:15:32 -04:00
Frederic Junod
7aa6d6350a Fix closing tag in gml tests 2017-03-21 14:55:41 +01:00
Alexandre Dubé
ef1033dffc Test for ol.format.WFS.writerFilter method 2017-03-21 09:19:07 -04:00
Alexandre Dubé
8a5fb286b6 Add writeFilter method to WFS format 2017-03-21 08:57:15 -04:00
Bart van den Eijnden
14c78a138a Merge pull request #6612 from Jenselme/wfs-1.0.0-writeGetFeature
Add support for WFS 1.0.0 to ol.format.WFS#writeTransaction
2017-03-21 11:08:40 +01:00
Julien Enselme
ecafa44196 Add support for WFS 1.0.0 to ol.format.WFS#writeTransaction
- Add a version property to olx.format.WFSWriteTransactionOptions to set
the WFS protocol version to use
- Use the specified version to use the correct schema and version in the
GML request
- Use the version to select the proper GML serializer
2017-03-21 10:59:28 +01:00
Andreas Hocevar
d216962b64 Merge pull request #5887 from felixveysseyre/interactive-overview-map
Interactive overview map
2017-03-21 10:17:58 +01:00
Andreas Hocevar
1320168cca Merge pull request #6610 from ahocevar/ie-eventtype
Fix event type case of MSPointerDown
2017-03-21 08:39:13 +01:00
Andreas Hocevar
f681302409 Merge pull request #6611 from openlayers/greenkeeper/jquery-3.2.1
Update jquery to the latest version 🚀
2017-03-20 21:57:58 +01:00
greenkeeper[bot]
6df077be77 chore(package): update jquery to version 3.2.1
https://greenkeeper.io/
2017-03-20 19:05:02 +00:00
Andreas Hocevar
93ef22759a Fix event type case of MSPointerDown 2017-03-20 19:36:43 +01:00
Andreas Hocevar
802c5ee30f Merge pull request #6609 from openlayers/greenkeeper/sinon-2.1.0
Update sinon to the latest version 🚀
2017-03-20 18:49:13 +01:00
Andreas Hocevar
f5c1908058 Merge pull request #6606 from ahocevar/delete-segmentdata
Reset dragSegments after vertex deletion
2017-03-20 18:17:34 +01:00
greenkeeper[bot]
5cc6565078 chore(package): update sinon to version 2.1.0
https://greenkeeper.io/
2017-03-20 16:46:09 +00:00
Félix VEYSSEYRE
6202c1736f Made OvervieMap interactive option default behavior 2017-03-20 17:15:47 +01:00
Andreas Hocevar
35ef65e6b9 Reset dragSegments after vertex deletion 2017-03-20 09:39:34 +01:00
Bart van den Eijnden
d931a92a9f Merge pull request #6523 from Jenselme/gml2-writeGeometryElement
Add Gml2 serializers to support WFS-T 1.0.0
2017-03-20 09:32:44 +01:00
Frédéric Junod
576b646f36 Merge pull request #6579 from fredj/update_slimerjs
Update slimerjs to v0.10.3
2017-03-20 08:34:34 +01:00
Frédéric Junod
b7fcc3ec46 Merge pull request #6577 from fredj/optionsFromCapabilities_crossOrigin
Adding crossOrigin to optionsFromCapabilities
2017-03-20 08:25:46 +01:00
Frederic Junod
9ae7df918f Update slimerjs to v0.10.3 2017-03-20 08:22:31 +01:00
Andreas Hocevar
75e27cef98 Merge pull request #6604 from ahocevar/star-radius
Fix RegularShape documentation
2017-03-18 21:10:41 +01:00
Andreas Hocevar
518d433d64 Fix RegularShape documentation 2017-03-18 12:16:26 +01:00
Andreas Hocevar
48a9270fad Merge pull request #6603 from openlayers/greenkeeper/eslint-3.18.0
Update eslint to the latest version 🚀
2017-03-18 08:04:52 +01:00
greenkeeper[bot]
686c3e1128 chore(package): update eslint to version 3.18.0
https://greenkeeper.io/
2017-03-17 22:12:40 +00:00
Andreas Hocevar
fb26c11dfb Merge pull request #6601 from openlayers/greenkeeper/jquery-3.2.0
Update jquery to the latest version 🚀
2017-03-16 23:03:52 +01:00
Andreas Hocevar
4e7202c9ae Merge pull request #6600 from openlayers/greenkeeper/fs-extra-2.1.2
Update fs-extra to the latest version 🚀
2017-03-16 22:46:25 +01:00
greenkeeper[bot]
5ec294fd7f chore(package): update jquery to version 3.2.0
https://greenkeeper.io/
2017-03-16 21:34:49 +00:00
greenkeeper[bot]
33ccb6619c fix(package): update fs-extra to version 2.1.2
https://greenkeeper.io/
2017-03-16 19:10:07 +00:00
Andreas Hocevar
0608c91587 Merge pull request #6578 from icholy/master
Add ol.RenderOrderFunction typedef
2017-03-16 14:47:06 +01:00
Murad Khafizov
76b917bf36 Add support of micrometers to scaleline
For high resolutions it starts to use micrometers (μm) instead of millimeters(mm). For example "5 μm" instead of "0.005 mm"
2017-03-16 12:45:44 +01:00
Andreas Hocevar
52e5bdbc9b Merge pull request #6589 from openlayers/greenkeeper/sinon-2.0.0
Update sinon to the latest version 🚀
2017-03-16 11:23:07 +01:00
Andreas Hocevar
121b2457e7 Merge pull request #6592 from openlayers/greenkeeper/clean-css-cli-4.0.9
Update clean-css-cli to the latest version 🚀
2017-03-16 10:06:59 +01:00
Andreas Hocevar
f1b7306eb6 Merge pull request #6594 from openlayers/greenkeeper/fs-extra-2.1.0
Update fs-extra to the latest version 🚀
2017-03-16 09:46:48 +01:00
greenkeeper[bot]
7d39ccb0e3 fix(package): update fs-extra to version 2.1.0
https://greenkeeper.io/
2017-03-15 12:38:46 +00:00
greenkeeper[bot]
0c11024fd7 chore(package): update clean-css-cli to version 4.0.9
https://greenkeeper.io/
2017-03-15 10:30:45 +00:00
greenkeeper[bot]
b4eb3eb8ba chore(package): update sinon to version 2.0.0
https://greenkeeper.io/
2017-03-15 06:33:59 +00:00
Frédéric Junod
793bf2f154 Merge pull request #6580 from fredj/rm_esprima
Remove unused esprima package
2017-03-11 07:39:22 +01:00
Frederic Junod
99de8b2eb1 Remove unused esprima package
It was added in #6302 but never used
2017-03-11 07:26:01 +01:00
Ilia Choly
2dc656c098 Add ol.RenderOrderFunction typedef 2017-03-09 13:02:39 -05:00
SanderH
ebde179ab2 Adding crossOrigin to optionsFromCapabilities
This pull request should resolve: https://github.com/openlayers/openlayers/issues/6521

Now with var and single quotes
2017-03-09 14:49:48 +01:00
Frédéric Junod
1e3462d476 Merge pull request #6570 from openlayers/sinon_stub
Don't use deprecated sinon.stub(obj, 'meth', fn)
2017-03-09 08:37:10 +01:00
Frédéric Junod
80c5b90dea Merge pull request #6569 from fredj/wmts_layer_not_found
Return null if the layer was not found in the WMTS capabilities
2017-03-08 15:44:12 +01:00
Frederic Junod
3e95c424ab Don't use deprecated sinon.stub(obj, 'meth', fn)
Code updated using https://github.com/hurrymaplelad/sinon-codemod
2017-03-08 15:37:46 +01:00
Frederic Junod
2e22fce718 Return null if the layer was not found in the WMTS capabilities 2017-03-08 15:29:26 +01:00
Frédéric Junod
cc13ca68fa Merge pull request #6551 from fredj/regular_shape_default_color
Use the default fill and stroke color
2017-03-08 08:42:27 +01:00
Jonathan Nagy
915b83a068 Remove trailing whitespace. 2017-03-08 16:34:27 +11:00
Jonathan Nagy
c54bf85dfc Overlay visible before updating render position
Make the overlay visible before updating the render position
so that the `offsetWidth` and `offsetHeight` can be 
considered in evaluating the offset and positioning of the 
element

See openlayers/openlayers#6566
2017-03-08 15:53:42 +11:00
Frederic Junod
1d3eb2eb6e Use the default fill and stroke color 2017-03-07 12:04:22 +01:00
Bart van den Eijnden
49af45c8b7 Merge pull request #6560 from geosense/featureloader_500_response
Don’t crash if feature loader xhr response returns 500
2017-03-06 11:31:39 +01:00
Aleš Jiránek
9c20a5eec8 Don’t crash if feature loader xhr response returns 500 2017-03-06 11:15:16 +01:00
Frédéric Junod
c215a1c50f Merge pull request #6559 from fredj/cleanup
Remove unneeded type cast
2017-03-06 09:49:05 +01:00
Frédéric Junod
e3664dbf64 Merge pull request #6558 from openlayers/greenkeeper/coveralls-2.12.0
Update coveralls to the latest version 🚀
2017-03-06 08:40:39 +01:00
Frédéric Junod
72b6a5c392 Merge pull request #6553 from openlayers/greenkeeper/proj4-2.4.3
Update proj4 to the latest version 🚀
2017-03-06 08:40:20 +01:00
Frederic Junod
192e3a3197 Remove unneeded type cast 2017-03-06 08:39:47 +01:00
greenkeeper[bot]
5b020cc00b chore(package): update coveralls to version 2.12.0
https://greenkeeper.io/
2017-03-06 08:24:19 +01:00
Frédéric Junod
6679faf1e3 Merge pull request #6554 from openlayers/greenkeeper/eslint-3.17.0
Update eslint to the latest version 🚀
2017-03-06 08:23:38 +01:00
greenkeeper[bot]
a519d83316 chore(package): update proj4 to version 2.4.3
https://greenkeeper.io/
2017-03-06 08:22:57 +01:00
greenkeeper[bot]
a078f01f7b chore(package): update eslint to version 3.17.0
https://greenkeeper.io/
2017-03-03 22:43:38 +00:00
Bart van den Eijnden
16d62f8d9b Merge pull request #6549 from bartvde/animating-api
Make getAnimating and cancelAnimations @api
2017-03-03 09:46:54 +01:00
bartvde
f06d1740e0 Make getAnimating and cancelAnimations @api 2017-03-02 13:48:50 +01:00
Bart van den Eijnden
0ed864383d Merge pull request #6547 from bartvde/rotate-cleanup
Clean up left-over code from animation changes
2017-03-02 13:46:23 +01:00
bartvde
3d18b54978 Cleanup left over code from animation changes 2017-03-02 13:34:49 +01:00
Frédéric Junod
b456250cbe Merge pull request #6540 from openlayers/getAccuracyGeometry_type
More precise ol.Geolocation#getAccuracyGeometry return type
2017-03-01 09:51:51 +01:00
Frédéric Junod
a561300e9d Merge pull request #6539 from openlayers/greenkeeper/sinon-2.0.0-pre.6
Update sinon to the latest version 🚀
2017-02-28 12:12:07 +01:00
Frederic Junod
c1be62e6c3 More precise ol.Geolocation#getAccuracyGeometry return type 2017-02-27 16:18:45 +01:00
greenkeeper[bot]
59a4bbf91e chore(package): update sinon to version 2.0.0-pre.6
https://greenkeeper.io/
2017-02-27 09:30:07 +00:00
Frédéric Junod
08a251103b Merge pull request #6535 from openlayers/greenkeeper/closure-util-1.18.0
Update closure-util to the latest version 🚀
2017-02-24 09:47:11 +01:00
greenkeeper[bot]
9fe42fdcd6 fix(package): update closure-util to version 1.18.0
https://greenkeeper.io/
2017-02-24 07:57:54 +00:00
Andreas Hocevar
aa2dd57f36 Merge pull request #6529 from openlayers/greenkeeper/clean-css-cli-4.0.8
Update clean-css-cli to the latest version 🚀
2017-02-22 23:40:31 +01:00
Andreas Hocevar
f2e834cd32 Merge pull request #6530 from openlayers/greenkeeper/eslint-3.16.1
Update eslint to the latest version 🚀
2017-02-22 23:39:00 +01:00
greenkeeper[bot]
16b6bf1743 chore(package): update eslint to version 3.16.1
https://greenkeeper.io/
2017-02-22 22:23:33 +00:00
greenkeeper[bot]
e3f11e9d8c chore(package): update clean-css-cli to version 4.0.8
https://greenkeeper.io/
2017-02-22 16:31:26 +00:00
Tim Schaub
1d47fc923f Merge pull request #6515 from tschaub/zoom
Add view methods for getting max zoom, min zoom, and any zoom for a resolution
2017-02-20 11:48:45 -07:00
Marc Jansen
bc1c948950 Merge pull request #6520 from openlayers/greenkeeper/eslint-3.16.0
Update eslint to the latest version 🚀
2017-02-20 18:33:14 +01:00
greenkeeper[bot]
fc9ed73ff4 chore(package): update eslint to version 3.16.0
https://greenkeeper.io/
2017-02-20 16:32:55 +00:00
Frédéric Junod
6d8fed6edc Merge pull request #6518 from fredj/fix_icon_src_type
Fix olx.style.IconOptions.prototype.src type
2017-02-20 13:17:35 +01:00
Frederic Junod
7c45a0dc4f Fix olx.style.IconOptions.prototype.src type
The `olx.style.IconOptions` `@typedef` was already correct.
2017-02-20 12:19:58 +01:00
Tim Schaub
b383e0ecb2 Add view.getMaxZoom() and view.getMinZoom() 2017-02-19 18:11:04 -07:00
Tim Schaub
719fa6e004 Add view.getZoomForResolution() 2017-02-19 17:16:20 -07:00
Tim Schaub
a10926ac74 Merge pull request #6513 from openlayers/greenkeeper/async-2.1.5
Update async to the latest version 🚀
2017-02-19 05:58:19 -07:00
Tim Schaub
ca5bf96cb9 Merge pull request #6512 from tschaub/avoid-undefined-zoom
Complete animations at target values
2017-02-19 05:55:11 -07:00
greenkeeper[bot]
6269b907c3 fix(package): update async to version 2.1.5
https://greenkeeper.io/
2017-02-19 01:33:38 +00:00
Tim Schaub
9bd48d06c3 Complete animations at target values 2017-02-17 13:06:20 -07:00
Andreas Hocevar
1834c11f48 Merge pull request #6511 from ahocevar/restore-wms-tiled-example
Revert accidently committed example change
2017-02-17 19:03:00 +01:00
Andreas Hocevar
e77aabdf1b Revert accidently committed example change 2017-02-17 18:25:12 +01:00
Tim Schaub
61404d5bd8 Merge pull request #6507 from probins/patch-1
ol.DEBUG no longer needed in transforms/module.js
2017-02-17 09:26:16 -07:00
Julien Enselme
5f5c906129 Add GML2 serializer for Envelope 2017-02-17 17:00:09 +01:00
Julien Enselme
fec279c460 Add GML2 serializer for MultiSurface and MultiPolygon 2017-02-17 16:57:45 +01:00
Julien Enselme
579ec3955e Add GML2 MultiLineString serialiazer 2017-02-17 16:50:54 +01:00
Julien Enselme
650837b207 Add GML2 serializer for MultiPoint 2017-02-17 16:39:48 +01:00
Julien Enselme
f8c6863fa7 Add GML2 serializer for Point 2017-02-17 16:28:52 +01:00
Julien Enselme
dd90c90819 Add GML2 serializer for Surface and Polygon
- Adapt the code from ol.format.GML3.
- Create utility function to create coordinates nodes with proper
attributes
2017-02-17 16:23:16 +01:00
Julien Enselme
21394826b6 Add GML2 serializer for Curve and LineString
Adapt the code from ol.format.GML3.
2017-02-17 15:48:10 +01:00
Julien Enselme
7f0ed44828 Boostrap GML2 serializers
- Add writeFeatureElement (copied and adapted from ol.format.GML3)
- Add writeGeometryElement (copied and adapted from ol.format.GML3)
- Add related constants (GEOMETRY_SERIALIZERS_, GEOMETRY_NODE_FACTORY_)
- Add empty serialization methods
2017-02-17 15:38:19 +01:00
Tim Schaub
8d7eb0e372 Merge pull request #6505 from tschaub/babelify
Update ol package to include Browserify config
2017-02-17 05:36:03 -07:00
Peter Robins
3161e435b8 ol.DEBUG no longer needed in transforms/module.js 2017-02-17 10:35:55 +00:00
Tim Schaub
4bf0365d85 Make it easier to apply the required Browserify transform 2017-02-16 17:04:43 -07:00
Tim Schaub
109d3149f4 Include stylesheet in the package 2017-02-16 16:51:00 -07:00
Tim Schaub
a3f40b2057 Merge pull request #6504 from tchandelle/drawing
Determine if we should handle the drawing while the pointer is moving
2017-02-16 13:52:24 -07:00
Thomas Chandelle
08a118cc94 Determine if we should handle the drawing when the pointer is moving 2017-02-16 16:52:04 +01:00
Andreas Hocevar
b05136ea53 Merge pull request #6499 from tchandelle/circle-modify
Be more tolerant when comparing vertices when modifying a circle
2017-02-16 13:49:42 +01:00
Thomas Chandelle
9bf6dcbdcb Find the closest vertex on the circle from the pixel coordinates 2017-02-16 10:35:01 +01:00
Andreas Hocevar
6020c147ed Merge pull request #6498 from ahocevar/update-travis-node
Travis failing on master - use Node v6.1.x
2017-02-15 22:27:47 +01:00
Andreas Hocevar
1f2f8f06dc Do not fail on failing 'npm ls' 2017-02-15 15:08:55 +01:00
Andreas Hocevar
3829d883a7 Make Travis use node v6.1 2017-02-15 14:36:23 +01:00
Andreas Hocevar
cf12639749 Merge pull request #6493 from ahocevar/vectortile-cleanup
Vector tile cleanup
2017-02-15 14:21:44 +01:00
Thomas Chandelle
0764be77c4 Failing test for "Circle Modification" 2017-02-15 09:46:51 +01:00
Andreas Hocevar
7db5eea56b Performance improvement: only create context when it is needed 2017-02-14 22:20:38 +01:00
Andreas Hocevar
302087b4ec Reuse properties from ol.layer.TileProperty 2017-02-14 22:19:38 +01:00
Andreas Hocevar
db58db396f Remove renderedResolution which is defined in superclass 2017-02-14 22:19:38 +01:00
Andreas Hocevar
6906046e9f Merge pull request #6483 from nearmap/tile-render-issue
Fix renderer.canvas.TileLayer to calculate correct canvas height for drawing.
2017-02-14 21:49:34 +01:00
Andreas Hocevar
1705a2ca5f Merge pull request #6488 from tchandelle/circle-pan
Do not draw circle when pointer not moved and freehand is on
2017-02-14 15:49:47 +01:00
Frédéric Junod
88be906ad5 Merge pull request #6491 from openlayers/greenkeeper/clean-css-cli-4.0.7
Update clean-css-cli to the latest version 🚀
2017-02-14 13:17:45 +01:00
greenkeeper[bot]
f2a7ed5ef1 chore(package): update clean-css-cli to version 4.0.7
https://greenkeeper.io/
2017-02-14 11:49:53 +00:00
Andreas Hocevar
f515c86f54 Merge pull request #6489 from openlayers/release-v4.0.1
Release v4.0.1
2017-02-14 10:23:04 +01:00
Andreas Hocevar
87eaa1fba4 Update ol package version to 4.0.1-beta.1 2017-02-14 10:22:06 +01:00
Andreas Hocevar
032ce16519 Update package version to 4.0.1 2017-02-14 10:21:18 +01:00
Andreas Hocevar
ea190e2009 Changelog for v4.0.1 2017-02-14 10:20:43 +01:00
Thomas Chandelle
73ef345a2d Abort drawing to clear the sketch feature 2017-02-14 09:26:35 +01:00
Thomas Chandelle
4575c4ab6f Do not draw circle when pointer not moved AND freehand is on 2017-02-14 09:22:07 +01:00
Andreas Hocevar
fbd954ac7c Merge pull request #6486 from ahocevar/reset-on-pointer-count-change
Do not set center when touches count has changed
2017-02-14 01:29:11 +01:00
Andreas Hocevar
676dda7ca6 Reset kinetic when number of touches changes 2017-02-14 01:15:16 +01:00
Andreas Hocevar
186935c147 Only update kinetic when number of touches has not changed 2017-02-14 00:48:59 +01:00
Andreas Hocevar
8e35b7a1ad Do not set center when touches count has changed 2017-02-13 22:30:51 +01:00
Andreas Hocevar
7037ca211d Add rendering test for 192x256 tiles 2017-02-13 18:27:34 +01:00
Jan Klaas Kollhof
b152f06973 Fix rendered.canvas.TileLayer to calculate correct canvas height for drawing. 2017-02-13 13:50:09 +11:00
Andreas Hocevar
0c159cf0f7 Update ol package version to v4.0.0-beta.1 2017-02-10 18:14:30 +00:00
Félix VEYSSEYRE
328862172d Moved logic into the constructor 2016-09-16 16:11:25 +02:00
Félix VEYSSEYRE
ac99b5011a Enabled ol.control.OverviewMap interactive option on example page 2016-09-15 15:10:41 +02:00
Félix VEYSSEYRE
2b7ed7381f Added interactive option to ol.control.OverviewMap 2016-09-15 15:10:01 +02:00
120 changed files with 2618 additions and 563 deletions

View File

@@ -3,7 +3,10 @@ sudo: false
language: node_js
node_js:
- "6"
- "6.1"
addons:
firefox: "latest"
cache:
directories:
@@ -17,7 +20,7 @@ before_install:
before_script:
- "rm src/ol/renderer/webgl/*shader.js"
- "sh -e /etc/init.d/xvfb start"
- "npm ls"
- "npm ls || true"
script: "make ci"

View File

@@ -308,4 +308,5 @@ package:
@cp -r package build
@cd ./src && cp -r ol/* ../build/package
@rm build/package/typedefs.js
@cp css/ol.css build/package
./node_modules/.bin/jscodeshift --transform transforms/module.js build/package

View File

@@ -2,6 +2,30 @@
### Next release
### v4.1.0
#### Adding duplicate layers to a map throws
Previously, you could do this:
```js
map.addLayer(layer);
map.addLayer(layer);
```
However, after adding a duplicate layer, things failed if you tried to remove that layer.
Now, `map.addLayer()` throws if you try adding a layer that has already been added to the map.
#### Simpler `constrainResolution` configuration
The `constrainResolution` configuration for `ol.interaction.PinchZoom` and `ol.interaction.MouseWheelZoom`
can now be set directly with an option in `ol.interaction.defaults`:
```js
ol.interaction.defaults({
constrainResolution: true
});
```
### v4.0.0
#### Simpler `ol.source.Zoomify` `url` configuration

11
changelog/v4.0.1.md Normal file
View File

@@ -0,0 +1,11 @@
# 4.0.1
## Summary
The v4.0.1 release is a patch release that addresses a regression in the v4.0.0 release. The fix makes pinch zooming work again properly when the two fingers are not placed on the screen at the same time.
See the [v4.0.0 release notes](https://github.com/openlayers/openlayers/releases/tag/v4.0.0) for details on upgrading from v3.20.x.
## Fix
* [#6486](https://github.com/openlayers/openlayers/pull/6486) - Do not set center when touches count has changed ([@ahocevar](https://github.com/ahocevar))

127
changelog/v4.1.0.md Normal file
View File

@@ -0,0 +1,127 @@
# 4.1.0
## Summary
The v4.1.0 release includes features and fixes from 91 pull requests.
#### Interactive overview map
The extent rectangle on the overview map can now be dragged to control the view for the main map.
#### Setting min and max zoom for a view
You can now change the min or max zoom for a view after it has been created. This can be useful if you want to limit how far out users can zoom based on changes in viewport width (use `view.setMinZoom()` for this).
#### Adding duplicate layers to a map throws
Previously, you could do this:
```js
map.addLayer(layer);
map.addLayer(layer);
```
However, after adding a duplicate layer, things failed if you tried to remove that layer.
Now, `map.addLayer()` throws if you try adding a layer that has already been added to the map.
#### Simpler `constrainResolution` configuration
The `constrainResolution` configuration for `ol.interaction.PinchZoom` and `ol.interaction.MouseWheelZoom`
can now be set directly with an option in `ol.interaction.defaults`:
```js
ol.interaction.defaults({
constrainResolution: true
});
```
## Detailed changes
* [#6675](https://github.com/openlayers/openlayers/pull/6675) - Reset cursor when translate interaction is removed or deactivated ([@tchandelle](https://github.com/tchandelle))
* [#6707](https://github.com/openlayers/openlayers/pull/6707) - Set version when building ol package ([@tschaub](https://github.com/tschaub))
* [#6706](https://github.com/openlayers/openlayers/pull/6706) - Add ol.source.Cluster#getDistance function ([@fredj](https://github.com/fredj))
* [#6695](https://github.com/openlayers/openlayers/pull/6695) - Unique layers ([@tschaub](https://github.com/tschaub))
* [#6704](https://github.com/openlayers/openlayers/pull/6704) - Include typedefs.js in closure compiler tutorial build configurations ([@openlayers](https://github.com/openlayers))
* [#6702](https://github.com/openlayers/openlayers/pull/6702) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6693](https://github.com/openlayers/openlayers/pull/6693) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6691](https://github.com/openlayers/openlayers/pull/6691) - Move eslint globals to to test/.eslintrc ([@fredj](https://github.com/fredj))
* [#6689](https://github.com/openlayers/openlayers/pull/6689) - Add new constrainResolution option to olx.interaction.DefaultsOptions ([@fredj](https://github.com/fredj))
* [#6692](https://github.com/openlayers/openlayers/pull/6692) - Improve docs for MouseWheelZoom constrainResolution ([@ahocevar](https://github.com/ahocevar))
* [#6687](https://github.com/openlayers/openlayers/pull/6687) - Clip image only if the layer extent intersects the view extent ([@tchandelle](https://github.com/tchandelle))
* [#6686](https://github.com/openlayers/openlayers/pull/6686) - Update finishCoordinate in ol.interaction.Draw#removeLastPoint ([@fredj](https://github.com/fredj))
* [#6682](https://github.com/openlayers/openlayers/pull/6682) - Add example, docs and typedef for MouseWheelZoom's constrainResolution option ([@ahocevar](https://github.com/ahocevar))
* [#6683](https://github.com/openlayers/openlayers/pull/6683) - Add this jsdoc tag to ol.interaction.DragBox.defaultBoxEndCondition ([@fredj](https://github.com/fredj))
* [#6681](https://github.com/openlayers/openlayers/pull/6681) - Add constrainResolution in olx.interaction.PinchZoomOptions typedef ([@fredj](https://github.com/fredj))
* [#6671](https://github.com/openlayers/openlayers/pull/6671) - Add constraintResolution option to MouseWheelZoom for zoom with trackpad ([@kaiCu](https://github.com/kaiCu))
* [#6680](https://github.com/openlayers/openlayers/pull/6680) - Remove ol.DRAG_BOX_HYSTERESIS_PIXELS define and add option ([@fredj](https://github.com/fredj))
* [#6666](https://github.com/openlayers/openlayers/pull/6666) - Use the optional extent in ol.structs.RBush#getExtent ([@fredj](https://github.com/fredj))
* [#6670](https://github.com/openlayers/openlayers/pull/6670) - fix(package): update browserify to version 14.3.0 ([@openlayers](https://github.com/openlayers))
* [#6664](https://github.com/openlayers/openlayers/pull/6664) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6659](https://github.com/openlayers/openlayers/pull/6659) - Add crossOrigin to examples using ol.style.Icon ([@openlayers](https://github.com/openlayers))
* [#6658](https://github.com/openlayers/openlayers/pull/6658) - Fixes for raster source rendering ([@tschaub](https://github.com/tschaub))
* [#6620](https://github.com/openlayers/openlayers/pull/6620) - Fix the parsing of flat coordinates in GML2 for 3D geometies ([@Jenselme](https://github.com/Jenselme))
* [#6657](https://github.com/openlayers/openlayers/pull/6657) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6644](https://github.com/openlayers/openlayers/pull/6644) - Allow minZoom and maxZoom to be set on a view ([@tschaub](https://github.com/tschaub))
* [#6636](https://github.com/openlayers/openlayers/pull/6636) - Add test for the metric unit displayed in the scaleline ([@fredj](https://github.com/fredj))
* [#6598](https://github.com/openlayers/openlayers/pull/6598) - Add support of micrometers to scaleline ([@hajjimurad](https://github.com/hajjimurad))
* [#6643](https://github.com/openlayers/openlayers/pull/6643) - Add common transforms by default ([@tschaub](https://github.com/tschaub))
* [#6567](https://github.com/openlayers/openlayers/pull/6567) - Overlay visible before updating render position ([@nagytech](https://github.com/nagytech))
* [#6634](https://github.com/openlayers/openlayers/pull/6634) - Fix custom build when openlayers is installed from yarn package manager ([@Toilal](https://github.com/Toilal))
* [#6639](https://github.com/openlayers/openlayers/pull/6639) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6635](https://github.com/openlayers/openlayers/pull/6635) - Add missing externs to custom builds examples ([@Toilal](https://github.com/Toilal))
* [#6631](https://github.com/openlayers/openlayers/pull/6631) - Fix request image size caclulation ([@ahocevar](https://github.com/ahocevar))
* [#6627](https://github.com/openlayers/openlayers/pull/6627) - Change css selector for user-select none ([@bartvde](https://github.com/bartvde))
* [#6626](https://github.com/openlayers/openlayers/pull/6626) - Respect cacheSize for reprojected caches ([@ahocevar](https://github.com/ahocevar))
* [#6623](https://github.com/openlayers/openlayers/pull/6623) - Fix outerWidth and outerHeight calculation in IE ([@ahocevar](https://github.com/ahocevar))
* [#6625](https://github.com/openlayers/openlayers/pull/6625) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6622](https://github.com/openlayers/openlayers/pull/6622) - Fix proj4 type ([@gberaudo](https://github.com/gberaudo))
* [#6617](https://github.com/openlayers/openlayers/pull/6617) - Use GeoServer/GWC caching when possible ([@ahocevar](https://github.com/ahocevar))
* [#6614](https://github.com/openlayers/openlayers/pull/6614) - Filter write util method ([@adube](https://github.com/adube))
* [#6616](https://github.com/openlayers/openlayers/pull/6616) - Fix closing tag in gml tests ([@fredj](https://github.com/fredj))
* [#6612](https://github.com/openlayers/openlayers/pull/6612) - Add support for WFS 1.0.0 to ol.format.WFS#writeTransaction ([@Jenselme](https://github.com/Jenselme))
* [#5887](https://github.com/openlayers/openlayers/pull/5887) - Interactive overview map ([@felixveysseyre](https://github.com/felixveysseyre))
* [#6610](https://github.com/openlayers/openlayers/pull/6610) - Fix event type case of MSPointerDown ([@ahocevar](https://github.com/ahocevar))
* [#6611](https://github.com/openlayers/openlayers/pull/6611) - Update jquery to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6609](https://github.com/openlayers/openlayers/pull/6609) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6606](https://github.com/openlayers/openlayers/pull/6606) - Reset dragSegments after vertex deletion ([@ahocevar](https://github.com/ahocevar))
* [#6523](https://github.com/openlayers/openlayers/pull/6523) - Add Gml2 serializers to support WFS-T 1.0.0 ([@Jenselme](https://github.com/Jenselme))
* [#6579](https://github.com/openlayers/openlayers/pull/6579) - Update slimerjs to v0.10.3 ([@fredj](https://github.com/fredj))
* [#6577](https://github.com/openlayers/openlayers/pull/6577) - Adding crossOrigin to optionsFromCapabilities ([@fredj](https://github.com/fredj))
* [#6604](https://github.com/openlayers/openlayers/pull/6604) - Fix RegularShape documentation ([@ahocevar](https://github.com/ahocevar))
* [#6603](https://github.com/openlayers/openlayers/pull/6603) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6601](https://github.com/openlayers/openlayers/pull/6601) - Update jquery to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6600](https://github.com/openlayers/openlayers/pull/6600) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6578](https://github.com/openlayers/openlayers/pull/6578) - Add ol.RenderOrderFunction typedef ([@icholy](https://github.com/icholy))
* [#6589](https://github.com/openlayers/openlayers/pull/6589) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6592](https://github.com/openlayers/openlayers/pull/6592) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6594](https://github.com/openlayers/openlayers/pull/6594) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6580](https://github.com/openlayers/openlayers/pull/6580) - Remove unused esprima package ([@fredj](https://github.com/fredj))
* [#6570](https://github.com/openlayers/openlayers/pull/6570) - Don't use deprecated sinon.stub(obj, 'meth', fn) ([@openlayers](https://github.com/openlayers))
* [#6569](https://github.com/openlayers/openlayers/pull/6569) - Return null if the layer was not found in the WMTS capabilities ([@fredj](https://github.com/fredj))
* [#6551](https://github.com/openlayers/openlayers/pull/6551) - Use the default fill and stroke color ([@fredj](https://github.com/fredj))
* [#6560](https://github.com/openlayers/openlayers/pull/6560) - Dont crash if feature loader xhr response returns 500 ([@geosense](https://github.com/geosense))
* [#6559](https://github.com/openlayers/openlayers/pull/6559) - Remove unneeded type cast ([@fredj](https://github.com/fredj))
* [#6558](https://github.com/openlayers/openlayers/pull/6558) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6553](https://github.com/openlayers/openlayers/pull/6553) - Update proj4 to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6554](https://github.com/openlayers/openlayers/pull/6554) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6549](https://github.com/openlayers/openlayers/pull/6549) - Make getAnimating and cancelAnimations @api ([@bartvde](https://github.com/bartvde))
* [#6547](https://github.com/openlayers/openlayers/pull/6547) - Clean up left-over code from animation changes ([@bartvde](https://github.com/bartvde))
* [#6540](https://github.com/openlayers/openlayers/pull/6540) - More precise ol.Geolocation#getAccuracyGeometry return type ([@openlayers](https://github.com/openlayers))
* [#6539](https://github.com/openlayers/openlayers/pull/6539) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6535](https://github.com/openlayers/openlayers/pull/6535) - Update closure-util to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6529](https://github.com/openlayers/openlayers/pull/6529) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6530](https://github.com/openlayers/openlayers/pull/6530) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6515](https://github.com/openlayers/openlayers/pull/6515) - Add view methods for getting max zoom, min zoom, and any zoom for a resolution ([@tschaub](https://github.com/tschaub))
* [#6520](https://github.com/openlayers/openlayers/pull/6520) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6518](https://github.com/openlayers/openlayers/pull/6518) - Fix olx.style.IconOptions.prototype.src type ([@fredj](https://github.com/fredj))
* [#6513](https://github.com/openlayers/openlayers/pull/6513) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6512](https://github.com/openlayers/openlayers/pull/6512) - Complete animations at target values ([@tschaub](https://github.com/tschaub))
* [#6511](https://github.com/openlayers/openlayers/pull/6511) - Revert accidently committed example change ([@ahocevar](https://github.com/ahocevar))
* [#6507](https://github.com/openlayers/openlayers/pull/6507) - ol.DEBUG no longer needed in transforms/module.js ([@probins](https://github.com/probins))
* [#6505](https://github.com/openlayers/openlayers/pull/6505) - Update ol package to include Browserify config ([@tschaub](https://github.com/tschaub))
* [#6504](https://github.com/openlayers/openlayers/pull/6504) - Determine if we should handle the drawing while the pointer is moving ([@tchandelle](https://github.com/tchandelle))
* [#6499](https://github.com/openlayers/openlayers/pull/6499) - Be more tolerant when comparing vertices when modifying a circle ([@tchandelle](https://github.com/tchandelle))
* [#6498](https://github.com/openlayers/openlayers/pull/6498) - Travis failing on master - use Node v6.1.x ([@ahocevar](https://github.com/ahocevar))
* [#6493](https://github.com/openlayers/openlayers/pull/6493) - Vector tile cleanup ([@ahocevar](https://github.com/ahocevar))
* [#6483](https://github.com/openlayers/openlayers/pull/6483) - Fix renderer.canvas.TileLayer to calculate correct canvas height for drawing. ([@nearmap](https://github.com/nearmap))
* [#6488](https://github.com/openlayers/openlayers/pull/6488) - Do not draw circle when pointer not moved and freehand is on ([@tchandelle](https://github.com/tchandelle))
* [#6491](https://github.com/openlayers/openlayers/pull/6491) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))

View File

@@ -34,7 +34,7 @@
.ol-unsupported {
display: none;
}
.ol-viewport .ol-unselectable {
.ol-viewport, .ol-unselectable {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
@@ -239,3 +239,7 @@
.ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7);
}
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}

View File

@@ -220,3 +220,7 @@ The `{-y}` placeholder requires a tile grid with extent.
### 57
At least 2 conditions are required.
### 58
Duplicate item added to a unique collection. For example, it may be that you tried to add the same layer to a map twice. Check for calls to `map.addLayer()` or other places where the map's layer collection is modified.

View File

@@ -172,6 +172,7 @@ The minimum config file looks like this:
"ol.ENABLE_WEBGL=false"
],
"js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.js"
],
@@ -223,6 +224,7 @@ Here is a version of `config.json` with more compilation checks enabled:
"ol.ENABLE_WEBGL=false"
],
"js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.js"
],

View File

@@ -51,7 +51,9 @@ Creating a custom build requires writing a build configuration file. The format
"compile": {
"externs": [
"externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js",
"externs/oli.js",
"externs/olx.js",
@@ -201,9 +203,16 @@ Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openl
],
"compile": {
"externs": [
"externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js",
"externs/olx.js",
"externs/oli.js"
"externs/oli.js",
"externs/proj4js.js",
"externs/tilejson.js",
"externs/topojson.js"
],
"define": [
"ol.ENABLE_WEBGL=false",

View File

@@ -45,7 +45,7 @@ The easiest way to use a custom projection is to add the [Proj4js](http://proj4j
Following example shows definition of a [British National Grid](https://epsg.io/27700):
``` html
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.14/proj4.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js"></script>
```
``` javascript

View File

@@ -11,7 +11,8 @@ var layers = [
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
}
})
})

View File

@@ -6,7 +6,7 @@ goog.require('ol.source.TileWMS');
var wmsSource = new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'},
params: {'LAYERS': 'ne:ne', 'TILED': true},
serverType: 'geoserver',
crossOrigin: 'anonymous'
});

View File

@@ -26,6 +26,7 @@ var madrid = new ol.Feature({
rome.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#8959A8',
crossOrigin: 'anonymous',
src: 'data/dot.png'
}))
}));
@@ -33,6 +34,7 @@ rome.setStyle(new ol.style.Style({
london.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#4271AE',
crossOrigin: 'anonymous',
src: 'data/dot.png'
}))
}));
@@ -40,6 +42,7 @@ london.setStyle(new ol.style.Style({
madrid.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: [113, 140, 0],
crossOrigin: 'anonymous',
src: 'data/dot.png'
}))
}));

View File

@@ -15,6 +15,7 @@ function createStyle(src, img) {
return new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 0.96],
crossOrigin: 'anonymous',
src: src,
img: img,
imgSize: img ? [img.width, img.height] : undefined

View File

@@ -51,6 +51,7 @@ for (i = 0; i < iconCount; ++i) {
rotation: info.rotation,
scale: info.scale,
size: info.size,
crossOrigin: 'anonymous',
src: 'data/Butterfly.png'
});
}

12
examples/min-zoom.html Normal file
View File

@@ -0,0 +1,12 @@
---
layout: example.html
title: View Min-Zoom
shortdesc: Demonstrates how the view's minimum zoom level can be changed.
docs: >
The <code>minZoom</code> option for a view limits how far out you can
zoom. This property can be updated by calling <code>view.setMinZoom(newMinZoom)</code>.
In this example, the minimum zoom level is set so that you only see one
world at a time. Resize your browser window to change the threshold.
tags: "min, zoom"
---
<div id="map" class="map"></div>

36
examples/min-zoom.js Normal file
View File

@@ -0,0 +1,36 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var viewport = document.getElementById('map');
function getMinZoom() {
var width = viewport.clientWidth;
return Math.ceil(Math.LOG2E * Math.log(width / 256));
}
var initialZoom = getMinZoom();
var view = new ol.View({
center: [0, 0],
minZoom: initialZoom,
zoom: initialZoom
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: view
});
window.addEventListener('resize', function() {
var minZoom = getMinZoom();
if (minZoom !== view.getMinZoom()) {
view.setMinZoom(minZoom);
}
});

View File

@@ -0,0 +1,12 @@
---
layout: example.html
title: Mousewheel/Trackpad Zoom
shortdesc: Restrict wheel/trackpad zooming to integer zoom levels.
docs: >
By default, the `ol.interaction.MouseWheelZoom` can leave the map at
fractional zoom levels. If instead you want to constrain wheel/trackpad
zooming to integer zoom levels, set <code>constrainResolution: true</code>
when constructing the interaction.
tags: "trackpad, mousewheel, zoom, interaction"
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,25 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.interaction');
goog.require('ol.interaction.MouseWheelZoom');
goog.require('ol.layer.Tile');
goog.require('ol.source.OSM');
var map = new ol.Map({
interactions: ol.interaction.defaults({mouseWheelZoom: false}).extend([
new ol.interaction.MouseWheelZoom({
constrainResolution: true // force zooming to a integer zoom
})
]),
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
})
});

View File

@@ -8,7 +8,7 @@ docs: >
in <a href="https://epsg.io/">EPSG.io</a> database.
tags: "reprojection, projection, proj4js, epsg.io"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of single image source.
tags: "reprojection, projection, proj4js, image, imagestatic"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -6,7 +6,7 @@ docs: >
This example shows client-side raster reprojection between various projections.
tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
---
<div id="map" class="map"></div>
<form class="form-inline">

View File

@@ -72,7 +72,8 @@ layers['wms4326'] = new ol.layer.Tile({
url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
},
projection: 'EPSG:4326'
})
@@ -99,13 +100,15 @@ fetch(url).then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result,
{layer: 'OSM_Land_Mask', matrixSet: 'EPSG3413_250m'});
var options = ol.source.WMTS.optionsFromCapabilities(result, {
layer: 'OSM_Land_Mask',
matrixSet: 'EPSG3413_250m'
});
options.crossOrigin = '';
options.projection = 'EPSG:3413';
options.wrapX = false;
layers['wmts3413'] = new ol.layer.Tile({
source: new ol.source.WMTS(options)
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
});
});
@@ -131,7 +134,7 @@ layers['states'] = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '',
params: {'LAYERS': 'topp:states', 'TILED': true},
params: {'LAYERS': 'topp:states'},
serverType: 'geoserver',
tileGrid: new ol.tilegrid.TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219],

View File

@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of OpenStreetMap to NAD83 Indiana East, including a ScaleLine control with US units.
tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -6,6 +6,6 @@ docs: >
Example of a Sphere Mollweide map with a Graticule component.
tags: "graticule, Mollweide, projection, proj4js"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
---
<div id="map" class="map"></div>

View File

@@ -22,7 +22,8 @@ var map4326 = new ol.Map({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
}
})
}),
@@ -42,7 +43,8 @@ var map3857 = new ol.Map({
source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms',
params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR'
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
}
})
}),

View File

@@ -6,7 +6,7 @@ docs: >
With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections.
tags: "wms, single image, proj4js, projection"
resources:
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.15/proj4.js
- https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js
- https://epsg.io/21781-1753.js
---
<div id="map" class="map"></div>

View File

@@ -15,6 +15,7 @@ var layers = [
source: new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'topp:states'},
ratio: 1,
serverType: 'geoserver'
})
})

View File

@@ -34,6 +34,6 @@ fetch(capabilitiesUrl).then(function(response) {
});
options.tilePixelRatio = tilePixelRatio;
map.addLayer(new ol.layer.Tile({
source: new ol.source.WMTS(options)
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
}));
});

View File

@@ -12,8 +12,10 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result,
{layer: 'layer-7328', matrixSet: 'EPSG:3857'});
var options = ol.source.WMTS.optionsFromCapabilities(result, {
layer: 'layer-7328',
matrixSet: 'EPSG:3857'
});
map = new ol.Map({
layers: [
@@ -23,7 +25,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
}),
new ol.layer.Tile({
opacity: 1,
source: new ol.source.WMTS(options)
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
})
],
target: 'map',

View File

@@ -8,6 +8,21 @@ var olx;
/* typedefs for object literals provided by applications */
/**
* @typedef {{unique: (boolean|undefined)}}
*/
olx.CollectionOptions;
/**
* Disallow the same item from being added to the collection twice. Default is
* false.
* @type {boolean|undefined}
* @api
*/
olx.CollectionOptions.prototype.unique;
/**
* @typedef {{html: string,
* tileRanges: (Object.<string, Array.<ol.TileRange>>|undefined)}}
@@ -2285,7 +2300,8 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType;
* srsName: (string|undefined),
* handle: (string|undefined),
* nativeElements: Array.<Object>,
* gmlOptions: (olx.format.GMLOptions|undefined)}}
* gmlOptions: (olx.format.GMLOptions|undefined),
* version: (string|undefined)}}
*/
olx.format.WFSWriteTransactionOptions;
@@ -2347,6 +2363,15 @@ olx.format.WFSWriteTransactionOptions.prototype.nativeElements;
olx.format.WFSWriteTransactionOptions.prototype.gmlOptions;
/**
* WFS version to use for the transaction. Can be either `1.0.0` or `1.1.0`.
* Default is `1.1.0`.
* @type {string|undefined}
* @api
*/
olx.format.WFSWriteTransactionOptions.prototype.version;
/**
* @typedef {{splitCollection: (boolean|undefined)}}
*/
@@ -2388,7 +2413,9 @@ olx.interaction;
/**
* Interactions for the map. Default is `true` for all options.
* @typedef {{altShiftDragRotate: (boolean|undefined),
* @typedef {{
* altShiftDragRotate: (boolean|undefined),
* constrainResolution: (boolean|undefined),
* doubleClickZoom: (boolean|undefined),
* keyboard: (boolean|undefined),
* mouseWheelZoom: (boolean|undefined),
@@ -2397,7 +2424,8 @@ olx.interaction;
* pinchRotate: (boolean|undefined),
* pinchZoom: (boolean|undefined),
* zoomDelta: (number|undefined),
* zoomDuration: (number|undefined)}}
* zoomDuration: (number|undefined)
* }}
*/
olx.interaction.DefaultsOptions;
@@ -2410,6 +2438,15 @@ olx.interaction.DefaultsOptions;
olx.interaction.DefaultsOptions.prototype.altShiftDragRotate;
/**
* Zoom to the closest integer zoom level after the wheel/trackpad or
* pinch gesture ends. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.DefaultsOptions.prototype.constrainResolution;
/**
* Whether double click zoom is desired. Default is `true`.
* @type {boolean|undefined}
@@ -2540,6 +2577,7 @@ olx.interaction.DragAndDropOptions.prototype.target;
/**
* @typedef {{className: (string|undefined),
* condition: (ol.EventsConditionType|undefined),
* minArea: (number|undefined),
* boxEndCondition: (ol.DragBoxEndConditionType|undefined)}}
*/
olx.interaction.DragBoxOptions;
@@ -2563,19 +2601,19 @@ olx.interaction.DragBoxOptions.prototype.className;
olx.interaction.DragBoxOptions.prototype.condition;
/**
* The minimum area of the box in pixel, this value is used by the default
* `boxEndCondition` function. Default is `64`.
* @type {number|undefined}
* @api
*/
olx.interaction.DragBoxOptions.prototype.minArea;
/**
* A function that takes a {@link ol.MapBrowserEvent} and two
* {@link ol.Pixel}s to indicate whether a boxend event should be fired.
* Default is:
* ```js
* function(mapBrowserEvent,
* startPixel, endPixel) {
* var width = endPixel[0] - startPixel[0];
* var height = endPixel[1] - startPixel[1];
* return width * width + height * height >=
* ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED;
* }
* ```
* {@link ol.Pixel}s to indicate whether a `boxend` event should be fired.
* Default is `true` if the area of the box is bigger than the `minArea` option.
* @type {ol.DragBoxEndConditionType|undefined}
* @api
*/
@@ -3076,7 +3114,8 @@ olx.interaction.ModifyOptions.prototype.wrapX;
/**
* @typedef {{duration: (number|undefined),
* @typedef {{constrainResolution: (boolean|undefined),
* duration: (number|undefined),
* timeout: (number|undefined),
* useAnchor: (boolean|undefined)}}
*/
@@ -3099,6 +3138,16 @@ olx.interaction.MouseWheelZoomOptions.prototype.duration;
olx.interaction.MouseWheelZoomOptions.prototype.timeout;
/**
* When using a trackpad or magic mouse, zoom to the closest integer zoom level
* after the scroll gesture ends.
* Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.MouseWheelZoomOptions.prototype.constrainResolution;
/**
* Enable zooming using the mouse's location as the anchor. Default is `true`.
* When set to false, zooming in and out will zoom to the center of the screen
@@ -3133,7 +3182,10 @@ olx.interaction.PinchRotateOptions.prototype.threshold;
/**
* @typedef {{duration: (number|undefined)}}
* @typedef {{
* duration: (number|undefined),
* constrainResolution: (boolean|undefined)
* }}
*/
olx.interaction.PinchZoomOptions;
@@ -3881,7 +3933,7 @@ olx.layer.TileOptions.prototype.useInterimTilesOnError;
/**
* @typedef {{renderOrder: (function(ol.Feature, ol.Feature):number|null|undefined),
* @typedef {{renderOrder: (ol.RenderOrderFunction|null|undefined),
* minResolution: (number|undefined),
* maxResolution: (number|undefined),
* opacity: (number|undefined),
@@ -3900,7 +3952,7 @@ olx.layer.VectorOptions;
* Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created. Use `null` to
* avoid the sort, but get an undefined draw order.
* @type {function(ol.Feature, ol.Feature):number|null|undefined}
* @type {ol.RenderOrderFunction|null|undefined}
* @api
*/
olx.layer.VectorOptions.prototype.renderOrder;
@@ -4015,7 +4067,7 @@ olx.layer.VectorOptions.prototype.visible;
* preload: (number|undefined),
* renderBuffer: (number|undefined),
* renderMode: (ol.layer.VectorTileRenderType|string|undefined),
* renderOrder: (function(ol.Feature, ol.Feature):number|undefined),
* renderOrder: (ol.RenderOrderFunction|undefined),
* source: (ol.source.VectorTile|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* updateWhileAnimating: (boolean|undefined),
@@ -4058,7 +4110,7 @@ olx.layer.VectorTileOptions.prototype.renderMode;
/**
* Render order. Function to be used when sorting features before rendering. By
* default features are drawn in the order that they are created.
* @type {function(ol.Feature, ol.Feature):number|undefined}
* @type {ol.RenderOrderFunction|undefined}
* @api
*/
olx.layer.VectorTileOptions.prototype.renderOrder;
@@ -6986,7 +7038,7 @@ olx.style.IconOptions.prototype.opacity;
/**
* Scale.
* Scale. Default is `1`.
* @type {number|undefined}
* @api
*/
@@ -7044,7 +7096,7 @@ olx.style.IconOptions.prototype.imgSize;
/**
* Image source URI.
* @type {string}
* @type {string|undefined}
* @api
*/
olx.style.IconOptions.prototype.src;
@@ -7093,7 +7145,7 @@ olx.style.RegularShapeOptions.prototype.radius;
/**
* Inner radius of a star.
* Outer radius of a star.
* @type {number|undefined}
* @api
*/
@@ -7101,7 +7153,7 @@ olx.style.RegularShapeOptions.prototype.radius1;
/**
* Outer radius of a star.
* Inner radius of a star.
* @type {number|undefined}
* @api
*/

View File

@@ -7,25 +7,31 @@
/**
* @constructor
*/
var proj4 = function() {};
var Proj4 = function() {};
/**
* @type {function(Array.<number>): Array.<number>}
* @param {ol.Coordinate} coordinates
* @return {ol.Coordinate}
*/
proj4.prototype.forward;
Proj4.prototype.forward = function(coordinates) {};
/**
* @type {function(Array.<number>): Array.<number>}
* @param {ol.Coordinate} coordinates
* @return {ol.Coordinate}
*/
proj4.prototype.inverse;
Proj4.prototype.inverse = function(coordinates) {};
/**
* @param {string} name
* @param {(string|Object)=} opt_def
* @return {undefined|Object.<string, Object.<{axis: string, units: string,
* to_meter: number}>>}
* @return {undefined|Object.<string, Object.<{axis: string, units: string, to_meter: number}>>}
*/
proj4.defs = function(name, opt_def) {};
Proj4.prototype.defs = function(name, opt_def) {};
/**
* @type {Proj4}
*/
var proj4;

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "4.0.0",
"version": "4.1.0",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -30,11 +30,11 @@
"css/ol.css"
],
"dependencies": {
"async": "2.1.4",
"browserify": "14.0.0",
"closure-util": "1.17.0",
"async": "2.3.0",
"browserify": "14.3.0",
"closure-util": "1.18.0",
"derequire": "2.0.6",
"fs-extra": "2.0.0",
"fs-extra": "2.1.2",
"glob": "7.1.1",
"handlebars": "4.0.6",
"jsdoc": "3.4.3",
@@ -50,27 +50,26 @@
"walk": "2.3.9"
},
"devDependencies": {
"clean-css-cli": "4.0.6",
"coveralls": "2.11.16",
"clean-css-cli": "4.0.12",
"coveralls": "2.13.0",
"debounce": "^1.0.0",
"eslint": "3.15.0",
"eslint": "3.18.0",
"eslint-config-openlayers": "7.0.0",
"eslint-plugin-openlayers-internal": "^3.1.0",
"esprima": "2.x",
"expect.js": "0.3.1",
"gaze": "^1.0.0",
"istanbul": "0.4.5",
"jquery": "3.1.1",
"jquery": "3.2.1",
"jscodeshift": "^0.3.30",
"mocha": "3.2.0",
"mocha-phantomjs-core": "^2.1.0",
"mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.14",
"proj4": "2.3.17",
"proj4": "2.4.3",
"resemblejs": "2.2.3",
"serve-files": "1.0.1",
"sinon": "1.17.7",
"slimerjs": "0.906.2"
"sinon": "2.1.0",
"slimerjs": "0.10.3"
},
"eslintConfig": {
"extends": "openlayers",

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "3.21.0-beta.17",
"version": "4.1.0",
"description": "OpenLayers as ES2015 modules",
"main": "index.js",
"module": "index.js",
@@ -10,5 +10,15 @@
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"vector-tile": "1.3.0"
},
"browserify": {
"transform": [
[
"babelify",
{
"plugins": ["transform-es2015-modules-commonjs"]
}
]
]
}
}

View File

@@ -13,11 +13,12 @@ goog.require('ol');
*/
ol.AssertionError = function(code) {
var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';
/**
* @type {string}
*/
this.message = 'Assertion failed. See ' +
(ol.VERSION ? 'https://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
this.message = 'Assertion failed. See https://openlayers.org/en/' + path +
'/doc/errors/#' + code + ' for details.';
/**

View File

@@ -6,6 +6,7 @@
goog.provide('ol.Collection');
goog.require('ol');
goog.require('ol.AssertionError');
goog.require('ol.CollectionEventType');
goog.require('ol.Object');
goog.require('ol.events.Event');
@@ -23,19 +24,34 @@ goog.require('ol.events.Event');
* @extends {ol.Object}
* @fires ol.Collection.Event
* @param {!Array.<T>=} opt_array Array.
* @param {olx.CollectionOptions=} opt_options Collection options.
* @template T
* @api
*/
ol.Collection = function(opt_array) {
ol.Collection = function(opt_array, opt_options) {
ol.Object.call(this);
var options = opt_options || {};
/**
* @private
* @type {boolean}
*/
this.unique_ = !!options.unique;
/**
* @private
* @type {!Array.<T>}
*/
this.array_ = opt_array ? opt_array : [];
if (this.unique_) {
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
this.assertUnique_(this.array_[i], i);
}
}
this.updateLength_();
};
@@ -125,6 +141,9 @@ ol.Collection.prototype.getLength = function() {
* @api
*/
ol.Collection.prototype.insertAt = function(index, elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
this.array_.splice(index, 0, elem);
this.updateLength_();
this.dispatchEvent(
@@ -150,6 +169,9 @@ ol.Collection.prototype.pop = function() {
* @api
*/
ol.Collection.prototype.push = function(elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
var n = this.getLength();
this.insertAt(n, elem);
return this.getLength();
@@ -200,6 +222,9 @@ ol.Collection.prototype.removeAt = function(index) {
ol.Collection.prototype.setAt = function(index, elem) {
var n = this.getLength();
if (index < n) {
if (this.unique_) {
this.assertUnique_(elem, index);
}
var prev = this.array_[index];
this.array_[index] = elem;
this.dispatchEvent(
@@ -224,6 +249,20 @@ ol.Collection.prototype.updateLength_ = function() {
};
/**
* @private
* @param {T} elem Element.
* @param {number=} opt_except Optional index to ignore.
*/
ol.Collection.prototype.assertUnique_ = function(elem, opt_except) {
for (var i = 0, ii = this.array_.length; i < ii; ++i) {
if (this.array_[i] === elem && i !== opt_except) {
throw new ol.AssertionError(58);
}
}
};
/**
* @enum {string}
* @private

View File

@@ -148,6 +148,44 @@ ol.control.OverviewMap = function(opt_options) {
render: render,
target: options.target
});
/* Interactive map */
var scope = this;
var overlay = this.boxOverlay_;
var overlayBox = this.boxOverlay_.getElement();
/* Functions definition */
var computeDesiredMousePosition = function(mousePosition) {
return {
clientX: mousePosition.clientX - (overlayBox.offsetWidth / 2),
clientY: mousePosition.clientY + (overlayBox.offsetHeight / 2)
};
};
var move = function(event) {
var coordinates = ovmap.getEventCoordinate(computeDesiredMousePosition(event));
overlay.setPosition(coordinates);
};
var endMoving = function(event) {
var coordinates = ovmap.getEventCoordinate(event);
scope.getMap().getView().setCenter(coordinates);
window.removeEventListener('mousemove', move);
window.removeEventListener('mouseup', endMoving);
};
/* Binding */
overlayBox.addEventListener('mousedown', function() {
window.addEventListener('mousemove', move);
window.addEventListener('mouseup', endMoving);
});
};
ol.inherits(ol.control.OverviewMap, ol.control.Control);

View File

@@ -120,16 +120,8 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
// upon it
return;
}
var currentRotation = view.getRotation();
if (currentRotation !== undefined) {
if (view.getRotation() !== undefined) {
if (this.duration_ > 0) {
currentRotation = currentRotation % (2 * Math.PI);
if (currentRotation < -Math.PI) {
currentRotation += 2 * Math.PI;
}
if (currentRotation > Math.PI) {
currentRotation -= 2 * Math.PI;
}
view.animate({
rotation: 0,
duration: this.duration_,

View File

@@ -203,7 +203,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
pointResolution /= 1852;
suffix = 'nm';
} else if (units == ol.control.ScaleLineUnits.METRIC) {
if (nominalCount < 1) {
if (nominalCount < 0.001) {
suffix = 'μm';
pointResolution *= 1000000;
} else if (nominalCount < 1) {
suffix = 'mm';
pointResolution *= 1000;
} else if (nominalCount < 1000) {

View File

@@ -28,7 +28,7 @@ ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
*/
ol.dom.outerWidth = function(element) {
var width = element.offsetWidth;
var style = element.currentStyle || getComputedStyle(element);
var style = getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width;
@@ -44,7 +44,7 @@ ol.dom.outerWidth = function(element) {
*/
ol.dom.outerHeight = function(element) {
var height = element.offsetHeight;
var style = element.currentStyle || getComputedStyle(element);
var style = getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height;

View File

@@ -26,7 +26,7 @@ ol.events.EventType = {
MOUSEOUT: 'mouseout',
MOUSEUP: 'mouseup',
MOUSEWHEEL: 'mousewheel',
MSPOINTERDOWN: 'mspointerdown',
MSPOINTERDOWN: 'MSPointerDown',
RESIZE: 'resize',
TOUCHSTART: 'touchstart',
TOUCHMOVE: 'touchmove',

View File

@@ -64,6 +64,12 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
failure.call(this);
}
}.bind(this);
/**
* @private
*/
xhr.onerror = function() {
failure.call(this);
}.bind(this);
xhr.send();
});
};

View File

@@ -2,8 +2,10 @@ goog.provide('ol.format.GML2');
goog.require('ol');
goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.xml');
@@ -57,7 +59,6 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName'];
var containerDimension = node.parentNode.getAttribute('srsDimension');
var axisOrientation = 'enu';
if (containerSrs) {
var proj = ol.proj.get(containerSrs);
@@ -65,24 +66,14 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
axisOrientation = proj.getAxisOrientation();
}
}
var coords = s.split(/[\s,]+/);
// The "dimension" attribute is from the GML 3.0.1 spec.
var dim = 2;
if (node.getAttribute('srsDimension')) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('srsDimension'));
} else if (node.getAttribute('dimension')) {
dim = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('dimension'));
} else if (containerDimension) {
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
}
var coordsGroups = s.trim().split(/\s+/);
var x, y, z;
var flatCoordinates = [];
for (var i = 0, ii = coords.length; i < ii; i += dim) {
x = parseFloat(coords[i]);
y = parseFloat(coords[i + 1]);
z = (dim === 3) ? parseFloat(coords[i + 2]) : 0;
for (var i = 0, ii = coordsGroups.length; i < ii; i++) {
var coords = coordsGroups[i].split(/,+/);
x = parseFloat(coords[0]);
y = parseFloat(coords[1]);
z = (coords.length === 3) ? parseFloat(coords[2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z);
} else {
@@ -204,3 +195,569 @@ ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_)
}
};
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface'];
var surface = context['surface'];
var multiCurve = context['multiCurve'];
var nodeName;
if (!Array.isArray(value)) {
nodeName = /** @type {ol.geom.Geometry} */ (value).getType();
if (nodeName === 'MultiPolygon' && multiSurface === true) {
nodeName = 'MultiSurface';
} else if (nodeName === 'Polygon' && surface === true) {
nodeName = 'Surface';
} else if (nodeName === 'MultiLineString' && multiCurve === true) {
nodeName = 'MultiCurve';
}
} else {
nodeName = 'Envelope';
}
return ol.xml.createElementNS('http://www.opengis.net/gml',
nodeName);
};
/**
* @param {Node} node Node.
* @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
var fid = feature.getId();
if (fid) {
node.setAttribute('fid', fid);
}
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var featureNS = context['featureNS'];
var geometryName = feature.getGeometryName();
if (!context.serializers) {
context.serializers = {};
context.serializers[featureNS] = {};
}
var properties = feature.getProperties();
var keys = [], values = [];
for (var key in properties) {
var value = properties[key];
if (value !== null) {
keys.push(key);
values.push(value);
if (key == geometryName || value instanceof ol.geom.Geometry) {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
this.writeGeometryElement, this);
}
} else {
if (!(key in context.serializers[featureNS])) {
context.serializers[featureNS][key] = ol.xml.makeChildAppender(
ol.format.XSD.writeStringTextNode);
}
}
}
}
var item = ol.obj.assign({}, context);
item.node = node;
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), context.serializers,
ol.xml.makeSimpleNodeFactory(undefined, featureNS),
values,
objectStack, keys);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack.
*/
ol.format.GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = ol.obj.assign({}, context);
item.node = node;
var value;
if (Array.isArray(geometry)) {
if (context.dataProjection) {
value = ol.proj.transformExtent(
geometry, context.featureProjection, context.dataProjection);
} else {
value = geometry;
}
} else {
value =
ol.format.Feature.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), ol.format.GML2.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} geometry LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) {
node.setAttribute('srsName', srsName);
}
if (node.nodeName === 'LineString' ||
node.nodeName === 'LineStringSegment') {
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
} else if (node.nodeName === 'Curve') {
var segments = ol.xml.createElementNS(node.namespaceURI, 'segments');
node.appendChild(segments);
this.writeCurveSegments_(segments,
geometry, objectStack);
}
};
/**
* @param {string} namespaceURI XML namespace.
* @returns {Node} coordinates node.
* @private
*/
ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = ol.xml.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ',');
coordinates.setAttribute('ts', ' ');
return coordinates;
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString|ol.geom.LinearRing} value Geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
// only 2d for simple features profile
var points = value.getCoordinates();
var len = points.length;
var parts = new Array(len);
var point;
for (var i = 0; i < len; ++i) {
point = points[i];
parts[i] = this.getCoords_(point, srsName);
}
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI,
'LineStringSegment');
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} geometry Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (node.nodeName !== 'PolygonPatch' && srsName) {
node.setAttribute('srsName', srsName);
}
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
{node: node, srsName: srsName},
ol.format.GML2.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') {
var patches = ol.xml.createElementNS(node.namespaceURI, 'patches');
node.appendChild(patches);
this.writeSurfacePatches_(
patches, geometry, objectStack);
}
};
/**
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node} Node.
* @private
*/
ol.format.GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1];
var parentNode = context.node;
var exteriorWritten = context['exteriorWritten'];
if (exteriorWritten === undefined) {
context['exteriorWritten'] = true;
}
return ol.xml.createElementNS(parentNode.namespaceURI,
exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LinearRing} ring LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = ol.xml.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack);
};
/**
* @param {Array.<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName
* @return {string} The coords string.
* @private
*/
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
}
return ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
point[1] + ',' + point[0]);
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiLineString} geometry MultiLineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
var curve = context['curve'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve},
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Point} geometry Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName);
ol.format.XSD.writeStringTextNode(coordinates, coord);
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiPoint} geometry MultiPoint geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName},
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Point} point Point geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writePointMember_ = function(node, point, objectStack) {
var child = ol.xml.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child);
this.writePoint_(child, point, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.LineString} line LineString geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) {
node.appendChild(child);
this.writeCurveOrLineString_(child, line, objectStack);
}
};
/**
* @param {Node} node Node.
* @param {ol.geom.LinearRing} geometry LinearRing geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
this.writeCoordinates_(coordinates, geometry, objectStack);
};
/**
* @param {Node} node Node.
* @param {ol.geom.MultiPolygon} geometry MultiPolygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
var surface = context['surface'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface},
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this);
};
/**
* @param {Node} node Node.
* @param {ol.geom.Polygon} polygon Polygon geometry.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack);
if (child) {
node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
}
};
/**
* @param {Node} node Node.
* @param {ol.Extent} extent Extent.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), ol.format.GML2.ENVELOPE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
values,
objectStack, keys, this);
};
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'Curve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiCurve': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'Point': ol.xml.makeChildAppender(ol.format.GML2.prototype.writePoint_),
'MultiPoint': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiPoint_),
'LineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeCurveOrLineString_),
'MultiLineString': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLinearRing_),
'Polygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeEnvelope)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'outerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_),
'innerBoundaryIs': ol.xml.makeChildAppender(ol.format.GML2.prototype.writeRing_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'pointMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writePointMember_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeLineStringOrCurveMember_)
}
};
/**
* @const
* @param {*} value Value.
* @param {Array.<*>} objectStack Object stack.
* @param {string=} opt_nodeName Node name.
* @return {Node|undefined} Node.
* @private
*/
ol.format.GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var parentNode = objectStack[objectStack.length - 1].node;
return ol.xml.createElementNS('http://www.opengis.net/gml',
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
};
/**
* @const
* @type {Object.<string, string>}
* @private
*/
ol.format.GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember',
'MultiSurface': 'surfaceMember'
};
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'surfaceMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': ol.xml.makeChildAppender(
ol.format.GML2.prototype.writeSurfaceOrPolygonMember_)
}
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.GML2.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': {
'lowerCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode),
'upperCorner': ol.xml.makeChildAppender(ol.format.XSD.writeStringTextNode)
}
};

View File

@@ -2,6 +2,7 @@ goog.provide('ol.format.WFS');
goog.require('ol');
goog.require('ol.asserts');
goog.require('ol.format.GML2');
goog.require('ol.format.GML3');
goog.require('ol.format.GMLBase');
goog.require('ol.format.filter');
@@ -53,7 +54,8 @@ ol.format.WFS = function(opt_options) {
* @type {string}
*/
this.schemaLocation_ = options.schemaLocation ?
options.schemaLocation : ol.format.WFS.SCHEMA_LOCATION;
options.schemaLocation :
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
ol.format.XMLFeature.call(this);
};
@@ -88,12 +90,23 @@ ol.format.WFS.OGCNS = 'http://www.opengis.net/ogc';
ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
/**
* @const
* @type {Object.<string, string>}
*/
ol.format.WFS.SCHEMA_LOCATIONS = {
'1.1.0': 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd',
'1.0.0': 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.0.0/wfs.xsd'
};
/**
* @const
* @type {string}
*/
ol.format.WFS.SCHEMA_LOCATION = 'http://www.opengis.net/wfs ' +
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd';
ol.format.WFS.DEFAULT_VERSION = '1.1.0';
/**
@@ -360,9 +373,14 @@ ol.format.WFS.writeFeature_ = function(node, feature, objectStack) {
var context = objectStack[objectStack.length - 1];
var featureType = context['featureType'];
var featureNS = context['featureNS'];
var gmlVersion = context['gmlVersion'];
var child = ol.xml.createElementNS(featureNS, featureType);
node.appendChild(child);
if (gmlVersion === 2) {
ol.format.GML2.prototype.writeFeatureElement(child, feature, objectStack);
} else {
ol.format.GML3.prototype.writeFeatureElement(child, feature, objectStack);
}
};
@@ -433,7 +451,8 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
}
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
{node: node, 'srsName': context['srsName']}),
{'gmlVersion': context['gmlVersion'], node: node,
'srsName': context['srsName']}),
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Property'), values,
objectStack);
@@ -450,14 +469,21 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
*/
ol.format.WFS.writeProperty_ = function(node, pair, objectStack) {
var name = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Name');
var context = objectStack[objectStack.length - 1];
var gmlVersion = context['gmlVersion'];
node.appendChild(name);
ol.format.XSD.writeStringTextNode(name, pair.name);
if (pair.value !== undefined && pair.value !== null) {
var value = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Value');
node.appendChild(value);
if (pair.value instanceof ol.geom.Geometry) {
if (gmlVersion === 2) {
ol.format.GML2.prototype.writeGeometryElement(value,
pair.value, objectStack);
} else {
ol.format.GML3.prototype.writeGeometryElement(value,
pair.value, objectStack);
}
} else {
ol.format.XSD.writeStringTextNode(value, pair.value);
}
@@ -756,6 +782,20 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
};
/**
* Encode filter as WFS `Filter` and return the Node.
*
* @param {ol.format.filter.Filter} filter Filter.
* @return {Node} Result.
* @api
*/
ol.format.WFS.writeFilter = function(filter) {
var child = ol.xml.createElementNS(ol.format.WFS.OGCNS, 'Filter');
ol.format.WFS.writeFilterCondition_(child, filter, []);
return child;
};
/**
* @param {Node} node Node.
* @param {Array.<string>} featureTypes Feature types.
@@ -851,8 +891,11 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
options) {
var objectStack = [];
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
var version = options.version ?
options.version : ol.format.WFS.DEFAULT_VERSION;
var gmlVersion = version === '1.0.0' ? 2 : 3;
node.setAttribute('service', 'WFS');
node.setAttribute('version', '1.1.0');
node.setAttribute('version', version);
var baseObj;
/** @type {ol.XmlNodeStackItem} */
var obj;
@@ -862,12 +905,13 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
node.setAttribute('handle', options.handle);
}
}
var schemaLocation = ol.format.WFS.SCHEMA_LOCATIONS[version];
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation', this.schemaLocation_);
'xsi:schemaLocation', schemaLocation);
if (inserts) {
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'srsName': options.srsName};
'gmlVersion': gmlVersion, 'srsName': options.srsName};
ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -877,7 +921,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
if (updates) {
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'srsName': options.srsName};
'gmlVersion': gmlVersion, 'srsName': options.srsName};
ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -887,7 +931,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
if (deletes) {
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'srsName': options.srsName},
'gmlVersion': gmlVersion, 'srsName': options.srsName},
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Delete'), deletes,
objectStack);
@@ -895,7 +939,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
if (options.nativeElements) {
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'srsName': options.srsName},
'gmlVersion': gmlVersion, 'srsName': options.srsName},
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Native'), options.nativeElements,
objectStack);

View File

@@ -192,12 +192,12 @@ ol.Geolocation.prototype.getAccuracy = function() {
/**
* Get a geometry of the position accuracy.
* @return {?ol.geom.Geometry} A geometry of the position accuracy.
* @return {?ol.geom.Polygon} A geometry of the position accuracy.
* @observable
* @api
*/
ol.Geolocation.prototype.getAccuracyGeometry = function() {
return /** @type {?ol.geom.Geometry} */ (
return /** @type {?ol.geom.Polygon} */ (
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
};

View File

@@ -47,12 +47,6 @@ ol.DEFAULT_TILE_SIZE = 256;
ol.DEFAULT_WMS_VERSION = '1.3.0';
/**
* @define {number} Hysteresis pixels.
*/
ol.DRAG_BOX_HYSTERESIS_PIXELS = 8;
/**
* @define {boolean} Enable the Canvas renderer. Default is `true`. Setting
* this to false at compile time in advanced mode removes all code

View File

@@ -75,6 +75,7 @@ ol.interaction.defaults = function(opt_options) {
var pinchZoom = options.pinchZoom !== undefined ? options.pinchZoom : true;
if (pinchZoom) {
interactions.push(new ol.interaction.PinchZoom({
constrainResolution: options.constrainResolution,
duration: options.zoomDuration
}));
}
@@ -92,6 +93,7 @@ ol.interaction.defaults = function(opt_options) {
options.mouseWheelZoom : true;
if (mouseWheelZoom) {
interactions.push(new ol.interaction.MouseWheelZoom({
constrainResolution: options.constrainResolution,
duration: options.zoomDuration
}));
}

View File

@@ -8,15 +8,6 @@ goog.require('ol.interaction.Pointer');
goog.require('ol.render.Box');
/**
* @const
* @type {number}
*/
ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED =
ol.DRAG_BOX_HYSTERESIS_PIXELS *
ol.DRAG_BOX_HYSTERESIS_PIXELS;
/**
* @classdesc
* Allows the user to draw a vector box by clicking and dragging on the map,
@@ -50,6 +41,12 @@ ol.interaction.DragBox = function(opt_options) {
*/
this.box_ = new ol.render.Box(options.className || 'ol-dragbox');
/**
* @type {number}
* @private
*/
this.minArea_ = options.minArea !== undefined ? options.minArea : 64;
/**
* @type {ol.Pixel}
* @private
@@ -81,13 +78,12 @@ ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer);
* @param {ol.Pixel} startPixel The starting pixel of the box.
* @param {ol.Pixel} endPixel The end pixel of the box.
* @return {boolean} Whether or not the boxend condition should be fired.
* @this {ol.interaction.DragBox}
*/
ol.interaction.DragBox.defaultBoxEndCondition = function(mapBrowserEvent,
startPixel, endPixel) {
ol.interaction.DragBox.defaultBoxEndCondition = function(mapBrowserEvent, startPixel, endPixel) {
var width = endPixel[0] - startPixel[0];
var height = endPixel[1] - startPixel[1];
return width * width + height * height >=
ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED;
return width * width + height * height >= this.minArea_;
};

View File

@@ -39,6 +39,11 @@ ol.interaction.DragPan = function(opt_options) {
*/
this.lastCentroid = null;
/**
* @type {number}
*/
this.lastPointersCount_;
/**
* @private
* @type {ol.EventsConditionType}
@@ -62,8 +67,10 @@ ol.inherits(ol.interaction.DragPan, ol.interaction.Pointer);
* @private
*/
ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
var targetPointers = this.targetPointers;
var centroid =
ol.interaction.Pointer.centroid(this.targetPointers);
ol.interaction.Pointer.centroid(targetPointers);
if (targetPointers.length == this.lastPointersCount_) {
if (this.kinetic_) {
this.kinetic_.update(centroid[0], centroid[1]);
}
@@ -80,7 +87,13 @@ ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
center = view.constrainCenter(center);
view.setCenter(center);
}
} else if (this.kinetic_) {
// reset so we don't overestimate the kinetic energy after
// after one finger down, tiny drag, second finger down
this.kinetic_.begin();
}
this.lastCentroid = centroid;
this.lastPointersCount_ = targetPointers.length;
};

View File

@@ -44,6 +44,12 @@ ol.interaction.Draw = function(options) {
handleUpEvent: ol.interaction.Draw.handleUpEvent_
});
/**
* @type {boolean}
* @private
*/
this.shouldHandle_ = false;
/**
* @type {ol.Pixel}
* @private
@@ -325,6 +331,8 @@ ol.interaction.Draw.handleEvent = function(event) {
* @private
*/
ol.interaction.Draw.handleDownEvent_ = function(event) {
this.shouldHandle_ = !this.freehand_;
if (this.freehand_) {
this.downPx_ = event.pixel;
if (!this.finishCoordinate_) {
@@ -347,18 +355,13 @@ ol.interaction.Draw.handleDownEvent_ = function(event) {
* @private
*/
ol.interaction.Draw.handleUpEvent_ = function(event) {
var downPx = this.downPx_;
var clickPx = event.pixel;
var dx = downPx[0] - clickPx[0];
var dy = downPx[1] - clickPx[1];
var squaredDistance = dx * dx + dy * dy;
var pass = true;
var shouldHandle = this.freehand_ ?
squaredDistance > this.squaredClickTolerance_ :
squaredDistance <= this.squaredClickTolerance_;
var circleMode = this.mode_ === ol.interaction.Draw.Mode_.CIRCLE;
if (shouldHandle) {
this.handlePointerMove_(event);
var circleMode = this.mode_ === ol.interaction.Draw.Mode_.CIRCLE;
if (this.shouldHandle_) {
if (!this.finishCoordinate_) {
this.startDrawing_(event);
if (this.mode_ === ol.interaction.Draw.Mode_.POINT) {
@@ -374,8 +377,9 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
this.addToDrawing_(event);
}
pass = false;
} else if (circleMode) {
} else if (this.freehand_) {
this.finishCoordinate_ = null;
this.abortDrawing_();
}
return pass;
};
@@ -388,6 +392,19 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
* @private
*/
ol.interaction.Draw.prototype.handlePointerMove_ = function(event) {
if (this.downPx_ &&
((!this.freehand_ && this.shouldHandle_) ||
(this.freehand_ && !this.shouldHandle_))) {
var downPx = this.downPx_;
var clickPx = event.pixel;
var dx = downPx[0] - clickPx[0];
var dy = downPx[1] - clickPx[1];
var squaredDistance = dx * dx + dy * dy;
this.shouldHandle_ = this.freehand_ ?
squaredDistance > this.squaredClickTolerance_ :
squaredDistance <= this.squaredClickTolerance_;
}
if (this.finishCoordinate_) {
this.modifyDrawing_(event);
} else {
@@ -586,12 +603,18 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
* @api
*/
ol.interaction.Draw.prototype.removeLastPoint = function() {
if (!this.sketchFeature_) {
return;
}
var geometry = /** @type {ol.geom.SimpleGeometry} */ (this.sketchFeature_.getGeometry());
var coordinates, sketchLineGeom;
if (this.mode_ === ol.interaction.Draw.Mode_.LINE_STRING) {
coordinates = this.sketchCoords_;
coordinates.splice(-2, 1);
this.geometryFunction_(coordinates, geometry);
if (coordinates.length >= 2) {
this.finishCoordinate_ = coordinates[coordinates.length - 2].slice();
}
} else if (this.mode_ === ol.interaction.Draw.Mode_.POLYGON) {
coordinates = this.sketchCoords_[0];
coordinates.splice(-2, 1);

View File

@@ -550,6 +550,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
return false;
}
this.handlePointerAtPixel_(evt.pixel, evt.map);
var pixelCoordinate = evt.map.getCoordinateFromPixel(evt.pixel);
this.dragSegments_.length = 0;
this.modified_ = false;
var vertexFeature = this.vertexFeature_;
@@ -575,7 +576,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
if (segmentDataMatch.geometry.getType() === ol.geom.GeometryType.CIRCLE &&
segmentDataMatch.index === ol.interaction.Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
var closestVertex = ol.interaction.Modify.closestOnSegmentData_(vertex, segmentDataMatch);
var closestVertex = ol.interaction.Modify.closestOnSegmentData_(pixelCoordinate, segmentDataMatch);
if (ol.coordinate.equals(closestVertex, vertex) && !componentSegments[uid][0]) {
this.dragSegments_.push([segmentDataMatch, 0]);
componentSegments[uid][0] = segmentDataMatch;
@@ -1087,6 +1088,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() {
this.overlay_.getSource().removeFeature(this.vertexFeature_);
this.vertexFeature_ = null;
}
dragSegments.length = 0;
}
}

View File

@@ -50,6 +50,12 @@ ol.interaction.MouseWheelZoom = function(opt_options) {
*/
this.useAnchor_ = options.useAnchor !== undefined ? options.useAnchor : true;
/**
* @private
* @type {boolean}
*/
this.constrainResolution_ = options.constrainResolution || false;
/**
* @private
* @type {?ol.Coordinate}
@@ -186,6 +192,16 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
view.setCenter(view.constrainCenter(center));
}
view.setResolution(resolution);
if (rebound === 0 && this.constrainResolution_) {
view.animate({
resolution: view.constrainResolution(resolution, delta > 0 ? -1 : 1),
easing: ol.easing.easeOut,
anchor: this.lastAnchor_,
duration: this.duration_
});
}
if (rebound > 0) {
view.animate({
resolution: minResolution,

View File

@@ -2,6 +2,7 @@ goog.provide('ol.interaction.Translate');
goog.require('ol');
goog.require('ol.Collection');
goog.require('ol.events');
goog.require('ol.events.Event');
goog.require('ol.functions');
goog.require('ol.array');
@@ -82,6 +83,11 @@ ol.interaction.Translate = function(opt_options) {
* @private
*/
this.lastFeature_ = null;
ol.events.listen(this,
ol.Object.getChangeEventType(ol.interaction.Property.ACTIVE),
this.handleActiveChanged_, this);
};
ol.inherits(ol.interaction.Translate, ol.interaction.Pointer);
@@ -233,6 +239,43 @@ ol.interaction.Translate.prototype.setHitTolerance = function(hitTolerance) {
};
/**
* @inheritDoc
*/
ol.interaction.Translate.prototype.setMap = function(map) {
var oldMap = this.getMap();
ol.interaction.Pointer.prototype.setMap.call(this, map);
this.updateState_(oldMap);
};
/**
* @private
*/
ol.interaction.Translate.prototype.handleActiveChanged_ = function() {
this.updateState_(null);
};
/**
* @param {ol.Map} oldMap Old map.
* @private
*/
ol.interaction.Translate.prototype.updateState_ = function(oldMap) {
var map = this.getMap();
var active = this.getActive();
if ((!map || !active) && this.previousCursor_ !== undefined) {
if (!map) {
map = oldMap;
}
var elem = map.getTargetElement();
elem.style.cursor = this.previousCursor_;
this.previousCursor_ = undefined;
}
};
/**
* @classdesc
* Events emitted by {@link ol.interaction.Translate} instances are instances of

View File

@@ -54,14 +54,14 @@ ol.layer.Group = function(opt_options) {
if (layers) {
if (Array.isArray(layers)) {
layers = new ol.Collection(layers.slice());
layers = new ol.Collection(layers.slice(), {unique: true});
} else {
ol.asserts.assert(layers instanceof ol.Collection,
43); // Expected `layers` to be an array or an `ol.Collection`
layers = layers;
}
} else {
layers = new ol.Collection();
layers = new ol.Collection(undefined, {unique: true});
}
this.setLayers(layers);

View File

@@ -102,7 +102,7 @@ ol.layer.Vector.prototype.getRenderBuffer = function() {
* order.
*/
ol.layer.Vector.prototype.getRenderOrder = function() {
return /** @type {function(ol.Feature, ol.Feature):number|null|undefined} */ (
return /** @type {ol.RenderOrderFunction|null|undefined} */ (
this.get(ol.layer.Vector.Property_.RENDER_ORDER));
};
@@ -157,7 +157,7 @@ ol.layer.Vector.prototype.getUpdateWhileInteracting = function() {
/**
* @param {function(ol.Feature, ol.Feature):number|null|undefined} renderOrder
* @param {ol.RenderOrderFunction|null|undefined} renderOrder
* Render order.
*/
ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {

View File

@@ -71,7 +71,7 @@ ol.layer.VectorTile.prototype.createRenderer = function(mapRenderer) {
* @api
*/
ol.layer.VectorTile.prototype.getPreload = function() {
return /** @type {number} */ (this.get(ol.layer.VectorTile.Property_.PRELOAD));
return /** @type {number} */ (this.get(ol.layer.TileProperty.PRELOAD));
};
@@ -91,7 +91,7 @@ ol.layer.VectorTile.prototype.getRenderMode = function() {
*/
ol.layer.VectorTile.prototype.getUseInterimTilesOnError = function() {
return /** @type {boolean} */ (
this.get(ol.layer.VectorTile.Property_.USE_INTERIM_TILES_ON_ERROR));
this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR));
};
@@ -116,13 +116,3 @@ ol.layer.VectorTile.prototype.setUseInterimTilesOnError = function(useInterimTil
this.set(
ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR, useInterimTilesOnError);
};
/**
* @enum {string}
* @private
*/
ol.layer.VectorTile.Property_ = {
PRELOAD: 'preload',
USE_INTERIM_TILES_ON_ERROR: 'useInterimTilesOnError'
};

View File

@@ -30,7 +30,6 @@ goog.require('ol.has');
goog.require('ol.interaction');
goog.require('ol.layer.Group');
goog.require('ol.obj');
goog.require('ol.proj.common');
goog.require('ol.renderer.Map');
goog.require('ol.renderer.Type');
goog.require('ol.renderer.canvas.Map');
@@ -1501,5 +1500,3 @@ ol.Map.createOptionsInternal = function(options) {
};
};
ol.proj.common.add();

View File

@@ -464,6 +464,8 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
var positioning = this.getPositioning();
this.setVisible(true);
var offsetX = offset[0];
var offsetY = offset[1];
if (positioning == ol.OverlayPositioning.BOTTOM_RIGHT ||
@@ -514,8 +516,6 @@ ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
this.rendered_.top_ = style.top = top;
}
}
this.setVisible(true);
};

View File

@@ -2,6 +2,8 @@ goog.provide('ol.proj');
goog.require('ol');
goog.require('ol.extent');
goog.require('ol.proj.EPSG3857');
goog.require('ol.proj.EPSG4326');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.proj.proj4');
@@ -29,7 +31,7 @@ if (ol.ENABLE_PROJ4JS) {
* import proj4 from 'proj4';
* ol.proj.setProj4(proj4);
*
* @param {proj4} proj4 Proj4.
* @param {Proj4} proj4 Proj4.
* @api
*/
ol.proj.setProj4 = function(proj4) {
@@ -467,3 +469,24 @@ ol.proj.transformWithProjections = function(point, sourceProjection, destination
sourceProjection, destinationProjection);
return transformFn(point);
};
/**
* Add transforms to and from EPSG:4326 and EPSG:3857. This function is called
* by when this module is executed and should only need to be called again after
* `ol.proj.clearAllProjections()` is called (e.g. in tests).
*/
ol.proj.addCommon = function() {
// Add transformations that don't alter coordinates to convert within set of
// projections with equal meaning.
ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS);
ol.proj.addEquivalentProjections(ol.proj.EPSG4326.PROJECTIONS);
// Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
// coordinates and back.
ol.proj.addEquivalentTransforms(
ol.proj.EPSG4326.PROJECTIONS,
ol.proj.EPSG3857.PROJECTIONS,
ol.proj.EPSG3857.fromEPSG4326,
ol.proj.EPSG3857.toEPSG4326);
};
ol.proj.addCommon();

View File

@@ -1,24 +1,13 @@
goog.provide('ol.proj.common');
goog.require('ol.proj');
goog.require('ol.proj.EPSG3857');
goog.require('ol.proj.EPSG4326');
/**
* FIXME empty description for jsdoc
* Deprecated. Transforms between EPSG:4326 and EPSG:3857 are now included by
* default. There is no need to call this function in application code and it
* will be removed in a future major release.
* @deprecated This function is no longer necessary.
* @api
*/
ol.proj.common.add = function() {
// Add transformations that don't alter coordinates to convert within set of
// projections with equal meaning.
ol.proj.addEquivalentProjections(ol.proj.EPSG3857.PROJECTIONS);
ol.proj.addEquivalentProjections(ol.proj.EPSG4326.PROJECTIONS);
// Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
// coordinates and back.
ol.proj.addEquivalentTransforms(
ol.proj.EPSG4326.PROJECTIONS,
ol.proj.EPSG3857.PROJECTIONS,
ol.proj.EPSG3857.fromEPSG4326,
ol.proj.EPSG3857.toEPSG4326);
};
ol.proj.common.add = ol.proj.addCommon;

View File

@@ -2,7 +2,6 @@ goog.provide('ol.proj.EPSG3857');
goog.require('ol');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
@@ -16,7 +15,7 @@ goog.require('ol.proj.Units');
* @param {string} code Code.
* @private
*/
ol.proj.EPSG3857_ = function(code) {
ol.proj.EPSG3857.Projection_ = function(code) {
ol.proj.Projection.call(this, {
code: code,
units: ol.proj.Units.METERS,
@@ -28,7 +27,7 @@ ol.proj.EPSG3857_ = function(code) {
}
});
};
ol.inherits(ol.proj.EPSG3857_, ol.proj.Projection);
ol.inherits(ol.proj.EPSG3857.Projection_, ol.proj.Projection);
/**
@@ -85,7 +84,7 @@ ol.proj.EPSG3857.CODES = [
* @type {Array.<ol.proj.Projection>}
*/
ol.proj.EPSG3857.PROJECTIONS = ol.proj.EPSG3857.CODES.map(function(code) {
return new ol.proj.EPSG3857_(code);
return new ol.proj.EPSG3857.Projection_(code);
});

View File

@@ -1,7 +1,6 @@
goog.provide('ol.proj.EPSG4326');
goog.require('ol');
goog.require('ol.proj');
goog.require('ol.proj.Projection');
goog.require('ol.proj.Units');
goog.require('ol.sphere.WGS84');
@@ -21,7 +20,7 @@ goog.require('ol.sphere.WGS84');
* @param {string=} opt_axisOrientation Axis orientation.
* @private
*/
ol.proj.EPSG4326_ = function(code, opt_axisOrientation) {
ol.proj.EPSG4326.Projection_ = function(code, opt_axisOrientation) {
ol.proj.Projection.call(this, {
code: code,
units: ol.proj.Units.DEGREES,
@@ -32,7 +31,7 @@ ol.proj.EPSG4326_ = function(code, opt_axisOrientation) {
worldExtent: ol.proj.EPSG4326.EXTENT
});
};
ol.inherits(ol.proj.EPSG4326_, ol.proj.Projection);
ol.inherits(ol.proj.EPSG4326.Projection_, ol.proj.Projection);
/**
@@ -58,12 +57,12 @@ ol.proj.EPSG4326.METERS_PER_UNIT = Math.PI * ol.sphere.WGS84.radius / 180;
* @type {Array.<ol.proj.Projection>}
*/
ol.proj.EPSG4326.PROJECTIONS = [
new ol.proj.EPSG4326_('CRS:84'),
new ol.proj.EPSG4326_('EPSG:4326', 'neu'),
new ol.proj.EPSG4326_('urn:ogc:def:crs:EPSG::4326', 'neu'),
new ol.proj.EPSG4326_('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
new ol.proj.EPSG4326_('urn:ogc:def:crs:OGC:1.3:CRS84'),
new ol.proj.EPSG4326_('urn:ogc:def:crs:OGC:2:84'),
new ol.proj.EPSG4326_('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
new ol.proj.EPSG4326_('urn:x-ogc:def:crs:EPSG:4326', 'neu')
new ol.proj.EPSG4326.Projection_('CRS:84'),
new ol.proj.EPSG4326.Projection_('EPSG:4326', 'neu'),
new ol.proj.EPSG4326.Projection_('urn:ogc:def:crs:EPSG::4326', 'neu'),
new ol.proj.EPSG4326.Projection_('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
new ol.proj.EPSG4326.Projection_('urn:ogc:def:crs:OGC:1.3:CRS84'),
new ol.proj.EPSG4326.Projection_('urn:ogc:def:crs:OGC:2:84'),
new ol.proj.EPSG4326.Projection_('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
new ol.proj.EPSG4326.Projection_('urn:x-ogc:def:crs:EPSG:4326', 'neu')
];

View File

@@ -3,14 +3,14 @@ goog.provide('ol.proj.proj4');
/**
* @private
* @type {proj4}
* @type {Proj4}
*/
ol.proj.proj4.cache_ = null;
/**
* Store the proj4 function.
* @param {proj4} proj4 The proj4 function.
* @param {Proj4} proj4 The proj4 function.
*/
ol.proj.proj4.set = function(proj4) {
ol.proj.proj4.cache_ = proj4;
@@ -19,7 +19,7 @@ ol.proj.proj4.set = function(proj4) {
/**
* Get proj4.
* @return {proj4} The proj4 function set above or available globally.
* @return {Proj4} The proj4 function set above or available globally.
*/
ol.proj.proj4.get = function() {
return ol.proj.proj4.cache_ || window['proj4'];

View File

@@ -3,6 +3,7 @@ goog.provide('ol.renderer.canvas.IntermediateCanvas');
goog.require('ol');
goog.require('ol.coordinate');
goog.require('ol.dom');
goog.require('ol.extent');
goog.require('ol.renderer.canvas.Layer');
goog.require('ol.transform');
@@ -29,12 +30,6 @@ ol.renderer.canvas.IntermediateCanvas = function(layer) {
*/
this.hitCanvasContext_ = null;
/**
* @protected
* @type {number}
*/
this.renderedResolution;
};
ol.inherits(ol.renderer.canvas.IntermediateCanvas, ol.renderer.canvas.Layer);
@@ -51,7 +46,9 @@ ol.renderer.canvas.IntermediateCanvas.prototype.composeFrame = function(frameSta
// clipped rendering if layer extent is set
var extent = layerState.extent;
var clipped = extent !== undefined;
var clipped = extent !== undefined &&
!ol.extent.containsExtent(extent, frameState.extent) &&
ol.extent.intersects(extent, frameState.extent);
if (clipped) {
this.clip(context, frameState, /** @type {ol.Extent} */ (extent));
}

View File

@@ -26,7 +26,7 @@ ol.renderer.canvas.TileLayer = function(tileLayer) {
* @protected
* @type {CanvasRenderingContext2D}
*/
this.context = ol.dom.createCanvasContext2D();
this.context = this.context === null ? null : ol.dom.createCanvasContext2D();
/**
* @private
@@ -178,12 +178,12 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
this.renderedRevision != sourceRevision) ||
oversampling != this.oversampling_) {
var context = this.context;
if (context) {
var tilePixelSize = tileSource.getTilePixelSize(z, pixelRatio, projection);
var width = Math.round(tileRange.getWidth() * tilePixelSize[0] / oversampling);
var height = Math.round(tileRange.getHeight() * tilePixelSize[0] / oversampling);
var context = this.context;
var height = Math.round(tileRange.getHeight() * tilePixelSize[1] / oversampling);
var canvas = context.canvas;
var opaque = tileSource.getOpaque(projection);
if (canvas.width != width || canvas.height != height) {
this.oversampling_ = oversampling;
canvas.width = width;
@@ -192,6 +192,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
context.clearRect(0, 0, width, height);
oversampling = this.oversampling_;
}
}
this.renderedTiles.length = 0;
/** @type {Array.<number>} */
@@ -213,9 +214,6 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
y = (imageExtent[3] - tileExtent[3]) / tileResolution * tilePixelRatio / oversampling;
w = currentTilePixelSize[0] * currentScale / oversampling;
h = currentTilePixelSize[1] * currentScale / oversampling;
if (!opaque) {
context.clearRect(x, y, w, h);
}
this.drawTileImage(tile, frameState, layerState, x, y, w, h, tileGutter);
this.renderedTiles.push(tile);
}
@@ -261,6 +259,9 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame = function(frameState, layer
* @param {number} gutter Tile gutter.
*/
ol.renderer.canvas.TileLayer.prototype.drawTileImage = function(tile, frameState, layerState, x, y, w, h, gutter) {
if (!this.getLayer().getSource().getOpaque(frameState.viewState.projection)) {
this.context.clearRect(x, y, w, h);
}
var image = tile.getImage();
if (image) {
this.context.drawImage(image, gutter, gutter,
@@ -273,7 +274,8 @@ ol.renderer.canvas.TileLayer.prototype.drawTileImage = function(tile, frameState
* @inheritDoc
*/
ol.renderer.canvas.TileLayer.prototype.getImage = function() {
return this.context.canvas;
var context = this.context;
return context ? context.canvas : null;
};

View File

@@ -1,6 +1,7 @@
goog.provide('ol.renderer.canvas.VectorTileLayer');
goog.require('ol');
goog.require('ol.dom');
goog.require('ol.extent');
goog.require('ol.proj');
goog.require('ol.proj.Units');
@@ -22,6 +23,8 @@ goog.require('ol.transform');
*/
ol.renderer.canvas.VectorTileLayer = function(layer) {
this.context = null;
ol.renderer.canvas.TileLayer.call(this, layer);
/**
@@ -74,9 +77,17 @@ ol.renderer.canvas.VectorTileLayer.VECTOR_REPLAYS = {
* @inheritDoc
*/
ol.renderer.canvas.VectorTileLayer.prototype.prepareFrame = function(frameState, layerState) {
var layerRevision = this.getLayer().getRevision();
var layer = this.getLayer();
var layerRevision = layer.getRevision();
if (this.renderedLayerRevision_ != layerRevision) {
this.renderedTiles.length = 0;
var renderMode = layer.getRenderMode();
if (!this.context && renderMode != ol.layer.VectorTileRenderType.VECTOR) {
this.context = ol.dom.createCanvasContext2D();
}
if (this.context && renderMode == ol.layer.VectorTileRenderType.VECTOR) {
this.context = null;
}
}
this.renderedLayerRevision_ = layerRevision;
return ol.renderer.canvas.TileLayer.prototype.prepareFrame.apply(this, arguments);
@@ -184,11 +195,10 @@ ol.renderer.canvas.VectorTileLayer.prototype.drawTileImage = function(
tile, frameState, layerState, x, y, w, h, gutter) {
var vectorTile = /** @type {ol.VectorTile} */ (tile);
this.createReplayGroup_(vectorTile, frameState);
var layer = this.getLayer();
if (layer.getRenderMode() != ol.layer.VectorTileRenderType.VECTOR) {
if (this.context) {
this.renderTileImage_(vectorTile, frameState, layerState);
}
ol.renderer.canvas.TileLayer.prototype.drawTileImage.apply(this, arguments);
}
};

View File

@@ -74,6 +74,16 @@ ol.source.Cluster = function(options) {
ol.inherits(ol.source.Cluster, ol.source.Vector);
/**
* Get the distance in pixels between clusters.
* @return {number} Distance.
* @api
*/
ol.source.Cluster.prototype.getDistance = function() {
return this.distance_;
};
/**
* Get a reference to the wrapped source.
* @return {ol.source.Vector} Source.

View File

@@ -79,10 +79,8 @@ ol.source.ImageStatic.prototype.handleImageChange = function(evt) {
imageWidth = this.imageSize_[0];
imageHeight = this.imageSize_[1];
} else {
// TODO: remove the type cast when a closure-compiler > 20160315 is used.
// see: https://github.com/google/closure-compiler/pull/1664
imageWidth = /** @type {number} */ (image.width);
imageHeight = /** @type {number} */ (image.height);
imageWidth = image.width;
imageHeight = image.height;
}
var resolution = ol.extent.getHeight(imageExtent) / imageHeight;
var targetWidth = Math.ceil(ol.extent.getWidth(imageExtent) / resolution);

View File

@@ -194,11 +194,11 @@ ol.source.ImageWMS.prototype.getImageInternal = function(extent, resolution, pix
var center = ol.extent.getCenter(extent);
var viewWidth = Math.ceil(ol.extent.getWidth(extent) / imageResolution);
var viewHeight = Math.ceil(ol.extent.getHeight(extent) / imageResolution);
var viewExtent = ol.extent.getForViewAndSize(center, resolution, 0,
var viewExtent = ol.extent.getForViewAndSize(center, imageResolution, 0,
[viewWidth, viewHeight]);
var requestWidth = Math.ceil(this.ratio_ * ol.extent.getWidth(extent) / imageResolution);
var requestHeight = Math.ceil(this.ratio_ * ol.extent.getHeight(extent) / imageResolution);
var requestExtent = ol.extent.getForViewAndSize(center, resolution, 0,
var requestExtent = ol.extent.getForViewAndSize(center, imageResolution, 0,
[requestWidth, requestHeight]);
var image = this.image_;

View File

@@ -65,12 +65,6 @@ ol.source.Raster = function(options) {
this.changed, this);
}
/**
* @private
* @type {CanvasRenderingContext2D}
*/
this.canvasContext_ = ol.dom.createCanvasContext2D();
/**
* @private
* @type {ol.TileQueue}
@@ -88,11 +82,11 @@ ol.source.Raster = function(options) {
}
/**
* The most recently rendered state.
* @type {?ol.SourceRasterRenderedState}
* The most recently requested frame state.
* @type {olx.FrameState}
* @private
*/
this.renderedState_ = null;
this.requestedFrameState_;
/**
* The most recently rendered image canvas.
@@ -101,6 +95,12 @@ ol.source.Raster = function(options) {
*/
this.renderedImageCanvas_ = null;
/**
* The most recently rendered revision.
* @type {number}
*/
this.renderedRevision_;
/**
* @private
* @type {olx.FrameState}
@@ -176,13 +176,11 @@ ol.source.Raster.prototype.updateFrameState_ = function(extent, resolution, proj
ol.obj.assign({}, frameState.viewState));
var center = ol.extent.getCenter(extent);
var width = Math.round(ol.extent.getWidth(extent) / resolution);
var height = Math.round(ol.extent.getHeight(extent) / resolution);
frameState.extent = extent;
frameState.focus = ol.extent.getCenter(extent);
frameState.size[0] = width;
frameState.size[1] = height;
frameState.extent = extent.slice();
frameState.focus = center;
frameState.size[0] = Math.round(ol.extent.getWidth(extent) / resolution);
frameState.size[1] = Math.round(ol.extent.getHeight(extent) / resolution);
var viewState = frameState.viewState;
viewState.center = center;
@@ -192,66 +190,6 @@ ol.source.Raster.prototype.updateFrameState_ = function(extent, resolution, proj
};
/**
* Determine if the most recently rendered image canvas is dirty.
* @param {ol.Extent} extent The requested extent.
* @param {number} resolution The requested resolution.
* @return {boolean} The image is dirty.
* @private
*/
ol.source.Raster.prototype.isDirty_ = function(extent, resolution) {
var state = this.renderedState_;
return !state ||
this.getRevision() !== state.revision ||
resolution !== state.resolution ||
!ol.extent.equals(extent, state.extent);
};
/**
* @inheritDoc
*/
ol.source.Raster.prototype.getImage = function(extent, resolution, pixelRatio, projection) {
if (!this.allSourcesReady_()) {
return null;
}
var currentExtent = extent.slice();
if (!this.isDirty_(currentExtent, resolution)) {
return this.renderedImageCanvas_;
}
var context = this.canvasContext_;
var canvas = context.canvas;
var width = Math.round(ol.extent.getWidth(currentExtent) / resolution);
var height = Math.round(ol.extent.getHeight(currentExtent) / resolution);
if (width !== canvas.width ||
height !== canvas.height) {
canvas.width = width;
canvas.height = height;
}
var frameState = this.updateFrameState_(currentExtent, resolution, projection);
var imageCanvas = new ol.ImageCanvas(
currentExtent, resolution, 1, this.getAttributions(), canvas,
this.composeFrame_.bind(this, frameState));
this.renderedImageCanvas_ = imageCanvas;
this.renderedState_ = {
extent: currentExtent,
resolution: resolution,
revision: this.getRevision()
};
return imageCanvas;
};
/**
* Determine if all sources are ready.
* @return {boolean} All sources are ready.
@@ -272,13 +210,41 @@ ol.source.Raster.prototype.allSourcesReady_ = function() {
/**
* Compose the frame. This renders data from all sources, runs pixel-wise
* operations, and renders the result to the stored canvas context.
* @param {olx.FrameState} frameState The frame state.
* @param {function(Error)} callback Called when composition is complete.
* @inheritDoc
*/
ol.source.Raster.prototype.getImage = function(extent, resolution, pixelRatio, projection) {
if (!this.allSourcesReady_()) {
return null;
}
var frameState = this.updateFrameState_(extent, resolution, projection);
this.requestedFrameState_ = frameState;
frameState.tileQueue.loadMoreTiles(16, 16);
// check if we can't reuse the existing ol.ImageCanvas
if (this.renderedImageCanvas_) {
var renderedResolution = this.renderedImageCanvas_.getResolution();
var renderedExtent = this.renderedImageCanvas_.getExtent();
if (resolution !== renderedResolution || !ol.extent.equals(extent, renderedExtent)) {
this.renderedImageCanvas_ = null;
}
}
if (!this.renderedImageCanvas_ || this.getRevision() !== this.renderedRevision_) {
this.processSources_();
}
return this.renderedImageCanvas_;
};
/**
* Start processing source data.
* @private
*/
ol.source.Raster.prototype.composeFrame_ = function(frameState, callback) {
ol.source.Raster.prototype.processSources_ = function() {
var frameState = this.requestedFrameState_;
var len = this.renderers_.length;
var imageDatas = new Array(len);
for (var i = 0; i < len; ++i) {
@@ -287,53 +253,56 @@ ol.source.Raster.prototype.composeFrame_ = function(frameState, callback) {
if (imageData) {
imageDatas[i] = imageData;
} else {
// image not yet ready
imageDatas = null;
break;
return;
}
}
if (imageDatas) {
var data = {};
this.dispatchEvent(new ol.source.Raster.Event(
ol.source.Raster.EventType_.BEFOREOPERATIONS, frameState, data));
this.worker_.process(imageDatas, data,
this.onWorkerComplete_.bind(this, frameState, callback));
}
frameState.tileQueue.loadMoreTiles(16, 16);
this.onWorkerComplete_.bind(this, frameState));
};
/**
* Called when pixel processing is complete.
* @param {olx.FrameState} frameState The frame state.
* @param {function(Error)} callback Called when rendering is complete.
* @param {Error} err Any error during processing.
* @param {ImageData} output The output image data.
* @param {Object} data The user data.
* @private
*/
ol.source.Raster.prototype.onWorkerComplete_ = function(frameState, callback, err, output, data) {
if (err) {
callback(err);
ol.source.Raster.prototype.onWorkerComplete_ = function(frameState, err, output, data) {
if (err || !output) {
return;
}
if (!output) {
// job aborted
// do nothing if extent or resolution changed
var extent = frameState.extent;
var resolution = frameState.viewState.resolution;
if (resolution !== this.requestedFrameState_.viewState.resolution ||
!ol.extent.equals(extent, this.requestedFrameState_.extent)) {
return;
}
var context;
if (this.renderedImageCanvas_) {
context = this.renderedImageCanvas_.getImage().getContext('2d');
} else {
var width = Math.round(ol.extent.getWidth(extent) / resolution);
var height = Math.round(ol.extent.getHeight(extent) / resolution);
context = ol.dom.createCanvasContext2D(width, height);
this.renderedImageCanvas_ = new ol.ImageCanvas(
extent, resolution, 1, this.getAttributions(), context.canvas);
}
context.putImageData(output, 0, 0);
this.changed();
this.renderedRevision_ = this.getRevision();
this.dispatchEvent(new ol.source.Raster.Event(
ol.source.Raster.EventType_.AFTEROPERATIONS, frameState, data));
var resolution = frameState.viewState.resolution / frameState.pixelRatio;
if (!this.isDirty_(frameState.extent, resolution)) {
this.canvasContext_.putImageData(output, 0, 0);
}
callback(null);
};

View File

@@ -194,7 +194,7 @@ ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
} else {
var projKey = ol.getUid(projection).toString();
if (!(projKey in this.tileCacheForProjection)) {
this.tileCacheForProjection[projKey] = new ol.TileCache();
this.tileCacheForProjection[projKey] = new ol.TileCache(this.tileCache.highWaterMark);
}
return this.tileCacheForProjection[projKey];
}

View File

@@ -610,11 +610,13 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate = function(coordinate,
*
* This method is not available when the source is configured with
* `useSpatialIndex` set to `false`.
* @param {ol.Extent=} opt_extent Destination extent. If provided, no new extent
* will be created. Instead, that extent's coordinates will be overwritten.
* @return {!ol.Extent} Extent.
* @api
*/
ol.source.Vector.prototype.getExtent = function() {
return this.featuresRtree_.getExtent();
ol.source.Vector.prototype.getExtent = function(opt_extent) {
return this.featuresRtree_.getExtent(opt_extent);
};

View File

@@ -292,7 +292,8 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
* - style - {string} The name of the style
* - format - {string} Image format for the layer. Default is the first
* format returned in the GetCapabilities response.
* @return {olx.source.WMTSOptions} WMTS source options object.
* - crossOrigin - {string|null|undefined} Cross origin. Default is `undefined`.
* @return {?olx.source.WMTSOptions} WMTS source options object or `null` if the layer was not found.
* @api
*/
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
@@ -300,6 +301,9 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var l = ol.array.find(layers, function(elt, index, array) {
return elt['Identifier'] == config['layer'];
});
if (l === null) {
return null;
}
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
var idx, matrixSet, matrixLimits;
if (l['TileMatrixSetLink'].length > 1) {
@@ -444,6 +448,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
tileGrid: tileGrid,
style: style,
dimensions: dimensions,
wrapX: wrapX
wrapX: wrapX,
crossOrigin: config['crossOrigin']
};
};

View File

@@ -213,5 +213,5 @@ ol.structs.RBush.prototype.clear = function() {
ol.structs.RBush.prototype.getExtent = function(opt_extent) {
// FIXME add getExtent() to rbush
var data = this.rbush_.data;
return [data.minX, data.minY, data.maxX, data.maxY];
return ol.extent.createOrUpdate(data.minX, data.minY, data.maxX, data.maxY, opt_extent);
};

View File

@@ -322,7 +322,11 @@ ol.style.RegularShape.prototype.render_ = function(atlasManager) {
var strokeWidth = 0;
if (this.stroke_) {
strokeStyle = ol.colorlike.asColorLike(this.stroke_.getColor());
strokeStyle = this.stroke_.getColor();
if (strokeStyle === null) {
strokeStyle = ol.render.canvas.defaultStrokeStyle;
}
strokeStyle = ol.colorlike.asColorLike(strokeStyle);
strokeWidth = this.stroke_.getWidth();
if (strokeWidth === undefined) {
strokeWidth = ol.render.canvas.defaultLineWidth;
@@ -442,7 +446,11 @@ ol.style.RegularShape.prototype.draw_ = function(renderOptions, context, x, y) {
if (this.fill_) {
context.fillStyle = ol.colorlike.asColorLike(this.fill_.getColor());
var color = this.fill_.getColor();
if (color === null) {
color = ol.render.canvas.defaultFillStyle;
}
context.fillStyle = ol.colorlike.asColorLike(color);
context.fill();
}
if (this.stroke_) {

View File

@@ -15,10 +15,9 @@ ol.TileCache = function(opt_highWaterMark) {
ol.structs.LRUCache.call(this);
/**
* @private
* @type {number}
*/
this.highWaterMark_ = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
this.highWaterMark = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
};
ol.inherits(ol.TileCache, ol.structs.LRUCache);
@@ -28,7 +27,7 @@ ol.inherits(ol.TileCache, ol.structs.LRUCache);
* @return {boolean} Can expire cache.
*/
ol.TileCache.prototype.canExpireCache = function() {
return this.getCount() > this.highWaterMark_;
return this.getCount() > this.highWaterMark;
};

View File

@@ -442,6 +442,15 @@ ol.RasterOperation;
ol.RegularShapeRenderOptions;
/**
* A function to be used when sorting features before rendering.
* It takes two instances of {@link ol.Feature} and returns a `{number}`.
*
* @typedef {function(ol.Feature, ol.Feature):number}
*/
ol.RenderOrderFunction;
/**
* @typedef {function(ol.Extent, number, number) : ol.ImageBase}
*/
@@ -631,7 +640,7 @@ ol.TilePriorityFunction;
/**
* @typedef {{
* dirty: boolean,
* renderedRenderOrder: (null|function(ol.Feature, ol.Feature):number),
* renderedRenderOrder: (null|ol.RenderOrderFunction),
* renderedTileRevision: number,
* renderedRevision: number,
* replayGroup: ol.render.ReplayGroup}}

View File

@@ -24,7 +24,7 @@ ol.VectorTile = function(tileCoord, state, src, format, tileLoadFunction) {
* @private
* @type {CanvasRenderingContext2D}
*/
this.context_ = ol.dom.createCanvasContext2D();
this.context_ = null;
/**
* @private
@@ -83,6 +83,9 @@ ol.inherits(ol.VectorTile, ol.Tile);
* @return {CanvasRenderingContext2D} The rendering context.
*/
ol.VectorTile.prototype.getContext = function() {
if (!this.context_) {
this.context_ = ol.dom.createCanvasContext2D();
}
return this.context_;
};

View File

@@ -16,6 +16,7 @@ goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.SimpleGeometry');
goog.require('ol.obj');
goog.require('ol.proj');
goog.require('ol.proj.Units');
@@ -79,7 +80,8 @@ goog.require('ol.proj.Units');
*/
ol.View = function(opt_options) {
ol.Object.call(this);
var options = opt_options || {};
var options = ol.obj.assign({}, opt_options);
/**
* @private
@@ -101,13 +103,6 @@ ol.View = function(opt_options) {
this.updateAnimations_ = this.updateAnimations_.bind(this);
/**
* @type {Object.<string, *>}
*/
var properties = {};
properties[ol.ViewProperty.CENTER] = options.center !== undefined ?
options.center : null;
/**
* @private
* @const
@@ -115,6 +110,24 @@ ol.View = function(opt_options) {
*/
this.projection_ = ol.proj.createProjection(options.projection, 'EPSG:3857');
this.applyOptions_(options);
};
ol.inherits(ol.View, ol.Object);
/**
* Set up the view with the given options.
* @param {olx.ViewOptions} options View options.
*/
ol.View.prototype.applyOptions_ = function(options) {
/**
* @type {Object.<string, *>}
*/
var properties = {};
properties[ol.ViewProperty.CENTER] = options.center !== undefined ?
options.center : null;
var resolutionConstraintInfo = ol.View.createResolutionConstraint_(
options);
@@ -168,8 +181,41 @@ ol.View = function(opt_options) {
properties[ol.ViewProperty.ROTATION] =
options.rotation !== undefined ? options.rotation : 0;
this.setProperties(properties);
/**
* @private
* @type {olx.ViewOptions}
*/
this.options_ = options;
};
/**
* Get an updated version of the view options used to construct the view. The
* current resolution (or zoom), center, and rotation are applied to any stored
* options. The provided options can be uesd to apply new min/max zoom or
* resolution limits.
* @param {olx.ViewOptions} newOptions New options to be applied.
* @return {olx.ViewOptions} New options updated with the current view state.
*/
ol.View.prototype.getUpdatedOptions_ = function(newOptions) {
var options = ol.obj.assign({}, this.options_);
// preserve resolution (or zoom)
if (options.resolution !== undefined) {
options.resolution = this.getResolution();
} else {
options.zoom = this.getZoom();
}
// preserve center
options.center = this.getCenter();
// preserve rotation
options.rotation = this.getRotation();
return ol.obj.assign({}, options, newOptions);
};
ol.inherits(ol.View, ol.Object);
/**
@@ -264,6 +310,7 @@ ol.View.prototype.animate = function(var_args) {
/**
* Determine if the view is being animated.
* @return {boolean} The view is being animated.
* @api
*/
ol.View.prototype.getAnimating = function() {
return this.getHints()[ol.ViewHint.ANIMATING] > 0;
@@ -272,6 +319,7 @@ ol.View.prototype.getAnimating = function() {
/**
* Cancel any ongoing animations.
* @api
*/
ol.View.prototype.cancelAnimations = function() {
this.setHint(ol.ViewHint.ANIMATING, -this.getHints()[ol.ViewHint.ANIMATING]);
@@ -323,18 +371,20 @@ ol.View.prototype.updateAnimations_ = function() {
var y = y0 + progress * (y1 - y0);
this.set(ol.ViewProperty.CENTER, [x, y]);
}
if (animation.sourceResolution) {
var resolution = animation.sourceResolution +
progress * (animation.targetResolution - animation.sourceResolution);
if (animation.sourceResolution && animation.targetResolution) {
var resolution = progress === 1 ?
animation.targetResolution :
animation.sourceResolution + progress * (animation.targetResolution - animation.sourceResolution);
if (animation.anchor) {
this.set(ol.ViewProperty.CENTER,
this.calculateCenterZoom(resolution, animation.anchor));
}
this.set(ol.ViewProperty.RESOLUTION, resolution);
}
if (animation.sourceRotation !== undefined) {
var rotation = animation.sourceRotation +
progress * (animation.targetRotation - animation.sourceRotation);
if (animation.sourceRotation !== undefined && animation.targetRotation !== undefined) {
var rotation = progress === 1 ?
animation.targetRotation :
animation.sourceRotation + progress * (animation.targetRotation - animation.sourceRotation);
if (animation.anchor) {
this.set(ol.ViewProperty.CENTER,
this.calculateCenterRotate(rotation, animation.anchor));
@@ -526,6 +576,46 @@ ol.View.prototype.getMinResolution = function() {
};
/**
* Get the maximum zoom level for the view.
* @return {number} The maximum zoom level.
* @api
*/
ol.View.prototype.getMaxZoom = function() {
return /** @type {number} */ (this.getZoomForResolution(this.minResolution_));
};
/**
* Set a new maximum zoom level for the view.
* @param {number} zoom The maximum zoom level.
* @api
*/
ol.View.prototype.setMaxZoom = function(zoom) {
this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));
};
/**
* Get the minimum zoom level for the view.
* @return {number} The minimum zoom level.
* @api
*/
ol.View.prototype.getMinZoom = function() {
return /** @type {number} */ (this.getZoomForResolution(this.maxResolution_));
};
/**
* Set a new minimum zoom level for the view.
* @param {number} zoom The minimum zoom level.
* @api
*/
ol.View.prototype.setMinZoom = function(zoom) {
this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));
};
/**
* Get the view projection.
* @return {ol.proj.Projection} The projection of the view.
@@ -657,8 +747,22 @@ ol.View.prototype.getState = function() {
ol.View.prototype.getZoom = function() {
var zoom;
var resolution = this.getResolution();
if (resolution !== undefined &&
resolution >= this.minResolution_ && resolution <= this.maxResolution_) {
if (resolution !== undefined) {
zoom = this.getZoomForResolution(resolution);
}
return zoom;
};
/**
* Get the zoom level for a resolution.
* @param {number} resolution The resolution.
* @return {number|undefined} The zoom level for the provided resolution.
* @api
*/
ol.View.prototype.getZoomForResolution = function(resolution) {
var zoom;
if (resolution >= this.minResolution_ && resolution <= this.maxResolution_) {
var offset = this.minZoom_ || 0;
var max, zoomFactor;
if (this.resolutions_) {

View File

@@ -14,14 +14,34 @@ var externsPaths = [
];
var infoPath = path.join(__dirname, '..', 'build', 'info.json');
var jsdocResolved = require.resolve('jsdoc/jsdoc.js');
var jsdoc = path.resolve(path.dirname(jsdocResolved), '../.bin/jsdoc');
/**
* Get checked path of a binary.
* @param {string} binaryName Binary name of the binary path to find.
* @return {string} Path.
*/
function getBinaryPath(binaryName) {
if (isWindows) {
binaryName += '.cmd';
}
// on Windows, use jsdoc.cmd
if (isWindows) {
jsdoc += '.cmd';
var jsdocResolved = require.resolve('jsdoc/jsdoc.js');
var expectedPaths = [
path.join(__dirname, '..', 'node_modules', '.bin', binaryName),
path.resolve(path.join(path.dirname(jsdocResolved), '..', '.bin', binaryName))
];
for (var i = 0; i < expectedPaths.length; i++) {
var expectedPath = expectedPaths[i];
if (fs.existsSync(expectedPath)) {
return expectedPath;
}
}
throw Error('JsDoc binary was not found in any of the expected paths: ' + expectedPaths);
}
var jsdoc = getBinaryPath('jsdoc');
var jsdocConfig = path.join(
__dirname, '..', 'config', 'jsdoc', 'info', 'conf.json');

View File

@@ -38,23 +38,12 @@ serve.createServer(function(err, server) {
url + '/test_rendering/index.html'
];
// TODO
// Workaround for https://github.com/laurentj/slimerjs/issues/333. When a
// version with the fix is released, replace block below with:
// var child = spawn(slimerjs.path, args, {stdio: 'pipe'});
// child.on('exit', function(code) {
// process.exit(code);
// }
var child = spawn(slimerjs.path, args, {stdio: 'pipe'});
child.stdout.on('data', function(data) {
process.stdout.write(data);
if (data == 'All tests passed.\n') {
process.exit(0);
}
});
child.on('exit', function() {
process.exit(1);
child.on('exit', function(code) {
process.exit(code);
});
});

View File

@@ -2,5 +2,10 @@
"rules": {
"openlayers-internal/no-missing-requires": 0,
"openlayers-internal/valid-provide": 0
},
"globals": {
"createMapDiv": true,
"disposeMap": true,
"resemble": true
}
}

View File

@@ -6,8 +6,9 @@ goog.require('ol.AssertionError');
describe('ol.AssertionError', function() {
it('generates a message', function() {
var error = new ol.AssertionError(42);
expect(error.message).to.be('Assertion failed. See /doc/errors/#42 for details.');
expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/latest/doc/errors/#42 for details.');
});
it('generates a message with a versioned url', function() {
var origVersion = ol.VERSION;
ol.VERSION = 'foo';
@@ -15,10 +16,12 @@ describe('ol.AssertionError', function() {
expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/foo/doc/errors/#42 for details.');
ol.VERSION = origVersion;
});
it('has an error code', function() {
var error = new ol.AssertionError(42);
expect(error.code).to.be(42);
});
it('has a name', function() {
var error = new ol.AssertionError(42);
expect(error.name).to.be('AssertionError');

View File

@@ -298,4 +298,74 @@ describe('ol.collection', function() {
});
});
describe('unique collection', function() {
it('allows unique items in the constructor', function() {
new ol.Collection([{}, {}, {}], {unique: true});
});
it('throws if duplicate items are passed to the constructor', function() {
var item = {};
var call = function() {
new ol.Collection([item, item], {unique: true});
};
expect(call).to.throwException();
});
it('allows unique items to be added via push', function() {
var unique = new ol.Collection(undefined, {unique: true});
unique.push({});
unique.push({});
});
it('throws if duplicate items are added via push', function() {
var unique = new ol.Collection(undefined, {unique: true});
var item = {};
unique.push(item);
var call = function() {
unique.push(item);
};
expect(call).to.throwException();
});
it('allows unique items to be added via insertAt', function() {
var unique = new ol.Collection(undefined, {unique: true});
unique.insertAt(0, {});
unique.insertAt(0, {});
});
it('throws if duplicate items are added via insertAt', function() {
var unique = new ol.Collection(undefined, {unique: true});
var item = {};
unique.insertAt(0, item);
var call = function() {
unique.insertAt(0, item);
};
expect(call).to.throwException();
});
it('allows unique items to be added via setAt', function() {
var unique = new ol.Collection(undefined, {unique: true});
unique.setAt(0, {});
unique.setAt(1, {});
});
it('allows items to be reset via setAt', function() {
var unique = new ol.Collection(undefined, {unique: true});
var item = {};
unique.setAt(0, item);
unique.setAt(0, item);
});
it('throws if duplicate items are added via setAt', function() {
var unique = new ol.Collection(undefined, {unique: true});
var item = {};
unique.setAt(0, item);
var call = function() {
unique.setAt(1, item);
};
expect(call).to.throwException();
});
});
});

View File

@@ -268,14 +268,29 @@ describe('ol.control.ScaleLine', function() {
var renderedHtmls;
var mapView;
var getMetricUnit = function(zoom) {
if (zoom > 30) {
return 'μm';
} else if (zoom > 20) {
return 'mm';
} else if (zoom > 10) {
return 'm';
} else {
return 'km';
}
};
beforeEach(function() {
currentZoom = 28;
currentZoom = 33;
renderedHtmls = {};
ctrl = new ol.control.ScaleLine();
ctrl = new ol.control.ScaleLine({
minWidth: 10
});
ctrl.setMap(map);
map.setView(new ol.View({
center: [0, 0],
zoom: currentZoom
zoom: currentZoom,
maxZoom: currentZoom
}));
mapView = map.getView();
map.renderSync();
@@ -296,6 +311,9 @@ describe('ol.control.ScaleLine', function() {
var currentHtml = ctrl.element_.innerHTML;
expect(currentHtml in renderedHtmls).to.be(false);
renderedHtmls[currentHtml] = true;
var unit = ctrl.innerElement_.textContent.match(/\d+ (.+)/)[1];
expect(unit).to.eql(getMetricUnit(currentZoom));
}
});
it('degrees: is rendered differently for different zoomlevels', function() {

View File

@@ -1,4 +1,3 @@
/*global createMapDiv, disposeMap*/
goog.provide('ol.test.control.ZoomSlider');
goog.require('ol.Map');

View File

@@ -62,6 +62,17 @@ describe('ol.format.GML2', function() {
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
});
it('can read a 3D point geometry', function() {
var text = '<gml:Point xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +
' <gml:coordinates>-90,-180,42</gml:coordinates>' +
'</gml:Point>';
var g = readGeometry(format, text);
expect(g).to.be.an(ol.geom.Point);
expect(g.getCoordinates()).to.eql([-180, -90, 42]);
});
it('can read a box element', function() {
var text = '<gml:Box xmlns:gml="http://www.opengis.net/gml" ' +
'srsName="EPSG:4326">' +
@@ -86,17 +97,17 @@ describe('ol.format.GML2', function() {
' -0.768746,47.358268 ' +
' -0.574463,47.684285 -0.347374,47.854602 ' +
' -0.006740,47.925567 ' +
' 0.135191,47.726864 0.149384,47.599127 0.419052,' +
' 47.670092 0.532597,47.428810 ' +
' 0.305508,47.443003 0.475824,47.144948 0.064225,' +
' 47.201721 ' +
' 0.135191,47.726864 0.149384,47.599127 ' +
' 0.419052,47.670092 0.532597,47.428810 ' +
' 0.305508,47.443003 0.475824,47.144948 ' +
' 0.064225,47.201721 ' +
' -0.318987,47.003018 </gml:coordinates>' +
' </gml:LinearRing>' +
' </gml:outerBoundaryIs>' +
' <gml:innerBoundaryIs>' +
' <gml:LinearRing>' +
' <gml:coordinates>-0.035126,47.485582 -0.035126,' +
' 47.485582 ' +
' <gml:coordinates>-0.035126,47.485582 ' +
' -0.035126,47.485582 ' +
' -0.049319,47.641706 -0.233829,47.655899 ' +
' -0.375760,47.457196 ' +
' -0.276408,47.286879 -0.035126,47.485582 ' +
@@ -131,6 +142,196 @@ describe('ol.format.GML2', function() {
});
});
});
describe('#writeFeatureElement', function() {
var node;
var featureNS = 'http://www.openlayers.org/';
beforeEach(function() {
node = ol.xml.createElementNS(featureNS, 'layer');
});
it('can serialize a LineString', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <LineString xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1 4.2,3' +
' </coordinates>' +
' </LineString>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.LineString([[1.1, 2], [3, 4.2]])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
it('can serialize a Polygon', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <Polygon xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <outerBoundaryIs>' +
' <LinearRing srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1 4.2,3 6,5.2' +
' </coordinates>' +
' </LinearRing>' +
' </outerBoundaryIs>' +
' </Polygon>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.Polygon([[[1.1, 2], [3, 4.2], [5.2, 6]]])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
it('can serialize a Point', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <Point xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1' +
' </coordinates>' +
' </Point>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.Point([1.1, 2])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
it('can serialize a Multi Point', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <MultiPoint xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <pointMember>' +
' <Point srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1' +
' </coordinates>' +
' </Point>' +
' </pointMember>' +
' </MultiPoint>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.MultiPoint([[1.1, 2]])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
it('can serialize a Multi Line String', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <MultiLineString xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <lineStringMember>' +
' <LineString srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1 4.2,3' +
' </coordinates>' +
' </LineString>' +
' </lineStringMember>' +
' </MultiLineString>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.MultiLineString([[[1.1, 2], [3, 4.2]]])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
it('can serialize a Multi Polygon', function() {
var expected =
'<layer xmlns="http://www.openlayers.org/" fid="1">' +
' <geometry>' +
' <MultiPolygon xmlns="http://www.opengis.net/gml" ' +
' srsName="EPSG:4326">' +
' <polygonMember>' +
' <Polygon srsName="EPSG:4326">' +
' <outerBoundaryIs>' +
' <LinearRing srsName="EPSG:4326">' +
' <coordinates ' +
' decimal="." cs="," ts=" ">' +
' 2,1.1 4.2,3 6,5.2' +
' </coordinates>' +
' </LinearRing>' +
' </outerBoundaryIs>' +
' </Polygon>' +
' </polygonMember>' +
' </MultiPolygon>' +
' </geometry>' +
' </layer>';
var feature = new ol.Feature({
geometry: new ol.geom.MultiPolygon([[[[1.1, 2], [3, 4.2], [5.2, 6]]]])
});
feature.setId(1);
var objectStack = [{
featureNS: featureNS,
srsName: 'EPSG:4326'
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(ol.xml.parse(expected));
});
});
});
describe('ol.format.GML3', function() {

View File

@@ -795,6 +795,50 @@ describe('ol.format.WFS', function() {
});
});
describe('when writing out a Transaction request', function() {
var text;
var filename = 'spec/ol/format/wfs/TransactionMultiVersion100.xml';
before(function(done) {
afterLoadText(filename, function(xml) {
text = xml;
done();
});
});
it('handles the WFS version', function() {
var format = new ol.format.WFS();
var insertFeature = new ol.Feature({
the_geom: new ol.geom.LineString([[1.1, 2], [3, 4.2]]),
foo: 'bar',
nul: null
});
insertFeature.setGeometryName('the_geom');
var inserts = [insertFeature];
var updateFeature = new ol.Feature({
the_geom: new ol.geom.LineString([[1.1, 2], [3, 4.2]]),
foo: 'bar',
// null value gets Property element with no Value
nul: null,
// undefined value means don't create a Property element
unwritten: undefined
});
updateFeature.setId('fid.42');
var updates = [updateFeature];
var deleteFeature = new ol.Feature();
deleteFeature.setId('fid.37');
var deletes = [deleteFeature];
var serialized = format.writeTransaction(inserts, updates, deletes, {
featureNS: 'http://www.openplans.org/topp',
featureType: 'states',
featurePrefix: 'topp',
version: '1.0.0'
});
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
describe('when writing out a GetFeature request', function() {
var text;
@@ -970,4 +1014,29 @@ describe('ol.format.WFS', function() {
});
describe('when writing out a WFS Filter', function() {
it('creates a filter', function() {
var text =
'<Filter xmlns="http://www.opengis.net/ogc">' +
' <And>' +
' <PropertyIsLike wildCard="*" singleChar="." escapeChar="!">' +
' <PropertyName>name</PropertyName>' +
' <Literal>Mississippi*</Literal>' +
' </PropertyIsLike>' +
' <PropertyIsEqualTo>' +
' <PropertyName>waterway</PropertyName>' +
' <Literal>riverbank</Literal>' +
' </PropertyIsEqualTo>' +
' </And>' +
'</Filter>';
var serialized = ol.format.WFS.writeFilter(
ol.format.filter.and(
ol.format.filter.like('name', 'Mississippi*'),
ol.format.filter.equalTo('waterway', 'riverbank')
)
);
expect(serialized).to.xmleql(ol.xml.parse(text));
});
});
});

View File

@@ -0,0 +1,37 @@
<Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd">
<Insert>
<states xmlns="http://www.openplans.org/topp">
<the_geom>
<LineString xmlns="http://www.opengis.net/gml">
<coordinates decimal="." cs="," ts=" ">1.1,2 3,4.2</coordinates>
</LineString>
</the_geom>
<foo>bar</foo>
</states>
</Insert>
<Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
<Property>
<Name>the_geom</Name>
<Value>
<LineString xmlns="http://www.opengis.net/gml">
<coordinates decimal="." cs="," ts=" ">1.1,2 3,4.2</coordinates>
</LineString>
</Value>
</Property>
<Property>
<Name>foo</Name>
<Value>bar</Value>
</Property>
<Property>
<Name>nul</Name>
</Property>
<Filter xmlns="http://www.opengis.net/ogc">
<FeatureId fid="fid.42"/>
</Filter>
</Update>
<Delete xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
<Filter xmlns="http://www.opengis.net/ogc">
<FeatureId fid="fid.37"/>
</Filter>
</Delete>
</Transaction>

View File

@@ -289,6 +289,31 @@ describe('ol.interaction.Draw', function() {
expect(geometry.getCoordinates()).to.eql([[10, -20], [30, -20]]);
});
it('supports removeLastPoint while drawing', function() {
draw.removeLastPoint();
// first point
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
simulateEvent('pointerup', 10, 20);
// second point
simulateEvent('pointermove', 40, 30);
simulateEvent('pointerdown', 40, 30);
simulateEvent('pointerup', 40, 30);
simulateEvent('pointermove', 100, 100);
draw.removeLastPoint();
// click near the removed point
simulateEvent('pointermove', 39, 31);
simulateEvent('pointerdown', 38, 31);
simulateEvent('pointerup', 38, 31);
expect(source.getFeatures()).to.have.length(0);
});
it('supports freehand drawing for linestrings', function() {
// freehand sequence
simulateEvent('pointermove', 10, 20);
@@ -534,6 +559,31 @@ describe('ol.interaction.Draw', function() {
]);
});
it('supports removeLastPoint while drawing', function() {
draw.removeLastPoint();
// first point
simulateEvent('pointermove', 10, 20);
simulateEvent('pointerdown', 10, 20);
simulateEvent('pointerup', 10, 20);
// second point
simulateEvent('pointermove', 40, 30);
simulateEvent('pointerdown', 40, 30);
simulateEvent('pointerup', 40, 30);
simulateEvent('pointermove', 100, 100);
draw.removeLastPoint();
// click near the removed point
simulateEvent('pointermove', 39, 31);
simulateEvent('pointerdown', 39, 31);
simulateEvent('pointerup', 39, 31);
expect(source.getFeatures()).to.have.length(0);
});
it('draws polygon with clicks, finishing on last point', function() {
// first point
simulateEvent('pointermove', 10, 20);

View File

@@ -1,4 +1,3 @@
/*global createMapDiv, disposeMap*/
goog.provide('ol.test.interaction.KeyboardPan');
goog.require('ol.Map');

View File

@@ -1,4 +1,3 @@
/*global createMapDiv, disposeMap*/
goog.provide('ol.test.interaction.KeyboardZoom');
goog.require('ol.Map');

View File

@@ -392,8 +392,8 @@ describe('ol.interaction.Modify', function() {
expect(circleFeature.getGeometry().getCenter()).to.eql([5, 5]);
// Increase radius
simulateEvent('pointermove', 25, -5, false, 0);
simulateEvent('pointerdown', 25, -5, false, 0);
simulateEvent('pointermove', 25, -4, false, 0);
simulateEvent('pointerdown', 25, -4, false, 0);
simulateEvent('pointermove', 30, -5, false, 0);
simulateEvent('pointerdrag', 30, -5, false, 0);
simulateEvent('pointerup', 30, -5, false, 0);

View File

@@ -1,4 +1,3 @@
/*global createMapDiv, disposeMap*/
goog.provide('ol.test.interaction.MouseWheelZoom');
goog.require('ol.Map');

View File

@@ -224,11 +224,67 @@ describe('ol.interaction.Translate', function() {
simulateEvent('pointerup', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('');
});
it('respects existing cursor value', function() {
element.style.cursor = 'pointer';
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
simulateEvent('pointerdown', 10, 20);
expect(element.style.cursor).to.match(/grabbing$/);
simulateEvent('pointerup', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('pointer');
});
it('resets css cursor when interaction is deactivated while pointer is on feature', function() {
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
translate.setActive(false);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('');
});
it('resets css cursor to existing cursor when interaction is deactivated while pointer is on feature', function() {
element.style.cursor = 'pointer';
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
translate.setActive(false);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('pointer');
});
it('resets css cursor interaction is removed while pointer is on feature', function() {
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
map.removeInteraction(translate);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('');
});
it('resets css cursor to existing cursor interaction is removed while pointer is on feature', function() {
element.style.cursor = 'pointer';
simulateEvent('pointermove', 10, 20);
expect(element.style.cursor).to.match(/grab$/);
map.removeInteraction(translate);
simulateEvent('pointermove', 0, 0);
expect(element.style.cursor).to.eql('pointer');
});

View File

@@ -50,6 +50,27 @@ describe('ol.Map', function() {
});
describe('#addLayer()', function() {
it('adds a layer to the map', function() {
var map = new ol.Map({});
var layer = new ol.layer.Tile();
map.addLayer(layer);
expect(map.getLayers().item(0)).to.be(layer);
});
it('throws if a layer is added twice', function() {
var map = new ol.Map({});
var layer = new ol.layer.Tile();
map.addLayer(layer);
var call = function() {
map.addLayer(layer);
};
expect(call).to.throwException();
});
});
describe('#addInteraction()', function() {
it('adds an interaction to the map', function() {
var map = new ol.Map({});
@@ -378,12 +399,37 @@ describe('ol.Map', function() {
var interactions = ol.interaction.defaults(options);
expect(interactions.getLength()).to.eql(1);
expect(interactions.item(0)).to.be.a(ol.interaction.MouseWheelZoom);
expect(interactions.item(0).constrainResolution_).to.eql(false);
expect(interactions.item(0).useAnchor_).to.eql(true);
interactions.item(0).setMouseAnchor(false);
expect(interactions.item(0).useAnchor_).to.eql(false);
});
});
describe('create pinchZoom interaction', function() {
it('creates pinchZoom interaction', function() {
options.pinchZoom = true;
var interactions = ol.interaction.defaults(options);
expect(interactions.getLength()).to.eql(1);
expect(interactions.item(0)).to.be.a(ol.interaction.PinchZoom);
expect(interactions.item(0).constrainResolution_).to.eql(false);
});
});
describe('set constrainResolution option', function() {
it('set constrainResolution option', function() {
options.pinchZoom = true;
options.mouseWheelZoom = true;
options.constrainResolution = true;
var interactions = ol.interaction.defaults(options);
expect(interactions.getLength()).to.eql(2);
expect(interactions.item(0)).to.be.a(ol.interaction.PinchZoom);
expect(interactions.item(0).constrainResolution_).to.eql(true);
expect(interactions.item(1)).to.be.a(ol.interaction.MouseWheelZoom);
expect(interactions.item(1).constrainResolution_).to.eql(true);
});
});
describe('create double click interaction', function() {
beforeEach(function() {

View File

@@ -1,13 +1,12 @@
goog.provide('ol.test.proj.EPSG3857');
goog.require('ol.proj');
goog.require('ol.proj.common');
describe('ol.proj.EPSG3857', function() {
afterEach(function() {
ol.proj.clearAllProjections();
ol.proj.common.add();
ol.proj.addCommon();
});
describe('fromEPSG4326()', function() {

View File

@@ -3,14 +3,13 @@ goog.provide('ol.test.proj');
goog.require('ol.proj');
goog.require('ol.proj.EPSG4326');
goog.require('ol.proj.Projection');
goog.require('ol.proj.common');
describe('ol.proj', function() {
afterEach(function() {
ol.proj.clearAllProjections();
ol.proj.common.add();
ol.proj.addCommon();
});
describe('projection equivalence', function() {

View File

@@ -9,18 +9,19 @@ goog.require('ol.renderer.canvas.IntermediateCanvas');
describe('ol.renderer.canvas.IntermediateCanvas', function() {
describe('#composeFrame()', function() {
it('clips to layer extent and draws image', function() {
var renderer, frameState, layerState, context;
beforeEach(function() {
var layer = new ol.layer.Image({
extent: [1, 2, 3, 4]
});
var renderer = new ol.renderer.canvas.IntermediateCanvas(layer);
renderer = new ol.renderer.canvas.IntermediateCanvas(layer);
var image = new Image();
image.width = 3;
image.height = 3;
renderer.getImage = function() {
return image;
};
var frameState = {
frameState = {
viewState: {
center: [2, 3],
resolution: 1,
@@ -35,8 +36,8 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() {
return ol.transform.create();
};
ol.renderer.Map.prototype.calculateMatrices2D(frameState);
var layerState = layer.getLayerState();
var context = {
layerState = layer.getLayerState();
context = {
save: sinon.spy(),
restore: sinon.spy(),
translate: sinon.spy(),
@@ -47,6 +48,11 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() {
clip: sinon.spy(),
drawImage: sinon.spy()
};
});
it('clips to layer extent and draws image', function() {
frameState.extent = [0, 1, 4, 5];
renderer.composeFrame(frameState, layerState, context);
expect(context.save.callCount).to.be(1);
expect(context.translate.callCount).to.be(0);
@@ -61,6 +67,35 @@ describe('ol.renderer.canvas.IntermediateCanvas', function() {
[renderer.getImage(), 0, 0, 3, 3, 0, 0, 3, 3]);
expect(context.restore.callCount).to.be(1);
});
it('does not clip if frame extent does not intersect layer extent', function() {
frameState.extent = [1.1, 2.1, 2.9, 3.9];
renderer.composeFrame(frameState, layerState, context);
expect(context.save.callCount).to.be(0);
expect(context.translate.callCount).to.be(0);
expect(context.rotate.callCount).to.be(0);
expect(context.beginPath.callCount).to.be(0);
expect(context.clip.callCount).to.be(0);
expect(context.drawImage.firstCall.args).to.eql(
[renderer.getImage(), 0, 0, 3, 3, 0, 0, 3, 3]);
expect(context.restore.callCount).to.be(0);
});
it('does not clip if frame extent is outside of layer extent', function() {
frameState.extent = [10, 20, 30, 40];
renderer.composeFrame(frameState, layerState, context);
expect(context.save.callCount).to.be(0);
expect(context.translate.callCount).to.be(0);
expect(context.rotate.callCount).to.be(0);
expect(context.beginPath.callCount).to.be(0);
expect(context.clip.callCount).to.be(0);
expect(context.drawImage.firstCall.args).to.eql(
[renderer.getImage(), 0, 0, 3, 3, 0, 0, 3, 3]);
expect(context.restore.callCount).to.be(0);
});
});
});

View File

@@ -37,7 +37,7 @@ describe('ol.renderer.vector', function() {
squaredTolerance = 1;
listener = function() {};
listenerThis = {};
iconStyleLoadSpy = sinon.stub(iconStyle, 'load', function() {
iconStyleLoadSpy = sinon.stub(iconStyle, 'load').callsFake(function() {
iconStyle.iconImage_.imageState_ = 1; // LOADING
});
});
@@ -79,8 +79,7 @@ describe('ol.renderer.vector', function() {
var imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image');
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
var drawPointSpy = sinon.stub(imageReplay,
'drawPoint', ol.nullFunction);
var drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false);
@@ -93,8 +92,7 @@ describe('ol.renderer.vector', function() {
var imageReplay = replayGroup.getReplay(
style.getZIndex(), 'Image');
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
var drawMultiPointSpy = sinon.stub(imageReplay,
'drawMultiPoint', ol.nullFunction);
var drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setImageStyleSpy.called).to.be(false);
@@ -108,8 +106,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString');
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
var drawLineStringSpy = sinon.stub(lineStringReplay,
'drawLineString', ol.nullFunction);
var drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -124,8 +121,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'LineString');
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
'setFillStrokeStyle');
var drawMultiLineStringSpy = sinon.stub(lineStringReplay,
'drawMultiLineString', ol.nullFunction);
var drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -141,8 +137,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon');
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
var drawPolygonSpy = sinon.stub(polygonReplay,
'drawPolygon', ol.nullFunction);
var drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);
@@ -158,8 +153,7 @@ describe('ol.renderer.vector', function() {
style.getZIndex(), 'Polygon');
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
'setFillStrokeStyle');
var drawMultiPolygonSpy = sinon.stub(polygonReplay,
'drawMultiPolygon', ol.nullFunction);
var drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(ol.nullFunction);
ol.renderer.vector.renderFeature(replayGroup, feature,
style, squaredTolerance, listener, listenerThis);
expect(setFillStrokeStyleSpy.called).to.be(true);

Some files were not shown because too many files have changed in this diff Show More