Compare commits

...

402 Commits

Author SHA1 Message Date
Andreas Hocevar 646c9fb177 v4.1.2-beta.1 2017-05-10 13:42:42 +02:00
Andreas Hocevar 366bf46ca1 Merge pull request #6792 from ahocevar/prepareframe-logic
Create intermediate canvas when resolutions have changed
2017-05-10 13:11:55 +02:00
Andreas Hocevar 50615557d9 Create intermediate canvas when resolutions have changed 2017-05-10 11:58:38 +02:00
Frédéric Junod 1c0f891427 Merge pull request #6790 from openlayers/greenkeeper/resemblejs-2.2.4
Update resemblejs to the latest version 🚀
2017-05-10 11:18:05 +02:00
greenkeeper[bot] 0c6c0ef6d5 chore(package): update resemblejs to version 2.2.4 2017-05-10 09:05:39 +00:00
Frédéric Junod 735ab45480 Merge pull request #6784 from openlayers/greenkeeper/clean-css-cli-4.1.0
chore(package): update clean-css-cli to version 4.1.0
2017-05-09 13:15:47 +02:00
greenkeeper[bot] 55c2adc503 chore(package): update clean-css-cli to version 4.1.0
Closes #6780
2017-05-08 16:40:04 +00:00
Bart van den Eijnden 2486b25e5e Merge pull request #6556 from KlausBenndorf/kmlinsetpixel
Reading kml xunits/yunits insetPixels
2017-05-08 11:02:19 +02:00
Frédéric Junod 020a8da9bb Merge pull request #6775 from openlayers/greenkeeper/closure-util-1.20.0
Update closure-util to the latest version 🚀
2017-05-05 14:40:29 +02:00
greenkeeper[bot] d559037f31 fix(package): update closure-util to version 1.20.0 2017-05-05 12:21:00 +00:00
Andreas Hocevar cce81bcefb Merge pull request #6774 from openlayers/greenkeeper/fs-extra-3.0.1
Update fs-extra to the latest version 🚀
2017-05-05 07:01:52 +02:00
greenkeeper[bot] fc73c4b1fd fix(package): update fs-extra to version 3.0.1 2017-05-05 00:07:26 +00:00
Tim Schaub 588efb1427 Merge pull request #6773 from openlayers/release-v4.1.1
Release v4.1.1
2017-05-03 08:48:41 -06:00
Tim Schaub e7afe2cb9c Update package versions to 4.1.1 2017-05-03 08:30:29 -06:00
Frederic Junod 5e3ba9b7d1 Use firefox < 53 in travis 2017-05-03 08:20:13 -06:00
Frederic Junod 51230aa3fb Fix broken link in wmts-ign example 2017-05-03 08:15:53 -06:00
Frederic Junod 069ae0aff4 Fix tissot example docs 2017-05-03 08:15:47 -06:00
Tim Schaub ec336e1d0e Out of beta 2017-05-03 08:14:14 -06:00
Tim Schaub d2e571e3d1 Correct path to cleancss 2017-05-03 08:13:57 -06:00
Frederic Junod 1a9c41ae4e Add missing goog.require 2017-05-03 08:12:54 -06:00
Frederic Junod 10aebb58d2 Allow user selection in overlay container 2017-05-03 08:12:09 -06:00
Tim Schaub 2d46c83149 Merge pull request #6770 from tschaub/no-missing-requires
Enforce the "no missing requires" rule
2017-05-03 08:05:26 -06:00
Tim Schaub 3c62396533 Report on any warnings from the linter 2017-05-03 06:37:36 -06:00
Frédéric Junod 22f55a7aeb Merge pull request #6772 from fredj/cleanup
Remove html tag from shortdesc
2017-05-03 09:52:20 +02:00
Frederic Junod 3d7bd00abf Remove html tag from shortdesc 2017-05-03 09:34:57 +02:00
Frédéric Junod 7b1ed14e4e Merge pull request #6769 from openlayers/greenkeeper/handlebars-4.0.8
Update handlebars to the latest version 🚀
2017-05-03 08:38:49 +02:00
Tim Schaub 3c88e04d4c New task for bundling dependencies 2017-05-02 23:28:00 -06:00
Tim Schaub 9adab910f4 Ensure that the package builds 2017-05-02 23:21:52 -06:00
Tim Schaub d7969931e8 Try to fix lint in the package 2017-05-02 23:21:45 -06:00
greenkeeper[bot] 94b6f27937 fix(package): update handlebars to version 4.0.8 2017-05-02 21:18:37 +00:00
Tim Schaub 8690bb7c12 Use @mapbox/vector-tile 2017-05-02 15:14:30 -06:00
Tim Schaub 49b5bbc964 Treat missing requires as an error 2017-05-02 15:04:20 -06:00
Tim Schaub 479d98212b Disable no-missing-requires rule in generated shader code 2017-05-02 15:04:20 -06:00
Tim Schaub 3f973e6fa3 Allow single (non-default) import from dependencies 2017-05-02 15:04:20 -06:00
Tim Schaub 584d4f67bd Uppercase for PBF constructor 2017-05-02 15:04:20 -06:00
Andreas Hocevar 642ed5f46e Merge pull request #6757 from hajjimurad/master
Fix crashing on creation of snap-interaction, if Circle is among the features to snap to.
2017-05-02 21:05:31 +02:00
Frédéric Junod 9a9e6e94ff Merge pull request #6766 from openlayers/greenkeeper/sinon-2.2.0
Update sinon to the latest version 🚀
2017-05-02 10:55:47 +02:00
Frédéric Junod 88b028e4a5 Merge pull request #6765 from fredj/fit_callback
Add new callback function to view.FitOptions
2017-05-02 10:36:37 +02:00
Frédéric Junod fb07d2dad6 Merge pull request #6764 from mblinsitu/getInteracting
Added View#getInteracting() to the api
2017-05-02 10:35:53 +02:00
greenkeeper[bot] b4f68ef021 chore(package): update sinon to version 2.2.0
https://greenkeeper.io/
2017-05-02 08:08:37 +00:00
Frederic Junod 403214f569 Add new callback function to view.FitOptions 2017-05-02 08:49:39 +02:00
Michel Beaudouin-Lafon 944f0df981 Fixed test to compare to true/false rather than 0/1 2017-05-01 17:09:27 +02:00
Michel Beaudouin-Lafon 97b3ff0499 Added View#getInteracting() to the api, similar to View#getAnimating() to access the hints 2017-05-01 14:09:44 +02:00
Andreas Hocevar 4507fb9368 Merge pull request #6760 from openlayers/greenkeeper/handlebars-4.0.7
Update handlebars to the latest version 🚀
2017-04-30 15:01:06 +02:00
Andreas Hocevar cdd44c4db8 Merge pull request #6761 from openlayers/greenkeeper/async-2.4.0
Update async to the latest version 🚀
2017-04-30 09:36:23 +02:00
greenkeeper[bot] 983fe5e086 fix(package): update async to version 2.4.0
https://greenkeeper.io/
2017-04-29 23:29:45 +00:00
greenkeeper[bot] f4686adced fix(package): update handlebars to version 4.0.7
https://greenkeeper.io/
2017-04-29 20:56:55 +00:00
Frédéric Junod 16f97a74d7 Merge pull request #6755 from fredj/missing_goog.require
Add missing goog.require
2017-04-28 11:49:03 +02:00
Murad Khafizov 242c55dcff formatting fixed 2017-04-28 10:50:05 +02:00
Murad Khafizov 1f87dcc6b8 fix crashing on using undefined segmentWriter 2017-04-28 10:49:58 +02:00
Frederic Junod dafe3a0811 Add missing goog.require 2017-04-28 08:48:46 +02:00
Frédéric Junod 9ac4d137ff Merge pull request #6751 from openlayers/greenkeeper/coveralls-2.13.1
Update coveralls to the latest version 🚀
2017-04-28 08:28:58 +02:00
Frédéric Junod 3cb3113705 Merge pull request #6750 from openlayers/greenkeeper/fs-extra-3.0.0
Update fs-extra to the latest version 🚀
2017-04-28 08:28:39 +02:00
greenkeeper[bot] 239f9e817d chore(package): update coveralls to version 2.13.1
https://greenkeeper.io/
2017-04-27 21:47:42 +00:00
greenkeeper[bot] b9f42ddc0f fix(package): update fs-extra to version 3.0.0
https://greenkeeper.io/
2017-04-27 19:40:01 +00:00
Frédéric Junod c437afc15b Merge pull request #6741 from fredj/overlay_select
Allow user selection in overlay container
2017-04-26 09:04:16 +02:00
Frédéric Junod 41812172a7 Merge pull request #6744 from openlayers/greenkeeper/mocha-3.3.0
Update mocha to the latest version 🚀
2017-04-24 14:20:39 +02:00
greenkeeper[bot] 11e682e061 chore(package): update mocha to version 3.3.0
https://greenkeeper.io/
2017-04-24 09:17:05 +00:00
Andreas Hocevar 821cf24c5b Merge pull request #6737 from ahocevar/graticule-labels
Graticule labels
2017-04-24 10:49:43 +02:00
Andreas Hocevar 14f29e95a7 Add label support to ol.Graticule 2017-04-24 10:26:16 +02:00
Frederic Junod 8aa30ee8f6 Allow user selection in overlay container 2017-04-24 09:32:36 +02:00
Frédéric Junod c9303f5889 Merge pull request #6740 from fredj/spelling
Fix spelling
2017-04-24 09:15:57 +02:00
Frederic Junod b1f38ea0e8 Fix spelling 2017-04-24 08:58:19 +02:00
Andreas Hocevar 3e9cbade45 Improve internal usability of ol.coordinate.degreesToStringHDMS 2017-04-23 22:46:33 +02:00
Frédéric Junod 52af66e0f9 Merge pull request #6730 from openlayers/greenkeeper/metalsmith-layouts-1.8.1
Update metalsmith-layouts to the latest version 🚀
2017-04-20 11:23:19 +02:00
greenkeeper[bot] c1911994ea fix(package): update metalsmith-layouts to version 1.8.1
https://greenkeeper.io/
2017-04-20 11:06:56 +02:00
Frédéric Junod af62ef736d Merge pull request #6732 from fredj/ff_52
Use firefox < 53 in travis
2017-04-20 11:06:48 +02:00
Frederic Junod 4a6f427df7 Use firefox < 53 in travis 2017-04-20 10:58:12 +02:00
Bart van den Eijnden 00a2d7b1cb Merge pull request #6677 from Jenselme/wfst-3D
Add an option to writeTransaction to support 3D geometries
2017-04-20 10:44:54 +02:00
Julien Enselme e2af6b9d04 Rename the is3D option for WFS transaction into hasZ
This is more consistent with existing code.
2017-04-20 10:39:02 +02:00
Julien Enselme 4955097a52 Prevent Z to be undefined in 3D WFS transactions
For newly created points, Z can be undefined. In these cases, we use 0
for Z.
2017-04-20 10:39:02 +02:00
Julien Enselme 870bc51ad9 Add an option to writeTransaction to support 3D geometries
Close #6630
2017-04-20 10:39:02 +02:00
Bart van den Eijnden ea54543602 Merge pull request #6524 from Jenselme/dont-repeat-featurePrefix
Don't append feature prefix twice in WFS requests
2017-04-20 10:38:00 +02:00
Julien Enselme bb278df881 Don't append feature prefix twice in WFS requests
Some WFS servers like tinyOWS require the feature prefix to be in the
feature type for the feature to be found (eg `prefix:layer`).

The problem was, the prefix was always added to the feature type which
gave us a type name like `prefix:prefix:feature` or
`feature:prefix:feature`. The requests were then rejected by the WFS
server.

We now check if the feature type starts with the prefix. If it does, we
don't append it again. If it doesn't we do.
2017-04-20 10:32:39 +02:00
Frédéric Junod 46fde0e439 Merge pull request #6727 from fredj/hitTolerance_doc
Add default value in doc for the hitTolerance option
2017-04-20 08:24:00 +02:00
Frédéric Junod e3d895be4c Merge pull request #6724 from fredj/wrapX_stamen
Add wrapX option to Stamen source
2017-04-20 08:23:43 +02:00
Frédéric Junod dd8d4b5ad8 Merge pull request #6728 from fredj/tissot_docs
Fix tissot examples docs
2017-04-19 15:13:36 +02:00
Frederic Junod d956a3bdb3 Fix broken link in wmts-ign example 2017-04-19 14:58:16 +02:00
Frederic Junod 66930ab303 Fix tissot example docs 2017-04-19 14:43:38 +02:00
Frederic Junod 0f032a1388 Add default value in doc for the hitTolerance option 2017-04-19 12:05:03 +02:00
Frédéric Junod 5ce54c9e0d Merge pull request #6725 from openlayers/greenkeeper/initial
Update dependencies to enable Greenkeeper 🌴
2017-04-19 09:20:28 +02:00
greenkeeper[bot] b86950da6f chore(package): update dependencies
https://greenkeeper.io/
2017-04-19 06:42:44 +00:00
Frederic Junod f7c71bdaac Add wrapX option to Stamen source 2017-04-18 13:31:30 +02:00
Tim Schaub ee2aa91d97 Merge pull request #6711 from tschaub/post-release
Correct path to cleancss
2017-04-14 05:12:34 -06:00
Tim Schaub c353455b83 Out of beta 2017-04-13 21:21:37 -06:00
Tim Schaub 530419a839 Correct path to cleancss 2017-04-13 21:20:34 -06:00
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
simonseyock c027b4d127 Reading kml xunits/yunits insetPixels 2017-03-04 12:24:51 +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
Andreas Hocevar 6f54f6c113 Merge pull request #6482 from openlayers/release-v4.0.0
Release v4.0.0
2017-02-10 18:00:41 +00:00
Andreas Hocevar d7eda2c69f Update package version to 4.0.0 2017-02-10 17:44:28 +00:00
Andreas Hocevar d6adbfd8fa Changelog for v4.0.0 2017-02-10 17:43:42 +00:00
Andreas Hocevar e6944c6664 Merge pull request #6477 from ahocevar/rotate-restore
Save and restore context when rotating
2017-02-10 16:58:18 +00:00
Frédéric Junod e58f173c78 Merge pull request #6475 from fredj/zoomify_url_template
Use an url template for ol.source.Zoomify
2017-02-10 12:13:37 +01:00
Andreas Hocevar f8d5401ccf Merge pull request #6478 from openlayers/greenkeeper/clean-css-cli-4.0.6
Update clean-css-cli to the latest version 🚀
2017-02-10 11:05:24 +00:00
Andreas Hocevar da4ddccad9 Allow Zoomify url without TileGroup, z, x and y placeholder 2017-02-10 12:01:56 +01:00
greenkeeper[bot] afd51801f8 chore(package): update clean-css-cli to version 4.0.6
https://greenkeeper.io/
2017-02-10 10:50:58 +00:00
Andreas Hocevar e561504d27 Save and restore context when rotating 2017-02-10 10:05:07 +00:00
Frederic Junod a4a8d01bac Use an url template for ol.source.Zoomify 2017-02-09 17:06:23 +01:00
Andreas Hocevar abb3bad108 Merge pull request #6472 from ahocevar/hittolerance-test
Use fixed pixel ratio for hit tolerance tests
2017-02-08 18:45:59 +01:00
Andreas Hocevar 8581e17593 Use fixed pixel ratio for hit tolerance tests 2017-02-08 16:30:16 +01:00
Frédéric Junod 310a0069f2 Merge pull request #6468 from fredj/rm_console.assert
Remove console.assert in ol.structs.PriorityQueue tests
2017-02-08 13:59:33 +01:00
Frederic Junod e9fb061704 Remove no-console eslint rule 2017-02-08 13:45:40 +01:00
Frederic Junod 04deaa3032 Remove console.assert in ol.structs.PriorityQueue tests 2017-02-08 13:45:40 +01:00
Frédéric Junod facd36f683 Merge pull request #6467 from fredj/round_dpi
Round the DPI value in ol.source.ImageArcGISRest
2017-02-08 13:42:48 +01:00
Frédéric Junod 6301de4739 Merge pull request #6466 from tchandelle/kml-test
Small XML error in KML test
2017-02-08 13:40:41 +01:00
Frederic Junod c260e927a0 Round the DPI value in ol.source.ImageArcGISRest 2017-02-08 13:32:57 +01:00
Thomas Chandelle 998e1705fa Small XML error in KML test 2017-02-08 13:29:26 +01:00
Andreas Hocevar c1af0de860 Merge pull request #6410 from rjackson64840/fix-toStringHDMS
fixed the degreesToStringHDMS_() function to promote a seconds value …
2017-02-08 11:36:25 +01:00
Andreas Hocevar ddeb9c84e2 Merge pull request #6461 from tchandelle/codepen
Add button to edit examples in CodePen
2017-02-08 11:24:46 +01:00
Thomas Chandelle 89dd4af9cb Remove JSFiddle 2017-02-08 09:04:16 +01:00
Andreas Hocevar 284e6c0b80 Merge pull request #6320 from ahocevar/stackoverflow
Use the 'openlayers' tag instead of 'openlayers-3'
2017-02-08 08:52:30 +01:00
Frédéric Junod 7175270fb1 Merge pull request #6460 from fredj/rm_unByKey
Remove ol.Observable#unByKey
2017-02-08 08:25:08 +01:00
Frederic Junod a6e17318d3 Remove ol.Observable#unByKey 2017-02-07 16:58:44 +01:00
Frederic Junod 92ba2c1e36 Use the 'openlayers' tag instead of 'openlayers-3' 2017-02-07 14:14:43 +01:00
Frédéric Junod 32a154a114 Merge pull request #6463 from openlayers/greenkeeper/clean-css-cli-4.0.5
chore(package): update clean-css-cli to version 4.0.5
2017-02-07 14:13:15 +01:00
greenkeeper[bot] 23ae1b5af7 chore(package): update clean-css-cli to version 4.0.5
Closes #6462

https://greenkeeper.io/
2017-02-07 11:37:33 +00:00
Frédéric Junod 7ca246a20f Merge pull request #6459 from fredj/ol.coordinate.distance
Use ol.coordinate.distance
2017-02-07 09:36:06 +01:00
Frederic Junod 5c731176b9 Use ol.coordinate.distance 2017-02-07 08:25:19 +01:00
Andreas Hocevar bff6a14a16 Merge pull request #6457 from tst-ppenev/add-circle-support
Add Circle Modification
2017-02-06 21:14:49 +01:00
Tim Schaub ac84e560bc Merge pull request #6455 from tschaub/stable
Make all @api annotations imply stability
2017-02-06 12:46:47 -07:00
Andreas Hocevar 6a9cbf11f3 Add tests 2017-02-06 14:45:54 -05:00
Pavel Penev bf86c31f8d Add Circles to <draw-and-modify-features> example 2017-02-06 14:45:54 -05:00
Pavel Penev 7dde3d5cff Add circle support to {ol.interaction.Modify}
Circles are broken into two modifiable line segments: center and
circumference.

