Compare commits

..

328 Commits

Author SHA1 Message Date
Andreas Hocevar
1cf01037aa Set version and tag for v4.3.0-beta.2 2017-07-15 11:33:05 +02:00
Frédéric Junod
89ec2dacad Merge pull request #7021 from openlayers/greenkeeper/fs-extra-4.0.0
Update fs-extra to the latest version 🚀
2017-07-15 08:20:34 +02:00
greenkeeper[bot]
b97439cf8e fix(package): update fs-extra to version 4.0.0 2017-07-14 18:11:16 +00:00
Andreas Hocevar
b7b2ee0c57 Merge pull request #7018 from openlayers/greenkeeper/jsdoc-3.5.3
Update jsdoc to the latest version 🚀
2017-07-14 07:56:41 +02:00
greenkeeper[bot]
fe39b5da1b fix(package): update jsdoc to version 3.5.3 2017-07-14 02:54:50 +00:00
Frédéric Junod
bc0bc3f8a9 Merge pull request #7015 from openlayers/greenkeeper/sinon-2.3.8
Update sinon to the latest version 🚀
2017-07-13 13:21:35 +02:00
greenkeeper[bot]
9c0d0c5681 chore(package): update sinon to version 2.3.8 2017-07-13 08:23:48 +00:00
Frédéric Junod
b97daf844b Merge pull request #7014 from openlayers/greenkeeper/jsdoc-3.5.2
Update jsdoc to the latest version 🚀
2017-07-13 08:39:54 +02:00
Tim Schaub
f8237c9cd2 Merge pull request #7013 from tschaub/sphere
Remove ol.sphere.WGS84 and ol.sphere.NORMAL
2017-07-12 21:14:05 -06:00
greenkeeper[bot]
b317a4474e fix(package): update jsdoc to version 3.5.2 2017-07-12 18:20:07 +00:00
Frédéric Junod
b1772dae44 Merge pull request #6981 from gberaudo/intermediate_canvas_rendering
Render transparent vector layers to an intermediate canvas
2017-07-12 14:14:13 +02:00
Guillaume Beraudo
c33383d248 Add rendering test for transparent layer 2017-07-12 10:56:15 +02:00
Guillaume Beraudo
645e359cde Render transparent vector layers to an intermediate canvas
Until now, the features of transparent vector layers were rendered using
the layer opacity. This caused colors to mix together and the opacities
to stack up to an higher value than the expected layer opacity.

With this commit, the features are rendered at 100% opacity to an
intermediate canvas which ensures colors do not mix up even in the case
of features using an array of styles. The intermediate canvas is then
composed to the map canvas using the layer opacity.