Method {@link ol.interaction.Modify#writeCircleGeometry_} has been
added for adding a circle to the R*-bush of modifiable segments.

Methods {handleDownEvent_}, {handleDragEvent_}, {handleUpEvent_} and
{handlePointerAtPixel_} have been updated to support circle segments.

Helper static methods
{@link ol.interaction.Modify.pointDistanceToSegmentDataSquared_} and
{@link ol.interaction.Modify.closestOnSegmentData_} with support for
circle line segments have been added.

Constants {@link ol.interaction.Modify.MODIFY_SEGMENT_CIRCLE_CENTER_INDEX}
and
{@link ol.interaction.Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX}
have been added.

Conflicts:
	src/ol/interaction/modify.js
2017-02-06 14:43:20 -05:00
Pavel Penev 8c6d15b877 Add an ol.coordinate.distance() helper method.
The method is a companion to {@link ol.coordinate.squaredDistance}.
The new method returns the Cartesian distance, instead of its square.

Conflicts:
	src/ol/coordinate.js
2017-02-06 14:43:20 -05:00
Tim Schaub 8066b89abf Merge pull request #6452 from tschaub/deprecated
Remove deprecated methods
2017-02-06 12:08:13 -07:00
Tim Schaub f5aea97d3b All @api annotations imply stability 2017-02-06 09:22:05 -07:00
Tim Schaub 8f39960427 Document removal of deprecated methods 2017-02-06 08:53:07 -07:00
Tim Schaub d96c7032ea Remove deprecated map.beforeRender() method 2017-02-06 08:48:49 -07:00
Tim Schaub 79fdbab70f Remove deprecated ol.animation functions 2017-02-06 08:44:09 -07:00
Andreas Hocevar ca23c7337f Merge pull request #6361 from tchandelle/canvas-margin
Remove "margin" at the bottom of the canvas
2017-02-06 14:47:16 +01:00
Frederic Junod 20c039135b Move updateSize test in the rendering tests 2017-02-06 14:25:55 +01:00
Andreas Hocevar b69ed3a3de Merge pull request #6450 from openlayers/greenkeeper/coveralls-2.11.16
Update coveralls to the latest version 🚀
2017-02-06 00:22:31 +01:00
greenkeeper[bot] 743627e578 chore(package): update coveralls to version 2.11.16
https://greenkeeper.io/
2017-02-05 20:43:13 +00:00
Tim Schaub 47bba9f698 Merge pull request #6302 from tschaub/mod
Publish a package for use with ES module bundlers
2017-02-05 06:32:17 -07:00
Tim Schaub 629d295e7a Additional package documentation 2017-02-04 16:53:35 -07:00
Tim Schaub c9365d8cd9 Merge pull request #6446 from openlayers/greenkeeper/eslint-3.15.0
Update eslint to the latest version 🚀
2017-02-03 20:14:20 -07:00
Tim Schaub b59342b567 Note that the WebGL renderer is not available 2017-02-03 17:08:17 -07:00
Tim Schaub 490f42d528 Avoid extra assignment for default export 2017-02-03 17:05:30 -07:00
Tim Schaub 3eaa0f412e Opinionated defines 2017-02-03 17:05:30 -07:00
Tim Schaub b2a4b69d13 Transform all defines 2017-02-03 17:05:30 -07:00
Tim Schaub b73ab8914a Replace define assignment with variable declaration 2017-02-03 17:05:30 -07:00
Tim Schaub 91c1857d83 Update transform to generate ES-2015 modules 2017-02-03 17:05:30 -07:00
Tim Schaub d17e809039 Rewrite boolean defines as globals 2017-02-03 17:05:30 -07:00
Tim Schaub ea04523bb9 Sort and replace provide and requires in one pass 2017-02-03 17:05:29 -07:00
Tim Schaub 329ec70836 Handle ol provide 2017-02-03 17:05:29 -07:00
Tim Schaub 04639842f2 Safer relative paths 2017-02-03 17:05:29 -07:00
Tim Schaub d20e9ca8df Add a readme 2017-02-03 17:05:29 -07:00
Tim Schaub 815af723ea Require ol.ext dependencies directly 2017-02-03 17:05:29 -07:00
Tim Schaub 386f94e0d4 Codemod for CommonJS package 2017-02-03 17:05:29 -07:00
Tim Schaub 35d254902f Merge pull request #6445 from tschaub/fix-pinch
Fix pinch zooming
2017-02-03 15:04:59 -07:00
greenkeeper[bot] 10fd0141ce chore(package): update eslint to version 3.15.0
https://greenkeeper.io/
2017-02-03 22:00:46 +00:00
Tim Schaub 67e2d02046 Resetting kinetic after one pointer up 2017-02-03 14:10:56 -07:00
Tim Schaub 14222e68e7 Removing side effects from logical expression 2017-02-03 14:10:56 -07:00
Thomas Chandelle 54c8beef4e Stop handling down/up sequence when all fingers have been removed 2017-02-03 14:10:56 -07:00
Tim Schaub bbf4c449e6 Merge pull request #6444 from tschaub/zoom-limits
Disallow pinch zooming beyond min/max resolution
2017-02-03 14:10:37 -07:00
Tim Schaub d713c9fea6 Disallow pinch zooming beyond min/max resolution 2017-02-03 12:56:03 -07:00
Thomas Chandelle ade0b7898b Remove "margin" at the bottom of the canvas 2017-02-03 16:54:29 +01:00
Frédéric Junod 259fc356bc Merge pull request #6443 from openlayers/goog.require
goog.require cleanup
2017-02-03 14:56:53 +01:00
Andreas Hocevar a0e77dd955 Merge pull request #6439 from ahocevar/tile-render-performance
Improve tile render performance
2017-02-03 13:26:35 +01:00
Frederic Junod 9d263629e6 Add missing goog.require 2017-02-03 12:47:13 +01:00
Frederic Junod 5763e1d145 Remove unused goog.require 2017-02-03 12:40:53 +01:00
Frédéric Junod 265a83c389 Merge pull request #6442 from fredj/goog.require
Fix missing goog.require
2017-02-03 11:10:49 +01:00
Frederic Junod 17fb40f5e6 Fix missing goog.require 2017-02-03 10:29:05 +01:00
Frédéric Junod d2cd01e024 Merge pull request #6441 from openlayers/greenkeeper/metalsmith-layouts-1.8.0
Update metalsmith-layouts to the latest version 🚀
2017-02-03 10:24:09 +01:00
greenkeeper[bot] f82e00595f fix(package): update metalsmith-layouts to version 1.8.0
https://greenkeeper.io/
2017-02-03 08:55:25 +00:00
Andreas Hocevar ec8d8228cf Less redraws while zooming in 2017-02-02 22:14:01 +01:00
Andreas Hocevar 72af545a4a Avoid oversampling when view resolution lower than tile resolution 2017-02-02 22:13:25 +01:00
Andreas Hocevar 9af1000874 Merge pull request #6437 from tchandelle/fit-circle2
Fit on circle
2017-02-02 11:40:55 +01:00
Thomas Chandelle c69efeb8ea Fit on circle 2017-02-02 10:34:57 +01:00
Andreas Hocevar da10988ffd Restore test values 2017-01-28 16:08:23 +01:00
alfred.jackson 419c3752d2 fixed the degreesToStringHDMS_() function to promote a seconds value of 60 up to the next minute; fixed test to account for the padding for minutes and seconds 2017-01-27 17:48:02 -06:00
alfred.jackson eebcccab66 fixed the degreesToStringHDMS_() function to promote a seconds value of 60 up to the next minute; fixed calculation of components 2017-01-27 17:32:21 -06:00
alfred.jackson 2001244b88 fixed the degreesToStringHDMS_() function to promote a seconds value of 60 up to the next minute 2017-01-27 14:43:41 -06:00
Thomas Chandelle 0850e612c5 Add link to codepen in examples 2017-01-16 11:58:58 +01:00
Andreas Hocevar 63535940fe Use the 'openlayers' tag instead of 'openlayers-3' 2017-01-13 15:49:29 +01: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
298 changed files with 5388 additions and 1920 deletions
+1
View File
@@ -1,2 +1,3 @@
examples/Jugl.js examples/Jugl.js
examples/resources/ examples/resources/
build/package/**/*webgl*
+5 -2
View File
@@ -3,7 +3,10 @@ sudo: false
language: node_js language: node_js
node_js: node_js:
- "6" - "6.1"
addons:
firefox: "52.0"
cache: cache:
directories: directories:
@@ -17,7 +20,7 @@ before_install:
before_script: before_script:
- "rm src/ol/renderer/webgl/*shader.js" - "rm src/ol/renderer/webgl/*shader.js"
- "sh -e /etc/init.d/xvfb start" - "sh -e /etc/init.d/xvfb start"
- "npm ls" - "npm ls || true"
script: "make ci" script: "make ci"
+1 -1
View File
@@ -4,7 +4,7 @@ Thanks for your interest in contributing to OpenLayers.
## Asking Questions ## Asking Questions
Please ask questions about using the library on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3). Please ask questions about using the library on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers).
When you want to get involved and discuss new features or changes, please use [the mailing list](https://groups.google.com/forum/#!forum/openlayers-dev). When you want to get involved and discuss new features or changes, please use [the mailing list](https://groups.google.com/forum/#!forum/openlayers-dev).
+13 -2
View File
@@ -86,7 +86,7 @@ check-deps:
done ;\ done ;\
.PHONY: ci .PHONY: ci
ci: lint build test test-rendering compile-examples check-examples apidoc ci: lint build test test-rendering package compile-examples check-examples apidoc
.PHONY: compile-examples .PHONY: compile-examples
compile-examples: build/compiled-examples/all.combined.js compile-examples: build/compiled-examples/all.combined.js
@@ -103,6 +103,7 @@ clean:
rm -f build/test_rendering_requires.js rm -f build/test_rendering_requires.js
rm -rf build/examples rm -rf build/examples
rm -rf build/compiled-examples rm -rf build/compiled-examples
rm -rf build/package
rm -rf $(BUILD_HOSTED) rm -rf $(BUILD_HOSTED)
.PHONY: cleanall .PHONY: cleanall
@@ -252,7 +253,7 @@ build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
build/timestamps/node-modules-timestamp build/timestamps/node-modules-timestamp
@mkdir -p $(@D) @mkdir -p $(@D)
@echo "Running eslint..." @echo "Running eslint..."
@./node_modules/.bin/eslint --quiet tasks test test_rendering src examples @./node_modules/.bin/eslint tasks test test_rendering src examples
@touch $@ @touch $@
build/timestamps/node-modules-timestamp: package.json build/timestamps/node-modules-timestamp: package.json
@@ -300,3 +301,13 @@ build/test_rendering_requires.js: $(SPEC_RENDERING_JS)
%shader.js: %shader.glsl src/ol/webgl/shader.mustache bin/pyglslunit.py build/timestamps/node-modules-timestamp %shader.js: %shader.glsl src/ol/webgl/shader.mustache bin/pyglslunit.py build/timestamps/node-modules-timestamp
@python bin/pyglslunit.py --input $< | ./node_modules/.bin/mustache - src/ol/webgl/shader.mustache > $@ @python bin/pyglslunit.py --input $< | ./node_modules/.bin/mustache - src/ol/webgl/shader.mustache > $@
.PHONY: package
package:
@rm -rf build/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
npm run lint-package
+1 -1
View File
@@ -31,6 +31,6 @@ Please see our guide on [contributing](CONTRIBUTING.md) if you're interested in
## Community ## Community
- Need help? Find it on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3) - Need help? Find it on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers)
- Follow [@openlayers](https://twitter.com/openlayers) on Twitter - Follow [@openlayers](https://twitter.com/openlayers) on Twitter
- Discuss with openlayers users on IRC in `#openlayers` at `chat.freenode` - Discuss with openlayers users on IRC in `#openlayers` at `chat.freenode`
+54 -3
View File
@@ -2,11 +2,55 @@
### Next release ### Next release
#### Removed build flags (`@define`) ### v4.1.0
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them. #### Adding duplicate layers to a map throws
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources. 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
Instead specifying a base url, the `url` for the `ol.source.Zoomify` source can now be a template. The `{TileGroup}`, `{x}`, `{y}`, `{z}` and placeholders must be included in the `url` in this case. the `url` can now also include subdomain placeholders:
```js
new ol.source.Zoomify({
url: 'https://{a-f}.example.com/cgi-bin/iipsrv.fcgi?zoomify=/a/b/{TileGroup}/{z}-{x}-{y}.jpg'
});
```
#### Removal of deprecated methods
The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead.
The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead.
```js
var key = map.on('moveend', function() { ...});
map.unByKey(key);
```
New code:
```js
var key = map.on('moveend', function() { ...});
ol.Observable.unByKey(key);
```
#### Simplified `ol.View#fit()` API #### Simplified `ol.View#fit()` API
@@ -29,6 +73,13 @@ Advanced use - new API:
map.getView().fit(extent, {size: [200, 100], padding 10}); map.getView().fit(extent, {size: [200, 100], padding 10});
``` ```
#### Removed build flags (`@define`)
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources.
### v3.20.0 ### v3.20.0
#### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions #### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions
+183
View File
@@ -0,0 +1,183 @@
# 4.0.0
Starting with this version, OpenLayers introduces [Semantic Versioning](http://semver.org). Unlike the switch from v2.x to v3.x, which marked a complete rewrite of the library with an entirely new API, major version increments now simply mean that users should pay attention to the *'Breaking changes'* section of the upgrade notes.
For users of mainstream bundlers and minifiers, OpenLayers is now also available as a set of ES2015 modules. See https://npmjs.com/package/ol/. With that package, bundling only the needed parts of the library with an application is now completely hassle free.
Version 4.0.0 includes enhancements and fixes from 107 pull requests since the previous release.
Among these changes, [#6381](https://github.com/openlayers/openlayers/pull/6381) adds an example which shows how to use [geojson-vt](https://www.npmjs.com/package/geojson-vt) for highly efficient rendering of GeoJSON data as vector tiles.
Several improvements were made to `ol.source.Zoomify`, including projection support ([#6387](https://github.com/openlayers/openlayers/pull/6387)) and support for URL templates ([#6475](https://github.com/openlayers/openlayers/pull/6475)).
Also the `ol.source.ImageArcGISRest` saw some enhancements, including HiDPI/Retina support and a fix that avoids non-integer DPI values ([#6300](https://github.com/openlayers/openlayers/pull/6300) and [#6467](https://github.com/openlayers/openlayers/pull/6467)).
On the topic of drawing tools, @tst-ppenev completed an effort to make the `ol.interaction.Modify` interaction support modification of `ol.geom.Circle` geometries ([#6457](https://github.com/openlayers/openlayers/pull/6457)).
## Breaking changes
### Simplified `ol.View#fit()` API
In most cases, it is no longer necessary to provide an `ol.Size` (previously the 2nd argument) to `ol.View#fit()`. By default, the size of the first map that uses the view will be used. If you want to specify a different size, it goes in the options now (previously the 3rd argument, now the 2nd).
Most common use case - old API:
```js
map.getView().fit(extent, map.getSize());
```
Most common use case - new API:
```js
map.getView().fit(extent);
```
Advanced use - old API:
```js
map.getView().fit(extent, [200, 100], {padding: 10});
```
Advanced use - new API:
```js
map.getView().fit(extent, {size: [200, 100], padding 10});
```
### Removal of deprecated methods
The deprecated `ol.animation` functions and `map.beforeRender()` method have been removed. Use `view.animate()` instead.
The `unByKey()` method has been removed from `ol.Observable` instances. Use the `ol.Observable.unByKey()` static function instead.
```js
var key = map.on('moveend', function() { ...});
map.unByKey(key);
```
New code:
```js
var key = map.on('moveend', function() { ...});
ol.Observable.unByKey(key);
```
## Upgrade notes
### Simpler `ol.source.Zoomify` `url` configuration
Instead specifying a base url, the `url` for the `ol.source.Zoomify` source can now be a template. The `{TileGroup}`, `{x}`, `{y}`, `{z}` and placeholders must be included in the `url` in this case. the `url` can now also include subdomain placeholders:
```js
new ol.source.Zoomify({
url: 'https://{a-f}.example.com/cgi-bin/iipsrv.fcgi?zoomify=/a/b/{TileGroup}/{z}-{x}-{y}.jpg'
});
```
#### Removed build flags (`@define`)
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
If you leave `ol.ENABLE_WEBGL` set to `true` in your build, you should set `ol.DEBUG_WEBGL` to `false` to avoid including debuggable shader sources.
## List of all changes
* [#6477](https://github.com/openlayers/openlayers/pull/6477) - Save and restore context when rotating ([@ahocevar](https://github.com/ahocevar))
* [#6475](https://github.com/openlayers/openlayers/pull/6475) - Use an url template for ol.source.Zoomify ([@fredj](https://github.com/fredj))
* [#6478](https://github.com/openlayers/openlayers/pull/6478) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6472](https://github.com/openlayers/openlayers/pull/6472) - Use fixed pixel ratio for hit tolerance tests ([@ahocevar](https://github.com/ahocevar))
* [#6468](https://github.com/openlayers/openlayers/pull/6468) - Remove console.assert in ol.structs.PriorityQueue tests ([@fredj](https://github.com/fredj))
* [#6467](https://github.com/openlayers/openlayers/pull/6467) - Round the DPI value in ol.source.ImageArcGISRest ([@fredj](https://github.com/fredj))
* [#6466](https://github.com/openlayers/openlayers/pull/6466) - Small XML error in KML test ([@tchandelle](https://github.com/tchandelle))
* [#6410](https://github.com/openlayers/openlayers/pull/6410) - fixed the degreesToStringHDMS_() function to promote a seconds value … ([@rjackson64840](https://github.com/rjackson64840))
* [#6461](https://github.com/openlayers/openlayers/pull/6461) - Add button to edit examples in CodePen ([@tchandelle](https://github.com/tchandelle))
* [#6320](https://github.com/openlayers/openlayers/pull/6320) - Use the 'openlayers' tag instead of 'openlayers-3' ([@ahocevar](https://github.com/ahocevar))
* [#6460](https://github.com/openlayers/openlayers/pull/6460) - Remove ol.Observable#unByKey ([@fredj](https://github.com/fredj))
* [#6463](https://github.com/openlayers/openlayers/pull/6463) - chore(package): update clean-css-cli to version 4.0.5 ([@openlayers](https://github.com/openlayers))
* [#6459](https://github.com/openlayers/openlayers/pull/6459) - Use ol.coordinate.distance ([@fredj](https://github.com/fredj))
* [#6457](https://github.com/openlayers/openlayers/pull/6457) - Add Circle Modification ([@tst-ppenev](https://github.com/tst-ppenev))
* [#6455](https://github.com/openlayers/openlayers/pull/6455) - Make all @api annotations imply stability ([@tschaub](https://github.com/tschaub))
* [#6452](https://github.com/openlayers/openlayers/pull/6452) - Remove deprecated methods ([@tschaub](https://github.com/tschaub))
* [#6361](https://github.com/openlayers/openlayers/pull/6361) - Remove "margin" at the bottom of the canvas ([@tchandelle](https://github.com/tchandelle))
* [#6450](https://github.com/openlayers/openlayers/pull/6450) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6302](https://github.com/openlayers/openlayers/pull/6302) - Publish a package for use with ES module bundlers ([@tschaub](https://github.com/tschaub))
* [#6446](https://github.com/openlayers/openlayers/pull/6446) - Update eslint to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6445](https://github.com/openlayers/openlayers/pull/6445) - Fix pinch zooming ([@tschaub](https://github.com/tschaub))
* [#6444](https://github.com/openlayers/openlayers/pull/6444) - Disallow pinch zooming beyond min/max resolution ([@tschaub](https://github.com/tschaub))
* [#6443](https://github.com/openlayers/openlayers/pull/6443) - goog.require cleanup ([@openlayers](https://github.com/openlayers))
* [#6439](https://github.com/openlayers/openlayers/pull/6439) - Improve tile render performance ([@ahocevar](https://github.com/ahocevar))
* [#6442](https://github.com/openlayers/openlayers/pull/6442) - Fix missing goog.require ([@fredj](https://github.com/fredj))
* [#6441](https://github.com/openlayers/openlayers/pull/6441) - Update metalsmith-layouts to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6437](https://github.com/openlayers/openlayers/pull/6437) - Fit on circle ([@tchandelle](https://github.com/tchandelle))
* [#6427](https://github.com/openlayers/openlayers/pull/6427) - Ensure WMS width and height are always integers ([@ahocevar](https://github.com/ahocevar))
* [#6432](https://github.com/openlayers/openlayers/pull/6432) - Use ol.proj.EPSG3857.WORLD_EXTENT in ol.source.TileImage tests ([@fredj](https://github.com/fredj))
* [#6424](https://github.com/openlayers/openlayers/pull/6424) - Update dependencies to enable Greenkeeper 🌴 ([@openlayers](https://github.com/openlayers))
* [#6422](https://github.com/openlayers/openlayers/pull/6422) - Don't listen twice to move and end events in ol.control.ZoomSlider ([@fredj](https://github.com/fredj))
* [#6426](https://github.com/openlayers/openlayers/pull/6426) - Add rewrite_polyfills to custom builds tutorial ([@probins](https://github.com/probins))
* [#6365](https://github.com/openlayers/openlayers/pull/6365) - Make enums for draw and modify interactions public ([@gberaudo](https://github.com/gberaudo))
* [#6294](https://github.com/openlayers/openlayers/pull/6294) - Update code for closure-compiler v20170124 ([@fredj](https://github.com/fredj))
* [#6413](https://github.com/openlayers/openlayers/pull/6413) - Accept ol.StyleFunction in ol.Feature#setStyle() ([@ahocevar](https://github.com/ahocevar))
* [#6398](https://github.com/openlayers/openlayers/pull/6398) - Be more tolerant of map and position value ([@fredj](https://github.com/fredj))
* [#6399](https://github.com/openlayers/openlayers/pull/6399) - Small doc fix in VectorTileOptions renderMode ([@tchandelle](https://github.com/tchandelle))
* [#6396](https://github.com/openlayers/openlayers/pull/6396) - Show current year in attribution in "HERE Map Tile API" example ([@chrismayer](https://github.com/chrismayer))
* [#6390](https://github.com/openlayers/openlayers/pull/6390) - Tag deprecated functions with @deprecated ([@fredj](https://github.com/fredj))
* [#6370](https://github.com/openlayers/openlayers/pull/6370) - Feature apidoc, fix events and observable properties ([@tchandelle](https://github.com/tchandelle))
* [#6376](https://github.com/openlayers/openlayers/pull/6376) - Make ol.format.filter.or/and accept n filter conditions ([@tsauerwein](https://github.com/tsauerwein))
* [#6393](https://github.com/openlayers/openlayers/pull/6393) - Only stop animation when animating ([@ahocevar](https://github.com/ahocevar))
* [#6387](https://github.com/openlayers/openlayers/pull/6387) - Add projection option to ol.source.Zoomify ([@ahocevar](https://github.com/ahocevar))
* [#6386](https://github.com/openlayers/openlayers/pull/6386) - Snap : only listen to change event triggered by the feature ([@tchandelle](https://github.com/tchandelle))
* [#6383](https://github.com/openlayers/openlayers/pull/6383) - Modify interaction: check if interaction is active before drawing modifying vertex ([@tchandelle](https://github.com/tchandelle))
* [#6381](https://github.com/openlayers/openlayers/pull/6381) - geojson-vt integration example ([@drnextgis](https://github.com/drnextgis))
* [#6373](https://github.com/openlayers/openlayers/pull/6373) - Use the ol.DEBUG_WEBGL flag to debug shader sources ([@tschaub](https://github.com/tschaub))
* [#6379](https://github.com/openlayers/openlayers/pull/6379) - Set the overview map target in ol.control.OverviewMap.setMap ([@fredj](https://github.com/fredj))
* [#6375](https://github.com/openlayers/openlayers/pull/6375) - Use present in license text ([@bartvde](https://github.com/bartvde))
* [#6371](https://github.com/openlayers/openlayers/pull/6371) - Adjust copyright to include 2017 ([@kolosov-sergey](https://github.com/kolosov-sergey))
* [#6364](https://github.com/openlayers/openlayers/pull/6364) - Make sure moveTo is called after beginPath ([@ahocevar](https://github.com/ahocevar))
* [#6285](https://github.com/openlayers/openlayers/pull/6285) - Make size argument of ol.View#calculateExtent() optional ([@ahocevar](https://github.com/ahocevar))
* [#6357](https://github.com/openlayers/openlayers/pull/6357) - Fix GeoJSONCRSCode definition ([@fredj](https://github.com/fredj))
* [#6362](https://github.com/openlayers/openlayers/pull/6362) - Remove empty file ([@fredj](https://github.com/fredj))
* [#6358](https://github.com/openlayers/openlayers/pull/6358) - Ensure polygons without stroke are fully filled ([@ahocevar](https://github.com/ahocevar))
* [#6356](https://github.com/openlayers/openlayers/pull/6356) - Bring custom builds tutorial up to date ([@probins](https://github.com/probins))
* [#6359](https://github.com/openlayers/openlayers/pull/6359) - When applying a pending fill, also apply a pending stroke ([@ahocevar](https://github.com/ahocevar))
* [#6360](https://github.com/openlayers/openlayers/pull/6360) - Remove ol.array.flatten function ([@openlayers](https://github.com/openlayers))
* [#6353](https://github.com/openlayers/openlayers/pull/6353) - API doc : add highlight style to the active anchor ([@tchandelle](https://github.com/tchandelle))
* [#6355](https://github.com/openlayers/openlayers/pull/6355) - Remove test.geojson which was accidently committed in 57342a6 ([@ahocevar](https://github.com/ahocevar))
* [#6349](https://github.com/openlayers/openlayers/pull/6349) - Better documentation for icon-color example ([@ahocevar](https://github.com/ahocevar))
* [#6351](https://github.com/openlayers/openlayers/pull/6351) - Only consider pointerdown event if the last pointerup has been emitted ([@tchandelle](https://github.com/tchandelle))
* [#6345](https://github.com/openlayers/openlayers/pull/6345) - Mitigate rounding errors in GetMap width/height calculation ([@giohappy](https://github.com/giohappy))
* [#6344](https://github.com/openlayers/openlayers/pull/6344) - No special raster reprojection handling for Chrome ([@ahocevar](https://github.com/ahocevar))
* [#6339](https://github.com/openlayers/openlayers/pull/6339) - Code cleanup ([@fredj](https://github.com/fredj))
* [#6337](https://github.com/openlayers/openlayers/pull/6337) - Constrain center in DragZoom interaction ([@tchandelle](https://github.com/tchandelle))
* [#6336](https://github.com/openlayers/openlayers/pull/6336) - Remove unused ol.format.Feature.getExtensions function ([@fredj](https://github.com/fredj))
* [#6333](https://github.com/openlayers/openlayers/pull/6333) - Use API key for Thunderforest resources ([@ahocevar](https://github.com/ahocevar))
* [#6300](https://github.com/openlayers/openlayers/pull/6300) - Add missing hidpi option for ol.source.ImageArcGISRest ([@fredj](https://github.com/fredj))
* [#6109](https://github.com/openlayers/openlayers/pull/6109) - Export Map as PNG (IE issue) ([@NaveenKY](https://github.com/NaveenKY))
* [#6332](https://github.com/openlayers/openlayers/pull/6332) - Constrain the center in zoomByDelta ([@tchandelle](https://github.com/tchandelle))
* [#6331](https://github.com/openlayers/openlayers/pull/6331) - Remove unused map parameter from ol.interaction.Interaction ([@tchandelle](https://github.com/tchandelle))
* [#6326](https://github.com/openlayers/openlayers/pull/6326) - Add lineDashOffset to stroke style ([@tchandelle](https://github.com/tchandelle))
* [#6328](https://github.com/openlayers/openlayers/pull/6328) - ol.geom.polygon documentation update on the coordinates format ([@quentin-ol](https://github.com/quentin-ol))
* [#6324](https://github.com/openlayers/openlayers/pull/6324) - Ensure resolution stays in range when pinching ([@tschaub](https://github.com/tschaub))
* [#6329](https://github.com/openlayers/openlayers/pull/6329) - Fix WMTS theme location for sea-levels layer ([@thomasmoelhave](https://github.com/thomasmoelhave))
* [#6323](https://github.com/openlayers/openlayers/pull/6323) - Fix typo in Introduction ([@hdsnet](https://github.com/hdsnet))
* [#6305](https://github.com/openlayers/openlayers/pull/6305) - Moved hit Tolerance parameter to own example. ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6319](https://github.com/openlayers/openlayers/pull/6319) - Remove the '3' from OpenLayers ([@ahocevar](https://github.com/ahocevar))
* [#6314](https://github.com/openlayers/openlayers/pull/6314) - WebGL conditional compilation ([@ahocevar](https://github.com/ahocevar))
* [#6313](https://github.com/openlayers/openlayers/pull/6313) - Remove ol.DEBUG ([@tschaub](https://github.com/tschaub))
* [#6317](https://github.com/openlayers/openlayers/pull/6317) - Update sinon to version 1.17.7 🚀 ([@openlayers](https://github.com/openlayers))
* [#6312](https://github.com/openlayers/openlayers/pull/6312) - Make layers responsible for creating layer renderers ([@tschaub](https://github.com/tschaub))
* [#6308](https://github.com/openlayers/openlayers/pull/6308) - Dedicated modules for shared enums ([@tschaub](https://github.com/tschaub))
* [#6307](https://github.com/openlayers/openlayers/pull/6307) - Dedicated modules for enums ([@tschaub](https://github.com/tschaub))
* [#6297](https://github.com/openlayers/openlayers/pull/6297) - Update resemblejs to version 2.2.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#6296](https://github.com/openlayers/openlayers/pull/6296) - Fix #6295. Update reference link in sphere.js ([@jbelien](https://github.com/jbelien))
* [#6255](https://github.com/openlayers/openlayers/pull/6255) - Don't reset the css cursor if it's not needed ([@fredj](https://github.com/fredj))
* [#6290](https://github.com/openlayers/openlayers/pull/6290) - Use interim tiles ([@ahocevar](https://github.com/ahocevar))
* [#6291](https://github.com/openlayers/openlayers/pull/6291) - Document olx.AtPixelOptions#hitTolerance default value ([@fredj](https://github.com/fredj))
* [#6283](https://github.com/openlayers/openlayers/pull/6283) - Avoid modifying coordinate in forEachLayerAtCoordinate ([@tschaub](https://github.com/tschaub))
* [#6278](https://github.com/openlayers/openlayers/pull/6278) - Add missing require for ol.View ([@tschaub](https://github.com/tschaub))
* [#6280](https://github.com/openlayers/openlayers/pull/6280) - Continue loading tiles when image is not ready yet ([@ahocevar](https://github.com/ahocevar))
* [#6277](https://github.com/openlayers/openlayers/pull/6277) - Name modules more like their provide ([@tschaub](https://github.com/tschaub))
* [#6264](https://github.com/openlayers/openlayers/pull/6264) - Remove the requirement to provide a size to ol.View#fit() ([@ahocevar](https://github.com/ahocevar))
* [#6274](https://github.com/openlayers/openlayers/pull/6274) - Update clean-css to version 3.4.23 🚀 ([@openlayers](https://github.com/openlayers))
* [#6269](https://github.com/openlayers/openlayers/pull/6269) - Update derequire to version 2.0.6 🚀 ([@openlayers](https://github.com/openlayers))
* [#6270](https://github.com/openlayers/openlayers/pull/6270) - Add a magnify example ([@tschaub](https://github.com/tschaub))
* [#6261](https://github.com/openlayers/openlayers/pull/6261) - Fit Zoomify view to image extent ([@ahocevar](https://github.com/ahocevar))
* [#6259](https://github.com/openlayers/openlayers/pull/6259) - Simplify Zoomify example ([@ahocevar](https://github.com/ahocevar))
* [#6260](https://github.com/openlayers/openlayers/pull/6260) - Enhance documentation for ol.View#fit ([@marcjansen](https://github.com/marcjansen))
* [#6258](https://github.com/openlayers/openlayers/pull/6258) - Set geometry name properly ([@ahocevar](https://github.com/ahocevar))
* [#6251](https://github.com/openlayers/openlayers/pull/6251) - Take image pixel ratio into account for rendered resolution ([@ahocevar](https://github.com/ahocevar))
* [#6244](https://github.com/openlayers/openlayers/pull/6244) - Enforces spacing around commas ([@fredj](https://github.com/fredj))
* [#6246](https://github.com/openlayers/openlayers/pull/6246) - Re-render vector tiles when layer has changed ([@ahocevar](https://github.com/ahocevar))
* [#6243](https://github.com/openlayers/openlayers/pull/6243) - Consistent spacing between keys and values in object literal ([@fredj](https://github.com/fredj))
* [#6238](https://github.com/openlayers/openlayers/pull/6238) - Update eslint to version 3.12.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#6236](https://github.com/openlayers/openlayers/pull/6236) - Update clean-css to version 3.4.22 🚀 ([@openlayers](https://github.com/openlayers))
+11
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
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))
+13
View File
@@ -0,0 +1,13 @@
# 4.1.1
## Summary
This is a patch release to fix several minor issues and two regressions in the [4.1.0 release](https://github.com/openlayers/openlayers/releases/tag/v4.1.0).
## Changes
* [#6711](https://github.com/openlayers/openlayers/pull/6711) - Correct path to cleancss ([@tschaub](https://github.com/tschaub))
* [#6728](https://github.com/openlayers/openlayers/pull/6728) - Fix tissot examples docs ([@fredj](https://github.com/fredj))
* [#6732](https://github.com/openlayers/openlayers/pull/6732) - Use firefox < 53 in travis ([@fredj](https://github.com/fredj))
* [#6741](https://github.com/openlayers/openlayers/pull/6741) - Allow user selection in overlay container ([@fredj](https://github.com/fredj))
* [#6755](https://github.com/openlayers/openlayers/pull/6755) - Add missing goog.require ([@fredj](https://github.com/fredj))
+5 -3
View File
@@ -59,14 +59,16 @@
<div class="row-fluid"> <div class="row-fluid">
<div id="source-controls"> <div id="source-controls">
<a id="copy-button"><i class="fa fa-clipboard"></i> Copy</a> <a id="copy-button"><i class="fa fa-clipboard"></i> Copy</a>
<a id="jsfiddle-button"><i class="fa fa-jsfiddle"></i> Edit</a> <a id="codepen-button"><i class="fa fa-codepen"></i> Edit</a>
</div> </div>
<form method="POST" id="jsfiddle-form" target="_blank" action="https://jsfiddle.net/api/post/library/pure/"> <form method="POST" id="codepen-form" target="_blank" action="https://codepen.io/pen/define/">
<textarea class="hidden" name="title">{{ title }}</textarea>
<textarea class="hidden" name="description">{{ shortdesc }}</textarea>
<textarea class="hidden" name="js">{{ js.source }}</textarea> <textarea class="hidden" name="js">{{ js.source }}</textarea>
<textarea class="hidden" name="css">{{ css.source }}</textarea> <textarea class="hidden" name="css">{{ css.source }}</textarea>
<textarea class="hidden" name="html">{{ contents }}</textarea> <textarea class="hidden" name="html">{{ contents }}</textarea>
<input type="hidden" name="wrap" value="l">
<input type="hidden" name="resources" value="https://openlayers.org/en/v{{ olVersion }}/css/ol.css,https://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}"> <input type="hidden" name="resources" value="https://openlayers.org/en/v{{ olVersion }}/css/ol.css,https://openlayers.org/en/v{{ olVersion }}/build/ol.js{{ extraResources }}">
<input type="hidden" name="data">
</form> </form>
<pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt; <pre><code id="example-source" class="language-markup">&lt;!DOCTYPE html&gt;
&lt;html&gt; &lt;html&gt;
-3
View File
@@ -26,9 +26,6 @@
"markdown": { "markdown": {
"parser": "gfm" "parser": "gfm"
}, },
"stability": {
"levels": ["deprecated","experimental","unstable","stable","frozen","locked"]
},
"templates": { "templates": {
"cleverLinks": true, "cleverLinks": true,
"monospaceLinks": true, "monospaceLinks": true,
+9 -11
View File
@@ -44,21 +44,19 @@ Interactions for [vector features](ol.Feature.html)
#### API change policy #### API change policy
The OpenLayers.x API consists of The OpenLayers API consists of
* names of classes, class methods and properties * names and signatures of constructors
* names of static functions and constants * names and signatures of instance methods and properties
* order and types of function arguments * names and signatures of functions
* types of function return values * names of constants
API elements marked as `experimental` provide stable and functioning code, but may change. Within a major release series, the API will not be changed. Any changes to the API will be accompanied by a new major release.
Any changes will be documented in upgrade notes so application code can be changed appropriately
before using the new version of the library. All other API elements will remain compatible throughout the 3.x releases so that no changes to existing application code are necessary when upgrading to a later version.
*Note*: The API change policy does not cover CSS class names that are used to theme the *Note*: The API change policy does not cover CSS class names that are used to style the
OpenLayers UI. OpenLayers UI.
*Note for Closure Compiler users compiling their application code together with OpenLayers*: *Note for Closure Compiler users compiling their application code together with OpenLayers*:
The names of types other than those in the list above (e.g. `ol.Pixel`) are subject to change. It The names of types other than those in the list above (e.g. `ol.Coordinate`) are subject to change. It
is therefore recommended to either use the resolved type as listed in the API docs (e.g. is therefore recommended to either use the resolved type as listed in the API docs (e.g.
`Array.<number>` instead of `ol.Pixel`), or pay attention to the upgrade notes, which will list `Array.<number>` instead of `ol.Coordinate`), or pay attention to the upgrade notes, which will list
the changes for those types. the changes for those types.
+1 -11
View File
@@ -1,10 +1,6 @@
/** /**
* Define an @api tag * Define an @api tag
*/ */
var conf = env.conf.stability;
var defaultLevels = ["deprecated","experimental","unstable","stable","frozen","locked"];
var levels = conf.levels || defaultLevels;
var util = require('util');
exports.defineTags = function(dictionary) { exports.defineTags = function(dictionary) {
dictionary.defineTag('api', { dictionary.defineTag('api', {
mustHaveValue: false, mustHaveValue: false,
@@ -12,13 +8,7 @@ exports.defineTags = function(dictionary) {
canHaveName: false, canHaveName: false,
onTagged: function(doclet, tag) { onTagged: function(doclet, tag) {
includeTypes(doclet); includeTypes(doclet);
var level = tag.text || "experimental"; doclet.stability = "stable";
if (levels.indexOf(level) >= 0) {
doclet.stability = level;
} else {
var errorText = util.format('Invalid stability level (%s) in %s line %s', tag.text, doclet.meta.filename, doclet.meta.lineno);
require('jsdoc/lib/jsdoc/util/error').handle( new Error(errorText) );
}
} }
}); });
}; };
+1 -1
View File
@@ -22,7 +22,7 @@ contain Markdown.
The second line tells the Closure compiler the type of the argument. The second line tells the Closure compiler the type of the argument.
The third line (`@api`) marks the method as part of the api and thus exportable. The stability can be added as value, e.g. `@api stable`. Without such an api annotation, the method will not be documented in the generated API documentation. Symbols without an api annotation will also not be exportable (unless they are explicitly exported with a `goog.exportProperty` call). The third line (`@api`) marks the method as part of the api and thus exportable. Without such an api annotation, the method will not be documented in the generated API documentation. Symbols without an api annotation will also not be exportable.
The `@api` annotation can be used in conjunction with the `@inheritDoc` annotation to export a symbol that is documented on a parent class (where the method may be abstract). In general, `@api` annotations should never be used on abstract methods (only on their implementations). The `@api` annotation can be used in conjunction with the `@inheritDoc` annotation to export a symbol that is documented on a parent class (where the method may be abstract). In general, `@api` annotations should never be used on abstract methods (only on their implementations).
@@ -92,30 +92,6 @@ $(function () {
textParts[1] + '</a>'; textParts[1] + '</a>';
}); });
// show/hide unstable items
var links = $('a[href^="ol."]');
var unstable = $('.unstable');
var stabilityToggle = $('#stability-toggle');
stabilityToggle.change(function() {
unstable.toggleClass('hidden', this.checked);
var search = this.checked ? '?stableonly=true' : '';
links.each(function(i, el) {
this.href = this.pathname + search + this.hash;
});
if (history.replaceState) {
var url = window.location.pathname + search + window.location.hash;
history.replaceState({}, '', url);
}
return false;
});
var search = window.location.search;
links.each(function(i, el) {
this.href = this.pathname + search + this.hash;
});
stabilityToggle.prop('checked', search === '?stableonly=true');
unstable.toggleClass('hidden', stabilityToggle[0].checked);
// Highlighting current anchor // Highlighting current anchor
var anchors = $('.anchor'); var anchors = $('.anchor');
@@ -23,9 +23,6 @@ var version = obj.packageInfo.version;
<div class="navbar-inner"> <div class="navbar-inner">
<div class="container"> <div class="container">
<a class="brand" href="/"><img src="logo-70x70.png"> OpenLayers</a> <a class="brand" href="/"><img src="logo-70x70.png"> OpenLayers</a>
<label id="stability">
<input type="checkbox" id="stability-toggle"> Stable Only
</label>
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<li><a href="../doc">Docs</a></li> <li><a href="../doc">Docs</a></li>
<li><a href="../examples">Examples</a></li> <li><a href="../examples">Examples</a></li>
+12 -3
View File
@@ -34,16 +34,21 @@
.ol-unsupported { .ol-unsupported {
display: none; display: none;
} }
.ol-viewport .ol-unselectable { .ol-viewport, .ol-unselectable {
-webkit-touch-callout: none; -webkit-touch-callout: none;
-webkit-user-select: none; -webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0); -webkit-tap-highlight-color: rgba(0,0,0,0);
} }
.ol-selectable {
-webkit-touch-callout: default;
-webkit-user-select: auto;
-moz-user-select: auto;
-ms-user-select: auto;
user-select: auto;
}
.ol-control { .ol-control {
position: absolute; position: absolute;
background-color: rgba(255,255,255,0.4); background-color: rgba(255,255,255,0.4);
@@ -239,3 +244,7 @@
.ol-overviewmap-box { .ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7); border: 2px dotted rgba(0,60,136,0.7);
} }
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}
+4
View File
@@ -220,3 +220,7 @@ The `{-y}` placeholder requires a tile grid with extent.
### 57 ### 57
At least 2 conditions are required. 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.
+1 -1
View File
@@ -7,7 +7,7 @@ layout: doc.hbs
Certain questions arise more often than others when users ask for help. This Certain questions arise more often than others when users ask for help. This
document tries to list some of the common questions that frequently get asked, document tries to list some of the common questions that frequently get asked,
e.g. on [Stack Overflow](http://stackoverflow.com/questions/tagged/openlayers-3). e.g. on [Stack Overflow](http://stackoverflow.com/questions/tagged/openlayers).
If you think a question (and naturally its answer) should be added here, feel If you think a question (and naturally its answer) should be added here, feel
free to ping us or to send a pull request enhancing this document. free to ping us or to send a pull request enhancing this document.
+1 -1
View File
@@ -19,4 +19,4 @@ We have put together a document that lists [Frequently Asked Questions (FAQ)](fa
# More questions? # More questions?
If you cannot find an answer in the documentation or the FAQ, you can ask your question on [stackoverflow using the tag 'openlayers-3'](http://stackoverflow.com/questions/tagged/openlayers-3). If you cannot find an answer in the documentation or the FAQ, you can ask your question on [Stack Overflow using the tag 'openlayers'](http://stackoverflow.com/questions/tagged/openlayers).
+2
View File
@@ -172,6 +172,7 @@ The minimum config file looks like this:
"ol.ENABLE_WEBGL=false" "ol.ENABLE_WEBGL=false"
], ],
"js": [ "js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js", "node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.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" "ol.ENABLE_WEBGL=false"
], ],
"js": [ "js": [
"node_modules/openlayers/src/ol/typedefs.js",
"node_modules/openlayers/externs/olx.js", "node_modules/openlayers/externs/olx.js",
"node_modules/openlayers/externs/oli.js" "node_modules/openlayers/externs/oli.js"
], ],
+10 -1
View File
@@ -51,7 +51,9 @@ Creating a custom build requires writing a build configuration file. The format
"compile": { "compile": {
"externs": [ "externs": [
"externs/bingmaps.js", "externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js", "externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js", "externs/geojson.js",
"externs/oli.js", "externs/oli.js",
"externs/olx.js", "externs/olx.js",
@@ -201,9 +203,16 @@ Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openl
], ],
"compile": { "compile": {
"externs": [ "externs": [
"externs/bingmaps.js",
"externs/cartodb.js",
"externs/closure-compiler.js", "externs/closure-compiler.js",
"externs/esrijson.js",
"externs/geojson.js",
"externs/olx.js", "externs/olx.js",
"externs/oli.js" "externs/oli.js",
"externs/proj4js.js",
"externs/tilejson.js",
"externs/topojson.js"
], ],
"define": [ "define": [
"ol.ENABLE_WEBGL=false", "ol.ENABLE_WEBGL=false",
+1 -1
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): Following example shows definition of a [British National Grid](https://epsg.io/27700):
``` html ``` 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 ``` javascript
+1 -1
View File
@@ -1,7 +1,7 @@
--- ---
layout: example.html layout: example.html
title: Clustered Features title: Clustered Features
shortdesc: Example of using <code>ol.source.Cluster</code>. shortdesc: Example of using ol.source.Cluster.
docs: > docs: >
This example shows how to do clustering on point features. This example shows how to do clustering on point features.
tags: "cluster, vector" tags: "cluster, vector"
+1
View File
@@ -13,5 +13,6 @@ tags: "draw, edit, modify, vector, featureoverlay"
<option value="Point">Point</option> <option value="Point">Point</option>
<option value="LineString">LineString</option> <option value="LineString">LineString</option>
<option value="Polygon">Polygon</option> <option value="Polygon">Polygon</option>
<option value="Circle">Circle</option>
</select> </select>
</form> </form>
+2 -1
View File
@@ -11,7 +11,8 @@ var layers = [
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR' 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
} }
}) })
}) })
+1 -1
View File
@@ -7,7 +7,7 @@ goog.require('ol.source.VectorTile');
goog.require('ol.layer.Tile'); goog.require('ol.layer.Tile');
goog.require('ol.layer.VectorTile'); goog.require('ol.layer.VectorTile');
goog.require('ol.tilegrid'); goog.require('ol.tilegrid');
goog.require('ol.proj'); goog.require('ol.proj.Projection');
var replacer = function(key, value) { var replacer = function(key, value) {
+1 -1
View File
@@ -6,7 +6,7 @@ goog.require('ol.source.TileWMS');
var wmsSource = new ol.source.TileWMS({ var wmsSource = new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'ne:ne'}, params: {'LAYERS': 'ne:ne', 'TILED': true},
serverType: 'geoserver', serverType: 'geoserver',
crossOrigin: 'anonymous' crossOrigin: 'anonymous'
}); });
+3 -1
View File
@@ -27,6 +27,8 @@ var graticule = new ol.Graticule({
color: 'rgba(255,120,0,0.9)', color: 'rgba(255,120,0,0.9)',
width: 2, width: 2,
lineDash: [0.5, 4] lineDash: [0.5, 4]
}) }),
showLabels: true
}); });
graticule.setMap(map); graticule.setMap(map);
+3
View File
@@ -26,6 +26,7 @@ var madrid = new ol.Feature({
rome.setStyle(new ol.style.Style({ rome.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#8959A8', color: '#8959A8',
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));
@@ -33,6 +34,7 @@ rome.setStyle(new ol.style.Style({
london.setStyle(new ol.style.Style({ london.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: '#4271AE', color: '#4271AE',
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));
@@ -40,6 +42,7 @@ london.setStyle(new ol.style.Style({
madrid.setStyle(new ol.style.Style({ madrid.setStyle(new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
color: [113, 140, 0], color: [113, 140, 0],
crossOrigin: 'anonymous',
src: 'data/dot.png' src: 'data/dot.png'
})) }))
})); }));
+1
View File
@@ -15,6 +15,7 @@ function createStyle(src, img) {
return new ol.style.Style({ return new ol.style.Style({
image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
anchor: [0.5, 0.96], anchor: [0.5, 0.96],
crossOrigin: 'anonymous',
src: src, src: src,
img: img, img: img,
imgSize: img ? [img.width, img.height] : undefined imgSize: img ? [img.width, img.height] : undefined
+1
View File
@@ -51,6 +51,7 @@ for (i = 0; i < iconCount; ++i) {
rotation: info.rotation, rotation: info.rotation,
scale: info.scale, scale: info.scale,
size: info.size, size: info.size,
crossOrigin: 'anonymous',
src: 'data/Butterfly.png' src: 'data/Butterfly.png'
}); });
} }
+1 -1
View File
@@ -3,7 +3,7 @@ layout: example.html
title: Advanced Mapbox Vector Tiles title: Advanced Mapbox Vector Tiles
shortdesc: Example of a Mapbox vector tiles map with custom tile grid. shortdesc: Example of a Mapbox vector tiles map with custom tile grid.
docs: > docs: >
A vector tiles map which reuses the same tiles for subsequent zoom levels to save bandwith on mobile devices. **Note**: No map will be visible when the access token has expired. A vector tiles map which reuses the same tiles for subsequent zoom levels to save bandwidth on mobile devices. **Note**: No map will be visible when the access token has expired.
tags: "mapbox, vector, tiles, mobile" tags: "mapbox, vector, tiles, mobile"
resources: resources:
- resources/mapbox-streets-v6-style.js - resources/mapbox-streets-v6-style.js
+12
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
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);
}
});
+12
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>
+25
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
})
});
+1 -1
View File
@@ -8,7 +8,7 @@ docs: >
in <a href="https://epsg.io/">EPSG.io</a> database. in <a href="https://epsg.io/">EPSG.io</a> database.
tags: "reprojection, projection, proj4js, epsg.io" tags: "reprojection, projection, proj4js, epsg.io"
resources: 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> <div id="map" class="map"></div>
<form class="form-inline"> <form class="form-inline">
+1 -1
View File
@@ -6,6 +6,6 @@ docs: >
This example shows client-side reprojection of single image source. This example shows client-side reprojection of single image source.
tags: "reprojection, projection, proj4js, image, imagestatic" tags: "reprojection, projection, proj4js, image, imagestatic"
resources: 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> <div id="map" class="map"></div>
+1 -1
View File
@@ -6,7 +6,7 @@ docs: >
This example shows client-side raster reprojection between various projections. This example shows client-side raster reprojection between various projections.
tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi" tags: "reprojection, projection, proj4js, osm, wms, wmts, hidpi"
resources: 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> <div id="map" class="map"></div>
<form class="form-inline"> <form class="form-inline">
+9 -6
View File
@@ -72,7 +72,8 @@ layers['wms4326'] = new ol.layer.Tile({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '', crossOrigin: '',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR' 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
}, },
projection: 'EPSG:4326' projection: 'EPSG:4326'
}) })
@@ -99,13 +100,15 @@ fetch(url).then(function(response) {
return response.text(); return response.text();
}).then(function(text) { }).then(function(text) {
var result = parser.read(text); var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result, var options = ol.source.WMTS.optionsFromCapabilities(result, {
{layer: 'OSM_Land_Mask', matrixSet: 'EPSG3413_250m'}); layer: 'OSM_Land_Mask',
matrixSet: 'EPSG3413_250m'
});
options.crossOrigin = ''; options.crossOrigin = '';
options.projection = 'EPSG:3413'; options.projection = 'EPSG:3413';
options.wrapX = false; options.wrapX = false;
layers['wmts3413'] = new ol.layer.Tile({ 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({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
crossOrigin: '', crossOrigin: '',
params: {'LAYERS': 'topp:states', 'TILED': true}, params: {'LAYERS': 'topp:states'},
serverType: 'geoserver', serverType: 'geoserver',
tileGrid: new ol.tilegrid.TileGrid({ tileGrid: new ol.tilegrid.TileGrid({
extent: [-13884991, 2870341, -7455066, 6338219], extent: [-13884991, 2870341, -7455066, 6338219],
@@ -174,7 +177,7 @@ function updateViewProjection() {
}); });
map.setView(newView); map.setView(newView);
// Example how to prevent double occurence of map by limiting layer extent // Example how to prevent double occurrence of map by limiting layer extent
if (newProj == ol.proj.get('EPSG:3857')) { if (newProj == ol.proj.get('EPSG:3857')) {
layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]); layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]);
} else { } else {
+33 -4
View File
@@ -10,11 +10,40 @@
}); });
} }
var fiddleButton = document.getElementById('jsfiddle-button'); var codepenButton = document.getElementById('codepen-button');
if (fiddleButton) { if (codepenButton) {
fiddleButton.onclick = function(event) { codepenButton.onclick = function(event) {
event.preventDefault(); event.preventDefault();
document.getElementById('jsfiddle-form').submit(); var form = document.getElementById('codepen-form');
// Doc : https://blog.codepen.io/documentation/api/prefill/
var resources = form.resources.value.split(',');
var data = {
title: form.title.value,
description: form.description.value,
layout: 'left',
html: form.html.value,
css: form.css.value,
js: form.js.value,
css_external: resources.filter(function(resource) {
return resource.lastIndexOf('.css') === resource.length - 4;
}).join(';'),
js_external: resources.filter(function(resource) {
return resource.lastIndexOf('.js') === resource.length - 3;
}).join(';')
};
// binary flags to display html, css, js and/or console tabs
data.editors = '' + Number(data.html.length > 0) +
Number(data.css.length > 0) +
Number(data.js.length > 0) +
Number(data.js.indexOf('console') > 0);
form.data.value = JSON.stringify(data);
form.submit();
}; };
} }
+1 -1
View File
@@ -106,7 +106,7 @@ pre[class*="language-"] {
cursor: pointer; cursor: pointer;
} }
#jsfiddle-button { #codepen-button {
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }
+1 -1
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. 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" tags: "reprojection, projection, openstreetmap, nad83, tile, scaleline"
resources: 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> <div id="map" class="map"></div>
+1 -1
View File
@@ -6,6 +6,6 @@ docs: >
Example of a Sphere Mollweide map with a Graticule component. Example of a Sphere Mollweide map with a Graticule component.
tags: "graticule, Mollweide, projection, proj4js" tags: "graticule, Mollweide, projection, proj4js"
resources: 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> <div id="map" class="map"></div>
+1 -1
View File
@@ -3,7 +3,7 @@ layout: example.html
title: Tissot Indicatrix title: Tissot Indicatrix
shortdesc: Draw Tissot's indicatrices on maps. shortdesc: Draw Tissot's indicatrices on maps.
docs: > docs: >
Example of [Tissot indicatrix](http://en.wikipedia.org/wiki/Tissot's_indicatrix)</a> maps. The map on the left is an EPSG:4326 map. The one on the right is EPSG:3857. Example of [Tissot indicatrix](http://en.wikipedia.org/wiki/Tissot's_indicatrix) maps. The map on the top is an `EPSG:4326` map. The one on the bottom is `EPSG:3857`.
tags: "tissot, circle" tags: "tissot, circle"
--- ---
<h4>EPSG:4326</h4> <h4>EPSG:4326</h4>
+4 -2
View File
@@ -22,7 +22,8 @@ var map4326 = new ol.Map({
source: new ol.source.TileWMS({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { 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({ source: new ol.source.TileWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: { params: {
'LAYERS': 'ne:NE1_HR_LC_SR_W_DR' 'LAYERS': 'ne:NE1_HR_LC_SR_W_DR',
'TILED': true
} }
}) })
}), }),
+1 -1
View File
@@ -6,7 +6,7 @@ docs: >
With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections. With [Proj4js](http://proj4js.org/) integration, OpenLayers can transform coordinates between arbitrary projections.
tags: "wms, single image, proj4js, projection" tags: "wms, single image, proj4js, projection"
resources: 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 - https://epsg.io/21781-1753.js
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
+1
View File
@@ -15,6 +15,7 @@ var layers = [
source: new ol.source.ImageWMS({ source: new ol.source.ImageWMS({
url: 'https://ahocevar.com/geoserver/wms', url: 'https://ahocevar.com/geoserver/wms',
params: {'LAYERS': 'topp:states'}, params: {'LAYERS': 'topp:states'},
ratio: 1,
serverType: 'geoserver' serverType: 'geoserver'
}) })
}) })
+1 -1
View File
@@ -3,7 +3,7 @@ layout: example.html
title: WMS Time title: WMS Time
shortdesc: Example of smooth tile transitions when changing the time dimension of a tiled WMS layer. shortdesc: Example of smooth tile transitions when changing the time dimension of a tiled WMS layer.
docs: > docs: >
Demonstrates smooth reloading of layers when changing the time dimension continously. Data shown: IEM generated CONUS composite of NWS NEXRAD WSR-88D level III base reflectivity. Demonstrates smooth reloading of layers when changing the time dimension continuously. Data shown: IEM generated CONUS composite of NWS NEXRAD WSR-88D level III base reflectivity.
tags: "wms, time, dimensions, transition, nexrad" tags: "wms, time, dimensions, transition, nexrad"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
+1 -1
View File
@@ -3,7 +3,7 @@ layout: example.html
title: WMTS Tile Transitions title: WMTS Tile Transitions
shortdesc: Example of smooth tile transitions when changing the dimension of a WMTS layer. shortdesc: Example of smooth tile transitions when changing the dimension of a WMTS layer.
docs: > docs: >
Demonstrates smooth reloading of layers when changing a dimension continously. The demonstration layer is a global sea-level computation (flooding computation from <a href="http://scalgo.com">SCALGO</a>, underlying data from <a href="http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1">CGIAR-CSI SRTM</a>) where cells that are flooded if the sea-level rises to more than <em>x</em> m are colored blue. The user selects the sea-level dimension using a slider. Demonstrates smooth reloading of layers when changing a dimension continuously. The demonstration layer is a global sea-level computation (flooding computation from <a href="http://scalgo.com">SCALGO</a>, underlying data from <a href="http://www.cgiar-csi.org/data/srtm-90m-digital-elevation-database-v4-1">CGIAR-CSI SRTM</a>) where cells that are flooded if the sea-level rises to more than <em>x</em> m are colored blue. The user selects the sea-level dimension using a slider.
tags: "wmts, parameter, transition" tags: "wmts, parameter, transition"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
+1 -1
View File
@@ -34,6 +34,6 @@ fetch(capabilitiesUrl).then(function(response) {
}); });
options.tilePixelRatio = tilePixelRatio; options.tilePixelRatio = tilePixelRatio;
map.addLayer(new ol.layer.Tile({ map.addLayer(new ol.layer.Tile({
source: new ol.source.WMTS(options) source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
})); }));
}); });
+4 -4
View File
@@ -5,10 +5,10 @@ shortdesc: Demonstrates displaying IGN (France) WMTS layers.
docs: > docs: >
In this example an IGN WMTS layer is displayed. In this example an IGN WMTS layer is displayed.
For more information on IGN's WMTS service see the For more information on IGN's WMTS service see the
<a href="http://professionnels.ign.fr/api-sig">IGN Géoportail API web page [IGN Géoportail API web page](http://api.ign.fr/accueil)
</a> and and
<a href="http://www.geoportail.gouv.fr/depot/api/cgu/DT_APIGeoportail.pdf"> [Descriptif technique des web services du Géoportail](http://www.geoportail.gouv.fr/depot/api/cgu/DT_APIGeoportail.pdf)
Descriptif technique des web services du Géoportail</a> (french). (french).
tags: "french, ign, geoportail, wmts" tags: "french, ign, geoportail, wmts"
--- ---
<div id="map" class="map"></div> <div id="map" class="map"></div>
+5 -3
View File
@@ -12,8 +12,10 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
return response.text(); return response.text();
}).then(function(text) { }).then(function(text) {
var result = parser.read(text); var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result, var options = ol.source.WMTS.optionsFromCapabilities(result, {
{layer: 'layer-7328', matrixSet: 'EPSG:3857'}); layer: 'layer-7328',
matrixSet: 'EPSG:3857'
});
map = new ol.Map({ map = new ol.Map({
layers: [ layers: [
@@ -23,7 +25,7 @@ fetch('data/WMTSCapabilities.xml').then(function(response) {
}), }),
new ol.layer.Tile({ new ol.layer.Tile({
opacity: 1, opacity: 1,
source: new ol.source.WMTS(options) source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
}) })
], ],
target: 'map', target: 'map',
+458 -261
View File
File diff suppressed because it is too large Load Diff
+14 -8
View File
@@ -7,25 +7,31 @@
/** /**
* @constructor * @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} name
* @param {(string|Object)=} opt_def * @param {(string|Object)=} opt_def
* @return {undefined|Object.<string, Object.<{axis: string, units: string, * @return {undefined|Object.<string, Object.<{axis: string, units: string, to_meter: number}>>}
* to_meter: number}>>}
*/ */
proj4.defs = function(name, opt_def) {}; Proj4.prototype.defs = function(name, opt_def) {};
/**
* @type {Proj4}
*/
var proj4;
+28 -33
View File
@@ -1,6 +1,6 @@
{ {
"name": "openlayers", "name": "openlayers",
"version": "3.20.1", "version": "4.1.2-beta.1",
"description": "Build tools and sources for developing OpenLayers based mapping applications", "description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [ "keywords": [
"map", "map",
@@ -13,6 +13,7 @@
"postinstall": "closure-util update", "postinstall": "closure-util update",
"start": "node tasks/serve.js", "start": "node tasks/serve.js",
"pretest": "eslint tasks test test_rendering src examples", "pretest": "eslint tasks test test_rendering src examples",
"lint-package": "eslint --fix build/package",
"test": "node tasks/test.js", "test": "node tasks/test.js",
"debug-server": "node tasks/serve-lib.js" "debug-server": "node tasks/serve-lib.js"
}, },
@@ -30,45 +31,49 @@
"css/ol.css" "css/ol.css"
], ],
"dependencies": { "dependencies": {
"async": "2.1.4", "async": "2.4.0",
"browserify": "14.0.0", "closure-util": "1.20.0",
"closure-util": "1.17.0",
"derequire": "2.0.6", "derequire": "2.0.6",
"fs-extra": "2.0.0", "fs-extra": "3.0.1",
"glob": "7.1.1", "glob": "7.1.1",
"handlebars": "4.0.6", "handlebars": "4.0.8",
"jsdoc": "3.4.3", "jsdoc": "3.4.3",
"marked": "0.3.6", "marked": "0.3.6",
"metalsmith": "2.3.0", "metalsmith": "2.3.0",
"metalsmith-layouts": "1.7.0", "metalsmith-layouts": "1.8.1",
"nomnom": "1.8.1", "nomnom": "1.8.1",
"pbf": "3.0.5", "pbf": "3.0.5",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "2.0.1", "rbush": "2.0.1",
"rollup": "^0.41.6",
"rollup-plugin-cleanup": "^1.0.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"temp": "0.8.3", "temp": "0.8.3",
"vector-tile": "1.3.0", "@mapbox/vector-tile": "1.3.0",
"walk": "2.3.9" "walk": "2.3.9"
}, },
"devDependencies": { "devDependencies": {
"clean-css-cli": "4.0.0", "clean-css-cli": "4.1.0",
"coveralls": "2.11.15", "coveralls": "2.13.1",
"debounce": "^1.0.0", "debounce": "^1.0.0",
"eslint": "3.14.1", "eslint": "3.19.0",
"eslint-config-openlayers": "7.0.0", "eslint-config-openlayers": "7.0.0",
"eslint-plugin-openlayers-internal": "^3.1.0", "eslint-plugin-openlayers-internal": "^3.1.0",
"expect.js": "0.3.1", "expect.js": "0.3.1",
"gaze": "^1.0.0", "gaze": "^1.0.0",
"istanbul": "0.4.5", "istanbul": "0.4.5",
"jquery": "3.1.1", "jquery": "3.2.1",
"mocha": "3.2.0", "jscodeshift": "^0.3.30",
"mocha": "3.3.0",
"mocha-phantomjs-core": "^2.1.0", "mocha-phantomjs-core": "^2.1.0",
"mustache": "2.3.0", "mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.14", "phantomjs-prebuilt": "2.1.14",
"proj4": "2.3.17", "proj4": "2.4.3",
"resemblejs": "2.2.3", "resemblejs": "2.2.4",
"serve-files": "1.0.1", "serve-files": "1.0.1",
"sinon": "1.17.7", "sinon": "2.2.0",
"slimerjs": "0.906.2" "slimerjs": "0.10.3"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "openlayers", "extends": "openlayers",
@@ -87,19 +92,10 @@
"openlayers-internal" "openlayers-internal"
], ],
"rules": { "rules": {
"no-console": [
2,
{
"allow": [
"assert",
"warn"
]
}
],
"no-constant-condition": 0, "no-constant-condition": 0,
"openlayers-internal/enum": 2, "openlayers-internal/enum": 2,
"openlayers-internal/no-duplicate-requires": 2, "openlayers-internal/no-duplicate-requires": 2,
"openlayers-internal/no-missing-requires": 1, "openlayers-internal/no-missing-requires": 2,
"openlayers-internal/no-unused-requires": 2, "openlayers-internal/no-unused-requires": 2,
"openlayers-internal/one-provide": 2, "openlayers-internal/one-provide": 2,
"openlayers-internal/requires-first": 2, "openlayers-internal/requires-first": 2,
@@ -109,21 +105,20 @@
}, },
"ext": [ "ext": [
{ {
"module": "rbush", "module": "rbush"
"browserify": true
}, },
{ {
"module": "pbf", "module": "pbf",
"browserify": true "name": "PBF"
}, },
{ {
"module": "pixelworks", "module": "pixelworks",
"browserify": true "import": "Processor"
}, },
{ {
"module": "vector-tile", "module": "@mapbox/vector-tile",
"name": "vectortile", "name": "vectortile",
"browserify": true "import": "VectorTile"
} }
] ]
} }
+5
View File
@@ -0,0 +1,5 @@
{
"parserOptions": {
"sourceType": "module"
}
}
+24
View File
@@ -0,0 +1,24 @@
{
"name": "ol",
"version": "4.1.1",
"description": "OpenLayers as ES2015 modules",
"main": "index.js",
"module": "index.js",
"license": "BSD-2-Clause",
"dependencies": {
"pbf": "3.0.5",
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"@mapbox/vector-tile": "1.3.0"
},
"browserify": {
"transform": [
[
"babelify",
{
"plugins": ["transform-es2015-modules-commonjs"]
}
]
]
}
}
+52
View File
@@ -0,0 +1,52 @@
# ol
OpenLayers as ES2015 modules.
## Usage
Add the `ol` package as a dependency to your project.
npm install ol --save
Import just what you need for your application:
```js
import Map from 'ol/map';
import View from 'ol/view';
import TileLayer from 'ol/layer/tile';
import XYZ from 'ol/source/xyz';
new Map({
target: 'map',
layers: [
new TileLayer({
source: new XYZ({
url: 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
})
})
],
view: new View({
center: [0, 0],
zoom: 2
})
});
```
See the following examples for more detail on bundling OpenLayers with your application:
* Using [Rollup & Uglify](https://gist.github.com/tschaub/8beb328ea72b36446fc2198d008287de)
* Using [Rollup & Closure Compiler](https://gist.github.com/tschaub/32a5692bedac5254da24fa3b12072f35)
* Using [Webpack & Uglify](https://gist.github.com/tschaub/79025aef325cd2837364400a105405b8)
* Using [Browserify & Uglify](https://gist.github.com/tschaub/4bfb209a8f809823f1495b2e4436018e)
## Module Identifiers
The module identifiers above (e.g. `ol/map`) are like the `ol.Map` names in the [API documentation](http://openlayers.org/en/latest/apidoc/) with `/` instead of `.` and all lowercase. Each module only has a `default` export (there are no other named exports).
Constructors are exported from dedicated modules. For example, the `ol/layer/tile` module exports the `Tile` layer constructor.
Utility functions are available as properties of the default export from utility modules. For example, the `getCenter` function is a property of the default export from the `ol/extent` utility module.
## Caveats
* The WebGL renderer is not available in this package.
-174
View File
@@ -1,174 +0,0 @@
goog.provide('ol.animation');
goog.require('ol');
goog.require('ol.ViewHint');
goog.require('ol.coordinate');
goog.require('ol.easing');
/**
* Generate an animated transition that will "bounce" the resolution as it
* approaches the final value.
* @param {olx.animation.BounceOptions} options Bounce options.
* @return {ol.PreRenderFunction} Pre-render function.
* @deprecated Use {@link ol.View#animate} instead.
* @api
*/
ol.animation.bounce = function(options) {
var resolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.upAndDown;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = easing((frameState.time - start) / duration);
var deltaResolution = resolution - frameState.viewState.resolution;
frameState.animate = true;
frameState.viewState.resolution += delta * deltaResolution;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view center.
* @param {olx.animation.PanOptions} options Pan options.
* @return {ol.PreRenderFunction} Pre-render function.
* @deprecated Use {@link ol.View#animate} instead.
* @api
*/
ol.animation.pan = function(options) {
var source = options.source;
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
var sourceY = source[1];
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaX = sourceX - frameState.viewState.center[0];
var deltaY = sourceY - frameState.viewState.center[1];
frameState.animate = true;
frameState.viewState.center[0] += delta * deltaX;
frameState.viewState.center[1] += delta * deltaY;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view rotation.
* @param {olx.animation.RotateOptions} options Rotate options.
* @return {ol.PreRenderFunction} Pre-render function.
* @deprecated Use {@link ol.View#animate} instead.
* @api
*/
ol.animation.rotate = function(options) {
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
var anchor = options.anchor ?
options.anchor : null;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaRotation =
(sourceRotation - frameState.viewState.rotation) * delta;
frameState.animate = true;
frameState.viewState.rotation += deltaRotation;
if (anchor) {
var center = frameState.viewState.center;
ol.coordinate.sub(center, anchor);
ol.coordinate.rotate(center, deltaRotation);
ol.coordinate.add(center, anchor);
}
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
/**
* Generate an animated transition while updating the view resolution.
* @param {olx.animation.ZoomOptions} options Zoom options.
* @return {ol.PreRenderFunction} Pre-render function.
* @deprecated Use {@link ol.View#animate} instead.
* @api
*/
ol.animation.zoom = function(options) {
var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
var easing = options.easing ?
options.easing : ol.easing.inAndOut;
return (
/**
* @param {ol.Map} map Map.
* @param {?olx.FrameState} frameState Frame state.
* @return {boolean} Run this function in the next frame.
*/
function(map, frameState) {
if (frameState.time < start) {
frameState.animate = true;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else if (frameState.time < start + duration) {
var delta = 1 - easing((frameState.time - start) / duration);
var deltaResolution =
sourceResolution - frameState.viewState.resolution;
frameState.animate = true;
frameState.viewState.resolution += delta * deltaResolution;
frameState.viewHints[ol.ViewHint.ANIMATING] += 1;
return true;
} else {
return false;
}
});
};
-13
View File
@@ -1,13 +0,0 @@
/**
* The animation static methods are designed to be used with the
* {@link ol.Map#beforeRender} method. For example:
*
* var map = new ol.Map({ ... });
* var zoom = ol.animation.zoom({
* resolution: map.getView().getResolution()
* });
* map.beforeRender(zoom);
* map.getView().setResolution(map.getView().getResolution() * 2);
*
* @namespace ol.animation
*/
-2
View File
@@ -1,7 +1,5 @@
goog.provide('ol.array'); goog.provide('ol.array');
goog.require('ol');
/** /**
* Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1. * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
+3 -2
View File
@@ -13,11 +13,12 @@ goog.require('ol');
*/ */
ol.AssertionError = function(code) { ol.AssertionError = function(code) {
var path = ol.VERSION ? ol.VERSION.split('-')[0] : 'latest';
/** /**
* @type {string} * @type {string}
*/ */
this.message = 'Assertion failed. See ' + this.message = 'Assertion failed. See https://openlayers.org/en/' + path +
(ol.VERSION ? 'https://openlayers.org/en/' + ol.VERSION.split('-')[0] : '') +
'/doc/errors/#' + code + ' for details.'; '/doc/errors/#' + code + ' for details.';
/** /**
+2 -2
View File
@@ -24,7 +24,7 @@ goog.require('ol.tilegrid');
* @constructor * @constructor
* @param {olx.AttributionOptions} options Attribution options. * @param {olx.AttributionOptions} options Attribution options.
* @struct * @struct
* @api stable * @api
*/ */
ol.Attribution = function(options) { ol.Attribution = function(options) {
@@ -46,7 +46,7 @@ ol.Attribution = function(options) {
/** /**
* Get the attribution markup. * Get the attribution markup.
* @return {string} The attribution HTML. * @return {string} The attribution HTML.
* @api stable * @api
*/ */
ol.Attribution.prototype.getHTML = function() { ol.Attribution.prototype.getHTML = function() {
return this.html_; return this.html_;
+54 -15
View File
@@ -6,6 +6,7 @@
goog.provide('ol.Collection'); goog.provide('ol.Collection');
goog.require('ol'); goog.require('ol');
goog.require('ol.AssertionError');
goog.require('ol.CollectionEventType'); goog.require('ol.CollectionEventType');
goog.require('ol.Object'); goog.require('ol.Object');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
@@ -23,19 +24,34 @@ goog.require('ol.events.Event');
* @extends {ol.Object} * @extends {ol.Object}
* @fires ol.Collection.Event * @fires ol.Collection.Event
* @param {!Array.<T>=} opt_array Array. * @param {!Array.<T>=} opt_array Array.
* @param {olx.CollectionOptions=} opt_options Collection options.
* @template T * @template T
* @api stable * @api
*/ */
ol.Collection = function(opt_array) { ol.Collection = function(opt_array, opt_options) {
ol.Object.call(this); ol.Object.call(this);
var options = opt_options || {};
/**
* @private
* @type {boolean}
*/
this.unique_ = !!options.unique;
/** /**
* @private * @private
* @type {!Array.<T>} * @type {!Array.<T>}
*/ */
this.array_ = opt_array ? opt_array : []; 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_(); this.updateLength_();
}; };
@@ -44,7 +60,7 @@ ol.inherits(ol.Collection, ol.Object);
/** /**
* Remove all elements from the collection. * Remove all elements from the collection.
* @api stable * @api
*/ */
ol.Collection.prototype.clear = function() { ol.Collection.prototype.clear = function() {
while (this.getLength() > 0) { while (this.getLength() > 0) {
@@ -58,7 +74,7 @@ ol.Collection.prototype.clear = function() {
* to the end of the collection. * to the end of the collection.
* @param {!Array.<T>} arr Array. * @param {!Array.<T>} arr Array.
* @return {ol.Collection.<T>} This collection. * @return {ol.Collection.<T>} This collection.
* @api stable * @api
*/ */
ol.Collection.prototype.extend = function(arr) { ol.Collection.prototype.extend = function(arr) {
var i, ii; var i, ii;
@@ -76,7 +92,7 @@ ol.Collection.prototype.extend = function(arr) {
* index and the array). The return value is ignored. * index and the array). The return value is ignored.
* @param {S=} opt_this The object to use as `this` in `f`. * @param {S=} opt_this The object to use as `this` in `f`.
* @template S * @template S
* @api stable * @api
*/ */
ol.Collection.prototype.forEach = function(f, opt_this) { ol.Collection.prototype.forEach = function(f, opt_this) {
this.array_.forEach(f, opt_this); this.array_.forEach(f, opt_this);
@@ -89,7 +105,7 @@ ol.Collection.prototype.forEach = function(f, opt_this) {
* collection's "length" property won't be in sync with the actual length * collection's "length" property won't be in sync with the actual length
* of the array. * of the array.
* @return {!Array.<T>} Array. * @return {!Array.<T>} Array.
* @api stable * @api
*/ */
ol.Collection.prototype.getArray = function() { ol.Collection.prototype.getArray = function() {
return this.array_; return this.array_;
@@ -100,7 +116,7 @@ ol.Collection.prototype.getArray = function() {
* Get the element at the provided index. * Get the element at the provided index.
* @param {number} index Index. * @param {number} index Index.
* @return {T} Element. * @return {T} Element.
* @api stable * @api
*/ */
ol.Collection.prototype.item = function(index) { ol.Collection.prototype.item = function(index) {
return this.array_[index]; return this.array_[index];
@@ -111,7 +127,7 @@ ol.Collection.prototype.item = function(index) {
* Get the length of this collection. * Get the length of this collection.
* @return {number} The length of the array. * @return {number} The length of the array.
* @observable * @observable
* @api stable * @api
*/ */
ol.Collection.prototype.getLength = function() { ol.Collection.prototype.getLength = function() {
return /** @type {number} */ (this.get(ol.Collection.Property_.LENGTH)); return /** @type {number} */ (this.get(ol.Collection.Property_.LENGTH));
@@ -122,9 +138,12 @@ ol.Collection.prototype.getLength = function() {
* Insert an element at the provided index. * Insert an element at the provided index.
* @param {number} index Index. * @param {number} index Index.
* @param {T} elem Element. * @param {T} elem Element.
* @api stable * @api
*/ */
ol.Collection.prototype.insertAt = function(index, elem) { ol.Collection.prototype.insertAt = function(index, elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
this.array_.splice(index, 0, elem); this.array_.splice(index, 0, elem);
this.updateLength_(); this.updateLength_();
this.dispatchEvent( this.dispatchEvent(
@@ -136,7 +155,7 @@ ol.Collection.prototype.insertAt = function(index, elem) {
* Remove the last element of the collection and return it. * Remove the last element of the collection and return it.
* Return `undefined` if the collection is empty. * Return `undefined` if the collection is empty.
* @return {T|undefined} Element. * @return {T|undefined} Element.
* @api stable * @api
*/ */
ol.Collection.prototype.pop = function() { ol.Collection.prototype.pop = function() {
return this.removeAt(this.getLength() - 1); return this.removeAt(this.getLength() - 1);
@@ -147,9 +166,12 @@ ol.Collection.prototype.pop = function() {
* Insert the provided element at the end of the collection. * Insert the provided element at the end of the collection.
* @param {T} elem Element. * @param {T} elem Element.
* @return {number} New length of the collection. * @return {number} New length of the collection.
* @api stable * @api
*/ */
ol.Collection.prototype.push = function(elem) { ol.Collection.prototype.push = function(elem) {
if (this.unique_) {
this.assertUnique_(elem);
}
var n = this.getLength(); var n = this.getLength();
this.insertAt(n, elem); this.insertAt(n, elem);
return this.getLength(); return this.getLength();
@@ -160,7 +182,7 @@ ol.Collection.prototype.push = function(elem) {
* Remove the first occurrence of an element from the collection. * Remove the first occurrence of an element from the collection.
* @param {T} elem Element. * @param {T} elem Element.
* @return {T|undefined} The removed element or undefined if none found. * @return {T|undefined} The removed element or undefined if none found.
* @api stable * @api
*/ */
ol.Collection.prototype.remove = function(elem) { ol.Collection.prototype.remove = function(elem) {
var arr = this.array_; var arr = this.array_;
@@ -179,7 +201,7 @@ ol.Collection.prototype.remove = function(elem) {
* Return `undefined` if the collection does not contain this index. * Return `undefined` if the collection does not contain this index.
* @param {number} index Index. * @param {number} index Index.
* @return {T|undefined} Value. * @return {T|undefined} Value.
* @api stable * @api
*/ */
ol.Collection.prototype.removeAt = function(index) { ol.Collection.prototype.removeAt = function(index) {
var prev = this.array_[index]; var prev = this.array_[index];
@@ -195,11 +217,14 @@ ol.Collection.prototype.removeAt = function(index) {
* Set the element at the provided index. * Set the element at the provided index.
* @param {number} index Index. * @param {number} index Index.
* @param {T} elem Element. * @param {T} elem Element.
* @api stable * @api
*/ */
ol.Collection.prototype.setAt = function(index, elem) { ol.Collection.prototype.setAt = function(index, elem) {
var n = this.getLength(); var n = this.getLength();
if (index < n) { if (index < n) {
if (this.unique_) {
this.assertUnique_(elem, index);
}
var prev = this.array_[index]; var prev = this.array_[index];
this.array_[index] = elem; this.array_[index] = elem;
this.dispatchEvent( 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} * @enum {string}
* @private * @private
@@ -251,7 +290,7 @@ ol.Collection.Event = function(type, opt_element) {
/** /**
* The element that is added to or removed from the collection. * The element that is added to or removed from the collection.
* @type {*} * @type {*}
* @api stable * @api
*/ */
this.element = opt_element; this.element = opt_element;
+2 -2
View File
@@ -7,13 +7,13 @@ ol.CollectionEventType = {
/** /**
* Triggered when an item is added to the collection. * Triggered when an item is added to the collection.
* @event ol.Collection.Event#add * @event ol.Collection.Event#add
* @api stable * @api
*/ */
ADD: 'add', ADD: 'add',
/** /**
* Triggered when an item is removed from the collection. * Triggered when an item is removed from the collection.
* @event ol.Collection.Event#remove * @event ol.Collection.Event#remove
* @api stable * @api
*/ */
REMOVE: 'remove' REMOVE: 'remove'
}; };
+1 -2
View File
@@ -1,6 +1,5 @@
goog.provide('ol.control'); goog.provide('ol.control');
goog.require('ol');
goog.require('ol.Collection'); goog.require('ol.Collection');
goog.require('ol.control.Attribution'); goog.require('ol.control.Attribution');
goog.require('ol.control.Rotate'); goog.require('ol.control.Rotate');
@@ -17,7 +16,7 @@ goog.require('ol.control.Zoom');
* *
* @param {olx.control.DefaultsOptions=} opt_options Defaults options. * @param {olx.control.DefaultsOptions=} opt_options Defaults options.
* @return {ol.Collection.<ol.control.Control>} Controls. * @return {ol.Collection.<ol.control.Control>} Controls.
* @api stable * @api
*/ */
ol.control.defaults = function(opt_options) { ol.control.defaults = function(opt_options) {
+5 -5
View File
@@ -21,7 +21,7 @@ goog.require('ol.obj');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.AttributionOptions=} opt_options Attribution options. * @param {olx.control.AttributionOptions=} opt_options Attribution options.
* @api stable * @api
*/ */
ol.control.Attribution = function(opt_options) { ol.control.Attribution = function(opt_options) {
@@ -359,7 +359,7 @@ ol.control.Attribution.prototype.handleToggle_ = function() {
/** /**
* Return `true` if the attribution is collapsible, `false` otherwise. * Return `true` if the attribution is collapsible, `false` otherwise.
* @return {boolean} True if the widget is collapsible. * @return {boolean} True if the widget is collapsible.
* @api stable * @api
*/ */
ol.control.Attribution.prototype.getCollapsible = function() { ol.control.Attribution.prototype.getCollapsible = function() {
return this.collapsible_; return this.collapsible_;
@@ -369,7 +369,7 @@ ol.control.Attribution.prototype.getCollapsible = function() {
/** /**
* Set whether the attribution should be collapsible. * Set whether the attribution should be collapsible.
* @param {boolean} collapsible True if the widget is collapsible. * @param {boolean} collapsible True if the widget is collapsible.
* @api stable * @api
*/ */
ol.control.Attribution.prototype.setCollapsible = function(collapsible) { ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
if (this.collapsible_ === collapsible) { if (this.collapsible_ === collapsible) {
@@ -388,7 +388,7 @@ ol.control.Attribution.prototype.setCollapsible = function(collapsible) {
* not do anything if the attribution isn't collapsible or if the current * not do anything if the attribution isn't collapsible or if the current
* collapsed state is already the one requested. * collapsed state is already the one requested.
* @param {boolean} collapsed True if the widget is collapsed. * @param {boolean} collapsed True if the widget is collapsed.
* @api stable * @api
*/ */
ol.control.Attribution.prototype.setCollapsed = function(collapsed) { ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
if (!this.collapsible_ || this.collapsed_ === collapsed) { if (!this.collapsible_ || this.collapsed_ === collapsed) {
@@ -402,7 +402,7 @@ ol.control.Attribution.prototype.setCollapsed = function(collapsed) {
* Return `true` when the attribution is currently collapsed or `false` * Return `true` when the attribution is currently collapsed or `false`
* otherwise. * otherwise.
* @return {boolean} True if the widget is collapsed. * @return {boolean} True if the widget is collapsed.
* @api stable * @api
*/ */
ol.control.Attribution.prototype.getCollapsed = function() { ol.control.Attribution.prototype.getCollapsed = function() {
return this.collapsed_; return this.collapsed_;
+3 -3
View File
@@ -34,7 +34,7 @@ goog.require('ol.events');
* @extends {ol.Object} * @extends {ol.Object}
* @implements {oli.control.Control} * @implements {oli.control.Control}
* @param {olx.control.ControlOptions} options Control options. * @param {olx.control.ControlOptions} options Control options.
* @api stable * @api
*/ */
ol.control.Control = function(options) { ol.control.Control = function(options) {
@@ -89,7 +89,7 @@ ol.control.Control.prototype.disposeInternal = function() {
/** /**
* Get the map associated with this control. * Get the map associated with this control.
* @return {ol.Map} Map. * @return {ol.Map} Map.
* @api stable * @api
*/ */
ol.control.Control.prototype.getMap = function() { ol.control.Control.prototype.getMap = function() {
return this.map_; return this.map_;
@@ -102,7 +102,7 @@ ol.control.Control.prototype.getMap = function() {
* the map here. * the map here.
* @param {ol.Map} map Map. * @param {ol.Map} map Map.
* @override * @override
* @api stable * @api
*/ */
ol.control.Control.prototype.setMap = function(map) { ol.control.Control.prototype.setMap = function(map) {
if (this.map_) { if (this.map_) {
+3 -3
View File
@@ -12,7 +12,7 @@ goog.require('ol.events.EventType');
* @classdesc * @classdesc
* Provides a button that when clicked fills up the full screen with the map. * Provides a button that when clicked fills up the full screen with the map.
* The full screen source element is by default the element containing the map viewport unless * The full screen source element is by default the element containing the map viewport unless
* overriden by providing the `source` option. In which case, the dom * overridden by providing the `source` option. In which case, the dom
* element introduced using this parameter will be displayed in full screen. * element introduced using this parameter will be displayed in full screen.
* *
* When in full screen mode, a close button is shown to exit full screen mode. * When in full screen mode, a close button is shown to exit full screen mode.
@@ -23,7 +23,7 @@ goog.require('ol.events.EventType');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.FullScreenOptions=} opt_options Options. * @param {olx.control.FullScreenOptions=} opt_options Options.
* @api stable * @api
*/ */
ol.control.FullScreen = function(opt_options) { ol.control.FullScreen = function(opt_options) {
@@ -155,7 +155,7 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
/** /**
* @inheritDoc * @inheritDoc
* @api stable * @api
*/ */
ol.control.FullScreen.prototype.setMap = function(map) { ol.control.FullScreen.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map); ol.control.Control.prototype.setMap.call(this, map);
+6 -6
View File
@@ -21,7 +21,7 @@ goog.require('ol.proj');
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.MousePositionOptions=} opt_options Mouse position * @param {olx.control.MousePositionOptions=} opt_options Mouse position
* options. * options.
* @api stable * @api
*/ */
ol.control.MousePosition = function(opt_options) { ol.control.MousePosition = function(opt_options) {
@@ -118,7 +118,7 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
* @return {ol.CoordinateFormatType|undefined} The format to render the current * @return {ol.CoordinateFormatType|undefined} The format to render the current
* position in. * position in.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.MousePosition.prototype.getCoordinateFormat = function() { ol.control.MousePosition.prototype.getCoordinateFormat = function() {
return /** @type {ol.CoordinateFormatType|undefined} */ ( return /** @type {ol.CoordinateFormatType|undefined} */ (
@@ -131,7 +131,7 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
* @return {ol.proj.Projection|undefined} The projection to report mouse * @return {ol.proj.Projection|undefined} The projection to report mouse
* position in. * position in.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.MousePosition.prototype.getProjection = function() { ol.control.MousePosition.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
@@ -162,7 +162,7 @@ ol.control.MousePosition.prototype.handleMouseOut = function(event) {
/** /**
* @inheritDoc * @inheritDoc
* @api stable * @api
*/ */
ol.control.MousePosition.prototype.setMap = function(map) { ol.control.MousePosition.prototype.setMap = function(map) {
ol.control.Control.prototype.setMap.call(this, map); ol.control.Control.prototype.setMap.call(this, map);
@@ -183,7 +183,7 @@ ol.control.MousePosition.prototype.setMap = function(map) {
* @param {ol.CoordinateFormatType} format The format to render the current * @param {ol.CoordinateFormatType} format The format to render the current
* position in. * position in.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.MousePosition.prototype.setCoordinateFormat = function(format) { ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
this.set(ol.control.MousePosition.Property_.COORDINATE_FORMAT, format); this.set(ol.control.MousePosition.Property_.COORDINATE_FORMAT, format);
@@ -195,7 +195,7 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
* @param {ol.proj.Projection} projection The projection to report mouse * @param {ol.proj.Projection} projection The projection to report mouse
* position in. * position in.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.MousePosition.prototype.setProjection = function(projection) { ol.control.MousePosition.prototype.setProjection = function(projection) {
this.set(ol.control.MousePosition.Property_.PROJECTION, projection); this.set(ol.control.MousePosition.Property_.PROJECTION, projection);
+42 -4
View File
@@ -148,6 +148,44 @@ ol.control.OverviewMap = function(opt_options) {
render: render, render: render,
target: options.target 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); ol.inherits(ol.control.OverviewMap, ol.control.Control);
@@ -462,7 +500,7 @@ ol.control.OverviewMap.prototype.handleToggle_ = function() {
/** /**
* Return `true` if the overview map is collapsible, `false` otherwise. * Return `true` if the overview map is collapsible, `false` otherwise.
* @return {boolean} True if the widget is collapsible. * @return {boolean} True if the widget is collapsible.
* @api stable * @api
*/ */
ol.control.OverviewMap.prototype.getCollapsible = function() { ol.control.OverviewMap.prototype.getCollapsible = function() {
return this.collapsible_; return this.collapsible_;
@@ -472,7 +510,7 @@ ol.control.OverviewMap.prototype.getCollapsible = function() {
/** /**
* Set whether the overview map should be collapsible. * Set whether the overview map should be collapsible.
* @param {boolean} collapsible True if the widget is collapsible. * @param {boolean} collapsible True if the widget is collapsible.
* @api stable * @api
*/ */
ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) { ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
if (this.collapsible_ === collapsible) { if (this.collapsible_ === collapsible) {
@@ -491,7 +529,7 @@ ol.control.OverviewMap.prototype.setCollapsible = function(collapsible) {
* not do anything if the overview map isn't collapsible or if the current * not do anything if the overview map isn't collapsible or if the current
* collapsed state is already the one requested. * collapsed state is already the one requested.
* @param {boolean} collapsed True if the widget is collapsed. * @param {boolean} collapsed True if the widget is collapsed.
* @api stable * @api
*/ */
ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) { ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
if (!this.collapsible_ || this.collapsed_ === collapsed) { if (!this.collapsible_ || this.collapsed_ === collapsed) {
@@ -504,7 +542,7 @@ ol.control.OverviewMap.prototype.setCollapsed = function(collapsed) {
/** /**
* Determine if the overview map is collapsed. * Determine if the overview map is collapsed.
* @return {boolean} The overview map is collapsed. * @return {boolean} The overview map is collapsed.
* @api stable * @api
*/ */
ol.control.OverviewMap.prototype.getCollapsed = function() { ol.control.OverviewMap.prototype.getCollapsed = function() {
return this.collapsed_; return this.collapsed_;
+2 -10
View File
@@ -17,7 +17,7 @@ goog.require('ol.easing');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.RotateOptions=} opt_options Rotate options. * @param {olx.control.RotateOptions=} opt_options Rotate options.
* @api stable * @api
*/ */
ol.control.Rotate = function(opt_options) { ol.control.Rotate = function(opt_options) {
@@ -120,16 +120,8 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
// upon it // upon it
return; return;
} }
var currentRotation = view.getRotation(); if (view.getRotation() !== undefined) {
if (currentRotation !== undefined) {
if (this.duration_ > 0) { 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({ view.animate({
rotation: 0, rotation: 0,
duration: this.duration_, duration: this.duration_,
+7 -4
View File
@@ -24,7 +24,7 @@ goog.require('ol.proj.Units');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.ScaleLineOptions=} opt_options Scale line options. * @param {olx.control.ScaleLineOptions=} opt_options Scale line options.
* @api stable * @api
*/ */
ol.control.ScaleLine = function(opt_options) { ol.control.ScaleLine = function(opt_options) {
@@ -108,7 +108,7 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
* @return {ol.control.ScaleLineUnits|undefined} The units to use in the scale * @return {ol.control.ScaleLineUnits|undefined} The units to use in the scale
* line. * line.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.ScaleLine.prototype.getUnits = function() { ol.control.ScaleLine.prototype.getUnits = function() {
return /** @type {ol.control.ScaleLineUnits|undefined} */ ( return /** @type {ol.control.ScaleLineUnits|undefined} */ (
@@ -145,7 +145,7 @@ ol.control.ScaleLine.prototype.handleUnitsChanged_ = function() {
* Set the units to use in the scale line. * Set the units to use in the scale line.
* @param {ol.control.ScaleLineUnits} units The units to use in the scale line. * @param {ol.control.ScaleLineUnits} units The units to use in the scale line.
* @observable * @observable
* @api stable * @api
*/ */
ol.control.ScaleLine.prototype.setUnits = function(units) { ol.control.ScaleLine.prototype.setUnits = function(units) {
this.set(ol.control.ScaleLine.Property_.UNITS, units); this.set(ol.control.ScaleLine.Property_.UNITS, units);
@@ -203,7 +203,10 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
pointResolution /= 1852; pointResolution /= 1852;
suffix = 'nm'; suffix = 'nm';
} else if (units == ol.control.ScaleLineUnits.METRIC) { } else if (units == ol.control.ScaleLineUnits.METRIC) {
if (nominalCount < 1) { if (nominalCount < 0.001) {
suffix = 'μm';
pointResolution *= 1000000;
} else if (nominalCount < 1) {
suffix = 'mm'; suffix = 'mm';
pointResolution *= 1000; pointResolution *= 1000;
} else if (nominalCount < 1000) { } else if (nominalCount < 1000) {
+1 -1
View File
@@ -17,7 +17,7 @@ goog.require('ol.easing');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.ZoomOptions=} opt_options Zoom options. * @param {olx.control.ZoomOptions=} opt_options Zoom options.
* @api stable * @api
*/ */
ol.control.Zoom = function(opt_options) { ol.control.Zoom = function(opt_options) {
+1 -1
View File
@@ -26,7 +26,7 @@ goog.require('ol.pointer.PointerEventHandler');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options. * @param {olx.control.ZoomSliderOptions=} opt_options Zoom slider options.
* @api stable * @api
*/ */
ol.control.ZoomSlider = function(opt_options) { ol.control.ZoomSlider = function(opt_options) {
+1 -1
View File
@@ -15,7 +15,7 @@ goog.require('ol.css');
* @constructor * @constructor
* @extends {ol.control.Control} * @extends {ol.control.Control}
* @param {olx.control.ZoomToExtentOptions=} opt_options Options. * @param {olx.control.ZoomToExtentOptions=} opt_options Options.
* @api stable * @api
*/ */
ol.control.ZoomToExtent = function(opt_options) { ol.control.ZoomToExtent = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
+40 -15
View File
@@ -17,7 +17,7 @@ goog.require('ol.string');
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {ol.Coordinate} delta Delta. * @param {ol.Coordinate} delta Delta.
* @return {ol.Coordinate} The input coordinate adjusted by the given delta. * @return {ol.Coordinate} The input coordinate adjusted by the given delta.
* @api stable * @api
*/ */
ol.coordinate.add = function(coordinate, delta) { ol.coordinate.add = function(coordinate, delta) {
coordinate[0] += delta[0]; coordinate[0] += delta[0];
@@ -86,7 +86,7 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {ol.CoordinateFormatType} Coordinate format. * @return {ol.CoordinateFormatType} Coordinate format.
* @api stable * @api
*/ */
ol.coordinate.createStringXY = function(opt_fractionDigits) { ol.coordinate.createStringXY = function(opt_fractionDigits) {
return ( return (
@@ -101,21 +101,36 @@ ol.coordinate.createStringXY = function(opt_fractionDigits) {
/** /**
* @private
* @param {number} degrees Degrees.
* @param {string} hemispheres Hemispheres. * @param {string} hemispheres Hemispheres.
* @param {number} degrees Degrees.
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {string} String. * @return {string} String.
*/ */
ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fractionDigits) { ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) {
var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180; var normalizedDegrees = ol.math.modulo(degrees + 180, 360) - 180;
var x = Math.abs(3600 * normalizedDegrees); var x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0; var dflPrecision = opt_fractionDigits || 0;
return Math.floor(x / 3600) + '\u00b0 ' + var precision = Math.pow(10, dflPrecision);
ol.string.padNumber(Math.floor((x / 60) % 60), 2) + '\u2032 ' +
ol.string.padNumber((x % 60), 2, dflPrecision) + '\u2033 ' + var deg = Math.floor(x / 3600);
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0); var min = Math.floor((x - deg * 3600) / 60);
var sec = x - (deg * 3600) - (min * 60);
sec = Math.ceil(sec * precision) / precision;
if (sec >= 60) {
sec = 0;
min += 1;
}
if (min >= 60) {
min = 0;
deg += 1;
}
return deg + '\u00b0 ' + ol.string.padNumber(min, 2) + '\u2032 ' +
ol.string.padNumber(sec, 2, dflPrecision) + '\u2033' +
(normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
}; };
@@ -144,7 +159,7 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {string} Formatted coordinate. * @return {string} Formatted coordinate.
* @api stable * @api
*/ */
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) { ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
if (coordinate) { if (coordinate) {
@@ -188,7 +203,7 @@ ol.coordinate.equals = function(coordinate1, coordinate2) {
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @param {number} angle Angle in radian. * @param {number} angle Angle in radian.
* @return {ol.Coordinate} Coordinate. * @return {ol.Coordinate} Coordinate.
* @api stable * @api
*/ */
ol.coordinate.rotate = function(coordinate, angle) { ol.coordinate.rotate = function(coordinate, angle) {
var cosAngle = Math.cos(angle); var cosAngle = Math.cos(angle);
@@ -250,6 +265,16 @@ ol.coordinate.squaredDistance = function(coord1, coord2) {
}; };
/**
* @param {ol.Coordinate} coord1 First coordinate.
* @param {ol.Coordinate} coord2 Second coordinate.
* @return {number} Distance between coord1 and coord2.
*/
ol.coordinate.distance = function(coord1, coord2) {
return Math.sqrt(ol.coordinate.squaredDistance(coord1, coord2));
};
/** /**
* Calculate the squared distance from a coordinate to a line segment. * Calculate the squared distance from a coordinate to a line segment.
* *
@@ -283,12 +308,12 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {string} Hemisphere, degrees, minutes and seconds. * @return {string} Hemisphere, degrees, minutes and seconds.
* @api stable * @api
*/ */
ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) { ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
if (coordinate) { if (coordinate) {
return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS', opt_fractionDigits) + ' ' + return ol.coordinate.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW', opt_fractionDigits); ol.coordinate.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
} else { } else {
return ''; return '';
} }
@@ -314,7 +339,7 @@ ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
* @param {number=} opt_fractionDigits The number of digits to include * @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`. * after the decimal point. Default is `0`.
* @return {string} XY. * @return {string} XY.
* @api stable * @api
*/ */
ol.coordinate.toStringXY = function(coordinate, opt_fractionDigits) { ol.coordinate.toStringXY = function(coordinate, opt_fractionDigits) {
return ol.coordinate.format(coordinate, '{x}, {y}', opt_fractionDigits); return ol.coordinate.format(coordinate, '{x}, {y}', opt_fractionDigits);
+8
View File
@@ -10,6 +10,14 @@ goog.provide('ol.css');
ol.css.CLASS_HIDDEN = 'ol-hidden'; ol.css.CLASS_HIDDEN = 'ol-hidden';
/**
* The CSS class that we'll give the DOM elements to have them selectable.
*
* @const
* @type {string}
*/
ol.css.CLASS_SELECTABLE = 'ol-selectable';
/** /**
* The CSS class that we'll give the DOM elements to have them unselectable. * The CSS class that we'll give the DOM elements to have them unselectable.
* *
+2 -2
View File
@@ -28,7 +28,7 @@ ol.dom.createCanvasContext2D = function(opt_width, opt_height) {
*/ */
ol.dom.outerWidth = function(element) { ol.dom.outerWidth = function(element) {
var width = element.offsetWidth; var width = element.offsetWidth;
var style = element.currentStyle || getComputedStyle(element); var style = getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10); width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width; return width;
@@ -44,7 +44,7 @@ ol.dom.outerWidth = function(element) {
*/ */
ol.dom.outerHeight = function(element) { ol.dom.outerHeight = function(element) {
var height = element.offsetHeight; var height = element.offsetHeight;
var style = element.currentStyle || getComputedStyle(element); var style = getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10); height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height; return height;
+11 -11
View File
@@ -12,7 +12,7 @@ goog.require('ol.has');
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if only the alt key is pressed. * @return {boolean} True if only the alt key is pressed.
* @api stable * @api
*/ */
ol.events.condition.altKeyOnly = function(mapBrowserEvent) { ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
@@ -29,7 +29,7 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if only the alt and shift keys are pressed. * @return {boolean} True if only the alt and shift keys are pressed.
* @api stable * @api
*/ */
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) { ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
@@ -46,7 +46,7 @@ ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True. * @return {boolean} True.
* @function * @function
* @api stable * @api
*/ */
ol.events.condition.always = ol.functions.TRUE; ol.events.condition.always = ol.functions.TRUE;
@@ -56,7 +56,7 @@ ol.events.condition.always = ol.functions.TRUE;
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if the event is a map `click` event. * @return {boolean} True if the event is a map `click` event.
* @api stable * @api
*/ */
ol.events.condition.click = function(mapBrowserEvent) { ol.events.condition.click = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.CLICK; return mapBrowserEvent.type == ol.MapBrowserEventType.CLICK;
@@ -85,7 +85,7 @@ ol.events.condition.mouseActionButton = function(mapBrowserEvent) {
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} False. * @return {boolean} False.
* @function * @function
* @api stable * @api
*/ */
ol.events.condition.never = ol.functions.FALSE; ol.events.condition.never = ol.functions.FALSE;
@@ -108,7 +108,7 @@ ol.events.condition.pointerMove = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if the event is a map `singleclick` event. * @return {boolean} True if the event is a map `singleclick` event.
* @api stable * @api
*/ */
ol.events.condition.singleClick = function(mapBrowserEvent) { ol.events.condition.singleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.SINGLECLICK; return mapBrowserEvent.type == ol.MapBrowserEventType.SINGLECLICK;
@@ -120,7 +120,7 @@ ol.events.condition.singleClick = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if the event is a map `dblclick` event. * @return {boolean} True if the event is a map `dblclick` event.
* @api stable * @api
*/ */
ol.events.condition.doubleClick = function(mapBrowserEvent) { ol.events.condition.doubleClick = function(mapBrowserEvent) {
return mapBrowserEvent.type == ol.MapBrowserEventType.DBLCLICK; return mapBrowserEvent.type == ol.MapBrowserEventType.DBLCLICK;
@@ -133,7 +133,7 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True only if there no modifier keys are pressed. * @return {boolean} True only if there no modifier keys are pressed.
* @api stable * @api
*/ */
ol.events.condition.noModifierKeys = function(mapBrowserEvent) { ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
@@ -151,7 +151,7 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if only the platform modifier key is pressed. * @return {boolean} True if only the platform modifier key is pressed.
* @api stable * @api
*/ */
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) { ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
@@ -168,7 +168,7 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if only the shift key is pressed. * @return {boolean} True if only the shift key is pressed.
* @api stable * @api
*/ */
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) { ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
@@ -202,7 +202,7 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
* *
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @return {boolean} True if the event originates from a mouse device. * @return {boolean} True if the event originates from a mouse device.
* @api stable * @api
*/ */
ol.events.condition.mouseOnly = function(mapBrowserEvent) { ol.events.condition.mouseOnly = function(mapBrowserEvent) {
ol.asserts.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event ol.asserts.assert(mapBrowserEvent.pointerEvent, 56); // mapBrowserEvent must originate from a pointer event
+4 -4
View File
@@ -25,14 +25,14 @@ ol.events.Event = function(type) {
/** /**
* The event type. * The event type.
* @type {string} * @type {string}
* @api stable * @api
*/ */
this.type = type; this.type = type;
/** /**
* The event target. * The event target.
* @type {Object} * @type {Object}
* @api stable * @api
*/ */
this.target = null; this.target = null;
@@ -43,7 +43,7 @@ ol.events.Event = function(type) {
* Stop event propagation. * Stop event propagation.
* @function * @function
* @override * @override
* @api stable * @api
*/ */
ol.events.Event.prototype.preventDefault = ol.events.Event.prototype.preventDefault =
@@ -51,7 +51,7 @@ ol.events.Event.prototype.preventDefault =
* Stop event propagation. * Stop event propagation.
* @function * @function
* @override * @override
* @api stable * @api
*/ */
ol.events.Event.prototype.stopPropagation = function() { ol.events.Event.prototype.stopPropagation = function() {
this.propagationStopped = true; this.propagationStopped = true;
+1 -1
View File
@@ -26,7 +26,7 @@ ol.events.EventType = {
MOUSEOUT: 'mouseout', MOUSEOUT: 'mouseout',
MOUSEUP: 'mouseup', MOUSEUP: 'mouseup',
MOUSEWHEEL: 'mousewheel', MOUSEWHEEL: 'mousewheel',
MSPOINTERDOWN: 'mspointerdown', MSPOINTERDOWN: 'MSPointerDown',
RESIZE: 'resize', RESIZE: 'resize',
TOUCHSTART: 'touchstart', TOUCHSTART: 'touchstart',
TOUCHMOVE: 'touchmove', TOUCHMOVE: 'touchmove',
+20 -21
View File
@@ -1,6 +1,5 @@
goog.provide('ol.extent'); goog.provide('ol.extent');
goog.require('ol');
goog.require('ol.asserts'); goog.require('ol.asserts');
goog.require('ol.extent.Corner'); goog.require('ol.extent.Corner');
goog.require('ol.extent.Relationship'); goog.require('ol.extent.Relationship');
@@ -11,7 +10,7 @@ goog.require('ol.extent.Relationship');
* *
* @param {Array.<ol.Coordinate>} coordinates Coordinates. * @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @return {ol.Extent} Bounding extent. * @return {ol.Extent} Bounding extent.
* @api stable * @api
*/ */
ol.extent.boundingExtent = function(coordinates) { ol.extent.boundingExtent = function(coordinates) {
var extent = ol.extent.createEmpty(); var extent = ol.extent.createEmpty();
@@ -44,7 +43,7 @@ ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) {
* @param {number} value The amount by which the extent should be buffered. * @param {number} value The amount by which the extent should be buffered.
* @param {ol.Extent=} opt_extent Extent. * @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} Extent. * @return {ol.Extent} Extent.
* @api stable * @api
*/ */
ol.extent.buffer = function(extent, value, opt_extent) { ol.extent.buffer = function(extent, value, opt_extent) {
if (opt_extent) { if (opt_extent) {
@@ -116,7 +115,7 @@ ol.extent.closestSquaredDistanceXY = function(extent, x, y) {
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} coordinate Coordinate. * @param {ol.Coordinate} coordinate Coordinate.
* @return {boolean} The coordinate is contained in the extent. * @return {boolean} The coordinate is contained in the extent.
* @api stable * @api
*/ */
ol.extent.containsCoordinate = function(extent, coordinate) { ol.extent.containsCoordinate = function(extent, coordinate) {
return ol.extent.containsXY(extent, coordinate[0], coordinate[1]); return ol.extent.containsXY(extent, coordinate[0], coordinate[1]);
@@ -133,7 +132,7 @@ ol.extent.containsCoordinate = function(extent, coordinate) {
* @param {ol.Extent} extent2 Extent 2. * @param {ol.Extent} extent2 Extent 2.
* @return {boolean} The second extent is contained by or on the edge of the * @return {boolean} The second extent is contained by or on the edge of the
* first. * first.
* @api stable * @api
*/ */
ol.extent.containsExtent = function(extent1, extent2) { ol.extent.containsExtent = function(extent1, extent2) {
return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] &&
@@ -148,7 +147,7 @@ ol.extent.containsExtent = function(extent1, extent2) {
* @param {number} x X coordinate. * @param {number} x X coordinate.
* @param {number} y Y coordinate. * @param {number} y Y coordinate.
* @return {boolean} The x, y values are contained in the extent. * @return {boolean} The x, y values are contained in the extent.
* @api stable * @api
*/ */
ol.extent.containsXY = function(extent, x, y) { ol.extent.containsXY = function(extent, x, y) {
return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3]; return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];
@@ -190,7 +189,7 @@ ol.extent.coordinateRelationship = function(extent, coordinate) {
/** /**
* Create an empty extent. * Create an empty extent.
* @return {ol.Extent} Empty extent. * @return {ol.Extent} Empty extent.
* @api stable * @api
*/ */
ol.extent.createEmpty = function() { ol.extent.createEmpty = function() {
return [Infinity, Infinity, -Infinity, -Infinity]; return [Infinity, Infinity, -Infinity, -Infinity];
@@ -284,7 +283,7 @@ ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
* @param {ol.Extent} extent1 Extent 1. * @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent 2. * @param {ol.Extent} extent2 Extent 2.
* @return {boolean} The two extents are equivalent. * @return {boolean} The two extents are equivalent.
* @api stable * @api
*/ */
ol.extent.equals = function(extent1, extent2) { ol.extent.equals = function(extent1, extent2) {
return extent1[0] == extent2[0] && extent1[2] == extent2[2] && return extent1[0] == extent2[0] && extent1[2] == extent2[2] &&
@@ -297,7 +296,7 @@ ol.extent.equals = function(extent1, extent2) {
* @param {ol.Extent} extent1 The extent to be modified. * @param {ol.Extent} extent1 The extent to be modified.
* @param {ol.Extent} extent2 The extent that will be included in the first. * @param {ol.Extent} extent2 The extent that will be included in the first.
* @return {ol.Extent} A reference to the first (extended) extent. * @return {ol.Extent} A reference to the first (extended) extent.
* @api stable * @api
*/ */
ol.extent.extend = function(extent1, extent2) { ol.extent.extend = function(extent1, extent2) {
if (extent2[0] < extent1[0]) { if (extent2[0] < extent1[0]) {
@@ -443,7 +442,7 @@ ol.extent.getArea = function(extent) {
* Get the bottom left coordinate of an extent. * Get the bottom left coordinate of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.Coordinate} Bottom left coordinate. * @return {ol.Coordinate} Bottom left coordinate.
* @api stable * @api
*/ */
ol.extent.getBottomLeft = function(extent) { ol.extent.getBottomLeft = function(extent) {
return [extent[0], extent[1]]; return [extent[0], extent[1]];
@@ -454,7 +453,7 @@ ol.extent.getBottomLeft = function(extent) {
* Get the bottom right coordinate of an extent. * Get the bottom right coordinate of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.Coordinate} Bottom right coordinate. * @return {ol.Coordinate} Bottom right coordinate.
* @api stable * @api
*/ */
ol.extent.getBottomRight = function(extent) { ol.extent.getBottomRight = function(extent) {
return [extent[2], extent[1]]; return [extent[2], extent[1]];
@@ -465,7 +464,7 @@ ol.extent.getBottomRight = function(extent) {
* Get the center coordinate of an extent. * Get the center coordinate of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.Coordinate} Center. * @return {ol.Coordinate} Center.
* @api stable * @api
*/ */
ol.extent.getCenter = function(extent) { ol.extent.getCenter = function(extent) {
return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2]; return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];
@@ -547,7 +546,7 @@ ol.extent.getForViewAndSize = function(center, resolution, rotation, size, opt_e
* Get the height of an extent. * Get the height of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {number} Height. * @return {number} Height.
* @api stable * @api
*/ */
ol.extent.getHeight = function(extent) { ol.extent.getHeight = function(extent) {
return extent[3] - extent[1]; return extent[3] - extent[1];
@@ -571,7 +570,7 @@ ol.extent.getIntersectionArea = function(extent1, extent2) {
* @param {ol.Extent} extent2 Extent 2. * @param {ol.Extent} extent2 Extent 2.
* @param {ol.Extent=} opt_extent Optional extent to populate with intersection. * @param {ol.Extent=} opt_extent Optional extent to populate with intersection.
* @return {ol.Extent} Intersecting extent. * @return {ol.Extent} Intersecting extent.
* @api stable * @api
*/ */
ol.extent.getIntersection = function(extent1, extent2, opt_extent) { ol.extent.getIntersection = function(extent1, extent2, opt_extent) {
var intersection = opt_extent ? opt_extent : ol.extent.createEmpty(); var intersection = opt_extent ? opt_extent : ol.extent.createEmpty();
@@ -614,7 +613,7 @@ ol.extent.getMargin = function(extent) {
* Get the size (width, height) of an extent. * Get the size (width, height) of an extent.
* @param {ol.Extent} extent The extent. * @param {ol.Extent} extent The extent.
* @return {ol.Size} The extent size. * @return {ol.Size} The extent size.
* @api stable * @api
*/ */
ol.extent.getSize = function(extent) { ol.extent.getSize = function(extent) {
return [extent[2] - extent[0], extent[3] - extent[1]]; return [extent[2] - extent[0], extent[3] - extent[1]];
@@ -625,7 +624,7 @@ ol.extent.getSize = function(extent) {
* Get the top left coordinate of an extent. * Get the top left coordinate of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.Coordinate} Top left coordinate. * @return {ol.Coordinate} Top left coordinate.
* @api stable * @api
*/ */
ol.extent.getTopLeft = function(extent) { ol.extent.getTopLeft = function(extent) {
return [extent[0], extent[3]]; return [extent[0], extent[3]];
@@ -636,7 +635,7 @@ ol.extent.getTopLeft = function(extent) {
* Get the top right coordinate of an extent. * Get the top right coordinate of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {ol.Coordinate} Top right coordinate. * @return {ol.Coordinate} Top right coordinate.
* @api stable * @api
*/ */
ol.extent.getTopRight = function(extent) { ol.extent.getTopRight = function(extent) {
return [extent[2], extent[3]]; return [extent[2], extent[3]];
@@ -647,7 +646,7 @@ ol.extent.getTopRight = function(extent) {
* Get the width of an extent. * Get the width of an extent.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {number} Width. * @return {number} Width.
* @api stable * @api
*/ */
ol.extent.getWidth = function(extent) { ol.extent.getWidth = function(extent) {
return extent[2] - extent[0]; return extent[2] - extent[0];
@@ -659,7 +658,7 @@ ol.extent.getWidth = function(extent) {
* @param {ol.Extent} extent1 Extent 1. * @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent. * @param {ol.Extent} extent2 Extent.
* @return {boolean} The two extents intersect. * @return {boolean} The two extents intersect.
* @api stable * @api
*/ */
ol.extent.intersects = function(extent1, extent2) { ol.extent.intersects = function(extent1, extent2) {
return extent1[0] <= extent2[2] && return extent1[0] <= extent2[2] &&
@@ -673,7 +672,7 @@ ol.extent.intersects = function(extent1, extent2) {
* Determine if an extent is empty. * Determine if an extent is empty.
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @return {boolean} Is empty. * @return {boolean} Is empty.
* @api stable * @api
*/ */
ol.extent.isEmpty = function(extent) { ol.extent.isEmpty = function(extent) {
return extent[2] < extent[0] || extent[3] < extent[1]; return extent[2] < extent[0] || extent[3] < extent[1];
@@ -775,7 +774,7 @@ ol.extent.intersectsSegment = function(extent, start, end) {
* [minX, minY, maxX, maxY] extent coordinates. * [minX, minY, maxX, maxY] extent coordinates.
* @param {ol.Extent=} opt_extent Destination extent. * @param {ol.Extent=} opt_extent Destination extent.
* @return {ol.Extent} Extent. * @return {ol.Extent} Extent.
* @api stable * @api
*/ */
ol.extent.applyTransform = function(extent, transformFn, opt_extent) { ol.extent.applyTransform = function(extent, transformFn, opt_extent) {
var coordinates = [ var coordinates = [
+11 -11
View File
@@ -52,7 +52,7 @@ goog.require('ol.style.Style');
* You may pass a Geometry object directly, or an object literal * You may pass a Geometry object directly, or an object literal
* containing properties. If you pass an object literal, you may * containing properties. If you pass an object literal, you may
* include a Geometry associated with a `geometry` key. * include a Geometry associated with a `geometry` key.
* @api stable * @api
*/ */
ol.Feature = function(opt_geometryOrProperties) { ol.Feature = function(opt_geometryOrProperties) {
@@ -113,7 +113,7 @@ ol.inherits(ol.Feature, ol.Object);
* Clone this feature. If the original feature has a geometry it * Clone this feature. If the original feature has a geometry it
* is also cloned. The feature id is not set in the clone. * is also cloned. The feature id is not set in the clone.
* @return {ol.Feature} The clone. * @return {ol.Feature} The clone.
* @api stable * @api
*/ */
ol.Feature.prototype.clone = function() { ol.Feature.prototype.clone = function() {
var clone = new ol.Feature(this.getProperties()); var clone = new ol.Feature(this.getProperties());
@@ -135,7 +135,7 @@ ol.Feature.prototype.clone = function() {
* geometries. The "default" geometry (the one that is rendered by default) is * geometries. The "default" geometry (the one that is rendered by default) is
* set when calling {@link ol.Feature#setGeometry}. * set when calling {@link ol.Feature#setGeometry}.
* @return {ol.geom.Geometry|undefined} The default geometry for the feature. * @return {ol.geom.Geometry|undefined} The default geometry for the feature.
* @api stable * @api
* @observable * @observable
*/ */
ol.Feature.prototype.getGeometry = function() { ol.Feature.prototype.getGeometry = function() {
@@ -149,7 +149,7 @@ ol.Feature.prototype.getGeometry = function() {
* is either set when reading data from a remote source or set explicitly by * is either set when reading data from a remote source or set explicitly by
* calling {@link ol.Feature#setId}. * calling {@link ol.Feature#setId}.
* @return {number|string|undefined} Id. * @return {number|string|undefined} Id.
* @api stable * @api
*/ */
ol.Feature.prototype.getId = function() { ol.Feature.prototype.getId = function() {
return this.id_; return this.id_;
@@ -161,7 +161,7 @@ ol.Feature.prototype.getId = function() {
* geometry is named `geometry`. * geometry is named `geometry`.
* @return {string} Get the property name associated with the default geometry * @return {string} Get the property name associated with the default geometry
* for this feature. * for this feature.
* @api stable * @api
*/ */
ol.Feature.prototype.getGeometryName = function() { ol.Feature.prototype.getGeometryName = function() {
return this.geometryName_; return this.geometryName_;
@@ -173,7 +173,7 @@ ol.Feature.prototype.getGeometryName = function() {
* {@link ol.Feature#setStyle} method. * {@link ol.Feature#setStyle} method.
* @return {ol.style.Style|Array.<ol.style.Style>| * @return {ol.style.Style|Array.<ol.style.Style>|
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style. * ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
* @api stable * @api
*/ */
ol.Feature.prototype.getStyle = function() { ol.Feature.prototype.getStyle = function() {
return this.style_; return this.style_;
@@ -184,7 +184,7 @@ ol.Feature.prototype.getStyle = function() {
* Get the feature's style function. * Get the feature's style function.
* @return {ol.FeatureStyleFunction|undefined} Return a function * @return {ol.FeatureStyleFunction|undefined} Return a function
* representing the current style of this feature. * representing the current style of this feature.
* @api stable * @api
*/ */
ol.Feature.prototype.getStyleFunction = function() { ol.Feature.prototype.getStyleFunction = function() {
return this.styleFunction_; return this.styleFunction_;
@@ -220,7 +220,7 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
* Set the default geometry for the feature. This will update the property * Set the default geometry for the feature. This will update the property
* with the name returned by {@link ol.Feature#getGeometryName}. * with the name returned by {@link ol.Feature#getGeometryName}.
* @param {ol.geom.Geometry|undefined} geometry The new geometry. * @param {ol.geom.Geometry|undefined} geometry The new geometry.
* @api stable * @api
* @observable * @observable
*/ */
ol.Feature.prototype.setGeometry = function(geometry) { ol.Feature.prototype.setGeometry = function(geometry) {
@@ -234,7 +234,7 @@ ol.Feature.prototype.setGeometry = function(geometry) {
* styles. If it is `null` the feature has no style (a `null` style). * styles. If it is `null` the feature has no style (a `null` style).
* @param {ol.style.Style|Array.<ol.style.Style>| * @param {ol.style.Style|Array.<ol.style.Style>|
* ol.FeatureStyleFunction|ol.StyleFunction} style Style for this feature. * ol.FeatureStyleFunction|ol.StyleFunction} style Style for this feature.
* @api stable * @api
* @fires ol.events.Event#event:change * @fires ol.events.Event#event:change
*/ */
ol.Feature.prototype.setStyle = function(style) { ol.Feature.prototype.setStyle = function(style) {
@@ -251,7 +251,7 @@ ol.Feature.prototype.setStyle = function(style) {
* The feature id can be used with the {@link ol.source.Vector#getFeatureById} * The feature id can be used with the {@link ol.source.Vector#getFeatureById}
* method. * method.
* @param {number|string|undefined} id The feature id. * @param {number|string|undefined} id The feature id.
* @api stable * @api
* @fires ol.events.Event#event:change * @fires ol.events.Event#event:change
*/ */
ol.Feature.prototype.setId = function(id) { ol.Feature.prototype.setId = function(id) {
@@ -265,7 +265,7 @@ ol.Feature.prototype.setId = function(id) {
* When calling {@link ol.Feature#getGeometry}, the value of the property with * When calling {@link ol.Feature#getGeometry}, the value of the property with
* this name will be returned. * this name will be returned.
* @param {string} name The property name of the default geometry. * @param {string} name The property name of the default geometry.
* @api stable * @api
*/ */
ol.Feature.prototype.setGeometryName = function(name) { ol.Feature.prototype.setGeometryName = function(name) {
ol.events.unlisten( ol.events.unlisten(
+6
View File
@@ -64,6 +64,12 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
failure.call(this); failure.call(this);
} }
}.bind(this); }.bind(this);
/**
* @private
*/
xhr.onerror = function() {
failure.call(this);
}.bind(this);
xhr.send(); xhr.send();
}); });
}; };
+1 -1
View File
@@ -16,7 +16,7 @@ goog.require('ol.proj');
* *
* @constructor * @constructor
* @abstract * @abstract
* @api stable * @api
*/ */
ol.format.Feature = function() { ol.format.Feature = function() {
-1
View File
@@ -1,6 +1,5 @@
goog.provide('ol.format.filter'); goog.provide('ol.format.filter');
goog.require('ol');
goog.require('ol.format.filter.And'); goog.require('ol.format.filter.And');
goog.require('ol.format.filter.Bbox'); goog.require('ol.format.filter.Bbox');
goog.require('ol.format.filter.EqualTo'); goog.require('ol.format.filter.EqualTo');
-2
View File
@@ -1,7 +1,5 @@
goog.provide('ol.format.filter.Filter'); goog.provide('ol.format.filter.Filter');
goog.require('ol');
/** /**
* @classdesc * @classdesc
+11 -11
View File
@@ -26,7 +26,7 @@ goog.require('ol.proj');
* @constructor * @constructor
* @extends {ol.format.JSONFeature} * @extends {ol.format.JSONFeature}
* @param {olx.format.GeoJSONOptions=} opt_options Options. * @param {olx.format.GeoJSONOptions=} opt_options Options.
* @api stable * @api
*/ */
ol.format.GeoJSON = function(opt_options) { ol.format.GeoJSON = function(opt_options) {
@@ -335,7 +335,7 @@ ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.readFeature; ol.format.GeoJSON.prototype.readFeature;
@@ -349,7 +349,7 @@ ol.format.GeoJSON.prototype.readFeature;
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.readFeatures; ol.format.GeoJSON.prototype.readFeatures;
@@ -420,7 +420,7 @@ ol.format.GeoJSON.prototype.readFeaturesFromObject = function(
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.geom.Geometry} Geometry. * @return {ol.geom.Geometry} Geometry.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.readGeometry; ol.format.GeoJSON.prototype.readGeometry;
@@ -441,7 +441,7 @@ ol.format.GeoJSON.prototype.readGeometryFromObject = function(
* @function * @function
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.readProjection; ol.format.GeoJSON.prototype.readProjection;
@@ -480,7 +480,7 @@ ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @override * @override
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeFeature; ol.format.GeoJSON.prototype.writeFeature;
@@ -492,7 +492,7 @@ ol.format.GeoJSON.prototype.writeFeature;
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {GeoJSONFeature} Object. * @return {GeoJSONFeature} Object.
* @override * @override
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) { ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
@@ -529,7 +529,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(feature, opt_options)
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeFeatures; ol.format.GeoJSON.prototype.writeFeatures;
@@ -541,7 +541,7 @@ ol.format.GeoJSON.prototype.writeFeatures;
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {GeoJSONFeatureCollection} GeoJSON Object. * @return {GeoJSONFeatureCollection} GeoJSON Object.
* @override * @override
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) { ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
@@ -564,7 +564,7 @@ ol.format.GeoJSON.prototype.writeFeaturesObject = function(features, opt_options
* @param {ol.geom.Geometry} geometry Geometry. * @param {ol.geom.Geometry} geometry Geometry.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} GeoJSON. * @return {string} GeoJSON.
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeGeometry; ol.format.GeoJSON.prototype.writeGeometry;
@@ -576,7 +576,7 @@ ol.format.GeoJSON.prototype.writeGeometry;
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object. * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.
* @override * @override
* @api stable * @api
*/ */
ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry, ol.format.GeoJSON.prototype.writeGeometryObject = function(geometry,
opt_options) { opt_options) {
+2 -2
View File
@@ -13,7 +13,7 @@ goog.require('ol.format.GML3');
* @param {olx.format.GMLOptions=} opt_options * @param {olx.format.GMLOptions=} opt_options
* Optional configuration object. * Optional configuration object.
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api stable * @api
*/ */
ol.format.GML = ol.format.GML3; ol.format.GML = ol.format.GML3;
@@ -25,7 +25,7 @@ ol.format.GML = ol.format.GML3;
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {olx.format.WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api stable * @api
*/ */
ol.format.GML.prototype.writeFeatures; ol.format.GML.prototype.writeFeatures;
+589 -17
View File
@@ -2,8 +2,11 @@ goog.provide('ol.format.GML2');
goog.require('ol'); goog.require('ol');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.format.Feature');
goog.require('ol.format.GMLBase'); goog.require('ol.format.GMLBase');
goog.require('ol.format.XSD'); goog.require('ol.format.XSD');
goog.require('ol.geom.Geometry');
goog.require('ol.obj');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.xml'); goog.require('ol.xml');
@@ -57,7 +60,6 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName']; var containerSrs = context['srsName'];
var containerDimension = node.parentNode.getAttribute('srsDimension');
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (containerSrs) { if (containerSrs) {
var proj = ol.proj.get(containerSrs); var proj = ol.proj.get(containerSrs);
@@ -65,24 +67,14 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
axisOrientation = proj.getAxisOrientation(); axisOrientation = proj.getAxisOrientation();
} }
} }
var coords = s.split(/[\s,]+/); var coordsGroups = s.trim().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 x, y, z; var x, y, z;
var flatCoordinates = []; var flatCoordinates = [];
for (var i = 0, ii = coords.length; i < ii; i += dim) { for (var i = 0, ii = coordsGroups.length; i < ii; i++) {
x = parseFloat(coords[i]); var coords = coordsGroups[i].split(/,+/);
y = parseFloat(coords[i + 1]); x = parseFloat(coords[0]);
z = (dim === 3) ? parseFloat(coords[i + 2]) : 0; y = parseFloat(coords[1]);
z = (coords.length === 3) ? parseFloat(coords[2]) : 0;
if (axisOrientation.substr(0, 2) === 'en') { if (axisOrientation.substr(0, 2) === 'en') {
flatCoordinates.push(x, y, z); flatCoordinates.push(x, y, z);
} else { } else {
@@ -204,3 +196,583 @@ ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
'Box': ol.xml.makeReplacer(ol.format.GML2.prototype.readBox_) '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 hasZ = context['hasZ'];
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, hasZ);
}
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 hasZ = context['hasZ'];
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, hasZ: hasZ, 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
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string.
* @private
*/
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
}
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
point[1] + ',' + point[0]);
if (opt_hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ',' + z;
}
return coords;
};
/**
* @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 hasZ = context['hasZ'];
var srsName = context['srsName'];
var curve = context['curve'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, 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 hasZ = context['hasZ'];
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, hasZ);
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 hasZ = context['hasZ'];
var srsName = context['srsName'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, 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 hasZ = context['hasZ'];
var srsName = context['srsName'];
var surface = context['surface'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, 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)
}
};
+29 -9
View File
@@ -565,6 +565,7 @@ ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
*/ */
ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) { ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (srsName) { if (srsName) {
@@ -578,6 +579,11 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
} else { } else {
coords = (point[1] + ' ' + point[0]); coords = (point[1] + ' ' + point[0]);
} }
if (hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
ol.format.XSD.writeStringTextNode(node, coords); ol.format.XSD.writeStringTextNode(node, coords);
}; };
@@ -585,17 +591,25 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
/** /**
* @param {Array.<number>} point Point geometry. * @param {Array.<number>} point Point geometry.
* @param {string=} opt_srsName Optional srsName * @param {string=} opt_srsName Optional srsName
* @param {boolean=} opt_hasZ whether the geometry has a Z coordinate (is 3D) or not.
* @return {string} The coords string. * @return {string} The coords string.
* @private * @private
*/ */
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) { ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (opt_srsName) { if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation(); axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
} }
return ((axisOrientation.substr(0, 2) === 'en') ? var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ' ' + point[1] : point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]); point[1] + ' ' + point[0]);
if (opt_hasZ) {
// For newly created points, Z can be undefined.
var z = point[2] || 0;
coords += ' ' + z;
}
return coords;
}; };
@@ -607,6 +621,7 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
*/ */
ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) { ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
// only 2d for simple features profile // only 2d for simple features profile
var points = value.getCoordinates(); var points = value.getCoordinates();
@@ -615,7 +630,7 @@ ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
var point; var point;
for (var i = 0; i < len; ++i) { for (var i = 0; i < len; ++i) {
point = points[i]; point = points[i];
parts[i] = this.getCoords_(point, srsName); parts[i] = this.getCoords_(point, srsName, hasZ);
} }
ol.format.XSD.writeStringTextNode(node, parts.join(' ')); ol.format.XSD.writeStringTextNode(node, parts.join(' '));
}; };
@@ -717,6 +732,7 @@ ol.format.GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_n
*/ */
ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
if (node.nodeName !== 'PolygonPatch' && srsName) { if (node.nodeName !== 'PolygonPatch' && srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
@@ -724,7 +740,7 @@ ol.format.GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') { if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings(); var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop( ol.xml.pushSerializeAndPop(
{node: node, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML3.RING_SERIALIZERS_, ol.format.GML3.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this); rings, objectStack, undefined, this);
@@ -771,13 +787,14 @@ ol.format.GML3.prototype.writeCurveOrLineString_ = function(node, geometry, obje
*/ */
ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var surface = context['surface']; var surface = context['surface'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var polygons = geometry.getPolygons(); var polygons = geometry.getPolygons();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, surface: surface}, ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_, ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this); objectStack, undefined, this);
@@ -794,11 +811,12 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) { objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
var hasZ = context['hasZ'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var points = geometry.getPoints(); var points = geometry.getPoints();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName}, ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML3.POINTMEMBER_SERIALIZERS_, ol.format.GML3.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points, ol.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this); objectStack, undefined, this);
@@ -813,13 +831,14 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
*/ */
ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { ol.format.GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
var curve = context['curve']; var curve = context['curve'];
if (srsName) { if (srsName) {
node.setAttribute('srsName', srsName); node.setAttribute('srsName', srsName);
} }
var lines = geometry.getLineStrings(); var lines = geometry.getLineStrings();
ol.xml.pushSerializeAndPop({node: node, srsName: srsName, curve: curve}, ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_, ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this); objectStack, undefined, this);
@@ -1168,7 +1187,7 @@ ol.format.GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, o
ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) { ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
opt_options = this.adaptOptions(opt_options); opt_options = this.adaptOptions(opt_options);
var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom'); var geom = ol.xml.createElementNS('http://www.opengis.net/gml', 'geom');
var context = {node: geom, srsName: this.srsName, var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName,
curve: this.curve_, surface: this.surface_, curve: this.curve_, surface: this.surface_,
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_}; multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
if (opt_options) { if (opt_options) {
@@ -1186,7 +1205,7 @@ ol.format.GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {olx.format.WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api stable * @api
*/ */
ol.format.GML3.prototype.writeFeatures; ol.format.GML3.prototype.writeFeatures;
@@ -1208,6 +1227,7 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
'xsi:schemaLocation', this.schemaLocation); 'xsi:schemaLocation', this.schemaLocation);
var context = { var context = {
srsName: this.srsName, srsName: this.srsName,
hasZ: this.hasZ,
curve: this.curve_, curve: this.curve_,
surface: this.surface_, surface: this.surface_,
multiSurface: this.multiSurface_, multiSurface: this.multiSurface_,
+1 -1
View File
@@ -564,7 +564,7 @@ ol.format.GMLBase.prototype.readGeometryFromNode = function(node, opt_options) {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Options. * @param {olx.format.ReadOptions=} opt_options Options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api stable * @api
*/ */
ol.format.GMLBase.prototype.readFeatures; ol.format.GMLBase.prototype.readFeatures;
+5 -5
View File
@@ -21,7 +21,7 @@ goog.require('ol.xml');
* @constructor * @constructor
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
* @param {olx.format.GPXOptions=} opt_options Options. * @param {olx.format.GPXOptions=} opt_options Options.
* @api stable * @api
*/ */
ol.format.GPX = function(opt_options) { ol.format.GPX = function(opt_options) {
@@ -479,7 +479,7 @@ ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api stable * @api
*/ */
ol.format.GPX.prototype.readFeature; ol.format.GPX.prototype.readFeature;
@@ -513,7 +513,7 @@ ol.format.GPX.prototype.readFeatureFromNode = function(node, opt_options) {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api stable * @api
*/ */
ol.format.GPX.prototype.readFeatures; ol.format.GPX.prototype.readFeatures;
@@ -546,7 +546,7 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
* @function * @function
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api stable * @api
*/ */
ol.format.GPX.prototype.readProjection; ol.format.GPX.prototype.readProjection;
@@ -913,7 +913,7 @@ ol.format.GPX.GPX_SERIALIZERS_ = ol.xml.makeStructureNS(
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Write options. * @param {olx.format.WriteOptions=} opt_options Write options.
* @return {string} Result. * @return {string} Result.
* @api stable * @api
*/ */
ol.format.GPX.prototype.writeFeatures; ol.format.GPX.prototype.writeFeatures;
+27 -9
View File
@@ -44,7 +44,7 @@ goog.require('ol.xml');
* @constructor * @constructor
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
* @param {olx.format.KMLOptions=} opt_options Options. * @param {olx.format.KMLOptions=} opt_options Options.
* @api stable * @api
*/ */
ol.format.KML = function(opt_options) { ol.format.KML = function(opt_options) {
@@ -285,7 +285,8 @@ ol.format.KML.createStyleDefaults_ = function() {
*/ */
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = { ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
'fraction': ol.style.IconAnchorUnits.FRACTION, 'fraction': ol.style.IconAnchorUnits.FRACTION,
'pixels': ol.style.IconAnchorUnits.PIXELS 'pixels': ol.style.IconAnchorUnits.PIXELS,
'insetPixels': ol.style.IconAnchorUnits.PIXELS
}; };
@@ -504,11 +505,26 @@ ol.format.KML.readURI_ = function(node) {
ol.format.KML.readVec2_ = function(node) { ol.format.KML.readVec2_ = function(node) {
var xunits = node.getAttribute('xunits'); var xunits = node.getAttribute('xunits');
var yunits = node.getAttribute('yunits'); var yunits = node.getAttribute('yunits');
var origin;
if (xunits !== 'insetPixels') {
if (yunits !== 'insetPixels') {
origin = ol.style.IconOrigin.BOTTOM_LEFT;
} else {
origin = ol.style.IconOrigin.TOP_LEFT;
}
} else {
if (yunits !== 'insetPixels') {
origin = ol.style.IconOrigin.BOTTOM_RIGHT;
} else {
origin = ol.style.IconOrigin.TOP_RIGHT;
}
}
return { return {
x: parseFloat(node.getAttribute('x')), x: parseFloat(node.getAttribute('x')),
xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits], xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits],
y: parseFloat(node.getAttribute('y')), y: parseFloat(node.getAttribute('y')),
yunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[yunits] yunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[yunits],
origin: origin
}; };
}; };
@@ -562,12 +578,14 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_; src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_;
} }
var anchor, anchorXUnits, anchorYUnits; var anchor, anchorXUnits, anchorYUnits;
var anchorOrigin = ol.style.IconOrigin.BOTTOM_LEFT;
var hotSpot = /** @type {ol.KMLVec2_|undefined} */ var hotSpot = /** @type {ol.KMLVec2_|undefined} */
(object['hotSpot']); (object['hotSpot']);
if (hotSpot) { if (hotSpot) {
anchor = [hotSpot.x, hotSpot.y]; anchor = [hotSpot.x, hotSpot.y];
anchorXUnits = hotSpot.xunits; anchorXUnits = hotSpot.xunits;
anchorYUnits = hotSpot.yunits; anchorYUnits = hotSpot.yunits;
anchorOrigin = hotSpot.origin;
} else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) { } else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_; anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_;
anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_; anchorXUnits = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS_;
@@ -616,7 +634,7 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
var imageStyle = new ol.style.Icon({ var imageStyle = new ol.style.Icon({
anchor: anchor, anchor: anchor,
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT, anchorOrigin: anchorOrigin,
anchorXUnits: anchorXUnits, anchorXUnits: anchorXUnits,
anchorYUnits: anchorYUnits, anchorYUnits: anchorYUnits,
crossOrigin: 'anonymous', // FIXME should this be configurable? crossOrigin: 'anonymous', // FIXME should this be configurable?
@@ -1765,7 +1783,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature. * @return {ol.Feature} Feature.
* @api stable * @api
*/ */
ol.format.KML.prototype.readFeature; ol.format.KML.prototype.readFeature;
@@ -1796,7 +1814,7 @@ ol.format.KML.prototype.readFeatureFromNode = function(node, opt_options) {
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api stable * @api
*/ */
ol.format.KML.prototype.readFeatures; ol.format.KML.prototype.readFeatures;
@@ -1847,7 +1865,7 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) {
* *
* @param {Document|Node|string} source Souce. * @param {Document|Node|string} source Souce.
* @return {string|undefined} Name. * @return {string|undefined} Name.
* @api stable * @api
*/ */
ol.format.KML.prototype.readName = function(source) { ol.format.KML.prototype.readName = function(source) {
if (ol.xml.isDocument(source)) { if (ol.xml.isDocument(source)) {
@@ -2047,7 +2065,7 @@ ol.format.KML.prototype.readRegionFromNode = function(node) {
* @function * @function
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api stable * @api
*/ */
ol.format.KML.prototype.readProjection; ol.format.KML.prototype.readProjection;
@@ -3006,7 +3024,7 @@ ol.format.KML.OUTER_BOUNDARY_NODE_FACTORY_ =
* @param {Array.<ol.Feature>} features Features. * @param {Array.<ol.Feature>} features Features.
* @param {olx.format.WriteOptions=} opt_options Options. * @param {olx.format.WriteOptions=} opt_options Options.
* @return {string} Result. * @return {string} Result.
* @api stable * @api
*/ */
ol.format.KML.prototype.writeFeatures; ol.format.KML.prototype.writeFeatures;
+3 -3
View File
@@ -3,8 +3,8 @@
goog.provide('ol.format.MVT'); goog.provide('ol.format.MVT');
goog.require('ol'); goog.require('ol');
goog.require('ol.ext.pbf'); goog.require('ol.ext.PBF');
goog.require('ol.ext.vectortile'); goog.require('ol.ext.vectortile.VectorTile');
goog.require('ol.format.Feature'); goog.require('ol.format.Feature');
goog.require('ol.format.FormatType'); goog.require('ol.format.FormatType');
goog.require('ol.geom.GeometryLayout'); goog.require('ol.geom.GeometryLayout');
@@ -149,7 +149,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
ol.format.MVT.prototype.readFeatures = function(source, opt_options) { ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
var layers = this.layers_; var layers = this.layers_;
var pbf = new ol.ext.pbf(/** @type {ArrayBuffer} */ (source)); var pbf = new ol.ext.PBF(/** @type {ArrayBuffer} */ (source));
var tile = new ol.ext.vectortile.VectorTile(pbf); var tile = new ol.ext.vectortile.VectorTile(pbf);
var features = []; var features = [];
var featureClass = this.featureClass_; var featureClass = this.featureClass_;
+3 -3
View File
@@ -22,7 +22,7 @@ goog.require('ol.xml');
* *
* @constructor * @constructor
* @extends {ol.format.XMLFeature} * @extends {ol.format.XMLFeature}
* @api stable * @api
*/ */
ol.format.OSMXML = function() { ol.format.OSMXML = function() {
ol.format.XMLFeature.call(this); ol.format.XMLFeature.call(this);
@@ -176,7 +176,7 @@ ol.format.OSMXML.NODE_PARSERS_ = ol.xml.makeStructureNS(
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @param {olx.format.ReadOptions=} opt_options Read options. * @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Features. * @return {Array.<ol.Feature>} Features.
* @api stable * @api
*/ */
ol.format.OSMXML.prototype.readFeatures; ol.format.OSMXML.prototype.readFeatures;
@@ -205,7 +205,7 @@ ol.format.OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
* @function * @function
* @param {Document|Node|Object|string} source Source. * @param {Document|Node|Object|string} source Source.
* @return {ol.proj.Projection} Projection. * @return {ol.proj.Projection} Projection.
* @api stable * @api
*/ */
ol.format.OSMXML.prototype.readProjection; ol.format.OSMXML.prototype.readProjection;

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