Transparent layers are automatically detected, non-transparent layers
are not affected by the change.
2017-07-12 09:23:04 +02:00
Tim Schaub
fa71593a2a Remove ol.sphere.NORMAL 2017-07-11 08:10:46 -06:00
Tim Schaub
2e903c0293 Remove ol.sphere.WGS84 2017-07-11 08:00:41 -06:00
Tim Schaub
aced192bcd Merge pull request #6899 from probins/radii
Use number literal for sphere radius
2017-07-11 07:08:30 -06:00
Andreas Hocevar
19b0b956f7 Merge pull request #7011 from openlayers/greenkeeper/jsdoc-3.5.1
Update jsdoc to the latest version 🚀
2017-07-11 00:02:28 +02:00
greenkeeper[bot]
9f9355ac46 fix(package): update jsdoc to version 3.5.1 2017-07-10 18:22:28 +00:00
Andreas Hocevar
f28e6c2d95 Merge pull request #7008 from openlayers/greenkeeper/sinon-2.3.7
Update sinon to the latest version 🚀
2017-07-10 19:13:06 +02:00
Andreas Hocevar
e633380221 Merge pull request #7007 from openlayers/greenkeeper/rollup-0.45.0
fix(package): update rollup to version 0.45.0
2017-07-10 19:11:58 +02:00
Andreas Hocevar
5f6f757bd0 Update rollup configuration 2017-07-10 18:59:58 +02:00
greenkeeper[bot]
b29fc52842 chore(package): update sinon to version 2.3.7 2017-07-10 13:23:45 +00:00
greenkeeper[bot]
791ffaabeb fix(package): update rollup to version 0.45.0
Closes #7001
2017-07-10 14:48:30 +02:00
Andreas Hocevar
c31d67fe57 Merge pull request #6996 from ch08532/bugfix/6987
6987: Memory leak with WMS time source with reprojection
2017-07-10 13:01:46 +02:00
Andreas Hocevar
a1710be335 Merge pull request #7003 from openlayers/greenkeeper/jsdoc-3.5.0
Update jsdoc to the latest version 🚀
2017-07-10 12:36:56 +02:00
Andreas Hocevar
2260d92436 Return promise to avoid truncated stdout output 2017-07-10 12:02:33 +02:00
Andreas Hocevar
4d0e106d98 Change paths for jsdoc 3.5 2017-07-10 12:02:12 +02:00
Frédéric Junod
8bc4bde5c3 Merge pull request #7004 from fredj/https
Use https for bing and stamen attributions
2017-07-10 08:58:49 +02:00
Frederic Junod
429e2982d0 Use https for bing and stamen attributions 2017-07-10 08:31:51 +02:00
greenkeeper[bot]
23f8540b4c fix(package): update jsdoc to version 3.5.0 2017-07-10 02:30:32 +00:00
Andreas Hocevar
59d8d749e3 Merge pull request #6998 from openlayers/greenkeeper/eslint-4.2.0
Update eslint to the latest version 🚀
2017-07-09 16:52:47 +02:00
Andreas Hocevar
cff9ef5e63 Remove lint 2017-07-09 16:11:36 +02:00
Andreas Hocevar
e6e0109a1b Merge pull request #6999 from ahocevar/vectortile-source-multilayer
Make VectorTile source work with multiple layers
2017-07-09 14:39:27 +02:00
Andreas Hocevar
7739239e89 Make VectorTile source work with multiple layers 2017-07-09 14:08:08 +02:00
greenkeeper[bot]
eb8d5bcade chore(package): update eslint to version 4.2.0 2017-07-09 03:45:00 +00:00
Chris Amaral
ff242ef28c timeimage.js - Added newTile.refreshInterimChain() to clean up interimTile references and preventing memory leak 2017-07-07 13:57:50 -04:00
Andreas Hocevar
4a0f97ac6a Merge pull request #6988 from ahocevar/vectortile-types
Add missing type annotations
2017-07-06 16:53:23 +02:00
Andreas Hocevar
a0e0e76995 Add missing type annotations 2017-07-06 12:31:57 +02:00
Frédéric Junod
b5f9b88d0e Merge pull request #6984 from openlayers/greenkeeper/closure-util-1.22.0
Update closure-util to the latest version 🚀
2017-07-06 11:20:14 +02:00
greenkeeper[bot]
339f048826 fix(package): update closure-util to version 1.22.0 2017-07-05 07:56:48 +00:00
Andreas Hocevar
4f0bfbc1db Merge pull request #6970 from cmortazavi/patch-1
Fix Bug when adding/removing layer with no cache
2017-07-03 20:34:13 +02:00
cmortazavi
db63cc1b23 Fix Bug when adding/removing layer with no cache 2017-07-02 09:34:14 +02:00
Andreas Hocevar
f88d8b8a7d Merge pull request #6972 from ahocevar/loaded-error-tiles
Handle error tiles properly
2017-06-29 09:33:33 +02:00
Andreas Hocevar
991328904d Merge pull request #6973 from openlayers/greenkeeper/clean-css-cli-4.1.6
Update clean-css-cli to the latest version 🚀
2017-06-29 09:33:03 +02:00
greenkeeper[bot]
9d3539b3cb chore(package): update clean-css-cli to version 4.1.6 2017-06-29 07:05:11 +00:00
Frédéric Junod
bd143c0ad1 Merge pull request #6971 from openlayers/greenkeeper/sinon-2.3.6
Update sinon to the latest version 🚀
2017-06-29 08:58:16 +02:00
Andreas Hocevar
970265acb0 Give preloaded lower resolution tiles a chance to display immediately 2017-06-29 00:02:24 +02:00
Andreas Hocevar
36c80f61bc Do not delete tile keys for error or empty tiles 2017-06-28 23:16:11 +02:00
greenkeeper[bot]
d86c7c22dc chore(package): update sinon to version 2.3.6 2017-06-28 18:22:37 +00:00
Andreas Hocevar
71b334d49c Merge pull request #6968 from ahocevar/spin-animation
Shortest arc rotation animation improvements and upgrade notes
2017-06-28 17:11:01 +02:00
Andreas Hocevar
ee0eb8b1a0 Normalize rotation to values between -180 and 180 degrees after animation 2017-06-28 16:36:33 +02:00
Andreas Hocevar
cd4ed759ed Upgrade notes and example update for shortest arc rotation animation 2017-06-28 15:31:26 +02:00
Andreas Hocevar
c0e4da6d8c Merge pull request #6966 from ahocevar/resolution-for-zoom
Add getResolutionForZoom method for ol.View
2017-06-28 13:01:54 +02:00
Andreas Hocevar
72f5ff917f Merge pull request #6965 from ahocevar/shortest-rotation
Use shortest rotation delta for animation
2017-06-28 13:01:33 +02:00
Andreas Hocevar
4c9c9fa719 Merge pull request #6967 from ahocevar/bing-road-on-demand
Add RoadOnDemand imagery set to Bing example
2017-06-28 10:56:54 +02:00
Frédéric Junod
163e01a2dc Merge pull request #6964 from fredj/kml_DataParser
Fix KML ExtendedData reading
2017-06-28 10:53:55 +02:00
Andreas Hocevar
79862ca8c2 Add RoadOnDemand imagery set to Bing example 2017-06-28 10:40:06 +02:00
Andreas Hocevar
aa8d7b0b36 Add getResolutionForZoom method for ol.View 2017-06-28 10:30:32 +02:00
Andreas Hocevar
8d0857fd7a Merge pull request #6958 from ahocevar/vectorimagetile-cleanup
Remove error tiles after loading is finished
2017-06-28 10:21:20 +02:00
Andreas Hocevar
67f69a32bb Use shortest rotation delta for animation 2017-06-28 10:06:10 +02:00
Frederic Junod
382674975e Fix KML ExtendedData reading 2017-06-28 09:51:18 +02:00
Frédéric Junod
eaaa895b0a Merge pull request #6793 from GaborFarkas/webgl_text
Webgl text
2017-06-27 15:44:57 +02:00
Tim Schaub
70b971d3a4 Merge pull request #6960 from tschaub/queue-then-load
Queue tiles before loading
2017-06-26 23:42:25 -06:00
Tim Schaub
3ddb8712a3 Queue tiles before loading 2017-06-26 18:31:53 -06:00
Andreas Hocevar
533ca8b9fe Remove error tiles after loading is finished 2017-06-26 16:16:47 +02:00
Andreas Hocevar
0fc710bc48 Merge pull request #6957 from openlayers/greenkeeper/eslint-4.1.1
Greenkeeper/eslint 4.1.1
2017-06-26 16:03:53 +02:00
Andreas Hocevar
fe18636ff9 Remove lint 2017-06-26 14:56:07 +02:00
Andreas Hocevar
c299bfcd0f Merge pull request #6955 from openlayers/greenkeeper/async-2.5.0
Update async to the latest version 🚀
2017-06-26 07:31:06 +02:00
greenkeeper[bot]
3f5a6bca26 chore(package): update eslint to version 4.1.1
Closes #6950
2017-06-26 02:33:20 +00:00
greenkeeper[bot]
a6b35e7d8a fix(package): update async to version 2.5.0 2017-06-26 00:06:01 +00:00
GaborFarkas
619e85e737 Fix linting issues 2017-06-23 21:12:27 +02:00
GaborFarkas
b3407b0554 Add reindented texture shader 2017-06-23 20:51:46 +02:00
GaborFarkas
a4c421e699 Use glyph atlases 2017-06-23 20:44:41 +02:00
GaborFarkas
a3a443324d Add tests for WebGL TextReplay 2017-06-23 20:44:41 +02:00
GaborFarkas
7b9833fdce Conform TextReplay to the new structure 2017-06-23 20:44:41 +02:00
GaborFarkas
bd87ec7c83 Conform ImageReplay to the new structure 2017-06-23 20:44:41 +02:00
GaborFarkas
26bfa7a172 Refactor WebGL ImageReplay 2017-06-23 20:37:37 +02:00
GaborFarkas
f82bc15013 Minimal working text renderer 2017-06-23 20:34:52 +02:00
GaborFarkas
da60b96445 Style texts and draw them on canvas 2017-06-23 20:34:52 +02:00
GaborFarkas
2ed5abed07 Add WebGL text defaults 2017-06-23 20:34:52 +02:00
Peter Robins
49dcda7794 Use number literal for sphere radii 2017-06-22 09:15:59 +00:00
Marc Jansen
9fc0fb5e74 Merge pull request #6916 from marcjansen/eslint-4-upgrade
Upgrade eslint to v4.0.0
2017-06-22 07:55:06 +02:00
Andreas Hocevar
d32006b324 Merge pull request #6943 from openlayers/greenkeeper/sinon-2.3.5
Update sinon to the latest version 🚀
2017-06-20 21:43:56 +02:00
Marc Jansen
feabb6440d Add reindented shader sources 2017-06-20 11:45:48 +02:00
Marc Jansen
87e9c9ad46 Change indentation of shader mustache template 2017-06-20 11:45:48 +02:00
Marc Jansen
7d6929c710 Manual adjustment of indentation 2017-06-20 10:41:03 +02:00
greenkeeper[bot]
887642e69c chore(package): update sinon to version 2.3.5 2017-06-20 07:47:44 +00:00
Andreas Hocevar
b9e6619b2d Merge pull request #6939 from ahocevar/cachesize-fix-abort
Abort loading when tile is disposed
2017-06-20 09:35:14 +02:00
Frédéric Junod
78b5fe5f8c Merge pull request #6930 from openlayers/translate_no_map
Handle setActive(false) on an interaction without map
2017-06-20 08:30:45 +02:00
Andreas Hocevar
72e9b74b3e Abort loading when tile is disposed 2017-06-19 18:26:10 +02:00
Andreas Hocevar
c6aeda1511 Merge pull request #6936 from ahocevar/cachesize-fix-tilequeue
Do not stop the render loop when all wanted tiles are aborted
2017-06-19 15:47:26 +02:00
Frédéric Junod
eb501e1244 Merge pull request #6920 from klokantech/type-strength-consistency-fix
Fix minor type strength inconsistency
2017-06-19 15:45:26 +02:00
Andreas Hocevar
1f51c14e7e Do not stop the render loop when all wanted tiles are aborted 2017-06-19 15:17:59 +02:00
Andreas Hocevar
dee3ebdc54 Merge pull request #6935 from ahocevar/no-data-uri
Use transparent image from canvas context
2017-06-19 13:30:08 +02:00
Marc Jansen
d0ef05977b Autofix indentation issues (eslint --fix) 2017-06-19 11:58:00 +02:00
Marc Jansen
a17db4f45c Configure indent rule more explicitly 2017-06-19 11:56:06 +02:00
Andreas Hocevar
20974fea55 Use transparent image from canvas context 2017-06-19 10:13:03 +02:00
Tim Schaub
416df98505 Merge pull request #6933 from probins/proj4
Improve proj.get() logic
2017-06-18 18:15:43 -06:00
Peter Robins
fb5891cd48 Improve proj.get() logic 2017-06-18 09:47:07 +00:00
Bart van den Eijnden
1d4a482c1a Merge pull request #6931 from bartvde/feature-prefix-wfs
Make sure we use the default featurePrefix
2017-06-15 22:04:51 +02:00
bartvde
8d57a879ce Make sure we use the default featurePrefix 2017-06-15 16:33:07 +02:00
Frederic Junod
3e7aecd094 Handle setActive(false) on an interaction without map 2017-06-15 08:41:52 +02:00
Andreas Hocevar
c46bc1f02a Merge pull request #6928 from ahocevar/reproj-resolution
Only adjust resolution when center within projection extent
2017-06-14 16:31:00 +02:00
Andreas Hocevar
0d0ed6c130 Only adjust resolution when center within projection extent 2017-06-14 15:33:16 +02:00
Frédéric Junod
0045bed6e7 Merge pull request #6923 from fredj/strict_mode
Load tasks/build-ext.js in strict mode
2017-06-14 09:46:48 +02:00
Frederic Junod
0982dc0551 Load tasks/build-ext.js in strict mode
For nodejs 4.x compatibility.
2017-06-13 16:50:29 +02:00
Andreas Hocevar
e38efc7cbe Merge pull request #6918 from ahocevar/image-reproject-pixelratio
Remove unnecessary pixelRatio check
2017-06-13 13:07:31 +02:00
Petr Sloup
ea4e5f2293 Fix minor type strength inconsistency 2017-06-13 12:58:57 +02:00
Andreas Hocevar
29d1590bc6 Remove unnecessary pixelRatio check 2017-06-13 11:12:27 +02:00
Andreas Hocevar
e14ee2ea72 Merge pull request #6917 from probins/patch-1
Correct typo in graticule docs
2017-06-13 11:09:41 +02:00
Peter Robins
68ca4b3c2a Correct typo in graticule docs 2017-06-13 09:42:18 +01:00
Marc Jansen
4ad85e52e2 Upgrade eslint to v4.0.0 2017-06-13 09:35:15 +02:00
Andreas Hocevar
4255e81b93 Merge pull request #6914 from openlayers/release-v4.2.0
Finish upgrade notes for v4.2.0
2017-06-12 16:36:29 +02:00
Andreas Hocevar
81e8cdc7ab Finish upgrade notes for v4.2.0 2017-06-12 16:34:29 +02:00
Andreas Hocevar
b1b5b54fd0 Merge pull request #6913 from openlayers/release-v4.2.0
Release v4.2.0
2017-06-12 16:30:36 +02:00
Andreas Hocevar
109362f147 Update package version to 4.2.0 2017-06-12 16:30:04 +02:00
Andreas Hocevar
b5038c18e2 Changelog for v4.2.0 2017-06-12 16:30:04 +02:00
Andreas Hocevar
87d889f96c Merge pull request #6912 from ahocevar/translate-cursor
Use class instead of style for Translate cursor
2017-06-12 14:26:41 +02:00
Andreas Hocevar
9b41ea4017 Use class instead of style for Translate cursor 2017-06-12 13:30:25 +02:00
Frédéric Junod
51658a0d7c Merge pull request #6858 from GaborFarkas/webgl_vector_improvements
Webgl vector improvements
2017-06-12 09:23:15 +02:00
Andreas Hocevar
2f45e14bea Merge pull request #6890 from ahocevar/movestart
Add a movestart event
2017-06-12 09:00:09 +02:00
Andreas Hocevar
aa56afdab7 Merge pull request #6910 from ahocevar/apidoc-no-duplicate-observables
Avoid duplicates in Observables list
2017-06-12 08:47:00 +02:00
Andreas Hocevar
9fda131d37 Add a movestart event 2017-06-12 08:39:12 +02:00
Andreas Hocevar
b3ddcd4ed9 Avoid duplicates in Observables list 2017-06-12 08:24:44 +02:00
Andreas Hocevar
107792635d Merge pull request #6902 from ahocevar/fix-kinetic
Require minimum duration for kinetic animation
2017-06-12 07:01:03 +02:00
GaborFarkas
7ea8cf5fb3 Don't introduce new self-intersections. Fixes #6823 2017-06-11 22:07:22 +02:00
Andreas Hocevar
1d6ce6db35 Merge pull request #6904 from openlayers/greenkeeper/sinon-2.3.4
chore(package): update sinon to version 2.3.4
2017-06-10 23:45:13 +02:00
greenkeeper[bot]
4e44a09072 chore(package): update sinon to version 2.3.4
Closes #6903
2017-06-10 10:38:14 +00:00
Andreas Hocevar
dc6d0c091a Require minimum duration for kinetic animation 2017-06-10 09:33:40 +02:00
Andreas Hocevar
af6aaf4bab Merge pull request #6901 from KlausBenndorf/regularShapePointsNotes
Added release note for changed methods of ol.style.regularShape
2017-06-10 09:16:12 +02:00
simonseyock
e822731f8c Added release note for changed methods of ol.style.regularShape
Regarding #6759
2017-06-09 22:57:41 +02:00
Frédéric Junod
a23246aca1 Merge pull request #6886 from gberaudo/extensible_cluster_source
Make ol.source.Cluster extensible
2017-06-09 15:12:44 +02:00
Andreas Hocevar
f31e45d7d2 Merge pull request #6887 from ahocevar/disable-rotation
Disable rotation for views with enableRotation: false
2017-06-09 14:07:58 +02:00
Andreas Hocevar
34e61da366 Merge pull request #6900 from openlayers/greenkeeper/clean-css-cli-4.1.4
Update clean-css-cli to the latest version 🚀
2017-06-09 14:02:13 +02:00
Frédéric Junod
451aef200f Merge pull request #6897 from probins/like
ProjectionLike in proj.getPointResolution
2017-06-09 13:57:05 +02:00
Guillaume Beraudo
bb8a1b061c Make ol.source.Cluster extensible
Change from private to protected to allow extension.
2017-06-09 13:43:07 +02:00
greenkeeper[bot]
d4367cdd7d chore(package): update clean-css-cli to version 4.1.4 2017-06-09 11:38:57 +00:00
Peter Robins
3b15bb80b9 ProjectionLike in proj.getPointResolution 2017-06-09 09:33:43 +00:00
Andreas Hocevar
399e11edf7 Merge pull request #6888 from probins/patch-1
Add note about custom functions to getPointResolution
2017-06-09 10:18:38 +02:00
Peter Robins
f97f370e5b Improve docs for getPointResolution functions 2017-06-09 08:07:35 +00:00
Andreas Hocevar
070f2e181c Merge pull request #6893 from tchandelle/decimals
Fix decimals options when writing features
2017-06-09 09:27:08 +02:00
Andreas Hocevar
9d9da4feb9 Merge pull request #6759 from KlausBenndorf/regularShapePoints
Regular shape points
2017-06-09 08:48:47 +02:00
Frédéric Junod
ce858a80ed Merge pull request #6892 from fredj/ProjectionLike
Accept a ol.ProjectionLike instead of ol.proj.Projection
2017-06-09 08:45:45 +02:00
Frederic Junod
4898c83590 Accept a ol.ProjectionLike in ol.control.MousePosition#setProjection 2017-06-09 08:29:14 +02:00
Frederic Junod
d8ed2eb1be Accept a ol.ProjectionLike in ol.Geolocation#setProjection 2017-06-09 08:28:29 +02:00
Andreas Hocevar
00c8a5845e Disable rotation for views with enableRotation: false 2017-06-08 17:29:47 +02:00
Thomas Chandelle
d8dba61b0a Rounds if decimals options = 0 2017-06-08 12:08:02 +02:00
Thomas Chandelle
b8117b3931 This method will never be used with an extent and write = true 2017-06-08 12:08:02 +02:00
Thomas Chandelle
aface2f43e Clone the geometry before applying the decimals transform
We may only do it if the geometry has not been previously transformed.
2017-06-08 12:08:02 +02:00
Frédéric Junod
9691130b83 Merge pull request #6883 from fredj/cleanup
Remove unused ol.pointer.EventSource#getMapping function
2017-06-08 11:12:09 +02:00
Frederic Junod
1fbf3caa50 Remove unused ol.pointer.EventSource#getMapping function 2017-06-08 10:42:10 +02:00
Andreas Hocevar
e3128c204e Merge pull request #6870 from kannes/patch-1
Center map on proper earth, not one to the left
2017-06-06 15:36:43 +02:00
Andreas Hocevar
1e6b27d42a Merge pull request #6872 from openlayers/greenkeeper/rollup-0.42.0
Update rollup to the latest version 🚀
2017-06-06 15:27:26 +02:00
Frédéric Junod
c24bd209e6 Merge pull request #6876 from fredj/filereader_tests
Only test ol.interaction.DragAndDrop if FileReader is supported
2017-06-06 13:45:42 +02:00
Frédéric Junod
df96cc6e56 Merge pull request #6874 from probins/patch-1
Remove unused var from ol.proj
2017-06-06 11:02:12 +02:00
Peter Robins
641549c9ed Remove unused var from ol.proj 2017-06-06 08:23:42 +00:00
Frederic Junod
66e0308028 Use 'in' operator instead of 'typeof'
In PhantomJS, `typeof XXX` returns `"object"`, not `"function"`
2017-06-06 09:48:02 +02:00
Frederic Junod
22939abb0d Only test ol.interaction.DragAndDrop if FileReader is supported 2017-06-06 09:43:59 +02:00
Frédéric Junod
dfc4bff579 Merge pull request #6875 from openlayers/greenkeeper/sinon-2.3.2
chore(package): update sinon to version 2.3.2
2017-06-06 08:58:40 +02:00
greenkeeper[bot]
588223915c fix(package): update rollup to version 0.42.0 2017-06-03 19:01:54 +00:00
Hannes
5702670bd3 removed bad [ 2017-06-02 14:20:52 +02:00
Hannes
d79760e9dd Center map on proper earth, not one to the left
The previous x coordinate was one earth to the left which led to confusing results with everything.
This change makes sure the map is centered in a proper location (pretty much the same as before) WITHIN proper bounds.
2017-06-02 14:10:37 +02:00
Frédéric Junod
21011d00ea Merge pull request #6867 from cs09g/cs09g-patch-1
add getArea to api
2017-06-01 08:20:30 +02:00
Chase(Seul-gi Choi)
23cb98272c add getArea to api
#6854
2017-06-01 11:44:44 +09:00
Andreas Hocevar
b8b2712f73 Merge pull request #6863 from cs09g/cs09g-patch-1
change size to optional
2017-05-31 13:37:52 +02:00
Frédéric Junod
8b6a29decf Merge pull request #6864 from openlayers/greenkeeper/closure-util-1.21.0
fix(package): update closure-util to version 1.21.0
2017-05-31 10:30:58 +02:00
Chase(Seul-gi Choi)
5475841ca0 fix parameter type string 2017-05-31 15:29:34 +09:00
cs09gi@gmail.com
e8a2ad1d1b change size to optional 2017-05-31 13:40:01 +09:00
Andreas Hocevar
54a62ea78d Merge pull request #6834 from notnotse/move-tolerance-option
Move tolerance option
2017-05-30 09:10:09 +02:00
GaborFarkas
bcda41b508 Do not bridge holes outside of outer ring 2017-05-29 15:55:16 +02:00
GaborFarkas
c0fac0f5ca Prepare replays for vector tiles 2017-05-29 15:53:53 +02:00
Andreas Hocevar
0faf0dd2a1 Merge pull request #6856 from oterral/fix_6848
Fix creation of new URL in readSharedStyle_ and readSharedStyleMap_
2017-05-29 14:32:32 +02:00
oterral
9a698ce1e8 Fix creation of new URL in readSharedStyle_ and readSharedStyleMap_ 2017-05-29 09:49:04 +02:00
greenkeeper[bot]
a7683c60c9 chore(package): update sinon to version 2.3.2 2017-05-26 17:27:50 +00:00
greenkeeper[bot]
9412b770bf fix(package): update closure-util to version 1.21.0 2017-05-26 13:38:43 +00:00
Andreas Hocevar
29a6473c3d Merge pull request #6852 from openlayers/greenkeeper/mocha-3.4.2
Update mocha to the latest version 🚀
2017-05-25 08:31:17 +02:00
greenkeeper[bot]
7ceed1f42d chore(package): update mocha to version 3.4.2 2017-05-24 17:33:13 +00:00
Andreas Hocevar
959367629e Merge pull request #6851 from ahocevar/draganddrop-active
Register/unregister listeners in setActive
2017-05-24 15:36:26 +02:00
Frédéric Junod
aeed1f79bb Merge pull request #6832 from oterral/fix_5269
Force state of error tiles when usInterimTilesOnError is false
2017-05-24 15:27:11 +02:00
Andreas Hocevar
278d3a0313 Register/unregister listeners in setActive 2017-05-24 14:51:39 +02:00
Andreas Hocevar
5af9f71d38 Merge pull request #6849 from oterral/fix_6848
Create URL object only when we can
2017-05-24 14:44:09 +02:00
Andreas Hocevar
b6f446e909 Merge pull request #6845 from tchandelle/snap-circle
Snap on circles
2017-05-24 14:34:07 +02:00
oterral
7804a2db86 Create URL object only when we can 2017-05-24 14:21:56 +02:00
Andreas Hocevar
0e4d2b50b4 Merge pull request #6842 from cs09g/cs09g-patch-1
add condition to check if active
2017-05-24 13:20:08 +02:00
Frédéric Junod
b594cf0d74 Merge pull request #6844 from openlayers/greenkeeper/sinon-2.3.1
Update sinon to the latest version 🚀
2017-05-24 08:28:27 +02:00
Thomas Chandelle
074fdeb212 Add snapping abilities on circles 2017-05-23 14:45:03 +02:00
Thomas Chandelle
a1355ee766 Changes snap example to allow Circle creations 2017-05-23 11:04:46 +02:00
greenkeeper[bot]
c3e1bb40f4 chore(package): update sinon to version 2.3.1 2017-05-23 09:04:09 +00:00
Chase(Seul-gi Choi)
661410a96e add condition to check if active
fixes #6840
"setMap" registers listeners to dropArea, but it doesn't check whether "active" is true or false. Simply add condition to check "active".
2017-05-23 10:48:12 +09:00
Andreas Hocevar
e272eced94 Merge pull request #6841 from openlayers/greenkeeper/sinon-2.3.0
Update sinon to the latest version 🚀
2017-05-22 13:07:06 +02:00
greenkeeper[bot]
4ab901ed43 chore(package): update sinon to version 2.3.0 2017-05-22 10:26:40 +00:00
oterral
c1abe4a550 Force state of error tiles when usInterimTilesOnError is false 2017-05-22 09:31:07 +02:00
Andreas Hocevar
3fc76f9c10 Merge pull request #6839 from openlayers/greenkeeper/async-2.4.1
Update async to the latest version 🚀
2017-05-22 07:37:55 +02:00
greenkeeper[bot]
1e304f56cb fix(package): update async to version 2.4.1 2017-05-22 04:23:48 +00:00
Andreas Hocevar
5929826c5f Merge pull request #6838 from openlayers/greenkeeper/handlebars-4.0.10
fix(package): update handlebars to version 4.0.10
2017-05-21 23:35:38 +02:00
greenkeeper[bot]
9dad36b117 fix(package): update handlebars to version 4.0.10
Closes #6837
2017-05-21 12:19:39 +00:00
Andreas Hocevar
8b9f994cea Merge pull request #6817 from ahocevar/topojson-layer
Multiple layers in TopoJSON vector tiles
2017-05-20 16:58:19 +02:00
Andreas Hocevar
7ecb2c0185 Add layerName and layers options to ol.source.TopoJSON 2017-05-20 16:48:42 +02:00
Andreas Hocevar
342c49f0bb Merge pull request #6833 from oterral/fix_6789
Fix geojson-vt example for line and point geometries
2017-05-20 09:31:25 +02:00
itjope
bb220b5c3b Add tests for isMoving 2017-05-20 09:08:03 +02:00
oterral
3455f00d23 Fix geojson-vt example for line and point geometries 2017-05-19 17:52:14 +02:00
Frédéric Junod
992ab7120c Merge pull request #6829 from openlayers/greenkeeper/clean-css-cli-4.1.3
Update clean-css-cli to the latest version 🚀
2017-05-19 12:34:11 +02:00
greenkeeper[bot]
5215722c78 chore(package): update clean-css-cli to version 4.1.3 2017-05-18 19:40:06 +00:00
itjope
56b3203fa9 Add moveTolerance option for ol.Map 2017-05-18 13:22:31 +02:00
Andreas Hocevar
3cc4a0c6e3 Merge pull request #6819 from ahocevar/vectortile-getfeatures
Adjust/fix API for working with vector tile features
2017-05-18 11:13:30 +02:00
Andreas Hocevar
556ede5960 Remove api annotation from ol.VectorImageTile#getImage 2017-05-17 10:15:45 +02:00
Andreas Hocevar
46c610f35e Merge pull request #6818 from ahocevar/tilejson
Add tileJSON option to ol.source.TileJSON
2017-05-17 08:45:57 +02:00
Frédéric Junod
18357be938 Merge pull request #6805 from fredj/better_box-selection_example
Display country name on click select
2017-05-17 08:20:58 +02:00
Andreas Hocevar
a9f369479f Dispose of vector tiles properly 2017-05-17 00:18:46 +02:00
Andreas Hocevar
8c00bbc91d Report ol.VectorTile instead of ol.VectorImageTile loads 2017-05-17 00:18:46 +02:00
Andreas Hocevar
9af01c515f Make ol.VectorTile#getFeatures and #getProjection exportable 2017-05-16 22:57:03 +02:00
Andreas Hocevar
567cc304ed Add tileJSON option to ol.source.TileJSON 2017-05-16 18:37:18 +02:00
Tim Schaub
98a1654b47 Merge pull request #6813 from tschaub/version-with-a-v
Prepend the version with a v
2017-05-16 09:02:08 -07:00
Andreas Hocevar
ddbe1986ad Merge pull request #6814 from ahocevar/renderfeature-getgeometry
Re-add ol.render.Feature#getGeometry()
2017-05-16 09:02:29 +02:00
Andreas Hocevar
ac19d4d19c Better documentation for ol.render.Feature#getGeometry 2017-05-16 08:43:08 +02:00
Andreas Hocevar
142f16afe4 Re-add the ol.render.Feature#getGeometry() method
This method does have value for users that want to switch between ol.Feature
and ol.render.Feature and still be able to use #getGeometry().getType() in a
style function to determine the feature geometry's type.
2017-05-16 08:41:55 +02:00
Tim Schaub
07810818cc Prepend the version with a v 2017-05-15 19:31:40 -07:00
Frédéric Junod
4664a19718 Merge pull request #6812 from openlayers/greenkeeper/mocha-3.4.1
Update mocha to the latest version 🚀
2017-05-15 08:42:33 +02:00
greenkeeper[bot]
46f59acdce chore(package): update mocha to version 3.4.1 2017-05-14 21:41:35 +00:00
Frédéric Junod
c61189121e Merge pull request #6786 from fredj/during_filter
Add ol.format.filter.during
2017-05-12 15:26:03 +02:00
Andreas Hocevar
8c14262efc Merge pull request #6806 from drnextgis/docs
Add note about features with the same id
2017-05-12 13:01:44 +02:00
drnextgis
fa398766d9 Add note about features with the same id 2017-05-12 17:49:37 +07:00
Frederic Junod
026fcc66c9 Display country name on click select
And not only when the box selection is used
2017-05-12 09:56:21 +02:00
Andreas Hocevar
7c5a3ae311 Merge pull request #6802 from ahocevar/vectorimage-nofeature
Remove unused setFeatures and getFormat methods
2017-05-12 08:50:47 +02:00
Andreas Hocevar
feacf7614e Remove unused getFormat() method and format_ member 2017-05-12 00:06:56 +02:00
Andreas Hocevar
8609e65fc2 Remove unused setFeatures method 2017-05-11 18:19:42 +02:00
Andreas Hocevar
3ff33699c8 Merge pull request #6801 from ahocevar/renderfeature-getid
Add getId method for ol.render.Feature
2017-05-11 17:07:53 +02:00
Andreas Hocevar
df72d7b20f Add getId() method for ol.render.Feature 2017-05-11 15:54:20 +02:00
Andreas Hocevar
1d7144564c Remove getGeometry() from the API 2017-05-11 15:53:55 +02:00
Frédéric Junod
aced2e4e94 Merge pull request #6778 from fredj/isMoving_tolerance
Add a small tolerance when testing pointer event positions
2017-05-11 09:43:24 +02:00
Andreas Hocevar
9b9ac03760 Merge pull request #6796 from ahocevar/rendered-resolution
Re-add accidently dropped condition
2017-05-11 08:55:03 +02:00
Frédéric Junod
c052de2bbc Merge pull request #6798 from openlayers/greenkeeper/clean-css-cli-4.1.2
chore(package): update clean-css-cli to version 4.1.2
2017-05-11 08:45:42 +02:00
Frederic Junod
85d0e9797c Add a small tolerance when testing pointer event positions 2017-05-11 08:36:11 +02:00
greenkeeper[bot]
f975319d02 chore(package): update clean-css-cli to version 4.1.2
Closes #6797
2017-05-11 08:32:24 +02:00
Frédéric Junod
b8164df349 Merge pull request #6795 from fredj/ol.DrawGeometryFunctionType_type
Fix ol.DrawGeometryFunctionType coordinates argument type
2017-05-11 08:26:58 +02:00
Andreas Hocevar
1458d77844 Merge pull request #6797 from openlayers/greenkeeper/clean-css-cli-4.1.1
Update clean-css-cli to the latest version 🚀
2017-05-11 00:40:28 +02:00
greenkeeper[bot]
052f2ac321 chore(package): update clean-css-cli to version 4.1.1 2017-05-10 17:53:06 +00:00
Andreas Hocevar
4a6945ac17 Merge pull request #6779 from ahocevar/vector-tile-grid
Decouple source and rendered tile grid of vector tile sources
2017-05-10 19:07:21 +02:00
Andreas Hocevar
c9ca9737a7 Re-add condition accidently dropped in 5061555 2017-05-10 19:04:55 +02:00
Frédéric Junod
2e1495fc07 Merge pull request #6785 from fredj/insertVertexCondition
Add insertVertexCondition to ol.interaction.Modify options
2017-05-10 13:37:59 +02:00
Frederic Junod
55de3020d3 Fix ol.DrawGeometryFunctionType coordinates argument type 2017-05-10 13:36:29 +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
Frederic Junod
ff91974345 Add insertVertexCondition to ol.interaction.Modify options 2017-05-09 15:34:43 +02:00
Andreas Hocevar
e7dc09cf9f Add more tests 2017-05-09 14:25:28 +02:00
Frederic Junod
fcf9649ef9 Add ol.format.filter.during 2017-05-09 14:07:33 +02:00
Andreas Hocevar
55e3746554 Avoid garbage creation on frame preparation/composition 2017-05-09 14:04:05 +02:00
Andreas Hocevar
a59a147dbd Handle tile state of ol.VectorImageTile properly 2017-05-09 14:04:05 +02:00
Andreas Hocevar
355ce9f679 Use same tile size in rendered and source tile grid 2017-05-09 14:04:04 +02:00
Andreas Hocevar
785e7135a7 Decouple source and rendered tile grid of vector tile sources 2017-05-09 14:04:04 +02: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
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
simonseyock
25aeb58c87 ol.style.RegularShape#getRadius2
returns undefined if no radius2 was provided in the constructor
2017-04-29 11:43:46 +02:00
simonseyock
dd73ac8892 ol.style.RegularShape#getPoints
returns now same amount of points as provided to the constructor
2017-04-29 11:43:27 +02: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
simonseyock
c027b4d127 Reading kml xunits/yunits insetPixels 2017-03-04 12:24:51 +01:00
290 changed files with 7046 additions and 3597 deletions

View File

@@ -1,2 +1,3 @@
examples/Jugl.js
examples/resources/
build/package/**/*webgl*

View File

@@ -86,7 +86,7 @@ check-deps:
done ;\
.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
compile-examples: build/compiled-examples/all.combined.js
@@ -253,7 +253,7 @@ build/timestamps/eslint-timestamp: $(SRC_JS) $(SPEC_JS) $(SPEC_RENDERING_JS) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
@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 $@
build/timestamps/node-modules-timestamp: package.json
@@ -310,3 +310,4 @@ 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

View File

@@ -2,6 +2,36 @@
### Next release
#### `ol.animate` now takes the shortest arc for rotation animation
Usually rotation animations should animate along the shortest arc. There are rare occasions where a spinning animation effect is desired. So if you previously had something like
```js
map.getView().animate({
rotation: 2 * Math.PI,
duration: 2000
});
```
we recommend to split the animation into two parts and use different easing functions. The code below results in the same effect as the snippet above did with previous versions:
```js
map.getView().animate({
rotation: Math.PI,
easing: ol.easing.easeIn
}, {
rotation: 2 * Math.PI,
easing: ol.easing.easeOut
});
```
### v4.2.0
#### Return values of two `ol.style.RegularShape` getters have changed
To provide a more consistent behaviour the following getters now return the same value that was given to constructor:
`ol.style.RegularShape#getPoints` does not return the double amount of points anymore if a radius2 is set.
`ol.style.RegularShape#getRadius2` will return `undefined` if no radius2 is set.
### v4.1.0
#### Adding duplicate layers to a map throws

151
changelog/v4.2.0.md Normal file
View File

@@ -0,0 +1,151 @@
# 4.2.0
## Summary
The v4.2.0 release includes features and fixes from 87 pull requests.
#### New `movestart` event on `ol.Map`
The map now has a `movestart` event, as countarpart to the already existing `moveend` event.
#### New `moveTolerance` option in `ol.Map`
Some touch devices do not play well with OpenLayers's way of detecting clicks. To overcome this, a new `moveTolerance` option was introduced, so users can override the 1 pixel threshold above which a touch-release sequence won't be considered a click any more.
#### Support for multiple layers in `ol.format.TopoJSON`
With the new `layerName` and `layers` options, applications can extract the layer as additional attribute for vector features from `ol.format.TopoJSON`. This can especially be useful for styling vector tile layers.
#### New `tileJSON` option for `ol.source.TileJSON`
Like `ol.source.TileUTFGrid`, `ol.source.TileJSON` now also has a `tileJSON` option to configue it with inline TileJSON instead of a TileJSON URL.
#### New `ol.format.filter.during` filter
Although OpenLayers has no support for WFS v2.0, we added `ol.format.filter.during` for the `During` temporal operator.
#### Improved vector tile rendering at non-native resolutions
The vector tile renderer now uses an internal tile grid for all resolutions to cache pre-rendered tiles, even if the tile source does not have tiles for the viewed resolution. This improves rendering quality and performance.
#### New `insertVertexCondition` for `ol.interaction.Modify`
Applications can now control whether a vertex will be inserted into the modified geometry. This makes it easier to modify custom geometries.
#### New `callback` option for `ol.View#fit()`
To allow applications to perform custom actions when an animation associated with `ol.View#fit()` is completed, that method now has a new `callback` option.
#### New `ol.View#getInteracting()` getter
Like `ol.View#getAnimating()` returns `true` during a view animation, `ol.View#getInteracting()` returns `true` while users are interacting with the view.
#### New `hasZ` option for `ol.format.WFS#writeTransaction()`
When the new `hasZ` option is set to `true`, 3D coordinates will be preserved and encoded when writing a WFS transaction.
#### New `wrapX` option for `ol.source.Stamen`
Like other tile sources, `ol.source.Stamen` now also has a `wrapX` option, which allows applications to turn off wrapping the world in x direction.
#### Label support for `ol.Graticule`
The `ol.Graticule` component has several new options to add and control the output of labels. To turn on labelling, configure `ol.Graticule` with `showLabels: true`. The new options to control label formatting are `lonLabelFormatter`, `latLabelFormatter`, `lonLabelPosition` and `latLabelPosition`.
#### Return values of two `ol.style.RegularShape` getters have changed
To provide a more consistent behaviour the following getters now return the same value that was given to constructor:
`ol.style.RegularShape#getPoints` does not return the double amount of points anymore if a radius2 is set.
`ol.style.RegularShape#getRadius2` will return `undefined` if no radius2 is set.
## Detailed changes
* [#6912](https://github.com/openlayers/openlayers/pull/6912) - Use class instead of style for Translate cursor ([@ahocevar](https://github.com/ahocevar))
* [#6858](https://github.com/openlayers/openlayers/pull/6858) - Webgl vector improvements ([@GaborFarkas](https://github.com/GaborFarkas))
* [#6890](https://github.com/openlayers/openlayers/pull/6890) - Add a movestart event ([@ahocevar](https://github.com/ahocevar))
* [#6910](https://github.com/openlayers/openlayers/pull/6910) - Avoid duplicates in Observables list ([@ahocevar](https://github.com/ahocevar))
* [#6902](https://github.com/openlayers/openlayers/pull/6902) - Require minimum duration for kinetic animation ([@ahocevar](https://github.com/ahocevar))
* [#6904](https://github.com/openlayers/openlayers/pull/6904) - chore(package): update sinon to version 2.3.4 ([@openlayers](https://github.com/openlayers))
* [#6901](https://github.com/openlayers/openlayers/pull/6901) - Added release note for changed methods of ol.style.regularShape ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6886](https://github.com/openlayers/openlayers/pull/6886) - Make ol.source.Cluster extensible ([@gberaudo](https://github.com/gberaudo))
* [#6887](https://github.com/openlayers/openlayers/pull/6887) - Disable rotation for views with enableRotation: false ([@ahocevar](https://github.com/ahocevar))
* [#6900](https://github.com/openlayers/openlayers/pull/6900) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6897](https://github.com/openlayers/openlayers/pull/6897) - ProjectionLike in proj.getPointResolution ([@probins](https://github.com/probins))
* [#6888](https://github.com/openlayers/openlayers/pull/6888) - Add note about custom functions to getPointResolution ([@probins](https://github.com/probins))
* [#6893](https://github.com/openlayers/openlayers/pull/6893) - Fix decimals options when writing features ([@tchandelle](https://github.com/tchandelle))
* [#6759](https://github.com/openlayers/openlayers/pull/6759) - Regular shape points ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6892](https://github.com/openlayers/openlayers/pull/6892) - Accept a ol.ProjectionLike instead of ol.proj.Projection ([@fredj](https://github.com/fredj))
* [#6883](https://github.com/openlayers/openlayers/pull/6883) - Remove unused ol.pointer.EventSource#getMapping function ([@fredj](https://github.com/fredj))
* [#6870](https://github.com/openlayers/openlayers/pull/6870) - Center map on proper earth, not one to the left ([@kannes](https://github.com/kannes))
* [#6872](https://github.com/openlayers/openlayers/pull/6872) - Update rollup to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6876](https://github.com/openlayers/openlayers/pull/6876) - Only test ol.interaction.DragAndDrop if FileReader is supported ([@fredj](https://github.com/fredj))
* [#6874](https://github.com/openlayers/openlayers/pull/6874) - Remove unused var from ol.proj ([@probins](https://github.com/probins))
* [#6875](https://github.com/openlayers/openlayers/pull/6875) - chore(package): update sinon to version 2.3.2 ([@openlayers](https://github.com/openlayers))
* [#6867](https://github.com/openlayers/openlayers/pull/6867) - add getArea to api ([@cs09g](https://github.com/cs09g))
* [#6863](https://github.com/openlayers/openlayers/pull/6863) - change size to optional ([@cs09g](https://github.com/cs09g))
* [#6864](https://github.com/openlayers/openlayers/pull/6864) - fix(package): update closure-util to version 1.21.0 ([@openlayers](https://github.com/openlayers))
* [#6834](https://github.com/openlayers/openlayers/pull/6834) - Move tolerance option ([@notnotse](https://github.com/notnotse))
* [#6856](https://github.com/openlayers/openlayers/pull/6856) - Fix creation of new URL in readSharedStyle_ and readSharedStyleMap_ ([@oterral](https://github.com/oterral))
* [#6852](https://github.com/openlayers/openlayers/pull/6852) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6851](https://github.com/openlayers/openlayers/pull/6851) - Register/unregister listeners in setActive ([@ahocevar](https://github.com/ahocevar))
* [#6832](https://github.com/openlayers/openlayers/pull/6832) - Force state of error tiles when usInterimTilesOnError is false ([@oterral](https://github.com/oterral))
* [#6849](https://github.com/openlayers/openlayers/pull/6849) - Create URL object only when we can ([@oterral](https://github.com/oterral))
* [#6845](https://github.com/openlayers/openlayers/pull/6845) - Snap on circles ([@tchandelle](https://github.com/tchandelle))
* [#6842](https://github.com/openlayers/openlayers/pull/6842) - add condition to check if active ([@cs09g](https://github.com/cs09g))
* [#6844](https://github.com/openlayers/openlayers/pull/6844) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6841](https://github.com/openlayers/openlayers/pull/6841) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6839](https://github.com/openlayers/openlayers/pull/6839) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6838](https://github.com/openlayers/openlayers/pull/6838) - fix(package): update handlebars to version 4.0.10 ([@openlayers](https://github.com/openlayers))
* [#6817](https://github.com/openlayers/openlayers/pull/6817) - Multiple layers in TopoJSON vector tiles ([@ahocevar](https://github.com/ahocevar))
* [#6833](https://github.com/openlayers/openlayers/pull/6833) - Fix geojson-vt example for line and point geometries ([@oterral](https://github.com/oterral))
* [#6829](https://github.com/openlayers/openlayers/pull/6829) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6819](https://github.com/openlayers/openlayers/pull/6819) - Adjust/fix API for working with vector tile features ([@ahocevar](https://github.com/ahocevar))
* [#6818](https://github.com/openlayers/openlayers/pull/6818) - Add tileJSON option to ol.source.TileJSON ([@ahocevar](https://github.com/ahocevar))
* [#6805](https://github.com/openlayers/openlayers/pull/6805) - Display country name on click select ([@fredj](https://github.com/fredj))
* [#6813](https://github.com/openlayers/openlayers/pull/6813) - Prepend the version with a v ([@tschaub](https://github.com/tschaub))
* [#6814](https://github.com/openlayers/openlayers/pull/6814) - Re-add ol.render.Feature#getGeometry() ([@ahocevar](https://github.com/ahocevar))
* [#6812](https://github.com/openlayers/openlayers/pull/6812) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6786](https://github.com/openlayers/openlayers/pull/6786) - Add ol.format.filter.during ([@fredj](https://github.com/fredj))
* [#6806](https://github.com/openlayers/openlayers/pull/6806) - Add note about features with the same id ([@drnextgis](https://github.com/drnextgis))
* [#6802](https://github.com/openlayers/openlayers/pull/6802) - Remove unused setFeatures and getFormat methods ([@ahocevar](https://github.com/ahocevar))
* [#6801](https://github.com/openlayers/openlayers/pull/6801) - Add getId method for ol.render.Feature ([@ahocevar](https://github.com/ahocevar))
* [#6778](https://github.com/openlayers/openlayers/pull/6778) - Add a small tolerance when testing pointer event positions ([@fredj](https://github.com/fredj))
* [#6796](https://github.com/openlayers/openlayers/pull/6796) - Re-add accidently dropped condition ([@ahocevar](https://github.com/ahocevar))
* [#6798](https://github.com/openlayers/openlayers/pull/6798) - chore(package): update clean-css-cli to version 4.1.2 ([@openlayers](https://github.com/openlayers))
* [#6795](https://github.com/openlayers/openlayers/pull/6795) - Fix ol.DrawGeometryFunctionType coordinates argument type ([@fredj](https://github.com/fredj))
* [#6797](https://github.com/openlayers/openlayers/pull/6797) - Update clean-css-cli to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6779](https://github.com/openlayers/openlayers/pull/6779) - Decouple source and rendered tile grid of vector tile sources ([@ahocevar](https://github.com/ahocevar))
* [#6785](https://github.com/openlayers/openlayers/pull/6785) - Add insertVertexCondition to ol.interaction.Modify options ([@fredj](https://github.com/fredj))
* [#6792](https://github.com/openlayers/openlayers/pull/6792) - Create intermediate canvas when resolutions have changed ([@ahocevar](https://github.com/ahocevar))
* [#6790](https://github.com/openlayers/openlayers/pull/6790) - Update resemblejs to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6784](https://github.com/openlayers/openlayers/pull/6784) - chore(package): update clean-css-cli to version 4.1.0 ([@openlayers](https://github.com/openlayers))
* [#6556](https://github.com/openlayers/openlayers/pull/6556) - Reading kml xunits/yunits insetPixels ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6775](https://github.com/openlayers/openlayers/pull/6775) - Update closure-util to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6774](https://github.com/openlayers/openlayers/pull/6774) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6770](https://github.com/openlayers/openlayers/pull/6770) - Enforce the "no missing requires" rule ([@tschaub](https://github.com/tschaub))
* [#6772](https://github.com/openlayers/openlayers/pull/6772) - Remove html tag from shortdesc ([@fredj](https://github.com/fredj))
* [#6769](https://github.com/openlayers/openlayers/pull/6769) - Update handlebars to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6757](https://github.com/openlayers/openlayers/pull/6757) - Fix crashing on creation of snap-interaction, if Circle is among the features to snap to. ([@hajjimurad](https://github.com/hajjimurad))
* [#6766](https://github.com/openlayers/openlayers/pull/6766) - Update sinon to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6765](https://github.com/openlayers/openlayers/pull/6765) - Add new callback function to view.FitOptions ([@fredj](https://github.com/fredj))
* [#6764](https://github.com/openlayers/openlayers/pull/6764) - Added View#getInteracting() to the api ([@mblinsitu](https://github.com/mblinsitu))
* [#6760](https://github.com/openlayers/openlayers/pull/6760) - Update handlebars to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6761](https://github.com/openlayers/openlayers/pull/6761) - Update async to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6755](https://github.com/openlayers/openlayers/pull/6755) - Add missing goog.require ([@fredj](https://github.com/fredj))
* [#6751](https://github.com/openlayers/openlayers/pull/6751) - Update coveralls to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6750](https://github.com/openlayers/openlayers/pull/6750) - Update fs-extra to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6741](https://github.com/openlayers/openlayers/pull/6741) - Allow user selection in overlay container ([@fredj](https://github.com/fredj))
* [#6744](https://github.com/openlayers/openlayers/pull/6744) - Update mocha to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6737](https://github.com/openlayers/openlayers/pull/6737) - Graticule labels ([@ahocevar](https://github.com/ahocevar))
* [#6740](https://github.com/openlayers/openlayers/pull/6740) - Fix spelling ([@fredj](https://github.com/fredj))
* [#6730](https://github.com/openlayers/openlayers/pull/6730) - Update metalsmith-layouts to the latest version 🚀 ([@openlayers](https://github.com/openlayers))
* [#6732](https://github.com/openlayers/openlayers/pull/6732) - Use firefox < 53 in travis ([@fredj](https://github.com/fredj))
* [#6677](https://github.com/openlayers/openlayers/pull/6677) - Add an option to writeTransaction to support 3D geometries ([@Jenselme](https://github.com/Jenselme))
* [#6524](https://github.com/openlayers/openlayers/pull/6524) - Don't append feature prefix twice in WFS requests ([@Jenselme](https://github.com/Jenselme))
* [#6727](https://github.com/openlayers/openlayers/pull/6727) - Add default value in doc for the hitTolerance option ([@fredj](https://github.com/fredj))
* [#6724](https://github.com/openlayers/openlayers/pull/6724) - Add wrapX option to Stamen source ([@fredj](https://github.com/fredj))
* [#6728](https://github.com/openlayers/openlayers/pull/6728) - Fix tissot examples docs ([@fredj](https://github.com/fredj))
* [#6725](https://github.com/openlayers/openlayers/pull/6725) - Update dependencies to enable Greenkeeper 🌴 ([@openlayers](https://github.com/openlayers))
* [#6711](https://github.com/openlayers/openlayers/pull/6711) - Correct path to cleancss ([@tschaub](https://github.com/tschaub))

View File

@@ -1,7 +1,7 @@
{
"opts": {
"recurse": true,
"template": "config/jsdoc/api/template"
"template": "../../config/jsdoc/api/template"
},
"tags": {
"allowUnknownTags": true
@@ -16,12 +16,12 @@
]
},
"plugins": [
"node_modules/jsdoc/plugins/markdown",
"config/jsdoc/api/plugins/inheritdoc",
"config/jsdoc/api/plugins/typedefs",
"config/jsdoc/api/plugins/events",
"config/jsdoc/api/plugins/observable",
"config/jsdoc/api/plugins/api"
"plugins/markdown",
"../../config/jsdoc/api/plugins/inheritdoc",
"../../config/jsdoc/api/plugins/typedefs",
"../../config/jsdoc/api/plugins/events",
"../../config/jsdoc/api/plugins/observable",
"../../config/jsdoc/api/plugins/api"
],
"markdown": {
"parser": "gfm"

View File

@@ -41,7 +41,7 @@ exports.handlers = {
cls.observables = [];
}
observable = observables[doclet.observable];
if (cls.observables.indexOf(observable) == -1) {
if (observable.type && cls.observables.indexOf(observable) == -1) {
cls.observables.push(observable);
}
if (!cls.fires) {

View File

@@ -16,8 +16,10 @@
<tbody>
<?js
var self = this;
var propsByName = {};
props.forEach(function(prop) {
if (!prop) { return; }
if (!prop || propsByName[prop.name]) { return; }
propsByName[prop.name] = prop;
var setter = prop.readonly ? 'no' : 'yes';
?>

View File

@@ -1,7 +1,7 @@
{
"opts": {
"recurse": true,
"template": "config/jsdoc/info"
"template": "../../config/jsdoc/info"
},
"tags": {
"allowUnknownTags": true
@@ -10,8 +10,8 @@
"includePattern": "\\.js$"
},
"plugins": [
"config/jsdoc/info/api-plugin",
"config/jsdoc/info/define-plugin",
"config/jsdoc/info/virtual-plugin"
"../../config/jsdoc/info/api-plugin",
"../../config/jsdoc/info/define-plugin",
"../../config/jsdoc/info/virtual-plugin"
]
}

View File

@@ -3,7 +3,6 @@
* an api tag) and boolean defines (with a define tag and a default value).
*/
var assert = require('assert');
var fs = require('fs');
var path = require('path');
@@ -89,7 +88,6 @@ exports.publish = function(data, opts) {
types: getTypes(doc.type.names)
});
} else {
var types;
var symbol = {
name: doc.longname,
kind: doc.kind,
@@ -169,13 +167,15 @@ exports.publish = function(data, opts) {
return (symbol.name in augments || symbol.virtual);
});
process.stdout.write(
JSON.stringify({
symbols: symbols,
defines: defines,
typedefs: typedefs,
externs: externs,
base: base
}, null, 2));
return new Promise(function(resolve, reject) {
process.stdout.write(
JSON.stringify({
symbols: symbols,
defines: defines,
typedefs: typedefs,
externs: externs,
base: base
}, null, 2));
});
};

View File

@@ -49,6 +49,17 @@
-ms-user-select: auto;
user-select: auto;
}
.ol-grabbing {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.ol-grab {
cursor: move;
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.ol-control {
position: absolute;
background-color: rgba(255,255,255,0.4);
@@ -247,4 +258,4 @@
.ol-overviewmap .ol-overviewmap-box:hover {
cursor: move;
}
}

View File

@@ -1,5 +1,6 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.easing');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
@@ -73,9 +74,16 @@ onClick('rotate-right', function() {
});
onClick('rotate-around-rome', function() {
// Rotation animation takes the shortest arc, so animate in two parts
var rotation = view.getRotation();
view.animate({
rotation: view.getRotation() + 2 * Math.PI,
anchor: rome
rotation: rotation + Math.PI,
anchor: rome,
easing: ol.easing.easeIn
}, {
rotation: rotation + 2 * Math.PI,
anchor: rome,
easing: ol.easing.easeOut
});
});
@@ -103,10 +111,19 @@ onClick('bounce-to-istanbul', function() {
});
onClick('spin-to-rome', function() {
// Rotation animation takes the shortest arc, so animate in two parts
var center = view.getCenter();
view.animate({
center: [
center[0] + (rome[0] - center[0]) / 2,
center[1] + (rome[1] - center[1]) / 2
],
rotation: Math.PI,
easing: ol.easing.easeIn
}, {
center: rome,
rotation: 2 * Math.PI,
duration: 2000
easing: ol.easing.easeOut
});
});

View File

@@ -12,7 +12,8 @@ cloak:
<select id="layer-select">
<option value="Aerial">Aerial</option>
<option value="AerialWithLabels" selected>Aerial with labels</option>
<option value="Road">Road</option>
<option value="Road">Road (static)</option>
<option value="RoadOnDemand">Road (dynamic)</option>
<option value="collinsBart">Collins Bart</option>
<option value="ordnanceSurvey">Ordnance Survey</option>
</select>

View File

@@ -6,6 +6,7 @@ goog.require('ol.source.BingMaps');
var styles = [
'Road',
'RoadOnDemand',
'Aerial',
'AerialWithLabels',
'collinsBart',

View File

@@ -45,29 +45,29 @@ var dragBox = new ol.interaction.DragBox({
map.addInteraction(dragBox);
var infoBox = document.getElementById('info');
dragBox.on('boxend', function() {
// features that intersect the box are added to the collection of
// selected features, and their names are displayed in the "info"
// div
var info = [];
// selected features
var extent = dragBox.getGeometry().getExtent();
vectorSource.forEachFeatureIntersectingExtent(extent, function(feature) {
selectedFeatures.push(feature);
info.push(feature.get('name'));
});
if (info.length > 0) {
infoBox.innerHTML = info.join(', ');
}
});
// clear selection when drawing a new box and when clicking on the map
dragBox.on('boxstart', function() {
selectedFeatures.clear();
infoBox.innerHTML = '&nbsp;';
});
map.on('click', function() {
selectedFeatures.clear();
infoBox.innerHTML = '&nbsp;';
var infoBox = document.getElementById('info');
selectedFeatures.on(['add', 'remove'], function() {
var names = selectedFeatures.getArray().map(function(feature) {
return feature.get('name');
});
if (names.length > 0) {
infoBox.innerHTML = names.join(', ');
} else {
infoBox.innerHTML = 'No countries selected';
}
});

View File

@@ -1,7 +1,7 @@
---
layout: example.html
title: Clustered Features
shortdesc: Example of using <code>ol.source.Cluster</code>.
shortdesc: Example of using ol.source.Cluster.
docs: >
This example shows how to do clustering on point features.
tags: "cluster, vector"

View File

@@ -97,7 +97,7 @@ function rgb2xyz(x) {
function xyz2rgb(x) {
return 255 * (x <= 0.0031308 ?
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
var raster = new ol.source.Raster({

View File

@@ -142,7 +142,7 @@ var lineFeature = new ol.Feature(
var polygonFeature = new ol.Feature(
new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6],
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
var map = new ol.Map({

View File

@@ -198,7 +198,7 @@ function stopAnimation(ended) {
// if animation cancelled set the marker at the beginning
var coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
/** @type {ol.geom.Point} */ (geoMarker.getGeometry())
.setCoordinates(coord);
.setCoordinates(coord);
//remove listener
map.un('postcompose', moveFeature);
}

View File

@@ -17,18 +17,30 @@ var replacer = function(key, value) {
var geometry = value.geometry;
if (rawType === 1) {
type = geometry.length === 1 ? 'Point' : 'MultiPoint';
type = 'MultiPoint';
if (geometry.length == 1) {
type = 'Point';
geometry = geometry[0];
}
} else if (rawType === 2) {
type = geometry.length === 1 ? 'LineString' : 'MultiLineString';
type = 'MultiLineString';
if (geometry.length == 1) {
type = 'LineString';
geometry = geometry[0];
}
} else if (rawType === 3) {
type = geometry.length === 1 ? 'Polygon' : 'MultiPolygon';
type = 'Polygon';
if (geometry.length > 1) {
type = 'MultiPolygon';
geometry = [geometry];
}
}
return {
'type': 'Feature',
'geometry': {
'type': type,
'coordinates': geometry.length == 1 ? geometry : [geometry]
'coordinates': geometry
},
'properties': value.tags
};
@@ -73,10 +85,10 @@ fetch(url).then(function(response) {
var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);
var features = format.readFeatures(
JSON.stringify({
type: 'FeatureCollection',
features: data ? data.features : []
}, replacer));
JSON.stringify({
type: 'FeatureCollection',
features: data ? data.features : []
}, replacer));
tile.setLoader(function() {
tile.setFeatures(features);
tile.setProjection(tilePixels);

View File

@@ -83,7 +83,7 @@ positionFeature.setStyle(new ol.style.Style({
geolocation.on('change:position', function() {
var coordinates = geolocation.getPosition();
positionFeature.setGeometry(coordinates ?
new ol.geom.Point(coordinates) : null);
new ol.geom.Point(coordinates) : null);
});
new ol.layer.Vector({

View File

@@ -27,6 +27,8 @@ var graticule = new ol.Graticule({
color: 'rgba(255,120,0,0.9)',
width: 2,
lineDash: [0.5, 4]
})
}),
showLabels: true
});
graticule.setMap(map);

View File

@@ -81,11 +81,11 @@ var map = new ol.Map({
function createUrl(tpl, layerDesc) {
return tpl
.replace('{base}', layerDesc.base)
.replace('{type}', layerDesc.type)
.replace('{scheme}', layerDesc.scheme)
.replace('{app_id}', layerDesc.app_id)
.replace('{app_code}', layerDesc.app_code);
.replace('{base}', layerDesc.base)
.replace('{type}', layerDesc.type)
.replace('{scheme}', layerDesc.scheme)
.replace('{app_id}', layerDesc.app_id)
.replace('{app_code}', layerDesc.app_code);
}
var select = document.getElementById('layer-select');

View File

@@ -3,7 +3,7 @@ layout: example.html
title: Advanced Mapbox Vector Tiles
shortdesc: Example of a Mapbox vector tiles map with custom tile grid.
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 source 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"
resources:
- resources/mapbox-streets-v6-style.js

View File

@@ -15,25 +15,16 @@ goog.require('ol.tilegrid.TileGrid');
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
// For how many zoom levels do we want to use the same vector tiles?
// 1 means "use tiles from all zoom levels". 2 means "use the same tiles for 2
// subsequent zoom levels".
var reuseZoomLevels = 2;
// Offset of loaded tiles from web mercator zoom level 0.
// 0 means "At map zoom level 0, use tiles from zoom level 0". 1 means "At map
// zoom level 0, use tiles from zoom level 1".
var zoomOffset = 1;
// Calculation of tile urls
// Calculation of resolutions that match zoom levels 1, 3, 5, 7, 9, 11, 13, 15.
var resolutions = [];
for (var z = zoomOffset / reuseZoomLevels; z <= 22 / reuseZoomLevels; ++z) {
resolutions.push(156543.03392804097 / Math.pow(2, z * reuseZoomLevels));
for (var i = 0; i <= 7; ++i) {
resolutions.push(156543.03392804097 / Math.pow(2, i * 2));
}
// Calculation of tile urls for zoom levels 1, 3, 5, 7, 9, 11, 13, 15.
function tileUrlFunction(tileCoord) {
return ('https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' +
'{z}/{x}/{y}.vector.pbf?access_token=' + key)
.replace('{z}', String(tileCoord[0] * reuseZoomLevels + zoomOffset))
.replace('{z}', String(tileCoord[0] * 2 - 1))
.replace('{x}', String(tileCoord[1]))
.replace('{y}', String(-tileCoord[2] - 1))
.replace('{a-d}', 'abcd'.substr(
@@ -43,8 +34,6 @@ function tileUrlFunction(tileCoord) {
var map = new ol.Map({
layers: [
new ol.layer.VectorTile({
renderMode: 'vector',
preload: Infinity,
source: new ol.source.VectorTile({
attributions: '© <a href="https://www.mapbox.com/map-feedback/">Mapbox</a> ' +
'© <a href="https://www.openstreetmap.org/copyright">' +
@@ -52,9 +41,10 @@ var map = new ol.Map({
format: new ol.format.MVT(),
tileGrid: new ol.tilegrid.TileGrid({
extent: ol.proj.get('EPSG:3857').getExtent(),
resolutions: resolutions
resolutions: resolutions,
tileSize: 512
}),
tilePixelRatio: 16,
tilePixelRatio: 8,
tileUrlFunction: tileUrlFunction
}),
style: createMapboxStreetsV6Style()

View File

@@ -96,8 +96,8 @@ var geojsonObject = {
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
}
}, {
'type': 'Feature',
@@ -117,11 +117,11 @@ var geojsonObject = {
'type': 'MultiPolygon',
'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]],
[-3e6, 6e6], [-5e6, 6e6]]],
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-3e6, 6e6]]],
[0, 6e6], [-3e6, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
[3e6, 6e6], [1e6, 6e6]]]
]
}
}, {
@@ -222,7 +222,13 @@ var select = new ol.interaction.Select({
var modify = new ol.interaction.Modify({
features: select.getFeatures(),
style: overlayStyle
style: overlayStyle,
insertVertexCondition: function() {
// prevent new vertices to be added to the polygons
return !this.features_.getArray().every(function(feature) {
return feature.getGeometry().getType().match(/Polygon/);
});
}
});
var map = new ol.Map({

View File

@@ -4,7 +4,6 @@ goog.require('ol.control');
goog.require('ol.control.MousePosition');
goog.require('ol.coordinate');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var mousePositionControl = new ol.control.MousePosition({
@@ -37,7 +36,7 @@ var map = new ol.Map({
var projectionSelect = document.getElementById('projection');
projectionSelect.addEventListener('change', function(event) {
mousePositionControl.setProjection(ol.proj.get(event.target.value));
mousePositionControl.setProjection(event.target.value);
});
var precisionInput = document.getElementById('precision');

View File

@@ -3,7 +3,7 @@ layout: example.html
title: OSM Vector Tiles
shortdesc: Using OpenStreetMap vector tiles.
docs: >
A simple vector tiles map with Mapzen vector tiles. **Note**: TopoJSON vector tiles are not optimized for rendering - they might clip geometries exactly at the tile boundary instead of adding a buffer, and use geographic coordinates instead of tile relative pixel coordinates in view projection.
A simple vector tiles map with Mapzen vector tiles. This example uses the TopoJSON format's `layerName` option to determine the layer ("water", "roads", "buildings") for styling. **Note**: [`ol.format.MVT`](../apidoc/ol.format.MVT.html) is an even more efficient format for vector tiles.
tags: "vector, tiles, osm, mapzen"
cloak:
vector-tiles-5eJz6JX: Your Mapzen API key from https://mapzen.com/developers

View File

@@ -1,4 +1,3 @@
goog.require('ol.Attribution');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.format.TopoJSON');
@@ -13,11 +12,6 @@ goog.require('ol.tilegrid');
var key = 'vector-tiles-5eJz6JX';
var attribution = [new ol.Attribution({
html: '&copy; OpenStreetMap contributors, Whos On First, Natural Earth, and openstreetmapdata.com'
})];
var format = new ol.format.TopoJSON();
var tileGrid = ol.tilegrid.createXYZ({maxZoom: 19});
var roadStyleCache = {};
var roadColor = {
'major_road': '#776',
@@ -34,65 +28,58 @@ var buildingStyle = new ol.style.Style({
width: 1
})
});
var waterStyle = new ol.style.Style({
fill: new ol.style.Fill({
color: '#9db9e8'
})
});
var roadStyle = function(feature) {
var kind = feature.get('kind');
var railway = feature.get('railway');
var sort_key = feature.get('sort_key');
var styleKey = kind + '/' + railway + '/' + sort_key;
var style = roadStyleCache[styleKey];
if (!style) {
var color, width;
if (railway) {
color = '#7de';
width = 1;
} else {
color = roadColor[kind];
width = kind == 'highway' ? 1.5 : 1;
}
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: color,
width: width
}),
zIndex: sort_key
});
roadStyleCache[styleKey] = style;
}
return style;
};
var map = new ol.Map({
layers: [
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/water/{z}/{x}/{y}.topojson?api_key=' + key
attributions: '&copy; OpenStreetMap contributors, Whos On First, ' +
'Natural Earth, and openstreetmapdata.com',
format: new ol.format.TopoJSON({
layerName: 'layer',
layers: ['water', 'roads', 'buildings']
}),
tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}),
url: 'https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: new ol.style.Style({
fill: new ol.style.Fill({
color: '#9db9e8'
})
})
}),
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/roads/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: function(feature) {
var kind = feature.get('kind');
var railway = feature.get('railway');
var sort_key = feature.get('sort_key');
var styleKey = kind + '/' + railway + '/' + sort_key;
var style = roadStyleCache[styleKey];
if (!style) {
var color, width;
if (railway) {
color = '#7de';
width = 1;
} else {
color = roadColor[kind];
width = kind == 'highway' ? 1.5 : 1;
}
style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: color,
width: width
}),
zIndex: sort_key
});
roadStyleCache[styleKey] = style;
style: function(feature, resolution) {
switch (feature.get('layer')) {
case 'water': return waterStyle;
case 'roads': return roadStyle(feature);
case 'buildings': return (resolution < 10) ? buildingStyle : null;
default: return null;
}
return style;
}
}),
new ol.layer.VectorTile({
source: new ol.source.VectorTile({
attributions: attribution,
format: format,
tileGrid: tileGrid,
url: 'https://tile.mapzen.com/mapzen/vector/v1/buildings/{z}/{x}/{y}.topojson?api_key=' + key
}),
style: function(f, resolution) {
return (resolution < 10) ? buildingStyle : null;
}
})
],

View File

@@ -54,28 +54,28 @@ var geojsonObject = {
'geometry': {
'type': 'Polygon',
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]]
[-3e6, 6e6], [-5e6, 6e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-2e6, 6e6]]]
[0, 6e6], [-2e6, 6e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]]
[3e6, 6e6], [1e6, 6e6]]]
}
}, {
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
[0, -1e6], [-2e6, -1e6]]]
[0, -1e6], [-2e6, -1e6]]]
}
}]
};

View File

@@ -162,13 +162,13 @@ function plot(resolution, counts, threshold) {
var value = counts.min + (index * counts.delta);
return 'bar' + (value >= threshold ? ' selected' : '');
})
.attr('width', barWidth - 2);
.attr('width', barWidth - 2);
bar.transition().attr('transform', function(value, index) {
return 'translate(' + (index * barWidth) + ', ' +
(plotHeight - yScale(value)) + ')';
})
.attr('height', yScale);
.attr('height', yScale);
bar.on('mousemove', function(count, index) {
var threshold = counts.min + (index * counts.delta);

View File

@@ -177,7 +177,7 @@ function updateViewProjection() {
});
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')) {
layers['bng'].setExtent([-1057216, 6405988, 404315, 8759696]);
} else {

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
})
}),
view: new ol.View({
center: [-25860000, 4130000],
center: [14200000, 4130000],
rotation: Math.PI / 6,
zoom: 10
})

View File

@@ -29,6 +29,7 @@ tags: "draw, edit, modify, vector, snap"
<option value="Point">Point</option>
<option value="LineString">LineString</option>
<option value="Polygon">Polygon</option>
<option value="Circle">Circle</option>
</select>
</div>
</form>

View File

@@ -81,6 +81,8 @@ var Draw = {
this.LineString.setActive(false);
map.addInteraction(this.Polygon);
this.Polygon.setActive(false);
map.addInteraction(this.Circle);
this.Circle.setActive(false);
},
Point: new ol.interaction.Draw({
source: vector.getSource(),
@@ -94,6 +96,10 @@ var Draw = {
source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('Polygon')
}),
Circle: new ol.interaction.Draw({
source: vector.getSource(),
type: /** @type {ol.geom.GeometryType} */ ('Circle')
}),
getActive: function() {
return this.activeType ? this[this.activeType].getActive() : false;
},

View File

@@ -29,13 +29,14 @@ var style = new ol.style.Style({
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
url: 'data/topojson/world-110m.json',
format: new ol.format.TopoJSON(),
format: new ol.format.TopoJSON({
// don't want to render the full world polygon (stored as 'land' layer),
// which repeats all countries
layers: ['countries']
}),
overlaps: false
}),
style: function(feature) {
// don't want to render the full world polygon, which repeats all countries
return feature.getId() !== undefined ? style : null;
}
style: style
});
var map = new ol.Map({

View File

@@ -47,8 +47,8 @@ var featureRequest = new ol.format.WFS().writeGetFeature({
featureTypes: ['water_areas'],
outputFormat: 'application/json',
filter: ol.format.filter.and(
ol.format.filter.like('name', 'Mississippi*'),
ol.format.filter.equalTo('waterway', 'riverbank')
ol.format.filter.like('name', 'Mississippi*'),
ol.format.filter.equalTo('waterway', 'riverbank')
)
});

View File

@@ -3,7 +3,7 @@ layout: example.html
title: WMS Time
shortdesc: Example of smooth tile transitions when changing the time dimension of a tiled WMS layer.
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"
---
<div id="map" class="map"></div>

View File

@@ -3,7 +3,7 @@ layout: example.html
title: WMTS Tile Transitions
shortdesc: Example of smooth tile transitions when changing the dimension of a WMTS layer.
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"
---
<div id="map" class="map"></div>

View File

@@ -28,8 +28,8 @@ var map = new ol.Map({
tileSize: tileSize,
tileUrlFunction: function(tileCoord) {
return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
.replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString());
},
wrapX: true
})

View File

@@ -112,7 +112,14 @@ olx.LogoOptions.prototype.src;
* @typedef {{map: (ol.Map|undefined),
* maxLines: (number|undefined),
* strokeStyle: (ol.style.Stroke|undefined),
* targetSize: (number|undefined)}}
* targetSize: (number|undefined),
* showLabels: (boolean|undefined),
* lonLabelFormatter: (undefined|function(number):string),
* latLabelFormatter: (undefined|function(number):string),
* lonLabelPosition: (number|undefined),
* latLabelPosition: (number|undefined),
* lonLabelStyle: (ol.style.Text|undefined),
* latLabelStyle: (ol.style.Text|undefined)}}
*/
olx.GraticuleOptions;
@@ -157,6 +164,106 @@ olx.GraticuleOptions.prototype.strokeStyle;
olx.GraticuleOptions.prototype.targetSize;
/**
* Render a label with the respective latitude/longitude for each graticule
* line. Default is false.
*
* @type {boolean|undefined}
* @api
*/
olx.GraticuleOptions.prototype.showLabels;
/**
* Label formatter for longitudes. This function is called with the longitude as
* argument, and should return a formatted string representing the longitude.
* By default, labels are formatted as degrees, minutes, seconds and hemisphere.
*
* @type {undefined|function(number):string}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelFormatter;
/**
* Label formatter for latitudes. This function is called with the latitude as
* argument, and should return a formatted string representing the latitude.
* By default, labels are formatted as degrees, minutes, seconds and hemisphere.
*
* @type {undefined|function(number):string}
* @api
*/
olx.GraticuleOptions.prototype.latLabelFormatter;
/**
* Longitude label position in fractions (0..1) of view extent. 0 means at the
* bottom of the viewport, 1 means at the top. Default is 0.
* @type {number|undefined}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelPosition;
/**
* Latitude label position in fractions (0..1) of view extent. 0 means at the
* left of the viewport, 1 means at the right. Default is 1.
* @type {number|undefined}
* @api
*/
olx.GraticuleOptions.prototype.latLabelPosition;
/**
* Longitude label text style. The default is
* ```js
* new ol.style.Text({
* font: '12px Calibri,sans-serif',
* textBaseline: 'bottom',
* fill: new ol.style.Fill({
* color: 'rgba(0,0,0,1)'
* }),
* stroke: new ol.style.Stroke({
* color: 'rgba(255,255,255,1)',
* width: 3
* })
* });
* ```
* Note that the default's `textBaseline` configuration will not work well for
* `lonLabelPosition` configurations that position labels close to the top of
* the viewport.
*
* @type {ol.style.Text|undefined}
* @api
*/
olx.GraticuleOptions.prototype.lonLabelStyle;
/**
* Latitude label text style. The default is
* ```js
* new ol.style.Text({
* font: '12px Calibri,sans-serif',
* textAlign: 'end',
* fill: new ol.style.Fill({
* color: 'rgba(0,0,0,1)'
* }),
* stroke: new ol.style.Stroke({
* color: 'rgba(255,255,255,1)',
* width: 3
* })
* });
* ```
* Note that the default's `textAlign` configuration will not work well for
* `latLabelPosition` configurations that position labels close to the left of
* the viewport.
*
* @type {ol.style.Text|undefined}
* @api
*/
olx.GraticuleOptions.prototype.latLabelStyle;
/**
* Object literal with config options for interactions.
* @typedef {{handleEvent: function(ol.MapBrowserEvent):boolean}}
@@ -185,6 +292,7 @@ olx.interaction.InteractionOptions.prototype.handleEvent;
* loadTilesWhileAnimating: (boolean|undefined),
* loadTilesWhileInteracting: (boolean|undefined),
* logo: (boolean|string|olx.LogoOptions|Element|undefined),
* moveTolerance: (number|undefined),
* overlays: (ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined),
* renderer: (ol.renderer.Type|Array.<ol.renderer.Type>|undefined),
* target: (Element|string|undefined),
@@ -278,6 +386,17 @@ olx.MapOptions.prototype.loadTilesWhileInteracting;
olx.MapOptions.prototype.logo;
/**
* The minimum distance in pixels the cursor must move to be detected
* as a map move event instead of a click. Increasing this value can make it
* easier to click on the map.
* Default is `1`.
* @type {number|undefined}
* @api
*/
olx.MapOptions.prototype.moveTolerance;
/**
* Overlays initially added to the map. By default, no overlays are added.
* @type {ol.Collection.<ol.Overlay>|Array.<ol.Overlay>|undefined}
@@ -561,7 +680,8 @@ olx.ProjectionOptions.prototype.worldExtent;
/**
* Function to determine resolution at a point. The function is called with a
* `{number}` view resolution and an `{ol.Coordinate}` as arguments, and returns
* the `{number}` resolution at the passed coordinate.
* the `{number}` resolution at the passed coordinate. If this is `undefined`,
* the default {@link ol.proj#getPointResolution} function will be used.
* @type {(function(number, ol.Coordinate):number|undefined)}
* @api
*/
@@ -1874,9 +1994,9 @@ olx.format.MVTOptions;
* {@link ol.Feature} to get full editing and geometry support at the cost of
* decreased rendering performance. The default is {@link ol.render.Feature},
* which is optimized for rendering and hit detection.
* @type {undefined|function((ol.geom.Geometry|Object.<string, *>)=)|
* @type {undefined|function((ol.geom.Geometry|Object.<string,*>)=)|
* function(ol.geom.GeometryType,Array.<number>,
* (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
* @api
*/
olx.format.MVTOptions.prototype.featureClass;
@@ -1933,7 +2053,11 @@ olx.format.PolylineOptions.prototype.geometryLayout;
/**
* @typedef {{defaultDataProjection: ol.ProjectionLike}}
* @typedef {{
* defaultDataProjection: ol.ProjectionLike,
* layerName: (string|undefined),
* layers: (Array.<string>|undefined)
* }}
*/
olx.format.TopoJSONOptions;
@@ -1946,6 +2070,38 @@ olx.format.TopoJSONOptions;
olx.format.TopoJSONOptions.prototype.defaultDataProjection;
/**
* Set the name of the TopoJSON topology `objects`'s children as feature
* property with the specified name. This means that when set to `'layer'`, a
* topology like
* ```
* {
* "type": "Topology",
* "objects": {
* "example": {
* "type": "GeometryCollection",
* "geometries": []
* }
* }
* }
* ```
* will result in features that have a property `'layer'` set to `'example'`.
* When not set, no property will be added to features.
* @type {string|undefined}
* @api
*/
olx.format.TopoJSONOptions.prototype.layerName;
/**
* Names of the TopoJSON topology's `objects`'s children to read features from.
* If not provided, features will be read from all children.
* @type {Array.<string>|undefined}
* @api
*/
olx.format.TopoJSONOptions.prototype.layers;
/**
* @typedef {{altitudeMode: (ol.format.IGCZ|undefined)}}
*/
@@ -2299,6 +2455,7 @@ olx.format.WFSWriteGetFeatureOptions.prototype.resultType;
* featureType: string,
* srsName: (string|undefined),
* handle: (string|undefined),
* hasZ: (boolean|undefined),
* nativeElements: Array.<Object>,
* gmlOptions: (olx.format.GMLOptions|undefined),
* version: (string|undefined)}}
@@ -2347,6 +2504,15 @@ olx.format.WFSWriteTransactionOptions.prototype.srsName;
olx.format.WFSWriteTransactionOptions.prototype.handle;
/**
* Must be set to true if the transaction is for a 3D layer. This will allow
* the Z coordinate to be included in the transaction.
* @type {boolean|undefined}
* @api
*/
olx.format.WFSWriteTransactionOptions.prototype.hasZ;
/**
* Native elements. Currently not supported.
* @type {Array.<Object>}
@@ -2905,7 +3071,7 @@ olx.interaction.DrawOptions.prototype.wrapX;
olx.interaction.ExtentOptions;
/**
* Initial extent. Defaults to no inital extent
* Initial extent. Defaults to no initial extent
* @type {ol.Extent|undefined}
* @api
*/
@@ -2970,7 +3136,7 @@ olx.interaction.TranslateOptions.prototype.layers;
/**
* Hit-detection tolerance. Pixels inside the radius around the given position
* will be checked for features. This only works for the canvas renderer and
* not for WebGL.
* not for WebGL. Default is `0`.
* @type {number|undefined}
* @api
*/
@@ -3047,12 +3213,15 @@ olx.interaction.KeyboardZoomOptions.prototype.delta;
/**
* @typedef {{condition: (ol.EventsConditionType|undefined),
* @typedef {{
* condition: (ol.EventsConditionType|undefined),
* deleteCondition: (ol.EventsConditionType|undefined),
* insertVertexCondition: (ol.EventsConditionType|undefined),
* pixelTolerance: (number|undefined),
* style: (ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction|undefined),
* features: ol.Collection.<ol.Feature>,
* wrapX: (boolean|undefined)}}
* wrapX: (boolean|undefined)
* }}
*/
olx.interaction.ModifyOptions;
@@ -3079,6 +3248,16 @@ olx.interaction.ModifyOptions.prototype.condition;
olx.interaction.ModifyOptions.prototype.deleteCondition;
/**
* A function that takes an {@link ol.MapBrowserEvent} and returns a boolean
* to indicate whether a new vertex can be added to the sketch features.
* Default is {@link ol.events.condition.always}
* @type {ol.EventsConditionType|undefined}
* @api
*/
olx.interaction.ModifyOptions.prototype.insertVertexCondition;
/**
* Pixel tolerance for considering the pointer close enough to a segment or
* vertex for editing. Default is `10`.
@@ -3391,7 +3570,7 @@ olx.interaction.SelectOptions.prototype.wrapX;
/**
* Hit-detection tolerance. Pixels inside the radius around the given position
* will be checked for features. This only works for the canvas renderer and
* not for WebGL.
* not for WebGL. Default is `0`.
* @type {number|undefined}
* @api
*/
@@ -4747,7 +4926,7 @@ olx.source.VectorTileOptions.prototype.state;
/**
* Class used to instantiate image tiles. Default is {@link ol.VectorTile}.
* Class used to instantiate vector tiles. Default is {@link ol.VectorTile}.
* @type {function(new: ol.VectorTile, ol.TileCoord,
* ol.TileState, string, ol.format.Feature,
* ol.TileLoadFunctionType)|undefined}
@@ -5558,14 +5737,17 @@ olx.source.ImageWMSOptions.prototype.url;
/**
* @typedef {{cacheSize: (number|undefined),
* @typedef {{
* cacheSize: (number|undefined),
* layer: string,
* minZoom: (number|undefined),
* maxZoom: (number|undefined),
* opaque: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: (string|undefined)}}
* url: (string|undefined),
* wrapX: (boolean|undefined)
* }}
*/
olx.source.StamenOptions;
@@ -5639,6 +5821,14 @@ olx.source.StamenOptions.prototype.tileLoadFunction;
olx.source.StamenOptions.prototype.url;
/**
* Whether to wrap the world horizontally. Default is `true`.
* @type {boolean|undefined}
* @api
*/
olx.source.StamenOptions.prototype.wrapX;
/**
* @typedef {{attributions: (ol.AttributionLike|undefined),
* crossOrigin: (null|string|undefined),
@@ -5863,8 +6053,9 @@ olx.source.TileArcGISRestOptions.prototype.urls;
* crossOrigin: (null|string|undefined),
* jsonp: (boolean|undefined),
* reprojectionErrorThreshold: (number|undefined),
* tileJSON: (TileJSON|undefined),
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
* url: string,
* url: (string|undefined),
* wrapX: (boolean|undefined)}}
*/
olx.source.TileJSONOptions;
@@ -5918,6 +6109,15 @@ olx.source.TileJSONOptions.prototype.jsonp;
olx.source.TileJSONOptions.prototype.reprojectionErrorThreshold;
/**
* TileJSON configuration for this source. If not provided, `url` must be
* configured.
* @type {TileJSON|undefined}
* @api
*/
olx.source.TileJSONOptions.prototype.tileJSON;
/**
* Optional function to load a tile given a URL. The default is
* ```js
@@ -5932,8 +6132,8 @@ olx.source.TileJSONOptions.prototype.tileLoadFunction;
/**
* URL to the TileJSON file.
* @type {string}
* URL to the TileJSON file. If not provided, `tileJSON` must be configured.
* @type {string|undefined}
* @api
*/
olx.source.TileJSONOptions.prototype.url;
@@ -7721,7 +7921,8 @@ olx.view;
* maxZoom: (number|undefined),
* minResolution: (number|undefined),
* duration: (number|undefined),
* easing: (undefined|function(number):number)
* easing: (undefined|function(number):number),
* callback: (undefined|function(boolean))
* }}
*/
olx.view.FitOptions;
@@ -7799,6 +8000,16 @@ olx.view.FitOptions.prototype.duration;
olx.view.FitOptions.prototype.easing;
/**
* Optional function called when the view is in it's final position. The callback will be
* called with `true` if the animation series completed on its own or `false`
* if it was cancelled.
* @type {undefined|function(boolean)}
* @api
*/
olx.view.FitOptions.prototype.callback;
/* typedefs for object literals exposed by the library */

View File

@@ -5,7 +5,6 @@
*/
/**
* @constructor
*/

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "4.1.1",
"version": "4.3.0-beta.2",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -13,6 +13,7 @@
"postinstall": "closure-util update",
"start": "node tasks/serve.js",
"pretest": "eslint tasks test test_rendering src examples",
"lint-package": "eslint --fix build/package",
"test": "node tasks/test.js",
"debug-server": "node tasks/serve-lib.js"
},
@@ -30,30 +31,33 @@
"css/ol.css"
],
"dependencies": {
"async": "2.3.0",
"browserify": "14.3.0",
"closure-util": "1.18.0",
"async": "2.5.0",
"closure-util": "1.22.0",
"derequire": "2.0.6",
"fs-extra": "2.1.2",
"fs-extra": "4.0.0",
"glob": "7.1.1",
"handlebars": "4.0.6",
"jsdoc": "3.4.3",
"handlebars": "4.0.10",
"jsdoc": "3.5.3",
"marked": "0.3.6",
"metalsmith": "2.3.0",
"metalsmith-layouts": "1.8.0",
"metalsmith-layouts": "1.8.1",
"nomnom": "1.8.1",
"pbf": "3.0.5",
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"rollup": "^0.45.0",
"rollup-plugin-cleanup": "^1.0.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"temp": "0.8.3",
"vector-tile": "1.3.0",
"@mapbox/vector-tile": "1.3.0",
"walk": "2.3.9"
},
"devDependencies": {
"clean-css-cli": "4.0.12",
"coveralls": "2.13.0",
"clean-css-cli": "4.1.6",
"coveralls": "2.13.1",
"debounce": "^1.0.0",
"eslint": "3.18.0",
"eslint": "4.2.0",
"eslint-config-openlayers": "7.0.0",
"eslint-plugin-openlayers-internal": "^3.1.0",
"expect.js": "0.3.1",
@@ -61,14 +65,14 @@
"istanbul": "0.4.5",
"jquery": "3.2.1",
"jscodeshift": "^0.3.30",
"mocha": "3.2.0",
"mocha": "3.4.2",
"mocha-phantomjs-core": "^2.1.0",
"mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.14",
"proj4": "2.4.3",
"resemblejs": "2.2.3",
"resemblejs": "2.2.4",
"serve-files": "1.0.1",
"sinon": "2.1.0",
"sinon": "2.3.8",
"slimerjs": "0.10.3"
},
"eslintConfig": {
@@ -91,31 +95,50 @@
"no-constant-condition": 0,
"openlayers-internal/enum": 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/one-provide": 2,
"openlayers-internal/requires-first": 2,
"openlayers-internal/valid-provide": 2,
"openlayers-internal/valid-requires": 2
"openlayers-internal/valid-requires": 2,
"indent": [
2,
2,
{
"VariableDeclarator": 2,
"SwitchCase": 1,
"MemberExpression": 2,
"FunctionDeclaration": {
"parameters": 2,
"body": 1
},
"FunctionExpression": {
"parameters": 2,
"body": 1
},
"CallExpression": {
"arguments": 2
}
}
]
}
},
"ext": [
{
"module": "rbush",
"browserify": true
"module": "rbush"
},
{
"module": "pbf",
"browserify": true
"name": "PBF"
},
{
"module": "pixelworks",
"browserify": true
"import": "Processor"
},
{
"module": "vector-tile",
"module": "@mapbox/vector-tile",
"name": "vectortile",
"browserify": true
"import": "VectorTile"
}
]
}

5
package/.eslintrc Normal file
View File

@@ -0,0 +1,5 @@
{
"parserOptions": {
"sourceType": "module"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "4.1.1",
"version": "4.3.0-beta.2",
"description": "OpenLayers as ES2015 modules",
"main": "index.js",
"module": "index.js",
@@ -9,7 +9,7 @@
"pbf": "3.0.5",
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"vector-tile": "1.3.0"
"@mapbox/vector-tile": "1.3.0"
},
"browserify": {
"transform": [

View File

@@ -9,20 +9,20 @@ goog.require('ol.math');
*/
ol.CenterConstraint.createExtent = function(extent) {
return (
/**
* @param {ol.Coordinate|undefined} center Center.
* @return {ol.Coordinate|undefined} Center.
*/
function(center) {
if (center) {
return [
ol.math.clamp(center[0], extent[0], extent[2]),
ol.math.clamp(center[1], extent[1], extent[3])
];
} else {
return undefined;
}
});
/**
* @param {ol.Coordinate|undefined} center Center.
* @return {ol.Coordinate|undefined} Center.
*/
function(center) {
if (center) {
return [
ol.math.clamp(center[0], extent[0], extent[2]),
ol.math.clamp(center[1], extent[1], extent[3])
];
} else {
return undefined;
}
});
};

View File

@@ -72,56 +72,56 @@ ol.color.fromNamed = function(color) {
* @return {ol.Color} Color.
*/
ol.color.fromString = (
function() {
function() {
// We maintain a small cache of parsed strings. To provide cheap LRU-like
// semantics, whenever the cache grows too large we simply delete an
// arbitrary 25% of the entries.
// We maintain a small cache of parsed strings. To provide cheap LRU-like
// semantics, whenever the cache grows too large we simply delete an
// arbitrary 25% of the entries.
/**
* @const
* @type {number}
*/
var MAX_CACHE_SIZE = 1024;
/**
* @type {Object.<string, ol.Color>}
*/
var cache = {};
/**
* @type {number}
*/
var cacheSize = 0;
return (
/**
* @const
* @type {number}
* @param {string} s String.
* @return {ol.Color} Color.
*/
var MAX_CACHE_SIZE = 1024;
/**
* @type {Object.<string, ol.Color>}
*/
var cache = {};
/**
* @type {number}
*/
var cacheSize = 0;
return (
/**
* @param {string} s String.
* @return {ol.Color} Color.
*/
function(s) {
var color;
if (cache.hasOwnProperty(s)) {
color = cache[s];
} else {
if (cacheSize >= MAX_CACHE_SIZE) {
var i = 0;
var key;
for (key in cache) {
if ((i++ & 3) === 0) {
delete cache[key];
--cacheSize;
}
}
function(s) {
var color;
if (cache.hasOwnProperty(s)) {
color = cache[s];
} else {
if (cacheSize >= MAX_CACHE_SIZE) {
var i = 0;
var key;
for (key in cache) {
if ((i++ & 3) === 0) {
delete cache[key];
--cacheSize;
}
color = ol.color.fromStringInternal_(s);
cache[s] = color;
++cacheSize;
}
return color;
});
}
color = ol.color.fromStringInternal_(s);
cache[s] = color;
++cacheSize;
}
return color;
});
})();
})();
/**

View File

@@ -23,8 +23,8 @@ ol.colorlike.asColorLike = function(color) {
*/
ol.colorlike.isColorLike = function(color) {
return (
typeof color === 'string' ||
color instanceof CanvasPattern ||
color instanceof CanvasGradient
typeof color === 'string' ||
color instanceof CanvasPattern ||
color instanceof CanvasGradient
);
};

View File

@@ -1,29 +0,0 @@
goog.provide('ol.Constraints');
/**
* @constructor
* @param {ol.CenterConstraintType} centerConstraint Center constraint.
* @param {ol.ResolutionConstraintType} resolutionConstraint
* Resolution constraint.
* @param {ol.RotationConstraintType} rotationConstraint
* Rotation constraint.
*/
ol.Constraints = function(centerConstraint, resolutionConstraint, rotationConstraint) {
/**
* @type {ol.CenterConstraintType}
*/
this.center = centerConstraint;
/**
* @type {ol.ResolutionConstraintType}
*/
this.resolution = resolutionConstraint;
/**
* @type {ol.RotationConstraintType}
*/
this.rotation = rotationConstraint;
};

View File

@@ -35,7 +35,7 @@ ol.control.defaults = function(opt_options) {
}
var attributionControl = options.attribution !== undefined ?
options.attribution : true;
options.attribution : true;
if (attributionControl) {
controls.push(new ol.control.Attribution(options.attributionOptions));
}

View File

@@ -53,7 +53,7 @@ ol.control.Attribution = function(opt_options) {
* @type {boolean}
*/
this.collapsible_ = options.collapsible !== undefined ?
options.collapsible : true;
options.collapsible : true;
if (!this.collapsible_) {
this.collapsed_ = false;
@@ -91,7 +91,7 @@ ol.control.Attribution = function(opt_options) {
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
this.collapseLabel_ : this.label_;
this.collapseLabel_ : this.label_;
var button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;

View File

@@ -115,7 +115,7 @@ ol.control.Control.prototype.setMap = function(map) {
this.map_ = map;
if (this.map_) {
var target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent();
this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element);
if (this.render !== ol.nullFunction) {
this.listenerKeys.push(ol.events.listen(map,

View File

@@ -12,7 +12,7 @@ goog.require('ol.events.EventType');
* @classdesc
* 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
* 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.
*
* When in full screen mode, a close button is shown to exit full screen mode.
@@ -34,7 +34,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {string}
*/
this.cssClassName_ = options.className !== undefined ? options.className :
'ol-full-screen';
'ol-full-screen';
var label = options.label !== undefined ? options.label : '\u2922';
@@ -43,7 +43,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node}
*/
this.labelNode_ = typeof label === 'string' ?
document.createTextNode(label) : label;
document.createTextNode(label) : label;
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
@@ -52,7 +52,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node}
*/
this.labelActiveNode_ = typeof labelActive === 'string' ?
document.createTextNode(labelActive) : labelActive;
document.createTextNode(labelActive) : labelActive;
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
var button = document.createElement('button');

View File

@@ -31,7 +31,7 @@ ol.control.MousePosition = function(opt_options) {
element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
var render = options.render ?
options.render : ol.control.MousePosition.render;
options.render : ol.control.MousePosition.render;
ol.control.Control.call(this, {
element: element,
@@ -47,7 +47,7 @@ ol.control.MousePosition = function(opt_options) {
this.setCoordinateFormat(options.coordinateFormat);
}
if (options.projection) {
this.setProjection(ol.proj.get(options.projection));
this.setProjection(options.projection);
}
/**
@@ -122,7 +122,7 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
*/
ol.control.MousePosition.prototype.getCoordinateFormat = function() {
return /** @type {ol.CoordinateFormatType|undefined} */ (
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
};
@@ -135,7 +135,7 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
*/
ol.control.MousePosition.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.control.MousePosition.Property_.PROJECTION));
this.get(ol.control.MousePosition.Property_.PROJECTION));
};
@@ -192,13 +192,13 @@ ol.control.MousePosition.prototype.setCoordinateFormat = function(format) {
/**
* Set the projection that is used to report the mouse position.
* @param {ol.proj.Projection} projection The projection to report mouse
* @param {ol.ProjectionLike} projection The projection to report mouse
* position in.
* @observable
* @api
*/
ol.control.MousePosition.prototype.setProjection = function(projection) {
this.set(ol.control.MousePosition.Property_.PROJECTION, projection);
this.set(ol.control.MousePosition.Property_.PROJECTION, ol.proj.get(projection));
};

View File

@@ -42,7 +42,7 @@ ol.control.OverviewMap = function(opt_options) {
* @type {boolean}
*/
this.collapsible_ = options.collapsible !== undefined ?
options.collapsible : true;
options.collapsible : true;
if (!this.collapsible_) {
this.collapsed_ = false;
@@ -80,7 +80,7 @@ ol.control.OverviewMap = function(opt_options) {
}
var activeLabel = (this.collapsible_ && !this.collapsed_) ?
this.collapseLabel_ : this.label_;
this.collapseLabel_ : this.label_;
var button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;

View File

@@ -112,7 +112,7 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
*/
ol.control.ScaleLine.prototype.getUnits = function() {
return /** @type {ol.control.ScaleLineUnits|undefined} */ (
this.get(ol.control.ScaleLine.Property_.UNITS));
this.get(ol.control.ScaleLine.Property_.UNITS));
};

View File

@@ -31,16 +31,16 @@ ol.control.Zoom = function(opt_options) {
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
options.zoomInTipLabel : 'Zoom in';
options.zoomInTipLabel : 'Zoom in';
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
options.zoomOutTipLabel : 'Zoom out';
options.zoomOutTipLabel : 'Zoom out';
var inElement = document.createElement('button');
inElement.className = className + '-in';
inElement.setAttribute('type', 'button');
inElement.title = zoomInTipLabel;
inElement.appendChild(
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
);
ol.events.listen(inElement, ol.events.EventType.CLICK,
@@ -51,7 +51,7 @@ ol.control.Zoom = function(opt_options) {
outElement.setAttribute('type', 'button');
outElement.title = zoomOutTipLabel;
outElement.appendChild(
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
);
ol.events.listen(outElement, ol.events.EventType.CLICK,

View File

@@ -27,16 +27,16 @@ ol.control.ZoomToExtent = function(opt_options) {
this.extent_ = options.extent ? options.extent : null;
var className = options.className !== undefined ? options.className :
'ol-zoom-extent';
'ol-zoom-extent';
var label = options.label !== undefined ? options.label : 'E';
var tipLabel = options.tipLabel !== undefined ?
options.tipLabel : 'Fit to extent';
options.tipLabel : 'Fit to extent';
var button = document.createElement('button');
button.setAttribute('type', 'button');
button.title = tipLabel;
button.appendChild(
typeof label === 'string' ? document.createTextNode(label) : label
typeof label === 'string' ? document.createTextNode(label) : label
);
ol.events.listen(button, ol.events.EventType.CLICK,

View File

@@ -26,6 +26,37 @@ ol.coordinate.add = function(coordinate, delta) {
};
/**
* Calculates the point closest to the passed coordinate on the passed circle.
*
* @param {ol.Coordinate} coordinate The coordinate.
* @param {ol.geom.Circle} circle The circle.
* @return {ol.Coordinate} Closest point on the circumference
*/
ol.coordinate.closestOnCircle = function(coordinate, circle) {
var r = circle.getRadius();
var center = circle.getCenter();
var x0 = center[0];
var y0 = center[1];
var x1 = coordinate[0];
var y1 = coordinate[1];
var dx = x1 - x0;
var dy = y1 - y0;
if (dx === 0 && dy === 0) {
dx = 1;
}
var d = Math.sqrt(dx * dx + dy * dy);
var x, y;
x = x0 + r * dx / d;
y = y0 + r * dy / d;
return [x, y];
};
/**
* Calculates the point closest to the passed coordinate on the passed segment.
* This is the foot of the perpendicular of the coordinate to the segment when
@@ -49,7 +80,7 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
var dx = x2 - x1;
var dy = y2 - y1;
var along = (dx === 0 && dy === 0) ? 0 :
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
var x, y;
if (along <= 0) {
x = x1;
@@ -90,25 +121,24 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
*/
ol.coordinate.createStringXY = function(opt_fractionDigits) {
return (
/**
* @param {ol.Coordinate|undefined} coordinate Coordinate.
* @return {string} String XY.
*/
function(coordinate) {
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
});
/**
* @param {ol.Coordinate|undefined} coordinate Coordinate.
* @return {string} String XY.
*/
function(coordinate) {
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
});
};
/**
* @private
* @param {number} degrees Degrees.
* @param {string} hemispheres Hemispheres.
* @param {number} degrees Degrees.
* @param {number=} opt_fractionDigits The number of digits to include
* after the decimal point. Default is `0`.
* @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 x = Math.abs(3600 * normalizedDegrees);
var dflPrecision = opt_fractionDigits || 0;
@@ -130,8 +160,8 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction
}
return deg + '\u00b0 ' + ol.string.padNumber(min, 2) + '\u2032 ' +
ol.string.padNumber(sec, 2, dflPrecision) + '\u2033 ' +
hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);
ol.string.padNumber(sec, 2, dflPrecision) + '\u2033' +
(normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
};
@@ -165,8 +195,8 @@ ol.coordinate.degreesToStringHDMS_ = function(degrees, hemispheres, opt_fraction
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
if (coordinate) {
return template
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
.replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
.replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
} else {
return '';
}
@@ -313,8 +343,8 @@ ol.coordinate.squaredDistanceToSegment = function(coordinate, segment) {
*/
ol.coordinate.toStringHDMS = function(coordinate, opt_fractionDigits) {
if (coordinate) {
return ol.coordinate.degreesToStringHDMS_(coordinate[1], 'NS', opt_fractionDigits) + ' ' +
ol.coordinate.degreesToStringHDMS_(coordinate[0], 'EW', opt_fractionDigits);
return ol.coordinate.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
ol.coordinate.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
} else {
return '';
}

View File

@@ -132,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
*/
ol.DeviceOrientation.prototype.getAlpha = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.ALPHA));
this.get(ol.DeviceOrientation.Property_.ALPHA));
};
@@ -145,7 +145,7 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
*/
ol.DeviceOrientation.prototype.getBeta = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.BETA));
this.get(ol.DeviceOrientation.Property_.BETA));
};
@@ -158,7 +158,7 @@ ol.DeviceOrientation.prototype.getBeta = function() {
*/
ol.DeviceOrientation.prototype.getGamma = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.GAMMA));
this.get(ol.DeviceOrientation.Property_.GAMMA));
};
@@ -171,7 +171,7 @@ ol.DeviceOrientation.prototype.getGamma = function() {
*/
ol.DeviceOrientation.prototype.getHeading = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.HEADING));
this.get(ol.DeviceOrientation.Property_.HEADING));
};
@@ -183,7 +183,7 @@ ol.DeviceOrientation.prototype.getHeading = function() {
*/
ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.DeviceOrientation.Property_.TRACKING));
this.get(ol.DeviceOrientation.Property_.TRACKING));
};

View File

@@ -17,7 +17,7 @@ goog.require('ol.has');
ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
originalEvent.altKey &&
originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
!originalEvent.shiftKey);
};
@@ -34,7 +34,7 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
originalEvent.altKey &&
originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
originalEvent.shiftKey);
};
@@ -138,7 +138,7 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
!originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
!originalEvent.shiftKey);
};
@@ -156,7 +156,7 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
!originalEvent.altKey &&
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
!originalEvent.shiftKey);
};
@@ -173,7 +173,7 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent;
return (
!originalEvent.altKey &&
!originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) &&
originalEvent.shiftKey);
};
@@ -191,7 +191,7 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
var target = mapBrowserEvent.originalEvent.target;
var tagName = target.tagName;
return (
tagName !== 'INPUT' &&
tagName !== 'INPUT' &&
tagName !== 'SELECT' &&
tagName !== 'TEXTAREA');
};

View File

@@ -47,15 +47,15 @@ ol.events.Event = function(type) {
*/
ol.events.Event.prototype.preventDefault =
/**
* Stop event propagation.
* @function
* @override
* @api
*/
ol.events.Event.prototype.stopPropagation = function() {
this.propagationStopped = true;
};
/**
* Stop event propagation.
* @function
* @override
* @api
*/
ol.events.Event.prototype.stopPropagation = function() {
this.propagationStopped = true;
};
/**

View File

@@ -131,8 +131,8 @@ ol.events.EventTarget.prototype.getListeners = function(type) {
*/
ol.events.EventTarget.prototype.hasListener = function(opt_type) {
return opt_type ?
opt_type in this.listeners_ :
Object.keys(this.listeners_).length > 0;
opt_type in this.listeners_ :
Object.keys(this.listeners_).length > 0;
};

View File

@@ -426,8 +426,10 @@ ol.extent.forEachCorner = function(extent, callback, opt_this) {
/**
* Get the size of an extent.
* @param {ol.Extent} extent Extent.
* @return {number} Area.
* @api
*/
ol.extent.getArea = function(extent) {
var area = 0;

View File

@@ -140,7 +140,7 @@ ol.Feature.prototype.clone = function() {
*/
ol.Feature.prototype.getGeometry = function() {
return /** @type {ol.geom.Geometry|undefined} */ (
this.get(this.geometryName_));
this.get(this.geometryName_));
};
@@ -240,7 +240,7 @@ ol.Feature.prototype.setGeometry = function(geometry) {
ol.Feature.prototype.setStyle = function(style) {
this.style_ = style;
this.styleFunction_ = !style ?
undefined : ol.Feature.createStyleFunction(style);
undefined : ol.Feature.createStyleFunction(style);
this.changed();
};

View File

@@ -18,60 +18,60 @@ goog.require('ol.xml');
*/
ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
return (
/**
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {ol.proj.Projection} projection Projection.
* @this {ol.source.Vector|ol.VectorTile}
*/
function(extent, resolution, projection) {
var xhr = new XMLHttpRequest();
xhr.open('GET',
typeof url === 'function' ? url(extent, resolution, projection) : url,
true);
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
xhr.responseType = 'arraybuffer';
}
/**
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @param {ol.proj.Projection} projection Projection.
* @this {ol.source.Vector|ol.VectorTile}
* @param {Event} event Event.
* @private
*/
function(extent, resolution, projection) {
var xhr = new XMLHttpRequest();
xhr.open('GET',
typeof url === 'function' ? url(extent, resolution, projection) : url,
true);
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
xhr.responseType = 'arraybuffer';
}
/**
* @param {Event} event Event.
* @private
*/
xhr.onload = function(event) {
// status will be 0 for file:// urls
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
var type = format.getType();
/** @type {Document|Node|Object|string|undefined} */
var source;
if (type == ol.format.FormatType.JSON ||
xhr.onload = function(event) {
// status will be 0 for file:// urls
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
var type = format.getType();
/** @type {Document|Node|Object|string|undefined} */
var source;
if (type == ol.format.FormatType.JSON ||
type == ol.format.FormatType.TEXT) {
source = xhr.responseText;
} else if (type == ol.format.FormatType.XML) {
source = xhr.responseXML;
if (!source) {
source = ol.xml.parse(xhr.responseText);
}
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
source = /** @type {ArrayBuffer} */ (xhr.response);
}
if (source) {
success.call(this, format.readFeatures(source,
{featureProjection: projection}),
format.readProjection(source));
} else {
failure.call(this);
source = xhr.responseText;
} else if (type == ol.format.FormatType.XML) {
source = xhr.responseXML;
if (!source) {
source = ol.xml.parse(xhr.responseText);
}
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
source = /** @type {ArrayBuffer} */ (xhr.response);
}
if (source) {
success.call(this, format.readFeatures(source,
{featureProjection: projection}),
format.readProjection(source));
} else {
failure.call(this);
}
}.bind(this);
/**
* @private
*/
xhr.onerror = function() {
} else {
failure.call(this);
}.bind(this);
xhr.send();
});
}
}.bind(this);
/**
* @private
*/
xhr.onerror = function() {
failure.call(this);
}.bind(this);
xhr.send();
});
};

View File

@@ -83,8 +83,8 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
}
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
};
@@ -121,9 +121,11 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
// loop over all outer rings and see if they contain our hole.
for (i = outerRings.length - 1; i >= 0; i--) {
var outerRing = outerRings[i][0];
if (ol.extent.containsExtent(new ol.geom.LinearRing(
outerRing).getExtent(),
new ol.geom.LinearRing(hole).getExtent())) {
var containsHole = ol.extent.containsExtent(
new ol.geom.LinearRing(outerRing).getExtent(),
new ol.geom.LinearRing(hole).getExtent()
);
if (containsHole) {
// the hole is contained push it into our polygon
outerRings[i].push(hole);
matched = true;
@@ -468,7 +470,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
if (opt_options && opt_options.idField &&
esriJSONFeature.attributes[opt_options.idField]) {
feature.setId(/** @type {number} */(
esriJSONFeature.attributes[opt_options.idField]));
esriJSONFeature.attributes[opt_options.idField]));
}
if (esriJSONFeature.attributes) {
feature.setProperties(esriJSONFeature.attributes);
@@ -559,8 +561,8 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options);
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options);
};

View File

@@ -47,7 +47,7 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
if (opt_options) {
options = {
dataProjection: opt_options.dataProjection ?
opt_options.dataProjection : this.readProjection(source),
opt_options.dataProjection : this.readProjection(source),
featureProjection: opt_options.featureProjection
};
}
@@ -166,9 +166,9 @@ ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
ol.format.Feature.transformWithOptions = function(
geometry, write, opt_options) {
var featureProjection = opt_options ?
ol.proj.get(opt_options.featureProjection) : null;
ol.proj.get(opt_options.featureProjection) : null;
var dataProjection = opt_options ?
ol.proj.get(opt_options.dataProjection) : null;
ol.proj.get(opt_options.dataProjection) : null;
/**
* @type {ol.geom.Geometry|ol.Extent}
*/
@@ -183,14 +183,14 @@ ol.format.Feature.transformWithOptions = function(
// FIXME this is necessary because ol.format.GML treats extents
// as geometries
transformed = ol.proj.transformExtent(
write ? geometry.slice() : geometry,
write ? featureProjection : dataProjection,
write ? dataProjection : featureProjection);
geometry,
dataProjection,
featureProjection);
}
} else {
transformed = geometry;
}
if (write && opt_options && opt_options.decimals) {
if (write && opt_options && opt_options.decimals !== undefined) {
var power = Math.pow(10, opt_options.decimals);
// if decimals option on write, round each coordinate appropriately
/**
@@ -203,11 +203,10 @@ ol.format.Feature.transformWithOptions = function(
}
return coordinates;
};
if (Array.isArray(transformed)) {
transform(transformed);
} else {
transformed.applyTransform(transform);
if (transformed === geometry) {
transformed = transformed.clone();
}
transformed.applyTransform(transform);
}
return transformed;
};

View File

@@ -2,6 +2,7 @@ goog.provide('ol.format.filter');
goog.require('ol.format.filter.And');
goog.require('ol.format.filter.Bbox');
goog.require('ol.format.filter.During');
goog.require('ol.format.filter.EqualTo');
goog.require('ol.format.filter.GreaterThan');
goog.require('ol.format.filter.GreaterThanOrEqualTo');
@@ -228,5 +229,19 @@ ol.format.filter.between = function(propertyName, lowerBoundary, upperBoundary)
ol.format.filter.like = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
return new ol.format.filter.IsLike(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
};
/**
* Create a `<During>` temporal operator.
*
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} begin The begin date in ISO-8601 format.
* @param {!string} end The end date in ISO-8601 format.
* @returns {!ol.format.filter.During} `<During>` operator.
* @api
*/
ol.format.filter.during = function(propertyName, begin, end) {
return new ol.format.filter.During(propertyName, begin, end);
};

View File

@@ -0,0 +1,33 @@
goog.provide('ol.format.filter.During');
goog.require('ol');
goog.require('ol.format.filter.Comparison');
/**
* @classdesc
* Represents a `<During>` comparison operator.
*
* @constructor
* @param {!string} propertyName Name of the context property to compare.
* @param {!string} begin The begin date in ISO-8601 format.
* @param {!string} end The end date in ISO-8601 format.
* @extends {ol.format.filter.Comparison}
* @api
*/
ol.format.filter.During = function(propertyName, begin, end) {
ol.format.filter.Comparison.call(this, 'During', propertyName);
/**
* @public
* @type {!string}
*/
this.begin = begin;
/**
* @public
* @type {!string}
*/
this.end = end;
};
ol.inherits(ol.format.filter.During, ol.format.filter.Comparison);

View File

@@ -39,7 +39,7 @@ ol.format.GeoJSON = function(opt_options) {
*/
this.defaultDataProjection = ol.proj.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
options.defaultDataProjection : 'EPSG:4326');
if (options.featureProjection) {
@@ -69,8 +69,8 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
}
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options));
};
@@ -163,8 +163,8 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options);
ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options);
};
@@ -329,7 +329,8 @@ ol.format.GeoJSON.GEOMETRY_WRITERS_ = {
/**
* Read a feature from a GeoJSON Feature source. Only works for Feature or
* geometry types. Use {@link ol.format.GeoJSON#readFeatures} to read
* FeatureCollection source.
* FeatureCollection source. If feature at source has an id, it will be used
* as Feature id by calling {@link ol.Feature#setId} internally.
*
* @function
* @param {Document|Node|Object|string} source Source.

View File

@@ -35,7 +35,7 @@ ol.format.GML2 = function(opt_options) {
* @inheritDoc
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML2.schemaLocation_;
options.schemaLocation : ol.format.GML2.schemaLocation_;
};
ol.inherits(ol.format.GML2, ol.format.GMLBase);
@@ -353,6 +353,7 @@ ol.format.GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
*/
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();
@@ -361,7 +362,7 @@ ol.format.GML2.prototype.writeCoordinates_ = function(node, value, objectStack)
var point;
for (var i = 0; i < len; ++i) {
point = points[i];
parts[i] = this.getCoords_(point, srsName);
parts[i] = this.getCoords_(point, srsName, hasZ);
}
ol.format.XSD.writeStringTextNode(node, parts.join(' '));
};
@@ -389,6 +390,7 @@ ol.format.GML2.prototype.writeCurveSegments_ = function(node, line, objectStack)
*/
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);
@@ -396,7 +398,7 @@ ol.format.GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objec
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
{node: node, srsName: srsName},
{node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this);
@@ -457,17 +459,25 @@ ol.format.GML2.prototype.writeRing_ = function(node, 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) {
ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
}
return ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] :
point[1] + ',' + point[0]);
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;
};
@@ -479,13 +489,14 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName) {
*/
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, srsName: srsName, curve: curve},
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);
@@ -500,6 +511,7 @@ ol.format.GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry,
*/
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);
@@ -507,7 +519,7 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
var coordinates = this.createCoordinatesNode_(node.namespaceURI);
node.appendChild(coordinates);
var point = geometry.getCoordinates();
var coord = this.getCoords_(point, srsName);
var coord = this.getCoords_(point, srsName, hasZ);
ol.format.XSD.writeStringTextNode(coordinates, coord);
};
@@ -521,12 +533,13 @@ ol.format.GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
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, srsName: srsName},
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML2.POINTMEMBER_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
@@ -587,13 +600,14 @@ ol.format.GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack
*/
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, srsName: srsName, surface: surface},
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);

View File

@@ -52,20 +52,20 @@ ol.format.GML3 = function(opt_options) {
* @type {boolean}
*/
this.multiCurve_ = options.multiCurve !== undefined ?
options.multiCurve : true;
options.multiCurve : true;
/**
* @private
* @type {boolean}
*/
this.multiSurface_ = options.multiSurface !== undefined ?
options.multiSurface : true;
options.multiSurface : true;
/**
* @inheritDoc
*/
this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML3.schemaLocation_;
options.schemaLocation : ol.format.GML3.schemaLocation_;
};
ol.inherits(ol.format.GML3, ol.format.GMLBase);
@@ -565,6 +565,7 @@ ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
*/
ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
var axisOrientation = 'enu';
if (srsName) {
@@ -578,6 +579,11 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
} else {
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);
};
@@ -585,17 +591,25 @@ ol.format.GML3.prototype.writePos_ = function(node, value, 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.GML3.prototype.getCoords_ = function(point, opt_srsName) {
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu';
if (opt_srsName) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
}
return ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]);
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;
};
@@ -607,6 +621,7 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
*/
ol.format.GML3.prototype.writePosList_ = 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();
@@ -615,7 +630,7 @@ ol.format.GML3.prototype.writePosList_ = function(node, value, objectStack) {
var point;
for (var i = 0; i < len; ++i) {
point = points[i];
parts[i] = this.getCoords_(point, srsName);
parts[i] = this.getCoords_(point, srsName, hasZ);
}
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) {
var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ'];
var srsName = context['srsName'];
if (node.nodeName !== 'PolygonPatch' && 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') {
var rings = geometry.getLinearRings();
ol.xml.pushSerializeAndPop(
{node: node, srsName: srsName},
{node: node, hasZ: hasZ, srsName: srsName},
ol.format.GML3.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_,
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) {
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, srsName: srsName, surface: surface},
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
ol.format.GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this);
@@ -794,11 +811,12 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) {
var context = objectStack[objectStack.length - 1];
var srsName = context['srsName'];
var hasZ = context['hasZ'];
if (srsName) {
node.setAttribute('srsName', srsName);
}
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.xml.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this);
@@ -813,13 +831,14 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
*/
ol.format.GML3.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, srsName: srsName, curve: curve},
ol.xml.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
ol.format.GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
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) {
opt_options = this.adaptOptions(opt_options);
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_,
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
if (opt_options) {
@@ -1208,6 +1227,7 @@ ol.format.GML3.prototype.writeFeaturesNode = function(features, opt_options) {
'xsi:schemaLocation', this.schemaLocation);
var context = {
srsName: this.srsName,
hasZ: this.hasZ,
curve: this.curve_,
surface: this.surface_,
multiSurface: this.multiSurface_,

View File

@@ -167,12 +167,12 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
var parsers = {};
for (i = 0, ii = featureTypes.length; i < ii; ++i) {
var featurePrefix = featureTypes[i].indexOf(':') === -1 ?
defaultPrefix : featureTypes[i].split(':')[0];
defaultPrefix : featureTypes[i].split(':')[0];
if (featurePrefix === p) {
parsers[featureTypes[i].split(':').pop()] =
(localName == 'featureMembers') ?
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this);
ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this);
}
}
parsersNS[featureNS[p]] = parsers;
@@ -203,7 +203,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
this.GEOMETRY_PARSERS_, node, objectStack, this);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context));
ol.format.Feature.transformWithOptions(geometry, false, context));
} else {
return undefined;
}
@@ -590,5 +590,5 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
*/
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
return ol.proj.get(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName'));
node.firstElementChild.getAttribute('srsName'));
};

View File

@@ -606,8 +606,8 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
// pass
}
var orderedKeys = (node.nodeName == 'rtept') ?
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node, 'properties': properties}),
@@ -629,7 +629,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(ol.format.Feature.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
properties['rtept'] = geometry.getCoordinates();
}
@@ -656,7 +656,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.MultiLineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(ol.format.Feature.transformWithOptions(geometry, true, options));
properties['trkseg'] = geometry.getLineStrings();
}
var parentNode = objectStack[objectStack.length - 1].node;
@@ -697,7 +697,7 @@ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry();
if (geometry) {
geometry = /** @type {ol.geom.Point} */
(ol.format.Feature.transformWithOptions(geometry, true, options));
(ol.format.Feature.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout();
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
}

View File

@@ -35,7 +35,7 @@ ol.format.IGC = function(opt_options) {
* @type {ol.format.IGCZ}
*/
this.altitudeMode_ = options.altitudeMode ?
options.altitudeMode : ol.format.IGCZ.NONE;
options.altitudeMode : ol.format.IGCZ.NONE;
};
ol.inherits(ol.format.IGC, ol.format.TextFeature);
@@ -158,7 +158,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
}
var lineString = new ol.geom.LineString(null);
var layout = altitudeMode == ol.format.IGCZ.NONE ?
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
lineString, false, opt_options));

View File

@@ -66,21 +66,21 @@ ol.format.KML = function(opt_options) {
* @type {Array.<ol.style.Style>}
*/
this.defaultStyle_ = options.defaultStyle ?
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
/**
* @private
* @type {boolean}
*/
this.extractStyles_ = options.extractStyles !== undefined ?
options.extractStyles : true;
options.extractStyles : true;
/**
* @private
* @type {boolean}
*/
this.writeStyles_ = options.writeStyles !== undefined ?
options.writeStyles : true;
options.writeStyles : true;
/**
* @private
@@ -93,7 +93,7 @@ ol.format.KML = function(opt_options) {
* @type {boolean}
*/
this.showPointNames_ = options.showPointNames !== undefined ?
options.showPointNames : true;
options.showPointNames : true;
};
ol.inherits(ol.format.KML, ol.format.XMLFeature);
@@ -285,7 +285,8 @@ ol.format.KML.createStyleDefaults_ = function() {
*/
ol.format.KML.ICON_ANCHOR_UNITS_MAP_ = {
'fraction': ol.style.IconAnchorUnits.FRACTION,
'pixels': ol.style.IconAnchorUnits.PIXELS
'pixels': ol.style.IconAnchorUnits.PIXELS,
'insetPixels': ol.style.IconAnchorUnits.PIXELS
};
@@ -352,53 +353,53 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
defaultStyle, sharedStyles, showPointNames) {
return (
/**
/**
* @param {number} resolution Resolution.
* @return {Array.<ol.style.Style>} Style.
* @this {ol.Feature}
*/
function(resolution) {
var drawName = showPointNames;
/** @type {ol.style.Style|undefined} */
var nameStyle;
var name = '';
if (drawName) {
if (this.getGeometry()) {
drawName = (this.getGeometry().getType() ===
function(resolution) {
var drawName = showPointNames;
/** @type {ol.style.Style|undefined} */
var nameStyle;
var name = '';
if (drawName) {
if (this.getGeometry()) {
drawName = (this.getGeometry().getType() ===
ol.geom.GeometryType.POINT);
}
}
}
if (drawName) {
name = /** @type {string} */ (this.get('name'));
drawName = drawName && name;
}
if (drawName) {
name = /** @type {string} */ (this.get('name'));
drawName = drawName && name;
}
if (style) {
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
name);
return style.concat(nameStyle);
}
return style;
}
if (styleUrl) {
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
sharedStyles);
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
name);
return foundStyle.concat(nameStyle);
}
return foundStyle;
}
if (style) {
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0],
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
name);
return defaultStyle.concat(nameStyle);
return style.concat(nameStyle);
}
return defaultStyle;
});
return style;
}
if (styleUrl) {
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
sharedStyles);
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
name);
return foundStyle.concat(nameStyle);
}
return foundStyle;
}
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0],
name);
return defaultStyle.concat(nameStyle);
}
return defaultStyle;
});
};
@@ -487,7 +488,7 @@ ol.format.KML.readFlatCoordinates_ = function(node) {
*/
ol.format.KML.readURI_ = function(node) {
var s = ol.xml.getAllTextContent(node, false).trim();
if (node.baseURI) {
if (node.baseURI && node.baseURI !== 'about:blank') {
var url = new URL(s, node.baseURI);
return url.href;
} else {
@@ -504,11 +505,26 @@ ol.format.KML.readURI_ = function(node) {
ol.format.KML.readVec2_ = function(node) {
var xunits = node.getAttribute('xunits');
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 {
x: parseFloat(node.getAttribute('x')),
xunits: ol.format.KML.ICON_ANCHOR_UNITS_MAP_[xunits],
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
};
};
@@ -533,7 +549,7 @@ ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(undefined,
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
};
/**
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
@@ -562,12 +578,14 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
src = ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_;
}
var anchor, anchorXUnits, anchorYUnits;
var anchorOrigin = ol.style.IconOrigin.BOTTOM_LEFT;
var hotSpot = /** @type {ol.KMLVec2_|undefined} */
(object['hotSpot']);
if (hotSpot) {
anchor = [hotSpot.x, hotSpot.y];
anchorXUnits = hotSpot.xunits;
anchorYUnits = hotSpot.yunits;
anchorOrigin = hotSpot.origin;
} else if (src === ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
anchor = ol.format.KML.DEFAULT_IMAGE_STYLE_ANCHOR_;
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({
anchor: anchor,
anchorOrigin: ol.style.IconOrigin.BOTTOM_LEFT,
anchorOrigin: anchorOrigin,
anchorXUnits: anchorXUnits,
anchorYUnits: anchorYUnits,
crossOrigin: 'anonymous', // FIXME should this be configurable?
@@ -789,7 +807,7 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) {
var whens = gxTrackObject.whens;
var i, ii;
for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii;
++i) {
++i) {
flatCoordinates[4 * i + 3] = whens[i];
}
var lineString = new ol.geom.LineString(null);
@@ -1003,23 +1021,23 @@ ol.format.KML.readStyle_ = function(node, objectStack) {
}
var fillStyle = /** @type {ol.style.Fill} */
('fillStyle' in styleObject ?
styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_);
styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_);
var fill = /** @type {boolean|undefined} */ (styleObject['fill']);
if (fill !== undefined && !fill) {
fillStyle = null;
}
var imageStyle = /** @type {ol.style.Image} */
('imageStyle' in styleObject ?
styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_);
styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_);
if (imageStyle == ol.format.KML.DEFAULT_NO_IMAGE_STYLE_) {
imageStyle = undefined;
}
var textStyle = /** @type {ol.style.Text} */
('textStyle' in styleObject ?
styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_);
styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_);
var strokeStyle = /** @type {ol.style.Stroke} */
('strokeStyle' in styleObject ?
styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_);
styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_);
var outline = /** @type {boolean|undefined} */
(styleObject['outline']);
if (outline !== undefined && !outline) {
@@ -1074,13 +1092,13 @@ ol.format.KML.setCommonGeometryProperties_ = function(multiGeometry,
ol.format.KML.DataParser_ = function(node, objectStack) {
var name = node.getAttribute('name');
ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack);
var featureObject =
/** @type {Object} */ (objectStack[objectStack.length - 1]);
var featureObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
if (name !== null) {
featureObject[name] = featureObject.value;
} else if (featureObject.displayName !== null) {
featureObject[featureObject.displayName] = featureObject.value;
}
delete featureObject['value'];
};
@@ -1719,7 +1737,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
var style = ol.format.KML.readStyle_(node, objectStack);
if (style) {
var styleUri;
if (node.baseURI) {
if (node.baseURI && node.baseURI !== 'about:blank') {
var url = new URL('#' + id, node.baseURI);
styleUri = url.href;
} else {
@@ -1746,7 +1764,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
return;
}
var styleUri;
if (node.baseURI) {
if (node.baseURI && node.baseURI !== 'about:blank') {
var url = new URL('#' + id, node.baseURI);
styleUri = url.href;
} else {
@@ -2126,16 +2144,16 @@ ol.format.KML.writeDataNode_ = function(node, pair, objectStack) {
if (typeof value == 'object') {
if (value !== null && value.displayName) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']);
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']);
}
if (value !== null && value.value) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']);
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']);
}
} else {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
}
};
@@ -2188,7 +2206,7 @@ ol.format.KML.writeExtendedData_ = function(node, namesAndValues, objectStack) {
for (var i = 0; i < length; i++) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack);
ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack);
}
};
@@ -2402,7 +2420,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
var sequence = ol.xml.makeSequence(properties, keys);
var namesAndValues = {names: keys, values: sequence};
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack);
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack);
}
var styleFunction = feature.getStyleFunction();

View File

@@ -3,8 +3,8 @@
goog.provide('ol.format.MVT');
goog.require('ol');
goog.require('ol.ext.pbf');
goog.require('ol.ext.vectortile');
goog.require('ol.ext.PBF');
goog.require('ol.ext.vectortile.VectorTile');
goog.require('ol.format.Feature');
goog.require('ol.format.FormatType');
goog.require('ol.geom.GeometryLayout');
@@ -44,12 +44,12 @@ ol.format.MVT = function(opt_options) {
/**
* @private
* @type {function((ol.geom.Geometry|Object.<string, *>)=)|
* @type {function((ol.geom.Geometry|Object.<string,*>)=)|
* function(ol.geom.GeometryType,Array.<number>,
* (Array.<number>|Array.<Array.<number>>),Object.<string, *>)}
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
*/
this.featureClass_ = options.featureClass ?
options.featureClass : ol.render.Feature;
options.featureClass : ol.render.Feature;
/**
* @private
@@ -124,7 +124,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
var geometryType;
if (type === 1) {
geometryType = coords.length === 1 ?
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
} else if (type === 2) {
if (coords.length === 1) {
geometryType = ol.geom.GeometryType.LINE_STRING;
@@ -137,8 +137,9 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
var values = rawFeature.properties;
values[this.layerName_] = layer;
var id = rawFeature.id;
return new this.featureClass_(geometryType, flatCoordinates, ends, values);
return new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
};
@@ -149,7 +150,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
ol.format.MVT.prototype.readFeatures = function(source, opt_options) {
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 features = [];
var featureClass = this.featureClass_;
@@ -237,7 +238,7 @@ ol.format.MVT.readGeometry_ = function(rawFeature) {
var geom;
if (type === 1) {
geom = coords.length === 1 ?
new ol.geom.Point(null) : new ol.geom.MultiPoint(null);
new ol.geom.Point(null) : new ol.geom.MultiPoint(null);
} else if (type === 2) {
if (coords.length === 1) {
geom = new ol.geom.LineString(null);

View File

@@ -386,13 +386,13 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
*/
ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'IndividualName': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ContactInfo': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readContactInfo_)
});
ol.format.OWS.NAMESPACE_URIS_, {
'IndividualName': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ContactInfo': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readContactInfo_)
});
/**
@@ -402,12 +402,12 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
*/
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
});
ol.format.OWS.NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
});
/**
@@ -417,9 +417,9 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
*/
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, {
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
'ServiceContact': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceContact_)
});
ol.format.OWS.NAMESPACE_URIS_, {
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
'ServiceContact': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceContact_)
});

View File

@@ -46,7 +46,7 @@ ol.format.Polyline = function(opt_options) {
* @type {ol.geom.GeometryLayout}
*/
this.geometryLayout_ = options.geometryLayout ?
options.geometryLayout : ol.geom.GeometryLayout.XY;
options.geometryLayout : ol.geom.GeometryLayout.XY;
};
ol.inherits(ol.format.Polyline, ol.format.TextFeature);
@@ -332,9 +332,9 @@ ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options)
flatCoordinates, 0, flatCoordinates.length, stride);
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options)));
ol.format.Feature.transformWithOptions(
new ol.geom.LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options)));
};
@@ -388,8 +388,8 @@ ol.format.Polyline.prototype.writeGeometry;
*/
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(
geometry, true, this.adaptOptions(opt_options)));
(ol.format.Feature.transformWithOptions(
geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride();
ol.geom.flat.flip.flipXY(

View File

@@ -10,7 +10,6 @@ goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.obj');
goog.require('ol.proj');
@@ -29,12 +28,24 @@ ol.format.TopoJSON = function(opt_options) {
ol.format.JSONFeature.call(this);
/**
* @private
* @type {string|undefined}
*/
this.layerName_ = options.layerName;
/**
* @private
* @type {Array.<string>}
*/
this.layers_ = options.layers ? options.layers : null;
/**
* @inheritDoc
*/
this.defaultDataProjection = ol.proj.get(
options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326');
options.defaultDataProjection : 'EPSG:4326');
};
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
@@ -202,18 +213,21 @@ ol.format.TopoJSON.readMultiPolygonGeometry_ = function(object, arcs) {
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {Array.<ol.Feature>} Array of features.
* @private
*/
ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
collection, arcs, scale, translate, opt_options) {
collection, arcs, scale, translate, property, name, opt_options) {
var geometries = collection.geometries;
var features = [];
var i, ii;
for (i = 0, ii = geometries.length; i < ii; ++i) {
features[i] = ol.format.TopoJSON.readFeatureFromGeometry_(
geometries[i], arcs, scale, translate, opt_options);
geometries[i], arcs, scale, translate, property, name, opt_options);
}
return features;
};
@@ -226,12 +240,15 @@ ol.format.TopoJSON.readFeaturesFromGeometryCollection_ = function(
* @param {Array.<Array.<ol.Coordinate>>} arcs Array of arcs.
* @param {Array.<number>} scale Scale for each dimension.
* @param {Array.<number>} translate Translation for each dimension.
* @param {string|undefined} property Property to set the `GeometryCollection`'s parent
* object to.
* @param {string} name Name of the `Topology`'s child object.
* @param {olx.format.ReadOptions=} opt_options Read options.
* @return {ol.Feature} Feature.
* @private
*/
ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
scale, translate, opt_options) {
scale, translate, property, name, opt_options) {
var geometry;
var type = object.type;
var geometryReader = ol.format.TopoJSON.GEOMETRY_READERS_[type];
@@ -242,12 +259,19 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
}
var feature = new ol.Feature();
feature.setGeometry(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) {
feature.setId(object.id);
}
if (object.properties) {
feature.setProperties(object.properties);
var properties = object.properties;
if (property) {
if (!properties) {
properties = {};
}
properties[property] = name;
}
if (properties) {
feature.setProperties(properties);
}
return feature;
};
@@ -283,21 +307,24 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
}
/** @type {Array.<ol.Feature>} */
var features = [];
var topoJSONFeatures = ol.obj.getValues(topoJSONTopology.objects);
var i, ii;
var feature;
for (i = 0, ii = topoJSONFeatures.length; i < ii; ++i) {
if (topoJSONFeatures[i].type === 'GeometryCollection') {
var topoJSONFeatures = topoJSONTopology.objects;
var property = this.layerName_;
var objectName, feature;
for (objectName in topoJSONFeatures) {
if (this.layers_ && this.layers_.indexOf(objectName) == -1) {
continue;
}
if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[i]);
(topoJSONFeatures[objectName]);
features.push.apply(features,
ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, opt_options));
feature, arcs, scale, translate, property, objectName, opt_options));
} else {
feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[i]);
(topoJSONFeatures[objectName]);
features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
feature, arcs, scale, translate, opt_options));
feature, arcs, scale, translate, property, objectName, opt_options));
}
}
return features;

View File

@@ -47,15 +47,15 @@ ol.format.WFS = function(opt_options) {
* @type {ol.format.GMLBase}
*/
this.gmlFormat_ = options.gmlFormat ?
options.gmlFormat : new ol.format.GML3();
options.gmlFormat : new ol.format.GML3();
/**
* @private
* @type {string}
*/
this.schemaLocation_ = options.schemaLocation ?
options.schemaLocation :
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
options.schemaLocation :
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
ol.format.XMLFeature.call(this);
};
@@ -90,6 +90,13 @@ ol.format.WFS.OGCNS = 'http://www.opengis.net/ogc';
ol.format.WFS.WFSNS = 'http://www.opengis.net/wfs';
/**
* @const
* @type {string}
*/
ol.format.WFS.FESNS = 'http://www.opengis.net/fes';
/**
* @const
* @type {Object.<string, string>}
@@ -399,6 +406,25 @@ ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
};
/**
* @param {string|undefined} featurePrefix The prefix of the feature.
* @param {string} featureType The type of the feature.
* @returns {string} The value of the typeName property.
* @private
*/
ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) {
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var prefix = featurePrefix + ':';
// The featureType already contains the prefix.
if (featureType.indexOf(prefix) === 0) {
return featureType;
} else {
return prefix + featureType;
}
};
/**
* @param {Node} node Node.
* @param {ol.Feature} feature Feature.
@@ -410,10 +436,9 @@ ol.format.WFS.writeDelete_ = function(node, feature, objectStack) {
ol.asserts.assert(feature.getId() !== undefined, 26); // Features must have an id set
var featureType = context['featureType'];
var featurePrefix = context['featurePrefix'];
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var featureNS = context['featureNS'];
node.setAttribute('typeName', featurePrefix + ':' + featureType);
var typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType);
node.setAttribute('typeName', typeName);
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
var fid = feature.getId();
@@ -434,10 +459,9 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
ol.asserts.assert(feature.getId() !== undefined, 27); // Features must have an id set
var featureType = context['featureType'];
var featurePrefix = context['featurePrefix'];
featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX;
var featureNS = context['featureNS'];
node.setAttribute('typeName', featurePrefix + ':' + featureType);
var typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType);
node.setAttribute('typeName', typeName);
ol.xml.setAttributeNS(node, ol.format.WFS.XMLNS, 'xmlns:' + featurePrefix,
featureNS);
var fid = feature.getId();
@@ -452,10 +476,10 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
}
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
{'gmlVersion': context['gmlVersion'], node: node,
'srsName': context['srsName']}),
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Property'), values,
objectStack);
'hasZ': context['hasZ'], 'srsName': context['srsName']}),
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Property'), values,
objectStack);
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
}
};
@@ -538,8 +562,14 @@ ol.format.WFS.writeQuery_ = function(node, featureType, objectStack) {
var featureNS = context['featureNS'];
var propertyNames = context['propertyNames'];
var srsName = context['srsName'];
var prefix = featurePrefix ? featurePrefix + ':' : '';
node.setAttribute('typeName', prefix + featureType);
var typeName;
// If feature prefix is not defined, we must not use the default prefix.
if (featurePrefix) {
typeName = ol.format.WFS.getTypeName_(featurePrefix, featureType);
} else {
typeName = featureType;
}
node.setAttribute('typeName', typeName);
if (srsName) {
node.setAttribute('srsName', srsName);
}
@@ -623,6 +653,32 @@ ol.format.WFS.writeWithinFilter_ = function(node, filter, objectStack) {
};
/**
* @param {Node} node Node.
* @param {ol.format.filter.During} filter Filter.
* @param {Array.<*>} objectStack Node stack.
* @private
*/
ol.format.WFS.writeDuringFilter_ = function(node, filter, objectStack) {
var valueReference = ol.xml.createElementNS(ol.format.WFS.FESNS, 'ValueReference');
ol.format.XSD.writeStringTextNode(valueReference, filter.propertyName);
node.appendChild(valueReference);
var timePeriod = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'TimePeriod');
node.appendChild(timePeriod);
var begin = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'begin');
timePeriod.appendChild(begin);
ol.format.WFS.writeTimeInstant_(begin, filter.begin);
var end = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'end');
timePeriod.appendChild(end);
ol.format.WFS.writeTimeInstant_(end, filter.end);
};
/**
* @param {Node} node Node.
* @param {ol.format.filter.LogicalNary} filter Filter.
@@ -754,6 +810,21 @@ ol.format.WFS.writeOgcLiteral_ = function(node, value) {
};
/**
* @param {Node} node Node.
* @param {string} time PropertyName value.
* @private
*/
ol.format.WFS.writeTimeInstant_ = function(node, time) {
var timeInstant = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'TimeInstant');
node.appendChild(timeInstant);
var timePosition = ol.xml.createElementNS(ol.format.GMLBase.GMLNS, 'timePosition');
timeInstant.appendChild(timePosition);
ol.format.XSD.writeStringTextNode(timePosition, time);
};
/**
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
@@ -763,6 +834,7 @@ ol.format.WFS.GETFEATURE_SERIALIZERS_ = {
'Query': ol.xml.makeChildAppender(ol.format.WFS.writeQuery_)
},
'http://www.opengis.net/ogc': {
'During': ol.xml.makeChildAppender(ol.format.WFS.writeDuringFilter_),
'And': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
'Or': ol.xml.makeChildAppender(ol.format.WFS.writeLogicalFilter_),
'Not': ol.xml.makeChildAppender(ol.format.WFS.writeNotFilter_),
@@ -892,7 +964,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
var objectStack = [];
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
var version = options.version ?
options.version : ol.format.WFS.DEFAULT_VERSION;
options.version : ol.format.WFS.DEFAULT_VERSION;
var gmlVersion = version === '1.0.0' ? 2 : 3;
node.setAttribute('service', 'WFS');
node.setAttribute('version', version);
@@ -908,10 +980,11 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
var schemaLocation = ol.format.WFS.SCHEMA_LOCATIONS[version];
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
'xsi:schemaLocation', schemaLocation);
var featurePrefix = options.featurePrefix ? options.featurePrefix : ol.format.WFS.FEATURE_PREFIX;
if (inserts) {
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName};
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -920,8 +993,8 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
}
if (updates) {
obj = {node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName};
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
ol.obj.assign(obj, baseObj);
ol.xml.pushSerializeAndPop(obj,
ol.format.WFS.TRANSACTION_SERIALIZERS_,
@@ -930,7 +1003,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
}
if (deletes) {
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName},
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Delete'), deletes,
@@ -938,7 +1011,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
}
if (options.nativeElements) {
ol.xml.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
'featureType': options.featureType, 'featurePrefix': options.featurePrefix,
'featureType': options.featureType, 'featurePrefix': featurePrefix,
'gmlVersion': gmlVersion, 'srsName': options.srsName},
ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Native'), options.nativeElements,

View File

@@ -38,7 +38,7 @@ ol.format.WKT = function(opt_options) {
* @private
*/
this.splitCollection_ = options.splitCollection !== undefined ?
options.splitCollection : false;
options.splitCollection : false;
};
ol.inherits(ol.format.WKT, ol.format.TextFeature);
@@ -330,7 +330,7 @@ ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
var geometry = this.parse_(text);
if (geometry) {
return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
ol.format.Feature.transformWithOptions(geometry, false, opt_options));
} else {
return null;
}
@@ -405,7 +405,7 @@ ol.format.WKT.prototype.writeGeometry;
*/
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
};
@@ -535,7 +535,7 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() {
}
c = this.nextChar_();
} while (
this.isNumeric_(c, decimal) ||
this.isNumeric_(c, decimal) ||
// if we haven't detected a scientific number before, 'e' or 'E'
// hint that we should continue to read
!scientificNotation && (c == 'e' || c == 'E') ||

View File

@@ -71,7 +71,7 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
*/
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
};
@@ -110,9 +110,9 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = ol.xml.pushParseAndPop(
{},
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack);
{},
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack);
if (!geographicBoundingBox) {
return undefined;
}
@@ -143,7 +143,7 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
*/
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
};
@@ -155,7 +155,7 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
};
@@ -167,8 +167,8 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
node, objectStack);
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
node, objectStack);
};
@@ -180,8 +180,8 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack)
*/
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
node, objectStack);
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
node, objectStack);
};
@@ -193,8 +193,8 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack
*/
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
node, objectStack);
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
node, objectStack);
};
@@ -206,7 +206,7 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
};
@@ -218,7 +218,7 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
};
@@ -233,7 +233,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
(objectStack[objectStack.length - 1]);
var layerObject = ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
if (!layerObject) {
return undefined;
@@ -246,7 +246,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
layerObject['queryable'] = queryable !== undefined ? queryable : false;
var cascaded = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('cascaded'));
node.getAttribute('cascaded'));
if (cascaded === undefined) {
cascaded = parentLayerObject['cascaded'];
}
@@ -279,7 +279,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
}
layerObject['fixedHeight'] = fixedHeight;
// See 7.2.4.8
// See 7.2.4.8
var addKeys = ['Style', 'CRS', 'AuthorityURL'];
addKeys.forEach(function(key) {
if (key in parentLayerObject) {
@@ -314,9 +314,9 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'),
'multipleValues': ol.format.XSD.readBooleanString(
node.getAttribute('multipleValues')),
node.getAttribute('multipleValues')),
'nearestValue': ol.format.XSD.readBooleanString(
node.getAttribute('nearestValue')),
node.getAttribute('nearestValue')),
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
'values': ol.format.XSD.readString(node)
};
@@ -332,8 +332,8 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack);
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack);
};
@@ -345,7 +345,7 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack
*/
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
};
@@ -357,7 +357,7 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
};
@@ -369,7 +369,7 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
};
@@ -381,7 +381,7 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
};
@@ -448,7 +448,7 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
};
@@ -460,7 +460,7 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
*/
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
};

View File

@@ -64,7 +64,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
}
WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,
ol.format.WMTSCapabilities.PARSERS_, node, []);
ol.format.WMTSCapabilities.PARSERS_, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
};
@@ -77,7 +77,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
*/
ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
};
@@ -89,7 +89,7 @@ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
*/
ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
};

View File

@@ -3,15 +3,16 @@
goog.provide('ol.Geolocation');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.GeolocationProperty');
goog.require('ol.Object');
goog.require('ol.Sphere');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.geom.Polygon');
goog.require('ol.has');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.sphere.WGS84');
goog.require('ol.proj.EPSG4326');
/**
@@ -59,6 +60,12 @@ ol.Geolocation = function(opt_options) {
*/
this.transform_ = ol.proj.identityTransform;
/**
* @private
* @type {ol.Sphere}
*/
this.sphere_ = new ol.Sphere(ol.proj.EPSG4326.RADIUS);
/**
* @private
* @type {number|undefined}
@@ -73,7 +80,7 @@ ol.Geolocation = function(opt_options) {
this.handleTrackingChanged_, this);
if (options.projection !== undefined) {
this.setProjection(ol.proj.get(options.projection));
this.setProjection(options.projection);
}
if (options.trackingOptions !== undefined) {
this.setTrackingOptions(options.trackingOptions);
@@ -140,9 +147,9 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
coords.altitude === null ? undefined : coords.altitude);
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
coords.altitudeAccuracy === null ?
undefined : coords.altitudeAccuracy);
undefined : coords.altitudeAccuracy);
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
undefined : ol.math.toRadians(coords.heading));
undefined : ol.math.toRadians(coords.heading));
if (!this.position_) {
this.position_ = [coords.longitude, coords.latitude];
} else {
@@ -154,7 +161,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
this.set(ol.GeolocationProperty.SPEED,
coords.speed === null ? undefined : coords.speed);
var geometry = ol.geom.Polygon.circular(
ol.sphere.WGS84, this.position_, coords.accuracy);
this.sphere_, this.position_, coords.accuracy);
geometry.applyTransform(this.transform_);
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
this.changed();
@@ -186,7 +193,7 @@ ol.Geolocation.prototype.positionError_ = function(error) {
*/
ol.Geolocation.prototype.getAccuracy = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ACCURACY));
this.get(ol.GeolocationProperty.ACCURACY));
};
@@ -198,7 +205,7 @@ ol.Geolocation.prototype.getAccuracy = function() {
*/
ol.Geolocation.prototype.getAccuracyGeometry = function() {
return /** @type {?ol.geom.Polygon} */ (
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
};
@@ -211,7 +218,7 @@ ol.Geolocation.prototype.getAccuracyGeometry = function() {
*/
ol.Geolocation.prototype.getAltitude = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE));
this.get(ol.GeolocationProperty.ALTITUDE));
};
@@ -224,7 +231,7 @@ ol.Geolocation.prototype.getAltitude = function() {
*/
ol.Geolocation.prototype.getAltitudeAccuracy = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
};
@@ -236,7 +243,7 @@ ol.Geolocation.prototype.getAltitudeAccuracy = function() {
*/
ol.Geolocation.prototype.getHeading = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.HEADING));
this.get(ol.GeolocationProperty.HEADING));
};
@@ -249,7 +256,7 @@ ol.Geolocation.prototype.getHeading = function() {
*/
ol.Geolocation.prototype.getPosition = function() {
return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.GeolocationProperty.POSITION));
this.get(ol.GeolocationProperty.POSITION));
};
@@ -262,7 +269,7 @@ ol.Geolocation.prototype.getPosition = function() {
*/
ol.Geolocation.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.GeolocationProperty.PROJECTION));
this.get(ol.GeolocationProperty.PROJECTION));
};
@@ -275,7 +282,7 @@ ol.Geolocation.prototype.getProjection = function() {
*/
ol.Geolocation.prototype.getSpeed = function() {
return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.SPEED));
this.get(ol.GeolocationProperty.SPEED));
};
@@ -287,7 +294,7 @@ ol.Geolocation.prototype.getSpeed = function() {
*/
ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.GeolocationProperty.TRACKING));
this.get(ol.GeolocationProperty.TRACKING));
};
@@ -302,19 +309,19 @@ ol.Geolocation.prototype.getTracking = function() {
*/
ol.Geolocation.prototype.getTrackingOptions = function() {
return /** @type {GeolocationPositionOptions|undefined} */ (
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
};
/**
* Set the projection to use for transforming the coordinates.
* @param {ol.proj.Projection} projection The projection the position is
* @param {ol.ProjectionLike} projection The projection the position is
* reported in.
* @observable
* @api
*/
ol.Geolocation.prototype.setProjection = function(projection) {
this.set(ol.GeolocationProperty.PROJECTION, projection);
this.set(ol.GeolocationProperty.PROJECTION, ol.proj.get(projection));
};

View File

@@ -119,7 +119,7 @@ ol.geom.flat.geodesic.greatCircleArc = function(
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
var lon = ol.math.toRadians(lon1) +
Math.atan2(Math.sin(theta) * sinD * cosLat1,
cosD - sinLat1 * Math.sin(lat));
cosD - sinLat1 * Math.sin(lat));
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
};

View File

@@ -108,8 +108,8 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
flatCoordinates, offset, end, stride);
var reverse = i === 0 ?
(right && isClockwise) || (!right && !isClockwise) :
(right && !isClockwise) || (!right && isClockwise);
(right && isClockwise) || (!right && !isClockwise) :
(right && !isClockwise) || (!right && isClockwise);
if (reverse) {
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
}

View File

@@ -43,7 +43,7 @@ goog.require('ol.math');
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
opt_simplifiedFlatCoordinates : [];
opt_simplifiedFlatCoordinates : [];
if (!highQuality) {
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
stride, squaredTolerance,

View File

@@ -103,7 +103,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
*/
ol.geom.MultiPoint.prototype.getPoint = function(index) {
var n = !this.flatCoordinates ?
0 : this.flatCoordinates.length / this.stride;
0 : this.flatCoordinates.length / this.stride;
if (index < 0 || n <= index) {
return null;
}

View File

@@ -375,7 +375,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout
} else {
var lastEnds = endss[endss.length - 1];
this.flatCoordinates.length = lastEnds.length === 0 ?
0 : lastEnds[lastEnds.length - 1];
0 : lastEnds[lastEnds.length - 1];
}
this.changed();
}

View File

@@ -1,13 +1,17 @@
goog.provide('ol.Graticule');
goog.require('ol.coordinate');
goog.require('ol.extent');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Point');
goog.require('ol.geom.flat.geodesic');
goog.require('ol.math');
goog.require('ol.proj');
goog.require('ol.render.EventType');
goog.require('ol.style.Fill');
goog.require('ol.style.Stroke');
goog.require('ol.style.Text');
/**
@@ -19,116 +23,201 @@ goog.require('ol.style.Stroke');
ol.Graticule = function(opt_options) {
var options = opt_options || {};
/**
* @type {ol.Map}
* @private
*/
/**
* @type {ol.Map}
* @private
*/
this.map_ = null;
/**
* @type {ol.proj.Projection}
* @private
*/
/**
* @type {ol.proj.Projection}
* @private
*/
this.projection_ = null;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.maxLat_ = Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.maxLon_ = Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.minLat_ = -Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.minLon_ = -Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.maxLatP_ = Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.maxLonP_ = Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.minLatP_ = -Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.minLonP_ = -Infinity;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.targetSize_ = options.targetSize !== undefined ?
options.targetSize : 100;
options.targetSize : 100;
/**
* @type {number}
* @private
*/
/**
* @type {number}
* @private
*/
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
/**
* @type {Array.<ol.geom.LineString>}
* @private
*/
/**
* @type {Array.<ol.geom.LineString>}
* @private
*/
this.meridians_ = [];
/**
* @type {Array.<ol.geom.LineString>}
* @private
*/
/**
* @type {Array.<ol.geom.LineString>}
* @private
*/
this.parallels_ = [];
/**
* @type {ol.style.Stroke}
* @private
*/
/**
* @type {ol.style.Stroke}
* @private
*/
this.strokeStyle_ = options.strokeStyle !== undefined ?
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
/**
* @type {ol.TransformFunction|undefined}
* @private
*/
/**
* @type {ol.TransformFunction|undefined}
* @private
*/
this.fromLonLatTransform_ = undefined;
/**
* @type {ol.TransformFunction|undefined}
* @private
*/
/**
* @type {ol.TransformFunction|undefined}
* @private
*/
this.toLonLatTransform_ = undefined;
/**
* @type {ol.Coordinate}
* @private
*/
/**
* @type {ol.Coordinate}
* @private
*/
this.projectionCenterLonLat_ = null;
/**
* @type {Array.<ol.GraticuleLabelDataType>}
* @private
*/
this.meridiansLabels_ = null;
/**
* @type {Array.<ol.GraticuleLabelDataType>}
* @private
*/
this.parallelsLabels_ = null;
if (options.showLabels == true) {
var degreesToString = ol.coordinate.degreesToStringHDMS;
/**
* @type {null|function(number):string}
* @private
*/
this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ?
degreesToString.bind(this, 'EW') : options.lonLabelFormatter;
/**
* @type {function(number):string}
* @private
*/
this.latLabelFormatter_ = options.latLabelFormatter == undefined ?
degreesToString.bind(this, 'NS') : options.latLabelFormatter;
/**
* Longitude label position in fractions (0..1) of view extent. 0 means
* bottom, 1 means top.
* @type {number}
* @private
*/
this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 :
options.lonLabelPosition;
/**
* Latitude Label position in fractions (0..1) of view extent. 0 means left, 1
* means right.
* @type {number}
* @private
*/
this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 :
options.latLabelPosition;
/**
* @type {ol.style.Text}
* @private
*/
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
new ol.style.Text({
font: '12px Calibri,sans-serif',
textBaseline: 'bottom',
fill: new ol.style.Fill({
color: 'rgba(0,0,0,1)'
}),
stroke: new ol.style.Stroke({
color: 'rgba(255,255,255,1)',
width: 3
})
});
/**
* @type {ol.style.Text}
* @private
*/
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
new ol.style.Text({
font: '12px Calibri,sans-serif',
textAlign: 'end',
fill: new ol.style.Fill({
color: 'rgba(0,0,0,1)'
}),
stroke: new ol.style.Stroke({
color: 'rgba(255,255,255,1)',
width: 3
})
});
this.meridiansLabels_ = [];
this.parallelsLabels_ = [];
}
this.setMap(options.map !== undefined ? options.map : null);
};
@@ -166,11 +255,39 @@ ol.Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredToler
var lineString = this.getMeridian_(lon, minLat, maxLat,
squaredTolerance, index);
if (ol.extent.intersects(lineString.getExtent(), extent)) {
if (this.meridiansLabels_) {
var textPoint = this.getMeridianPoint_(lineString, extent, index);
this.meridiansLabels_[index] = {
geom: textPoint,
text: this.lonLabelFormatter_(lon)
};
}
this.meridians_[index++] = lineString;
}
return index;
};
/**
* @param {ol.geom.LineString} lineString Meridian
* @param {ol.Extent} extent Extent.
* @param {number} index Index.
* @return {ol.geom.Point} Meridian point.
* @private
*/
ol.Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates();
var clampedBottom = Math.max(extent[1], flatCoordinates[1]);
var clampedTop = Math.min(extent[3], flatCoordinates[flatCoordinates.length - 1]);
var lat = ol.math.clamp(
extent[1] + Math.abs(extent[1] - extent[3]) * this.lonLabelPosition_,
clampedBottom, clampedTop);
var coordinate = [flatCoordinates[0], lat];
var point = this.meridiansLabels_[index] !== undefined ?
this.meridiansLabels_[index].geom : new ol.geom.Point(null);
point.setCoordinates(coordinate);
return point;
};
/**
* @param {number} lat Latitude.
@@ -186,12 +303,41 @@ ol.Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredToler
var lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance,
index);
if (ol.extent.intersects(lineString.getExtent(), extent)) {
if (this.parallelsLabels_) {
var textPoint = this.getParallelPoint_(lineString, extent, index);
this.parallelsLabels_[index] = {
geom: textPoint,
text: this.latLabelFormatter_(lat)
};
}
this.parallels_[index++] = lineString;
}
return index;
};
/**
* @param {ol.geom.LineString} lineString Parallels.
* @param {ol.Extent} extent Extent.
* @param {number} index Index.
* @return {ol.geom.Point} Parallel point.
* @private
*/
ol.Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
var flatCoordinates = lineString.getFlatCoordinates();
var clampedLeft = Math.max(extent[0], flatCoordinates[0]);
var clampedRight = Math.min(extent[2], flatCoordinates[flatCoordinates.length - 2]);
var lon = ol.math.clamp(
extent[0] + Math.abs(extent[0] - extent[2]) * this.latLabelPosition_,
clampedLeft, clampedRight);
var coordinate = [lon, flatCoordinates[1]];
var point = this.parallelsLabels_[index] !== undefined ?
this.parallelsLabels_[index].geom : new ol.geom.Point(null);
point.setCoordinates(coordinate);
return point;
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} center Center.
@@ -204,6 +350,12 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
var interval = this.getInterval_(resolution);
if (interval == -1) {
this.meridians_.length = this.parallels_.length = 0;
if (this.meridiansLabels_) {
this.meridiansLabels_.length = 0;
}
if (this.parallelsLabels_) {
this.parallelsLabels_.length = 0;
}
return;
}
@@ -249,6 +401,9 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
}
this.meridians_.length = idx;
if (this.meridiansLabels_) {
this.meridiansLabels_.length = idx;
}
// Create parallels
@@ -272,6 +427,9 @@ ol.Graticule.prototype.createGraticule_ = function(extent, center, resolution, s
}
this.parallels_.length = idx;
if (this.parallelsLabels_) {
this.parallelsLabels_.length = idx;
}
};
@@ -329,11 +487,11 @@ ol.Graticule.prototype.getMap = function() {
* @private
*/
ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
squaredTolerance, index) {
squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.meridian(lon,
minLat, maxLat, this.projection_, squaredTolerance);
minLat, maxLat, this.projection_, squaredTolerance);
var lineString = this.meridians_[index] !== undefined ?
this.meridians_[index] : new ol.geom.LineString(null);
this.meridians_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
return lineString;
};
@@ -359,18 +517,18 @@ ol.Graticule.prototype.getMeridians = function() {
* @private
*/
ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
squaredTolerance, index) {
squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.parallel(lat,
this.minLon_, this.maxLon_, this.projection_, squaredTolerance);
this.minLon_, this.maxLon_, this.projection_, squaredTolerance);
var lineString = this.parallels_[index] !== undefined ?
this.parallels_[index] : new ol.geom.LineString(null);
this.parallels_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
return lineString;
};
/**
* Get the list of parallels. Pallels are lines of equal latitude.
* Get the list of parallels. Parallels are lines of equal latitude.
* @return {Array.<ol.geom.LineString>} The parallels.
* @api
*/
@@ -426,11 +584,28 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) {
var i, l, line;
for (i = 0, l = this.meridians_.length; i < l; ++i) {
line = this.meridians_[i];
vectorContext.drawLineString(line, null);
vectorContext.drawGeometry(line);
}
for (i = 0, l = this.parallels_.length; i < l; ++i) {
line = this.parallels_[i];
vectorContext.drawLineString(line, null);
vectorContext.drawGeometry(line);
}
var labelData;
if (this.meridiansLabels_) {
for (i = 0, l = this.meridiansLabels_.length; i < l; ++i) {
labelData = this.meridiansLabels_[i];
this.lonLabelStyle_.setText(labelData.text);
vectorContext.setTextStyle(this.lonLabelStyle_);
vectorContext.drawGeometry(labelData.geom);
}
}
if (this.parallelsLabels_) {
for (i = 0, l = this.parallelsLabels_.length; i < l; ++i) {
labelData = this.parallelsLabels_[i];
this.latLabelStyle_.setText(labelData.text);
vectorContext.setTextStyle(this.latLabelStyle_);
vectorContext.drawGeometry(labelData.geom);
}
}
};
@@ -445,7 +620,7 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
var extent = projection.getExtent();
var worldExtent = projection.getWorldExtent();
var worldExtentP = ol.proj.transformExtent(worldExtent,
epsg4326Projection, projection);
epsg4326Projection, projection);
var maxLat = worldExtent[3];
var maxLon = worldExtent[2];
@@ -469,13 +644,13 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
this.fromLonLatTransform_ = ol.proj.getTransform(
epsg4326Projection, projection);
epsg4326Projection, projection);
this.toLonLatTransform_ = ol.proj.getTransform(
projection, epsg4326Projection);
projection, epsg4326Projection);
this.projectionCenterLonLat_ = this.toLonLatTransform_(
ol.extent.getCenter(extent));
ol.extent.getCenter(extent));
this.projection_ = projection;
};

View File

@@ -4,7 +4,7 @@ goog.require('ol');
goog.require('ol.webgl');
var ua = typeof navigator !== 'undefined' ?
navigator.userAgent.toLowerCase() : '';
navigator.userAgent.toLowerCase() : '';
/**
* User agent string says we are dealing with Firefox as browser.
@@ -56,27 +56,27 @@ ol.has.CANVAS_LINE_DASH = false;
* @api
*/
ol.has.CANVAS = ol.ENABLE_CANVAS && (
/**
* @return {boolean} Canvas supported.
*/
function() {
if (!('HTMLCanvasElement' in window)) {
/**
* @return {boolean} Canvas supported.
*/
function() {
if (!('HTMLCanvasElement' in window)) {
return false;
}
try {
var context = document.createElement('CANVAS').getContext('2d');
if (!context) {
return false;
}
try {
var context = document.createElement('CANVAS').getContext('2d');
if (!context) {
return false;
} else {
if (context.setLineDash !== undefined) {
ol.has.CANVAS_LINE_DASH = true;
}
return true;
} else {
if (context.setLineDash !== undefined) {
ol.has.CANVAS_LINE_DASH = true;
}
} catch (e) {
return false;
return true;
}
})();
} catch (e) {
return false;
}
})();
/**
@@ -148,7 +148,7 @@ ol.has.WEBGL;
if (gl) {
hasWebGL = true;
textureSize = /** @type {number} */
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
extensions = gl.getSupportedExtensions();
}
} catch (e) {

View File

@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED;
ol.ImageState.IDLE : ol.ImageState.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);

View File

@@ -3,6 +3,7 @@ goog.provide('ol.ImageTile');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.TileState');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
@@ -30,7 +31,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
/**
* @private
* @type {Image}
* @type {Image|HTMLCanvasElement}
*/
this.image_ = new Image();
if (crossOrigin !== null) {
@@ -59,6 +60,7 @@ ol.inherits(ol.ImageTile, ol.Tile);
ol.ImageTile.prototype.disposeInternal = function() {
if (this.state == ol.TileState.LOADING) {
this.unlistenImage_();
this.image_.src = ol.ImageTile.blankImage.toDataURL('image/png');
}
if (this.interimTile) {
this.interimTile.dispose();
@@ -70,8 +72,8 @@ ol.ImageTile.prototype.disposeInternal = function() {
/**
* Get the image element for this tile.
* @inheritDoc
* Get the HTML image element for this tile (may be a Canvas, Image, or Video).
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
* @api
*/
ol.ImageTile.prototype.getImage = function() {
@@ -95,6 +97,7 @@ ol.ImageTile.prototype.getKey = function() {
ol.ImageTile.prototype.handleImageError_ = function() {
this.state = ol.TileState.ERROR;
this.unlistenImage_();
this.image_ = ol.ImageTile.blankImage;
this.changed();
};
@@ -143,3 +146,15 @@ ol.ImageTile.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
this.imageListenerKeys_ = null;
};
/**
* A blank image.
* @type {HTMLCanvasElement}
*/
ol.ImageTile.blankImage = (function() {
var ctx = ol.dom.createCanvasContext2D(1, 1);
ctx.fillStyle = 'rgba(0,0,0,0)';
ctx.fillRect(0, 0, 1, 1);
return ctx.canvas;
})();

View File

@@ -45,13 +45,13 @@ ol.interaction.defaults = function(opt_options) {
var kinetic = new ol.Kinetic(-0.005, 0.05, 100);
var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true;
options.altShiftDragRotate : true;
if (altShiftDragRotate) {
interactions.push(new ol.interaction.DragRotate());
}
var doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true;
options.doubleClickZoom : true;
if (doubleClickZoom) {
interactions.push(new ol.interaction.DoubleClickZoom({
delta: options.zoomDelta,
@@ -67,7 +67,7 @@ ol.interaction.defaults = function(opt_options) {
}
var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
true;
true;
if (pinchRotate) {
interactions.push(new ol.interaction.PinchRotate());
}
@@ -90,7 +90,7 @@ ol.interaction.defaults = function(opt_options) {
}
var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
options.mouseWheelZoom : true;
options.mouseWheelZoom : true;
if (mouseWheelZoom) {
interactions.push(new ol.interaction.MouseWheelZoom({
constrainResolution: options.constrainResolution,
@@ -99,7 +99,7 @@ ol.interaction.defaults = function(opt_options) {
}
var shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true;
options.shiftDragZoom : true;
if (shiftDragZoom) {
interactions.push(new ol.interaction.DragZoom({
duration: options.zoomDuration

View File

@@ -34,14 +34,14 @@ ol.interaction.DragAndDrop = function(opt_options) {
* @type {Array.<function(new: ol.format.Feature)>}
*/
this.formatConstructors_ = options.formatConstructors ?
options.formatConstructors : [];
options.formatConstructors : [];
/**
* @private
* @type {ol.proj.Projection}
*/
this.projection_ = options.projection ?
ol.proj.get(options.projection) : null;
ol.proj.get(options.projection) : null;
/**
* @private
@@ -141,14 +141,10 @@ ol.interaction.DragAndDrop.handleEvent = ol.functions.TRUE;
/**
* @inheritDoc
* @private
*/
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
if (this.dropListenKeys_) {
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
this.dropListenKeys_ = null;
}
ol.interaction.Interaction.prototype.setMap.call(this, map);
ol.interaction.DragAndDrop.prototype.registerListeners_ = function() {
var map = this.getMap();
if (map) {
var dropArea = this.target ? this.target : map.getViewport();
this.dropListenKeys_ = [
@@ -165,6 +161,31 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
};
/**
* @inheritDoc
*/
ol.interaction.DragAndDrop.prototype.setActive = function(active) {
ol.interaction.Interaction.prototype.setActive.call(this, active);
if (active) {
this.registerListeners_();
} else {
this.unregisterListeners_();
}
};
/**
* @inheritDoc
*/
ol.interaction.DragAndDrop.prototype.setMap = function(map) {
this.unregisterListeners_();
ol.interaction.Interaction.prototype.setMap.call(this, map);
if (this.getActive()) {
this.registerListeners_();
}
};
/**
* @param {ol.format.Feature} format Format.
* @param {string} text Text.
@@ -181,6 +202,17 @@ ol.interaction.DragAndDrop.prototype.tryReadFeatures_ = function(format, text, o
};
/**
* @private
*/
ol.interaction.DragAndDrop.prototype.unregisterListeners_ = function() {
if (this.dropListenKeys_) {
this.dropListenKeys_.forEach(ol.events.unlistenByKey);
this.dropListenKeys_ = null;
}
};
/**
* @enum {string}
* @private

View File

@@ -58,14 +58,14 @@ ol.interaction.DragBox = function(opt_options) {
* @type {ol.EventsConditionType}
*/
this.condition_ = options.condition ?
options.condition : ol.events.condition.always;
options.condition : ol.events.condition.always;
/**
* @private
* @type {ol.DragBoxEndConditionType}
*/
this.boxEndCondition_ = options.boxEndCondition ?
options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition;
options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition;
};
ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer);
@@ -100,7 +100,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) {
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType_.BOXDRAG,
mapBrowserEvent.coordinate, mapBrowserEvent));
mapBrowserEvent.coordinate, mapBrowserEvent));
};
@@ -115,8 +115,8 @@ ol.interaction.DragBox.prototype.getGeometry = function() {
/**
* To be overriden by child classes.
* FIXME: use constructor option instead of relying on overridding.
* To be overridden by child classes.
* FIXME: use constructor option instead of relying on overriding.
* @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event.
* @protected
*/

View File

@@ -49,7 +49,7 @@ ol.interaction.DragPan = function(opt_options) {
* @type {ol.EventsConditionType}
*/
this.condition_ = options.condition ?
options.condition : ol.events.condition.noModifierKeys;
options.condition : ol.events.condition.noModifierKeys;
/**
* @private

View File

@@ -1,6 +1,7 @@
goog.provide('ol.interaction.DragRotate');
goog.require('ol');
goog.require('ol.RotationConstraint');
goog.require('ol.ViewHint');
goog.require('ol.events.condition');
goog.require('ol.functions');
@@ -36,7 +37,7 @@ ol.interaction.DragRotate = function(opt_options) {
* @type {ol.EventsConditionType}
*/
this.condition_ = options.condition ?
options.condition : ol.events.condition.altShiftKeysOnly;
options.condition : ol.events.condition.altShiftKeysOnly;
/**
* @private
@@ -64,13 +65,16 @@ ol.interaction.DragRotate.handleDragEvent_ = function(mapBrowserEvent) {
}
var map = mapBrowserEvent.map;
var view = map.getView();
if (view.getConstraints().rotation === ol.RotationConstraint.disable) {
return;
}
var size = map.getSize();
var offset = mapBrowserEvent.pixel;
var theta =
Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2);
if (this.lastAngle_ !== undefined) {
var delta = theta - this.lastAngle_;
var view = map.getView();
var rotation = view.getRotation();
ol.interaction.Interaction.rotateWithoutConstraints(
view, rotation - delta);

View File

@@ -1,6 +1,7 @@
goog.provide('ol.interaction.DragRotateAndZoom');
goog.require('ol');
goog.require('ol.RotationConstraint');
goog.require('ol.ViewHint');
goog.require('ol.events.condition');
goog.require('ol.interaction.Interaction');
@@ -37,7 +38,7 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
* @type {ol.EventsConditionType}
*/
this.condition_ = options.condition ?
options.condition : ol.events.condition.shiftKeyOnly;
options.condition : ol.events.condition.shiftKeyOnly;
/**
* @private
@@ -85,7 +86,7 @@ ol.interaction.DragRotateAndZoom.handleDragEvent_ = function(mapBrowserEvent) {
var theta = Math.atan2(deltaY, deltaX);
var magnitude = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
var view = map.getView();
if (this.lastAngle_ !== undefined) {
if (view.getConstraints().rotation !== ol.RotationConstraint.disable && this.lastAngle_ !== undefined) {
var angleDelta = theta - this.lastAngle_;
ol.interaction.Interaction.rotateWithoutConstraints(
view, view.getRotation() - angleDelta);

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