Compare commits

...

410 Commits

Author SHA1 Message Date
Tim Schaub
a9b62af3fc Merge pull request #6232 from openlayers/release-v3.20.0
Release v3.20.0
2016-12-10 13:10:00 -07:00
Tim Schaub
53473ddeb1 Add note about WebGL rendering 2016-12-10 12:50:06 -07:00
Tim Schaub
49b3359aa8 Update package version to 3.20.0 2016-12-10 12:24:34 -07:00
Tim Schaub
b21944fb50 Changelog for v3.20.0 2016-12-10 12:24:02 -07:00
Tim Schaub
4db2177c1d Merge pull request #6230 from tschaub/attribution-ignore-duplicates
Ignore duplicated attributions
2016-12-10 11:50:54 -07:00
Tim Schaub
bb62360213 Create a lookup of unique attributions 2016-12-10 11:36:27 -07:00
Andreas Hocevar
adacfb6453 Add test for duplicated attribution 2016-12-10 11:31:22 -07:00
Attila Berényi
bedda42c3e Ignore duplicate attributions.
See https://github.com/openlayers/ol3/issues/5297
2016-12-10 11:31:05 -07:00
Tim Schaub
862152f9db Merge pull request #6192 from tchandelle/delete-vertex
Modify interaction: always stop event propagation when removing vertex
2016-12-10 11:18:37 -07:00
Tim Schaub
da419ffc6c Merge pull request #6228 from tschaub/rename-example
Rename the pinch zoom example
2016-12-09 12:42:49 -07:00
Andreas Hocevar
676b3efbd7 Merge pull request #6229 from openlayers/greenkeeper-phantomjs-prebuilt-2.1.14
Update phantomjs-prebuilt to version 2.1.14 🚀
2016-12-09 20:35:47 +01:00
greenkeeperio-bot
f0dc965974 chore(package): update phantomjs-prebuilt to version 2.1.14
https://greenkeeper.io/
2016-12-09 10:44:14 -07:00
Tim Schaub
1f742da046 Merge pull request #6196 from raiyni/ExtendedData
KML ExtendedData Export
2016-12-09 10:41:33 -07:00
Tim Schaub
a2fc950b44 Merge pull request #6227 from openlayers/greenkeeper-eslint-3.12.0
Update eslint to version 3.12.0 🚀
2016-12-09 10:33:07 -07:00
Tim Schaub
2bb61dab60 Example wording 2016-12-09 10:32:06 -07:00
Tim Schaub
8d5042c1b1 Dash as word separators in URLs for consistency 2016-12-09 10:24:55 -07:00
Tim Schaub
4ff87a0eef Merge pull request #6224 from aAXEe/pinZoom-allowFractionalZoom
Pinch zoom: allow fractional zoom
2016-12-09 10:22:05 -07:00
greenkeeperio-bot
403bc4bbe1 chore(package): update eslint to version 3.12.0
https://greenkeeper.io/
2016-12-09 10:15:41 -07:00
Axel Utech
61ac0c47ed add an upgrade note about the new pinchZoom behavior 2016-12-09 18:03:20 +01:00
Axel Utech
f5a27d2788 add a pinchZoom example demonstrating the old behavior with constrained zooms 2016-12-09 18:03:01 +01:00
Axel Utech
321b1f72ad add an option to make the pinchZoom constrain zoom levels to integers
Changes the default behavior of ol.interaction.PinchZoom to keep
the fractional zoom level after the gesture.
The old behavior of zooming to the next whole-number level can be
enforced with the new parameter `constrainResolution`.
2016-12-09 18:02:36 +01:00
Tim Schaub
fbbc42f8f9 Merge pull request #6226 from tchandelle/doc-anchors
Improve the headers styles in the api doc
2016-12-09 09:42:38 -07:00
Andreas Hocevar
26f31e3771 Merge pull request #5995 from KlausBenndorf/hitTolerance
Add hit tolerance parameter to ol.Map#forEachFeatureAtPixel
2016-12-08 11:06:46 +01:00
simonseyock
f28e0ebc1f Added hitTolerance parameter to reworked files 2016-12-08 10:21:57 +01:00
simonseyock
f10ae6c474 Adressed review.
Reusing transform
Changing either size of the canvas or clearing it
adding unit of hitTolerance to jsdoc
2016-12-08 10:14:36 +01:00
simonseyock
55ec0af072 Simplified api 2016-12-08 10:14:36 +01:00
simonseyock
8edc2be103 Added hitTolerance to TranslateInteraction 2016-12-08 10:14:09 +01:00
simonseyock
a469803941 adjusted hitTolerance by pixelRatio 2016-12-08 10:14:09 +01:00
simonseyock
00a4f3b410 buffering extent by resolution*hitTolerance 2016-12-08 10:14:09 +01:00
simonseyock
f6ee11bb68 Documentation and linting 2016-12-08 10:14:09 +01:00
simonseyock
eede027417 Added buffer to ol.renderer.canvas.VectorTileLayer#forEachFeatureAtCoordinate
buffering by pointResolution times hitTolerance
2016-12-08 10:14:09 +01:00
simonseyock
3a08cfd7c6 Added test for ol.render.canvas.ReplayGroup#getCircleArray_ 2016-12-08 10:14:09 +01:00
simonseyock
e9d2b913ea removed uses of lazy evaluation of || 2016-12-08 10:14:09 +01:00
simonseyock
4640c44f2a Added old syntax and hasFeatureAtPixel to changelog 2016-12-08 10:14:09 +01:00
simonseyock
c93b0ba859 Added upgrade note 2016-12-08 10:14:09 +01:00
simonseyock
5608e7284b Renamed FeatureAtPixelOptions to AtPixelOptions for future use in forEachLayerAtPixel 2016-12-08 10:14:09 +01:00
simonseyock
f0439685ad minor typos 2016-12-08 10:14:09 +01:00
simonseyock
da020d77e9 Added cache for circle arrays. Reusing context. 2016-12-08 10:14:09 +01:00
simonseyock
e0edefb4d7 Added hitTolerance to select interaction. Added hitTolerance to select interaction example. 2016-12-08 10:14:09 +01:00
simonseyock
2ea41afe6e Added hitTolerance to hasFeatureAtPixel. Corrected JsDoc problems. 2016-12-08 10:14:09 +01:00
simonseyock
63f57768a3 Removed olx.LayerFilter 2016-12-08 10:14:09 +01:00
simonseyock
80e392ea52 Satisfying linter, jsdoc & compiler 2016-12-08 10:14:09 +01:00
simonseyock
2493eb2c20 Implemented midpoint circle algorithm 2016-12-08 10:13:47 +01:00
simonseyock
5ce0d8aa2a changed signature of internal methods 2016-12-08 10:13:47 +01:00
simonseyock
80188b2044 Change signature of api methods 2016-12-08 10:12:42 +01:00
simonseyock
a6c768ae07 Make forEachFeatureAtCoordinate work with variable hitContext size 2016-12-08 10:12:42 +01:00
simonseyock
85893646c4 Added hitTolerance test 2016-12-08 10:12:42 +01:00
Frédéric Junod
e95778e47f Merge pull request #6220 from fredj/collection_push_length
Fix ol.Collection#push return value
2016-12-08 08:26:31 +01:00
Frédéric Junod
000453a0e1 Merge pull request #6213 from drnextgis/preload
Add preload option to olx.layer.VectorTileOptions
2016-12-08 08:25:56 +01:00
Andreas Hocevar
0061b15a91 Merge pull request #6222 from ahocevar/fix-foreachlayeratpixel
Fix forEachLayerAtPixel and improve class hierarchy
2016-12-07 22:29:05 +01:00
Andreas Hocevar
d854222c4b Fix forEachLayerAtPixel and improve class hierarchy 2016-12-07 19:39:52 +01:00
Marc Jansen
f795019215 Merge pull request #6075 from tchandelle/modify_stride
Keep the other dim from the original segment when modifying vertex
2016-12-07 19:22:59 +01:00
Frederic Junod
5e0ce08804 Fix ol.Collection#push return value 2016-12-07 15:11:31 +01:00
Frédéric Junod
10e36a0529 Merge pull request #6218 from gberaudo/modify_interaction_check_map_rendered
Make modify interaction more robust
2016-12-07 12:14:05 +01:00
Guillaume Beraudo
109e6a8324 Make modify interaction more robust
When the map has not been rendered yet, adding a feature should not
trigger coordinate related functions as they make use of the framestate.
2016-12-07 11:15:28 +01:00
drnextgis
f492d69691 Add preload option to olx.layer.VectorTileOptions 2016-12-07 10:22:13 +07:00
Tim Schaub
59e802737e Merge pull request #6205 from tschaub/no-extra-provides
Rework remaining modules with multiple provides
2016-12-06 17:46:44 -07:00
Tim Schaub
63e952a91a Treat one-provide violations as errors 2016-12-06 14:50:35 -07:00
Tim Schaub
041766d53c Reworked mapbrowser* things 2016-12-06 14:49:43 -07:00
Tim Schaub
57e3e7273e Add Property enum to ol.layer.Base 2016-12-06 14:49:43 -07:00
Tim Schaub
66dc2582ef Dedicated module for GeometryLayout 2016-12-06 14:49:43 -07:00
Tim Schaub
7858b68fc0 Dedicated module for GeometryType enum 2016-12-06 14:49:43 -07:00
Tim Schaub
c00906cde9 Add Event to ol.Object 2016-12-06 14:49:43 -07:00
Tim Schaub
daba1fbcb6 Add EventType enum to ol.Object 2016-12-06 14:49:43 -07:00
Tim Schaub
3d2f677f2a Add OperationType enum to ol.source.Raster 2016-12-06 14:49:43 -07:00
Tim Schaub
c0fe3f1e4f Dedicated module for ol.extent.Relationship enum 2016-12-06 14:49:43 -07:00
Tim Schaub
780bb1b30d Dedicated module for ol.extent.Corner enum 2016-12-06 14:49:43 -07:00
Tim Schaub
82c0dcdc00 Merge pull request #6207 from tschaub/require-all
Require all when generating exports
2016-12-06 14:41:02 -07:00
Tim Schaub
fc8915d8b7 Merge pull request #6204 from tschaub/proj
Refactored proj modules
2016-12-06 14:38:35 -07:00
Andreas Hocevar
db5032af49 Merge pull request #6209 from ahocevar/not-to-be
Test array with to.eql(), not to.be.eql()
2016-12-06 16:25:08 +01:00
Andreas Hocevar
132be598e7 Test array with to.eql(), not to.be.eql() 2016-12-06 16:03:35 +01:00
Andreas Hocevar
89ebf0a182 Merge pull request #6091 from tchandelle/linedash
Apply pixelRatio to line dash
2016-12-06 15:53:23 +01:00
Andreas Hocevar
621589b318 Merge pull request #6082 from ahocevar/unified-canvas-rendering
Unified canvas rendering
2016-12-06 08:59:40 +01:00
Andreas Hocevar
93d86e63fc Defer frame preparation when too much time was spent 2016-12-06 08:51:55 +01:00
Andreas Hocevar
ee7b894350 Refactor VectorTile renderer and add lower resolution clipping 2016-12-06 08:51:55 +01:00
Andreas Hocevar
0d65d1d813 Remove support for skipped features 2016-12-06 08:47:41 +01:00
Andreas Hocevar
2aa4f0c01c Fix forEachLayerAtPixel for the canvas renderer 2016-12-06 08:47:41 +01:00
Andreas Hocevar
ccdb955cd9 Simplify canvas tile renderer with image composition 2016-12-06 08:47:40 +01:00
Tim Schaub
f898a3b182 Merge pull request #6173 from bjornharrtell/topolis
Topolis example
2016-12-05 18:11:20 -07:00
Tim Schaub
c8064d15b7 Merge pull request #6206 from tschaub/zero
Stop asserting that zero duration animations take time
2016-12-05 08:59:05 -07:00
Thomas Chandelle
3b64133f21 Add tests for linedash for HiDPI display 2016-12-05 09:26:06 +01:00
Thomas Chandelle
7ee04ec200 Compare current linedash and new linedash as arrays 2016-12-05 09:24:13 +01:00
Thomas Chandelle
a0e310700c Apply pixelRatio to line dash 2016-12-05 09:24:13 +01:00
Tim Schaub
99eddbb31f Require all when generating exports 2016-12-04 16:43:15 -07:00
Tim Schaub
dfbc7bb743 Stop dividing by zero 2016-12-04 15:10:53 -07:00
Tim Schaub
12add87603 Stop asserting that zero duration animations take time 2016-12-04 15:04:54 -07:00
Tim Schaub
6259caf634 Consistently return a function or undefined 2016-12-04 12:58:33 -08:00
Tim Schaub
6d22119425 One provide per proj module 2016-12-04 12:44:04 -08:00
Tim Schaub
08569d4eb3 Dedicated module for ol.proj.Projection 2016-12-04 12:41:04 -08:00
Tim Schaub
a33caa598c Dedicated module for proj4 access 2016-12-04 10:37:33 -08:00
Tim Schaub
b54342dfb8 Dedicated module for projections cache 2016-12-04 10:24:43 -08:00
Tim Schaub
679fe298aa Dedicated module for transforms cache 2016-12-04 10:09:32 -08:00
Tim Schaub
fd6116ab6b Dedicated module for ol.proj.Units 2016-12-04 09:17:24 -08:00
Tim Schaub
f6a3ec513e Merge pull request #6203 from tschaub/missing-requires
Address a few missing requires
2016-12-04 10:11:28 -07:00
Tim Schaub
ab640a20d0 Move CLONE_PROPS to ol.pointer.PointerEventHandler 2016-12-03 10:48:32 -08:00
Tim Schaub
fda2d8e40e Functions in ol.geom.flat.interpolate namespace 2016-12-03 10:45:52 -08:00
Tim Schaub
37c445275f Require ol.MapBrowserEvent 2016-12-03 10:37:49 -08:00
Tim Schaub
e87407c28f Merge pull request #6201 from tschaub/arcgis-fix
Remove assertion in TileArcGISRest source
2016-12-03 10:29:07 -08:00
Tim Schaub
a3f3c24c51 Merge pull request #6202 from tschaub/animate-zero
Allow animation duration to be zero
2016-12-03 10:28:18 -08:00
Tim Schaub
c04a011077 Merge pull request #6198 from oterral/flyTo
Fix sourceResolution value in view.animate
2016-12-02 23:07:30 -08:00
Tim Schaub
dfb4c800b9 Allow animation duration to be zero 2016-12-02 19:15:34 -08:00
Tim Schaub
fdec14c425 Merge pull request #6177 from tchandelle/fit-animations
Add duration and easing options to view.fit() for animations
2016-12-02 19:09:08 -08:00
Tim Schaub
ce8cf27ad3 Remove assertion 2016-12-02 15:22:10 -08:00
oterral
9eda6df821 Fix sourceResolution value in view.animate 2016-12-02 16:39:25 +01:00
Ron Young
85881082b0 use feature geometry in filter 2016-12-01 21:38:13 -06:00
Ron Young
fdff4c5c7c export ExtendedData tests 2016-12-01 21:11:13 -06:00
Ron Young
aa08f88105 node factories, serializers, and writers for exporing ExtendedData 2016-12-01 21:10:07 -06:00
Ron Young
cde48521d0 add ol.format.XSD CDATA writer 2016-12-01 20:33:47 -06:00
Marc Jansen
bdeaafcdf7 Merge pull request #6078 from bjornharrtell/windingnumber
Use winding number algorithm for linearRingContainsXY
2016-12-01 13:46:07 +01:00
Thomas Chandelle
510076290d Always stop event propagation when removing vertex 2016-12-01 10:27:47 +01:00
Andreas Hocevar
9dc300d520 Merge pull request #6187 from openlayers/greenkeeper-pbf-3.0.5
Update pbf to version 3.0.5 🚀
2016-11-30 16:25:13 +01:00
greenkeeperio-bot
5c0a6de288 chore(package): update pbf to version 3.0.5
https://greenkeeper.io/
2016-11-30 06:35:35 -08:00
Thomas Chandelle
b77b5e5a55 Replace the anchor by an empty div element 2016-11-29 17:00:29 +01:00
Andreas Hocevar
794628782c Merge pull request #6175 from tchandelle/projection-perf
Generate projection transform function only when requested
2016-11-29 13:21:11 +01:00
Andreas Hocevar
fe758c2606 Simplify and make the compiler happy 2016-11-29 12:14:11 +01:00
Andreas Hocevar
c03f19bf5c Merge pull request #6181 from ahocevar/bing-key
Replace expired Bing key with a new one
2016-11-29 11:41:06 +01:00
Andreas Hocevar
d9453890eb Replace expired Bing key with a new one 2016-11-29 11:31:17 +01:00
Marc Jansen
4dc828c691 Merge pull request #6164 from marcjansen/color-parsing
Simplify color parsing and allow more decimals
2016-11-29 11:03:22 +01:00
Marc Jansen
88cfdb435c Use indexOf instead of RegExp as suggested 2016-11-29 10:55:04 +01:00
Björn Harrtell
656af72615 Use winding number algorithm for linearRingContainsXY 2016-11-29 09:10:47 +01:00
Björn Harrtell
6c644186ba Add test case for ol.geom.flat.contains 2016-11-29 09:07:10 +01:00
Frédéric Junod
51f7bfb415 Merge pull request #6178 from fredj/missing_require
Add missing goog.require
2016-11-29 08:20:57 +01:00
Andreas Hocevar
8f7aee4847 Merge pull request #6176 from tchandelle/animation-easing
Doc: easing option is optional
2016-11-28 19:28:08 +01:00
Andreas Hocevar
8c6437fba5 Merge pull request #6180 from openlayers/greenkeeper-eslint-3.11.1
Update eslint to version 3.11.1 🚀
2016-11-28 19:27:33 +01:00
greenkeeperio-bot
65c89199f1 chore(package): update eslint to version 3.11.1
https://greenkeeper.io/
2016-11-28 10:33:30 -07:00
Frédéric Junod
9ef0434be2 Merge pull request #6179 from fredj/rm_unused
Remove unused ol.Map.removePreRenderFunction function
2016-11-28 16:53:15 +01:00
Frederic Junod
59b8d969d6 Remove unused ol.Map.removePreRenderFunction function
The function is no longer used after #6079
2016-11-28 14:02:42 +01:00
Thomas Chandelle
5b04771d3f Add duration and easing options to view.fit() for animations 2016-11-28 13:55:40 +01:00
Frederic Junod
1b6c239114 Add missing goog.require 2016-11-28 13:46:26 +01:00
Thomas Chandelle
c4af981b01 easing option is optional
jsdoc was probably interpreting function(number):number|undefined as
a function that returns a number or undefined.
2016-11-28 13:07:02 +01:00
Thomas Chandelle
c898cda2e6 Generate projection transform function only when requested 2016-11-28 09:50:41 +01:00
Bart van den Eijnden
d47e5aed10 Merge pull request #6052 from oterral/teo_dflt_style
Remove the use of ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ when …
2016-11-28 09:38:10 +01:00
Björn Harrtell
7ad519fbf3 Topolis example 2016-11-27 00:46:25 +01:00
Frédéric Junod
8fe783d975 Merge pull request #6159 from tchandelle/examples-require-carriage-return
Remove carriage return after goog.require in examples
2016-11-25 13:20:15 +01:00
Frédéric Junod
15769101af Merge pull request #6169 from tchandelle/image-rotation-webgl
Image rotation in WebGL was anti-clockwise
2016-11-25 10:18:10 +01:00
Tobias Sauerwein
0e95905c6f Merge pull request #5590 from thhomas/kml-region-extendeddata
Kml format: improved support for region and extendeddata
2016-11-25 09:33:46 +01:00
Thomas Chandelle
9ffa103a79 Image rotation in WebGL was anti-clockwise 2016-11-25 09:02:20 +01:00
Marc Jansen
7f0d914161 Merge pull request #5462 from GaborFarkas/webgl_vector
WebGL vector support
2016-11-25 09:01:10 +01:00
Frédéric Junod
66a55d126b Merge pull request #6168 from openlayers/greenkeeper-mocha-3.2.0
Update mocha to version 3.2.0 🚀
2016-11-25 08:45:26 +01:00
greenkeeperio-bot
d5c7692a96 chore(package): update mocha to version 3.2.0
https://greenkeeper.io/
2016-11-24 17:34:54 -07:00
Bart van den Eijnden
3e31ff113b Merge pull request #5589 from thhomas/wmts-tilematrixlimits
Wmts tilematrixlimits
2016-11-24 10:14:25 +01:00
Thomas Tilak
1f04a0aad9 adds TileMatrixSetLimits to WMTS format reader
enhance wmtstilegrid to use it when building matrixId and resolution arrays
2016-11-23 18:50:24 +01:00
Thomas Tilak
d2e3017088 improve kml parsing of <Region> and <ExtendedData> tags 2016-11-23 17:46:04 +01:00
Marc Jansen
02d41caa8a Simplify color parsing and allow more decimals 2016-11-23 16:06:08 +01:00
GaborFarkas
dba0934112 Refactor LineString GLSL & clean up 2016-11-23 10:14:20 +01:00
GaborFarkas
d27591dea7 Adjust WebGL immediate test 2016-11-23 09:51:38 +01:00
GaborFarkas
0f204641e3 Clean up GLSLs somewhat 2016-11-23 09:51:37 +01:00
GaborFarkas
02461b3416 Add no-op WebGL text replay 2016-11-23 09:51:37 +01:00
GaborFarkas
3e56dba1b4 Do not draw vectors outside viewport 2016-11-23 09:51:37 +01:00
GaborFarkas
3b2ff5a2ee Revamp WebGL CircleReplay 2016-11-23 09:51:37 +01:00
GaborFarkas
efbc4ead8d Minor fixes according to review 2016-11-23 09:51:37 +01:00
GaborFarkas
dd905ffb5b Cleanup and fix DPR in WebGL CircleReplay 2016-11-23 09:51:37 +01:00
GaborFarkas
a7ddda7d81 Force close polygon contours (WebGL) 2016-11-23 09:51:37 +01:00
GaborFarkas
ca1414b2d0 Add depth test to PolygonReplay 2016-11-23 09:51:37 +01:00
GaborFarkas
310fabe94a Add tests for WebGL Immediate API 2016-11-23 09:51:37 +01:00
GaborFarkas
0c45b52a7a Add functions to WebGL Immediate API 2016-11-23 09:51:37 +01:00
GaborFarkas
8a6b206220 Add more tests 2016-11-23 09:51:37 +01:00
GaborFarkas
0cb0ea2a8a Add tests for ol.render.webgl.CircleReplay 2016-11-23 09:51:37 +01:00
GaborFarkas
c675a33235 Add tests for ol.render.webgl.Replay 2016-11-23 09:51:37 +01:00
GaborFarkas
62fb8d8fd8 Fix typos 2016-11-23 09:51:37 +01:00
GaborFarkas
36df9a9c09 Add missing requires 2016-11-23 09:51:37 +01:00
GaborFarkas
dc360c2d7f Refactor WebGL render tests 2016-11-23 09:51:37 +01:00
GaborFarkas
763bbca549 Fix skipping replay 2016-11-23 09:51:37 +01:00
GaborFarkas
697cbf16f0 Fix some rendering issues with complex styling 2016-11-23 09:51:37 +01:00
GaborFarkas
dd7e49c217 Fix canvas cricle test 2016-11-23 09:51:37 +01:00
GaborFarkas
58afee6706 Clean up polygon replay GLSL 2016-11-23 09:51:37 +01:00
GaborFarkas
ac6408be3b Add circle replay to WebGL renderer 2016-11-23 09:51:36 +01:00
GaborFarkas
86c914f3df Fix glitched lines with rotated view 2016-11-23 09:51:36 +01:00
GaborFarkas
5fb0a84579 Fix WebGL PolygonReplay#bridgeHole_ 2016-11-23 09:51:36 +01:00
GaborFarkas
a002474761 Fix typo in polygon rendering test 2016-11-23 09:51:36 +01:00
GaborFarkas
e124b34b24 Correctly draw polygons with transparent border 2016-11-23 09:51:36 +01:00
GaborFarkas
3af5c2805e Add tests to WebGL triangulating functions 2016-11-23 09:51:36 +01:00
GaborFarkas
004c0f7e27 Fix WebGL PolygonReplay#getPointsInTriangle_ 2016-11-23 09:51:36 +01:00
GaborFarkas
0c3d5eca5c Add tests for the linked list struct 2016-11-23 09:51:36 +01:00
GaborFarkas
71d790ccfd Add zIndex support to WebGL renderer 2016-11-23 09:51:36 +01:00
GaborFarkas
8e8098b362 Add some test to PolygonReplay 2016-11-23 09:51:36 +01:00
GaborFarkas
5cf2e9c072 Add shutdown methods to replays 2016-11-23 09:51:36 +01:00
GaborFarkas
360e77481d Restructure webgl replays 2016-11-23 09:51:36 +01:00
GaborFarkas
dc27f768d0 Correctly triangulate simple polygons. 2016-11-23 09:51:36 +01:00
GaborFarkas
a0089b5126 Correctly triangulate bad polygons. 2016-11-23 09:51:36 +01:00
GaborFarkas
657f2c7b6c Optimize processing flat coordinates 2016-11-23 09:51:36 +01:00
GaborFarkas
5d65028d26 Initial ear clipping algorithm 2016-11-23 09:51:33 +01:00
GaborFarkas
88f7e7a38d Utilities for polygon renderer 2016-11-23 09:49:48 +01:00
GaborFarkas
610084d456 Linked list structure for polygon renderer 2016-11-23 09:49:48 +01:00
GaborFarkas
18bc820f8b Prevent overdraw in PolygonReplay. 2016-11-23 09:49:48 +01:00
GaborFarkas
4b2fb38954 Fix preparation of multipolygons with holes. 2016-11-23 09:49:48 +01:00
GaborFarkas
226bf5a9ea Allow empty fillStyle for polygons. 2016-11-23 09:49:48 +01:00
GaborFarkas
16a50ee0c7 Extend PolygonReplay with hit detection and skipping. 2016-11-23 09:49:48 +01:00
GaborFarkas
ce3b286cd3 RTE correct only once. 2016-11-23 09:49:48 +01:00
GaborFarkas
112fae228a Sanity check fill colors. 2016-11-23 09:49:48 +01:00
GaborFarkas
18cf6c30bd Add basic polygon renderer. 2016-11-23 09:49:48 +01:00
GaborFarkas
269c3eb943 Set WebGL LineString threshold to 14.6
This commit will be a fixup for the previous one, or get deleted eventually.
2016-11-23 09:49:48 +01:00
GaborFarkas
e893603966 Add tests to LineStringReplay 2016-11-23 09:49:47 +01:00
GaborFarkas
638b7752fa Fix bugs in LineStringReplay. 2016-11-23 09:49:47 +01:00
GaborFarkas
f96a4a7301 Properly handle zeros in stroke style. 2016-11-23 09:49:47 +01:00
GaborFarkas
1c7203a203 Add skipping capability to LineStringReplay 2016-11-23 09:49:47 +01:00
GaborFarkas
48d3bfe297 Take line width into account when forming miters. 2016-11-23 09:49:47 +01:00
GaborFarkas
16dfc5dfba Adjust replays to new version. 2016-11-23 09:49:47 +01:00
GaborFarkas
c966e21e40 Fix black canvas when image is missing 2016-11-23 09:49:47 +01:00
GaborFarkas
2415050500 Add hit detection support to LineStringReplay
Also, making it more consistent with ImageReplay
2016-11-23 09:49:47 +01:00
GaborFarkas
b7396b0b94 Improve code quality
Cleaning up, making the code more consistent, and restructuring commonly used methods.
2016-11-23 09:49:47 +01:00
GaborFarkas
3897312af6 Add full support to different styles in one layer. 2016-11-23 09:49:47 +01:00
GaborFarkas
9d6a860cd1 Fix overdraw issue with Firefox
As usual, Firefox is the good guy here, too, and this is an issue with Chrome
2016-11-23 09:49:47 +01:00
GaborFarkas
4d8777220a Fix compiler and compiled lib related problems. 2016-11-23 09:49:47 +01:00
GaborFarkas
b0d11391b2 Fix rounding problems
Fragment shader does not know about the projection matrix, thus it has to take the pixel ratio into account.
2016-11-23 09:49:47 +01:00
GaborFarkas
249084dcd4 Eliminate overdraw with a nice little trick 2016-11-23 09:49:47 +01:00
GaborFarkas
c9c970303f Handling sharp angles in linestring GLSL 2016-11-23 09:49:47 +01:00
GaborFarkas
3f828248b9 Rework isClosed with added tests 2016-11-23 09:49:47 +01:00
GaborFarkas
e64549c50c Fix weird behaviour of boundaries
With drawElements, it seems like we cannot connect an old index with a much fresher one, as it will produce weird errors.
2016-11-23 09:49:47 +01:00
GaborFarkas
4be8de62ae Refactor linestring geom validation
Now it only focuses on issues not addressed by ol.geom.flat.simplify methods.
2016-11-23 09:49:47 +01:00
GaborFarkas
f15a9652d8 Fix rendering of boundaries. 2016-11-23 09:49:47 +01:00
GaborFarkas
eba006b796 Falling back to bevel when exceeding miterLimit 2016-11-23 09:49:47 +01:00
GaborFarkas
8c561a45b9 Inspect linestring validity before drawing 2016-11-23 09:49:46 +01:00
GaborFarkas
99e4009b19 Minor improvements
ol.render.webgl.LineStringReplay.startIndices_ is initialized with a 0, and the end index of a valid line is added in every valid iteration.

drawElements_ is refactored for a clearer code.
2016-11-23 09:49:46 +01:00
GaborFarkas
e2ec6d0b82 Adding support for closed lines 2016-11-23 09:49:46 +01:00
GaborFarkas
0f8e1a7e40 Refactoring ol.render.webgl.LineStringReplay 2016-11-23 09:49:46 +01:00
GaborFarkas
c13d09ba23 Handle case of one segment lines with identical coordinates + quality improvements 2016-11-23 09:49:46 +01:00
GaborFarkas
fb71860a03 Adding linestring cap support 2016-11-23 09:49:46 +01:00
GaborFarkas
350d1add81 Change goog.base to call, and goog.inherits to ol.inherits 2016-11-23 09:49:46 +01:00
GaborFarkas
0972988bdb Properly triangulate linestrings 2016-11-23 09:49:46 +01:00
GaborFarkas
c7edd21cc3 Extend linestring renderer with GLSL and indexed geometries. 2016-11-23 09:49:46 +01:00
GaborFarkas
caeb8e4820 Eliminating jitter by restructuring 2016-11-23 09:49:46 +01:00
GaborFarkas
6e958514ee Taking line width into account 2016-11-23 09:49:46 +01:00
GaborFarkas
628db9146d Creating a webgl.Replay struct, making the WebGL LineString renderer compilable 2016-11-23 09:49:46 +01:00
GaborFarkas
f5978c659c Adding some defaults 2016-11-23 09:49:46 +01:00
GaborFarkas
a6ddee0c5f Updating old code to current ol3 version 2016-11-23 09:49:46 +01:00
GaborFarkas
a052b645df Fix dependencies 2016-11-23 09:49:46 +01:00
Guillaume Beraudo
e40b545e40 Add basic WEBGL LineString rendering
Use gl.LINES and hardcode a width.
Implement polygon stroking using the line string replay.
2016-11-23 09:49:46 +01:00
Guillaume Beraudo
8e9b589ca9 Add tests to PolygonReplay renderer 2016-11-23 09:49:46 +01:00
Guillaume Beraudo
581ea8c775 Add color to WEBGL polygons 2016-11-23 09:49:46 +01:00
Guillaume Beraudo
2519cf36fc Basic WEBGL rendering of polygons 2016-11-23 09:49:46 +01:00
Guillaume Beraudo
8bdbe7aae0 Add earcut to package.json and wrap it in ol.ext
Earcut is a library for triangulating polygons.
See https://github.com/mapbox/earcut.
2016-11-23 09:49:46 +01:00
Bart van den Eijnden
c8d35e4fb0 Merge pull request #6155 from romanzoller/gpx-geometry-layout
Set GeometryLayout correctly when reading GPX
2016-11-23 08:52:26 +01:00
Frédéric Junod
13884dac4d Merge pull request #6161 from openlayers/greenkeeper-async-2.1.4
Update async to version 2.1.4 🚀
2016-11-23 08:22:23 +01:00
greenkeeperio-bot
9a900becd3 chore(package): update async to version 2.1.4
https://greenkeeper.io/
2016-11-22 12:28:01 -07:00
Thomas Chandelle
d8c428a8a2 Remove also carriage return after goog.require in examples 2016-11-22 16:49:12 +01:00
Roman Zoller
f56b2c8a75 Set GeometryLayout correctly when reading GPX
Fixes #6148
2016-11-22 10:42:11 +01:00
Bart van den Eijnden
d759ad603a Merge pull request #6153 from romanzoller/remove-licenses
Remove legacy licenses folder
2016-11-22 09:32:11 +01:00
Andreas Hocevar
caef2b51b4 Merge pull request #6154 from openlayers/greenkeeper-mocha-phantomjs-core-2.1.0
Update mocha-phantomjs-core to version 2.1.0 🚀
2016-11-21 23:07:37 +01:00
greenkeeperio-bot
2842938514 chore(package): update mocha-phantomjs-core to version 2.1.0
https://greenkeeper.io/
2016-11-21 12:41:06 -07:00
Roman Zoller
6ce1731a03 Remove legacy licenses folder
Fixes #6152
2016-11-21 15:38:04 +01:00
Tim Schaub
76e1f4e041 Merge pull request #6146 from tchandelle/circle-as-regularshape
Merge ol.style.Circle and RegularShape together
2016-11-18 12:44:51 -07:00
Thomas Chandelle
800c6f53a9 Merge ol.style.Circle and RegularShape together 2016-11-18 15:17:35 +01:00
Bart van den Eijnden
fd3c9f58bf Merge pull request #6139 from bartvde/wmts-proj
Match equivalent projections from WMTS caps
2016-11-16 18:27:33 +01:00
Bart van den Eijnden
c990cab0c3 Match equivalent projections from WMTS caps 2016-11-16 16:17:55 +01:00
Andreas Hocevar
d0a957d484 Merge pull request #6138 from openlayers/greenkeeper-clean-css-3.4.21
Update clean-css to version 3.4.21 🚀
2016-11-16 13:56:36 +01:00
Andreas Hocevar
886ddb160c Merge pull request #6132 from tohu12/getColor_to_Icon
Add getter for color property to ol.style.Icon
2016-11-16 13:54:24 +01:00
Bart van den Eijnden
26a80af517 Merge pull request #6127 from omarkljung/format_wkt_z
Format WKT Z, M and ZM
2016-11-16 12:03:54 +01:00
greenkeeperio-bot
5fa1bd4bf0 chore(package): update clean-css to version 3.4.21
https://greenkeeper.io/
2016-11-16 03:59:30 -07:00
Tomas Hulek
e7e425c288 Added getter for Color property to ol.style.Icon and updated test 2016-11-16 11:12:49 +01:00
Tim Schaub
d0ada3442d Merge pull request #6136 from openlayers/greenkeeper-eslint-3.10.2
Update eslint to version 3.10.2 🚀
2016-11-15 17:38:12 -07:00
greenkeeperio-bot
4b1dfd7897 chore(package): update eslint to version 3.10.2
https://greenkeeper.io/
2016-11-15 16:45:19 -07:00
Olle Markljung
f436f2d5e2 Adds support for M, Z and ZM WKT formatting 2016-11-15 21:04:56 +01:00
Andreas Hocevar
5b59ddd473 Merge pull request #6133 from KlausBenndorf/docuFix
Doc clarification ol.MapBrowserEvent#pixel, ol.MapBrowserEvent#coordinate, ol.Map#getEventCoordinate
2016-11-15 20:48:11 +01:00
simonseyock
8c49f6db46 Changed wording 2016-11-15 18:41:29 +01:00
Andreas Hocevar
9fd55e50f7 Merge pull request #6134 from dnlkoch/add-style-setters
Add setter methods for fill, image, stroke and text styles
2016-11-15 18:34:27 +01:00
Daniel Koch
c60e1d0fb3 Setter methods for fill, image, stroke and text 2016-11-15 17:19:49 +01:00
simonseyock
a133beb168 Documentation clarification
Clarified the description of the pixel and coordinate attribute of the ol.MapBrowserEvent
2016-11-15 17:13:23 +01:00
Andreas Hocevar
b87564335e Merge pull request #6129 from openlayers/greenkeeper-pbf-3.0.4
Update pbf to version 3.0.4 🚀
2016-11-14 23:04:30 +01:00
greenkeeperio-bot
ca1c6c343e chore(package): update pbf to version 3.0.4
https://greenkeeper.io/
2016-11-14 14:38:31 -07:00
Tim Schaub
940b5e18b5 Merge pull request #6121 from tschaub/hint-change-means-view-change
Hint change means view change
2016-11-14 11:55:36 -07:00
Tim Schaub
8401d22f28 Setting a view hint triggers change 2016-11-14 10:18:39 -07:00
Tim Schaub
1ae6921e53 Make view.setHint() trigger change 2016-11-14 10:18:39 -07:00
Tim Schaub
15c4dadbaf Merge pull request #6120 from tschaub/hint-changed
Set interacting hint during trackpad scroll
2016-11-14 10:17:12 -07:00
Tim Schaub
82e6508dea Merge pull request #6128 from openlayers/greenkeeper-pbf-3.0.3
Update pbf to version 3.0.3 🚀
2016-11-14 06:15:46 -07:00
greenkeeperio-bot
8c7d5e9cbc chore(package): update pbf to version 3.0.3
https://greenkeeper.io/
2016-11-14 05:55:40 -07:00
Marc Jansen
8dbd16ee40 Merge pull request #6124 from marcjansen/more-digits
Allow up to 16 decimals for alpha channel when parsing rgba strings to colors
2016-11-14 10:33:42 +01:00
Marc Jansen
9af73a1588 Allow max 16 decimals for alpha when parsing rgba 2016-11-14 08:40:39 +01:00
Tim Schaub
0ac620c817 Set interacting hint during trackpad scroll 2016-11-13 10:25:45 -07:00
Tim Schaub
5b85f8ecc9 Render on view changes 2016-11-13 10:25:20 -07:00
Tim Schaub
8f6e07bfb8 Merge pull request #6117 from openlayers/greenkeeper-handlebars-4.0.6
Update handlebars to version 4.0.6 🚀
2016-11-12 19:43:58 -07:00
greenkeeperio-bot
70d7a865d7 chore(package): update handlebars to version 4.0.6
https://greenkeeper.io/
2016-11-12 18:33:00 -07:00
Tim Schaub
51cab63032 Merge pull request #6113 from tschaub/scroll-zoom
Smooth trackpad zooming
2016-11-12 15:00:05 -07:00
Tim Schaub
455b28d2fa Merge pull request #6105 from tschaub/feature-loader
Move vector tile loader functions into vector tile module
2016-11-12 14:55:53 -07:00
Tim Schaub
3c8d339617 Merge pull request #6114 from tschaub/curly
Updated linter config and curly conditional blocks
2016-11-12 14:54:44 -07:00
Tim Schaub
d4295e7ed7 Updated linter config and curly conditional blocks 2016-11-12 13:29:19 -07:00
Tim Schaub
7c5e428578 Merge pull request #6106 from tschaub/types
Add type annotations for vector tiles
2016-11-12 12:11:10 -07:00
Tim Schaub
489d37d384 Use representative wheel delta values in the tests 2016-11-12 12:07:57 -07:00
Tim Schaub
e6f8288d36 Cancel and restart animation when wheel zooming 2016-11-12 11:34:54 -07:00
Tim Schaub
e2be8611ef Unconstrainted zooming 2016-11-12 11:27:41 -07:00
Tim Schaub
7dd7eb1b6f Adjust resolution then animate to next 2016-11-12 11:27:41 -07:00
Tim Schaub
94e6dc4e4e Keep track of scroll mode 2016-11-12 11:27:41 -07:00
Tim Schaub
822b0a49b4 Merge pull request #6107 from tschaub/more-animation
Reset hint first and notify of change when cancelling animations
2016-11-12 11:21:43 -07:00
Marc Jansen
5baf107078 Merge pull request #6112 from openlayers/greenkeeper-eslint-3.10.0
Update eslint to version 3.10.0 🚀
2016-11-11 23:37:36 +01:00
greenkeeperio-bot
c39f05623e chore(package): update eslint to version 3.10.0
https://greenkeeper.io/
2016-11-11 13:29:27 -07:00
Tim Schaub
9b828afad3 Merge pull request #6110 from openlayers/greenkeeper-coveralls-2.11.15
Update coveralls to version 2.11.15 🚀
2016-11-11 12:43:01 -07:00
greenkeeperio-bot
16f2cf4809 chore(package): update coveralls to version 2.11.15
https://greenkeeper.io/
2016-11-11 09:53:30 -07:00
Tim Schaub
7f01de9261 Reset hint first and notify of change when cancelling animations 2016-11-11 06:31:26 -07:00
Tim Schaub
9272db1d25 Let the compiler know these are vector tiles 2016-11-11 05:48:06 -07:00
Tim Schaub
a20bd72aa9 Move loader functions and response handlers to tile module 2016-11-11 05:35:20 -07:00
Tim Schaub
b829471c85 Move default tile load function to tile module 2016-11-11 05:04:36 -07:00
Bart van den Eijnden
64057d7e6b Merge pull request #6077 from bartvde/bing-hidpi
Optionally enable hidpi support for Bing
2016-11-11 09:17:08 +01:00
Tim Schaub
447c6800ca Merge pull request #6103 from tschaub/inanimate
Properly complete multiple parallel animations
2016-11-10 18:12:16 -07:00
Tim Schaub
291766c48d Let people zoom a lot with the button 2016-11-10 10:20:47 -07:00
Tim Schaub
97d942c8e2 Correctly prune completed animation series 2016-11-10 10:18:42 -07:00
Tim Schaub
0c54d141cb Merge pull request #6101 from tschaub/wheel-zoom
Avoid starting new zoom animation while already animating
2016-11-10 08:20:46 -07:00
Andreas Hocevar
2d711a59b5 Merge pull request #6099 from tchandelle/modify-test
Modify interaction tests : check for change events
2016-11-10 15:53:58 +01:00
Tim Schaub
25770e7ef4 Only zoom if not zooming 2016-11-10 06:25:03 -07:00
Andreas Hocevar
61df657cfb Merge pull request #6069 from tchandelle/translate-no-features
If there is no features option, all features will be translated.
2016-11-10 13:32:52 +01:00
Thomas Chandelle
5d214567ab Add test for Translate interaction, without features option 2016-11-09 14:36:25 +01:00
Andreas Hocevar
902003ee12 Merge pull request #6097 from tchandelle/doc-index
API index page : Fix link anchor to static members
2016-11-09 14:32:07 +01:00
Thomas Chandelle
af82f972da Check for middle events
Most of the times, there is only 3 events. This loop is supposed to
check the middle one, but never does;
2016-11-09 14:25:33 +01:00
Thomas Chandelle
60e352fa09 Make Translate options optional 2016-11-09 13:54:10 +01:00
Thomas Chandelle
741494098e Fix link anchor to static members 2016-11-09 13:30:57 +01:00
Andreas Hocevar
100990cc12 Merge pull request #6095 from tchandelle/line-arrows
LineString Arrows example: rotate with the view
2016-11-09 10:44:21 +01:00
Thomas Chandelle
5b00095bd0 Rotate the arrows with the view 2016-11-09 09:42:08 +01:00
Andreas Hocevar
6090051661 Merge pull request #6093 from openlayers/greenkeeper-mustache-2.3.0
Update mustache to version 2.3.0 🚀
2016-11-08 21:26:41 +01:00
greenkeeperio-bot
c52d6f2c6b chore(package): update mustache to version 2.3.0
https://greenkeeper.io/
2016-11-08 09:29:48 -07:00
Bart van den Eijnden
183266beef Update externs definition 2016-11-07 19:27:33 +01:00
Andreas Hocevar
d52b3715d9 Fix tile size and pixel ratio 2016-11-07 19:22:19 +01:00
Tim Schaub
77ec54e245 Merge pull request #6079 from tschaub/animate
Add view animation
2016-11-07 09:50:41 -07:00
Tim Schaub
2b82f7281f Merge pull request #6081 from openlayers/greenkeeper-metalsmith-layouts-1.7.0
Update metalsmith-layouts to version 1.7.0 🚀
2016-11-06 17:37:37 -07:00
Tim Schaub
474e6ea643 Add upgrade notes about view.animate() 2016-11-06 17:13:13 -07:00
Tim Schaub
ea9fea000a Deprecation warning for map.beforeRender() and ol.animation functions 2016-11-06 17:13:03 -07:00
Tim Schaub
7fde4a48f4 Test that zoom is preferred over resolution 2016-11-06 16:48:04 -07:00
Tim Schaub
8d15a00b81 Add a tour to the animation example 2016-11-06 16:47:59 -07:00
Tim Schaub
2eedffa100 Separate olx.OverlayPanOptions from olx.animation.PanOptions 2016-11-06 10:40:27 -07:00
Tim Schaub
fee761b159 Correct ol.ViewAnimation typedef 2016-11-06 10:16:09 -07:00
Tim Schaub
6f08498684 Run animations in series 2016-11-06 10:06:58 -07:00
Tim Schaub
337c6bb73e Improve example legibility 2016-11-06 09:47:15 -07:00
Tim Schaub
3455686734 Doc updates 2016-11-06 09:39:35 -07:00
Tim Schaub
f4579dacd8 Add view.animate() to the API 2016-11-06 09:28:53 -07:00
Tim Schaub
4b19f12c29 Link to view.animate() 2016-11-06 09:17:14 -07:00
Tim Schaub
6b00e2ace4 Documentation for view.animate() 2016-11-06 09:13:59 -07:00
Tim Schaub
da8eb97f54 Use the animating hint 2016-11-06 09:13:59 -07:00
Tim Schaub
f6ad883db6 Use view.animate() to auto-pan an overlay 2016-11-06 09:13:55 -07:00
Tim Schaub
a484cf0910 Remove use of map.beforeRender() in geolocation orientation example 2016-11-06 09:12:24 -07:00
Tim Schaub
e447df39f7 Use view.animate() on zoom slider drag end 2016-11-06 09:12:24 -07:00
Tim Schaub
e13d3f6d2b Use view.animate() in zoom slider control 2016-11-06 09:12:24 -07:00
Tim Schaub
f16d1b06eb Use view.animation() when rotating 2016-11-06 09:12:18 -07:00
Tim Schaub
1147d51f2f Use view.animate() in drag zoom interaction 2016-11-06 07:59:48 -07:00
Tim Schaub
01da26b1c4 Unused kinetic.pan() method 2016-11-06 07:56:53 -07:00
Tim Schaub
5fb9a2ebf8 Test animation callback 2016-11-06 07:53:19 -07:00
greenkeeperio-bot
b37f978c29 chore(package): update metalsmith-layouts to version 1.7.0
https://greenkeeper.io/
2016-11-06 07:19:38 -07:00
Tim Schaub
3acfe79c78 Support anchor for rotation animations 2016-11-05 20:49:15 -06:00
Tim Schaub
c95aa39dde Support anchor for resolution animations 2016-11-05 20:41:40 -06:00
Tim Schaub
8529a74063 Put maps side by side 2016-11-05 18:29:29 -06:00
Tim Schaub
f6e9c12161 Use view.animate() in the pan interaction 2016-11-05 18:26:24 -06:00
Tim Schaub
dd079e915a Use view.animate() in the rotation control 2016-11-05 18:11:04 -06:00
Tim Schaub
0c8c5a003b Use view.animate() in zoom control 2016-11-05 18:08:37 -06:00
Tim Schaub
61ef7bf95d Use view.animate() after drag panning 2016-11-05 18:05:44 -06:00
Tim Schaub
c452164b8a Ensure that all animations complete 2016-11-05 17:31:49 -06:00
Tim Schaub
3d26d3bdc6 Update the animation example 2016-11-05 13:23:45 -06:00
Tim Schaub
83b7a1e2fc View animation 2016-11-05 13:22:17 -06:00
Tim Schaub
e979baa3dc Stub out view animation 2016-11-05 12:16:11 -06:00
Tim Schaub
16954f8df0 New view animation options 2016-11-05 12:15:45 -06:00
Bart van den Eijnden
02c0a6a533 Optionally enable hidpi support for Bing 2016-11-04 17:17:07 +01:00
Thomas Chandelle
5d61218134 Keep the other dim from the original segment when modifying vertex 2016-11-04 09:47:30 +01:00
Bart van den Eijnden
bccc841ebd Merge pull request #6074 from tchandelle/example-modify
Fix typo on style name on Modify Features Test example
2016-11-04 09:39:12 +01:00
Bart van den Eijnden
c0f960cf71 Merge pull request #6073 from tchandelle/errors-link
Fix link to errors doc
2016-11-04 09:12:07 +01:00
Frédéric Junod
d58103087f Merge pull request #6072 from openlayers/greenkeeper-metalsmith-2.3.0
Update metalsmith to version 2.3.0 🚀
2016-11-04 07:01:32 +01:00
greenkeeperio-bot
bf13dfeb50 chore(package): update metalsmith to version 2.3.0
https://greenkeeper.io/
2016-11-03 14:43:50 -06:00
Andreas Hocevar
0f58fa32eb Merge pull request #6068 from ahocevar/geojson-write-transform
Fix GeoJSON writeGeometry tests
2016-11-03 14:54:36 +01:00
Andreas Hocevar
73f970f350 Merge pull request #6067 from ahocevar/freehand-circle
Do not draw circle when pointer not moved
2016-11-03 14:47:33 +01:00
Andreas Hocevar
3656529252 Fix GeoJSON writeGeometry tests 2016-11-03 14:44:04 +01:00
Thomas Chandelle
2420ad56c1 If there is no features option, all features will be translated. 2016-11-03 14:03:11 +01:00
Andreas Hocevar
fb1a8335ac Do not draw circle when pointer not moved 2016-11-03 12:59:36 +01:00
oterral
a28576d2b9 Remove the use of ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ when it's not wanted 2016-11-03 11:11:53 +01:00
Andreas Hocevar
760a231306 Merge pull request #6064 from ahocevar/better-modify-box
Make vertex candidate selection work better on rotated views
2016-11-03 09:34:06 +01:00
Andreas Hocevar
c2aa18dcbf Make vertex candidate selection work better on rotated views 2016-11-02 19:21:45 +01:00
Tim Schaub
b934eb6e59 Merge pull request #6054 from openlayers/greenkeeper-eslint-3.9.1
Update eslint to version 3.9.1 🚀
2016-11-01 10:11:16 -06:00
Tim Schaub
bd4808d161 Merge pull request #6058 from openlayers/greenkeeper-fs-extra-1.0.0
Update fs-extra to version 1.0.0 🚀
2016-11-01 08:48:22 -06:00
greenkeeperio-bot
337c9a7e93 chore(package): update fs-extra to version 1.0.0
https://greenkeeper.io/
2016-11-01 08:06:43 -06:00
greenkeeperio-bot
71ebed07bf chore(package): update eslint to version 3.9.1
https://greenkeeper.io/
2016-11-01 11:51:06 +01:00
Frédéric Junod
5f5bc2ecdb Merge pull request #6053 from openlayers/greenkeeper-glob-7.1.1
Update glob to version 7.1.1 🚀
2016-10-31 13:12:05 +01:00
Tim Schaub
888032dcc9 Merge pull request #6045 from tschaub/sealevel
Add an example using Mapbox Terrain-RGB tiles
2016-10-28 09:21:56 -06:00
Tim Schaub
df83f6633f Add an example using Mapbox Terrain-RGB tiles 2016-10-28 09:08:35 -06:00
Andreas Hocevar
7492a91c10 Merge pull request #6042 from oterral/teo_dflt_style
Set constants of KML format even if a default style is provided
2016-10-28 16:01:01 +02:00
oterral
f369ea2e29 Set constants of KML format even if a default style is provided 2016-10-28 14:53:44 +02:00
Andreas Hocevar
b4e59a99e8 Merge branch 'release-v3.19.1' 2016-10-28 14:21:58 +02:00
Andreas Hocevar
48c1d09a95 Merge branch 'master' into release-v3.19.1 2016-10-28 14:21:34 +02:00
Marc Jansen
6092e6ecbb Update package version to 3.19.1 2016-10-28 11:51:29 +02:00
Marc Jansen
849b04b882 Changelog for v3.19.1 2016-10-28 11:51:07 +02:00
Andreas Hocevar
cc0452a2d9 Merge pull request #6039 from ahocevar/undefined-fillstyle
Do not fill when there is no fillStyle
2016-10-28 11:48:08 +02:00
Andreas Hocevar
cfe78f2766 Merge pull request #6034 from ahocevar/gradient-pattern-origin
Use geometry extent's top left corner as pattern/gradient origin
2016-10-28 11:48:01 +02:00
Andreas Hocevar
b9fe59c269 Merge pull request #6027 from bjornharrtell/issue-6023
Close polygon sketch at all times
2016-10-28 11:47:55 +02:00
Andreas Hocevar
a3b474623e Merge pull request #6022 from ahocevar/white-lines
Revert "Merge pull request #5890 from ahocevar/no-white-lines"
2016-10-28 11:47:49 +02:00
Andreas Hocevar
04f070b159 Merge pull request #6039 from ahocevar/undefined-fillstyle
Do not fill when there is no fillStyle
2016-10-28 11:20:46 +02:00
Marc Jansen
14f575f207 Merge pull request #6040 from openlayers/coveralls-badge
Update the coveralls badge
2016-10-28 11:03:47 +02:00
Marc Jansen
8a69f1f6ea Update the coveralls badge 2016-10-28 10:51:34 +02:00
Andreas Hocevar
aa7e54833d Do not fill when there is no fillStyle 2016-10-28 10:34:27 +02:00
Frédéric Junod
39abb2b143 Merge pull request #6036 from fredj/mousewheel_timeout_option
Add new timeout option to ol.interaction.MouseWheelZoom
2016-10-28 09:46:12 +02:00
Andreas Hocevar
d90bfbde58 Merge pull request #6034 from ahocevar/gradient-pattern-origin
Use geometry extent's top left corner as pattern/gradient origin
2016-10-28 09:16:30 +02:00
Frederic Junod
e0a9910d4e Add new timeout option to ol.interaction.MouseWheelZoom
And remove the `ol.MOUSEWHEELZOOM_TIMEOUT_DURATION` define.
2016-10-28 09:07:42 +02:00
Andreas Hocevar
7834a95210 Merge pull request #6027 from bjornharrtell/issue-6023
Close polygon sketch at all times
2016-10-28 00:37:22 +02:00
Andreas Hocevar
f4d12ad448 Merge pull request #6035 from openlayers/greenkeeper-metalsmith-2.2.1
Update metalsmith to version 2.2.1 🚀
2016-10-28 00:35:43 +02:00
greenkeeperio-bot
5d5d49ad12 chore(package): update metalsmith to version 2.2.1
https://greenkeeper.io/
2016-10-27 14:44:29 -06:00
Andreas Hocevar
a2a2a53e08 Use geometry extent's top left corner as pattern/gradient origin 2016-10-27 21:27:17 +02:00
Björn Harrtell
9d5453a927 Test to validate sketch polygon 2016-10-27 18:56:11 +02:00
Björn Harrtell
1bd11c1958 Close polygon sketch at all times 2016-10-25 22:36:40 +02:00
Andreas Hocevar
767bec4dc7 Merge pull request #6022 from ahocevar/white-lines
Revert "Merge pull request #5890 from ahocevar/no-white-lines"
2016-10-25 13:03:08 +02:00
Andreas Hocevar
70338b928e Revert "Merge pull request #5890 from ahocevar/no-white-lines"
This partially reverts commit 5f18246355,
reversing most of the changes made to
004afa6b9a.
2016-10-25 11:34:02 +02:00
Marc Jansen
dd6b05b285 Merge pull request #6020 from marcjansen/ol.obj-tests
Test that ol.obj.assign throws on undefined/null
2016-10-24 14:14:42 +02:00
Marc Jansen
e59b90377f Merge pull request #6012 from marcjansen/combined-coverage
Combine standard coverage and rendering coverage
2016-10-24 14:14:20 +02:00
Bart van den Eijnden
e0a0804040 Merge pull request #6019 from bartvde/issue-6018
Make sure updateParams reloads in TileArcGISRest
2016-10-24 13:17:26 +02:00
Marc Jansen
f973eaa24d Test that ol.obj.assign throws on undefined/null 2016-10-24 10:39:48 +02:00
Bart van den Eijnden
2fe4d63893 Make sure updateParams reloads in TileArcGISRest 2016-10-24 10:31:15 +02:00
Bart van den Eijnden
908f254bd2 Merge pull request #6017 from bartvde/revert-i18n-workshop
Revert "Point to the English workshop"
2016-10-24 09:46:28 +02:00
Bart van den Eijnden
2132a02f76 Revert "Point to the English workshop"
This reverts commit ede6fc6e01.
2016-10-24 09:31:38 +02:00
Tim Schaub
78f283c32b Merge pull request #6014 from openlayers/greenkeeper-browserify-13.1.1
Update browserify to version 13.1.1 🚀
2016-10-23 19:30:51 -07:00
greenkeeperio-bot
9659d8598c chore(package): update browserify to version 13.1.1
https://greenkeeper.io/
2016-10-22 12:05:00 -07:00
Marc Jansen
42d1c51cbb Combine standard coverage and rendering coverage 2016-10-22 14:42:40 +02:00
Frédéric Junod
c34f097ffd Merge pull request #6011 from fredj/rm_unused
Remove unused function
2016-10-21 15:44:08 +02:00
Frederic Junod
0a2b145fd5 Remove unused ol.extent.empty function 2016-10-21 14:25:46 +02:00
Frederic Junod
0f8d26d829 Remove unused ol.extent.touches function 2016-10-21 14:23:31 +02:00
Frederic Junod
2a1a9ec337 Remove unused ol.extent.isInfinite function 2016-10-21 14:22:37 +02:00
Frederic Junod
5627a467cd Remove unused ol.extent.normalize function 2016-10-21 14:20:33 +02:00
tchandelle
dc9770911f Wrong link to errors 2016-10-17 09:45:47 +02:00
Thomas Chandelle
32f112659f Typo for MultiLineString style 2016-10-13 16:58:41 +02:00
greenkeeperio-bot
86e879be5d chore(package): update glob to version 7.1.1
https://greenkeeper.io/
2016-10-07 15:58:58 -06:00
266 changed files with 16409 additions and 7129 deletions

View File

@@ -1,7 +1,7 @@
# OpenLayers 3
[![Travis CI Status](https://secure.travis-ci.org/openlayers/ol3.svg)](http://travis-ci.org/#!/openlayers/ol3)
[![Coverage Status](https://coveralls.io/repos/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/r/openlayers/ol3?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/openlayers/ol3/badge.svg?branch=master)](https://coveralls.io/github/openlayers/ol3?branch=master)
[![OSGeo Project](https://img.shields.io/badge/OSGeo-Project-brightgreen.svg)](http://osgeo.org/)
[OpenLayers 3](https://openlayers.org/) is a high-performance, feature-packed library for creating interactive maps on the web. It can display map tiles, vector data and markers loaded from any source on any web page. OpenLayers has been developed to further the use of geographic information of all kinds. It is completely free, Open Source JavaScript, released under the 2-clause BSD License (also known as the FreeBSD).

View File

@@ -1,5 +1,100 @@
## Upgrade notes
### v3.20.0
#### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions
The `map.beforeRender()` and `ol.animation` functions have been deprecated in favor of a new `view.animate()` function. Use of the deprecated functions will result in a warning during development. These functions are subject to removal in an upcoming release.
For details on the `view.animate()` method, see the API docs and the view animation example. Upgrading should be relatively straightforward. For example, if you wanted to have an animated pan, zoom, and rotation previously, you might have done this:
```js
var zoom = ol.animation.zoom({
resolution: view.getResolution()
});
var pan = ol.animation.pan({
source: view.getCenter()
});
var rotate = ol.animation.rotate({
rotation: view.getRotation()
});
map.beforeRender(zoom, pan, rotate);
map.setZoom(1);
map.setCenter([0, 0]);
map.setRotation(Math.PI);
```
Now, the same can be accomplished with this:
```js
view.animate({
zoom: 1,
center: [0, 0],
rotation: Math.PI
});
```
#### `ol.Map#forEachFeatureAtPixel` and `ol.Map#hasFeatureAtPixel` parameters have changed
If you are using the layer filter of one of these methods, please note that you now have to pass in the layer filter via an `ol.AtPixelOptions` object. If you are not using the layer filter the usage has not changed.
Old syntax:
```js
map.forEachFeatureAtPixel(pixel, callback, callbackThis, layerFilterFn, layerFilterThis);
map.hasFeatureAtPixel(pixel, layerFilterFn, layerFilterThis);
```
New syntax:
```js
map.forEachFeatureAtPixel(pixel, callback.bind(callbackThis), {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
map.hasFeatureAtPixel(pixel, {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
```
This change is due to the introduction of the `hitTolerance` parameter which can be passed in via this `ol.AtPixelOptions` object, too.
#### Use `ol.proj.getPointResolution()` instead of `projection.getPointResolution()`
The experimental `getPointResolution` method has been removed from `ol.Projection` instances. Since the implementation of this method required an inverse transform (function for transforming projected coordinates to geographic coordinates) and `ol.Projection` instances are not constructed with forward or inverse transforms, it does not make sense that a projection instance can always calculate the point resolution.
As a substitute for the `projection.getPointResolution()` function, a `ol.proj.getPointResolution()` function has been added. To upgrade, you will need to change things like this:
```js
projection.getPointResolution(resolution, point);
```
into this:
```js
ol.proj.getPointResolution(projection, resolution, point);
```
Note that if you were previously creating a projection with a `getPointResolution` function in the constructor (or calling `projection.setGetPointResolution()` after construction), this function will be used by `ol.proj.getPointResolution()`.
#### `ol.interaction.PinchZoom` no longer zooms to a whole-number zoom level after the gesture ends
The old behavior of `ol.interaction.PinchZoom` was to zoom to the next integer zoom level after the user ends the gesture.
Now the pinch zoom keeps the user selected zoom level even if it is a fractional zoom.
To get the old behavior set the new `constrainResolution` parameter to `true` like this:
```js
new ol.interaction.PinchZoom({constrainResolution: true})
```
See the new `pinch-zoom` example for a complete implementation.
### v3.19.1
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from `[0, 0]` to the top-left
corner of the extent of the geometry being filled.
### v3.19.0
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`

22
changelog/v3.19.1.md Normal file
View File

@@ -0,0 +1,22 @@
# v3.19.1
## Summary
The v3.19.1 release is a patch release that addresses four regressions in the
v3.19.0 release. See the
[v3.19.0 release notes](https://github.com/openlayers/ol3/releases/tag/v3.19.0)
for details on upgrading from v3.18.x.
## Upgrade notes
#### `ol.style.Fill` with `CanvasGradient` or `CanvasPattern`
The origin for gradients and patterns has changed from `[0, 0]` to the top-left
corner of the extent of the geometry being filled.
## Fixes
* [#6039](https://github.com/openlayers/ol3/pull/6039) - Do not fill when there is no fillStyle ([@ahocevar](https://github.com/ahocevar))
* [#6034](https://github.com/openlayers/ol3/pull/6034) - Use geometry extent's top left corner as pattern/gradient origin ([@ahocevar](https://github.com/ahocevar))
* [#6027](https://github.com/openlayers/ol3/pull/6027) - Close polygon sketch at all times ([@bjornharrtell](https://github.com/bjornharrtell))
* [#6022](https://github.com/openlayers/ol3/pull/6022) - Revert "Merge pull request #5890 from ahocevar/no-white-lines" ([@ahocevar](https://github.com/ahocevar))

195
changelog/v3.20.0.md Normal file
View File

@@ -0,0 +1,195 @@
# v3.20.0
## Summary
The v3.20.0 release includes enhancements and fixes from 89 pull requests since the previous release.
Among the changes, take a look at the new `view.animate()` function. This replaces the previous `map.beforeRender()` and `ol.animation` functions with more intuitive view animations that allow for chaining together multiple transitions and support a callback on animation end. In addition, two or more maps that share a view will be animated together. See the upgrade notes and the animation example for more detail.
On the subject of view transitions, scrolling with a trackpad or magic mouse now transitions the view resolution smoothly. Instead of jumping to the next integer zoom level, trackpad or magic mouse scrolling can leave the view at a fractional zoom level. In line with this trackpad behavior, pinch zooming on touch devices also now leaves the view at a fractional zoom level (see the upgrade notes for an option to restore the old behavior).
On the rendering front, the Canvas renderer got another overhaul. This release brings back the strategy of rendering to a dedicated Canvas element per layer. If you were experiencing issues with gaps between tiles on rotated views or when zooming, this change should bring rendering improvements.
Also on the rendering front, @GaborFarkas completed a nearly 5 month effort to bring line and polygon support to the WebGL renderer. If you're interested in experimenting with WebGL for vector rendering, use `renderer: 'webgl'` in your map constructor.
See the full list of changes below. There are some other gems down there.
## Upgrade notes
#### Use `view.animate()` instead of `map.beforeRender()` and `ol.animation` functions
The `map.beforeRender()` and `ol.animation` functions have been deprecated in favor of a new `view.animate()` function. Use of the deprecated functions will result in a warning during development. These functions are subject to removal in an upcoming release.
For details on the `view.animate()` method, see the API docs and the view animation example. Upgrading should be relatively straightforward. For example, if you wanted to have an animated pan, zoom, and rotation previously, you might have done this:
```js
var zoom = ol.animation.zoom({
resolution: view.getResolution()
});
var pan = ol.animation.pan({
source: view.getCenter()
});
var rotate = ol.animation.rotate({
rotation: view.getRotation()
});
map.beforeRender(zoom, pan, rotate);
map.setZoom(1);
map.setCenter([0, 0]);
map.setRotation(Math.PI);
```
Now, the same can be accomplished with this:
```js
view.animate({
zoom: 1,
center: [0, 0],
rotation: Math.PI
});
```
#### `ol.Map#forEachFeatureAtPixel` and `ol.Map#hasFeatureAtPixel` parameters have changed
If you are using the layer filter of one of these methods, please note that you now have to pass in the layer filter via an `ol.AtPixelOptions` object. If you are not using the layer filter the usage has not changed.
Old syntax:
```js
map.forEachFeatureAtPixel(pixel, callback, callbackThis, layerFilterFn, layerFilterThis);
map.hasFeatureAtPixel(pixel, layerFilterFn, layerFilterThis);
```
New syntax:
```js
map.forEachFeatureAtPixel(pixel, callback.bind(callbackThis), {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
map.hasFeatureAtPixel(pixel, {
layerFilter: layerFilterFn.bind(layerFilterThis)
});
```
This change is due to the introduction of the `hitTolerance` parameter which can be passed in via this `ol.AtPixelOptions` object, too.
#### Use `ol.proj.getPointResolution()` instead of `projection.getPointResolution()`
The experimental `getPointResolution` method has been removed from `ol.Projection` instances. Since the implementation of this method required an inverse transform (function for transforming projected coordinates to geographic coordinates) and `ol.Projection` instances are not constructed with forward or inverse transforms, it does not make sense that a projection instance can always calculate the point resolution.
As a substitute for the `projection.getPointResolution()` function, a `ol.proj.getPointResolution()` function has been added. To upgrade, you will need to change things like this:
```js
projection.getPointResolution(resolution, point);
```
into this:
```js
ol.proj.getPointResolution(projection, resolution, point);
```
Note that if you were previously creating a projection with a `getPointResolution` function in the constructor (or calling `projection.setGetPointResolution()` after construction), this function will be used by `ol.proj.getPointResolution()`.
#### `ol.interaction.PinchZoom` no longer zooms to a whole-number zoom level after the gesture ends
The old behavior of `ol.interaction.PinchZoom` was to zoom to the next integer zoom level after the user ends the gesture.
Now the pinch zoom keeps the user selected zoom level even if it is a fractional zoom.
To get the old behavior set the new `constrainResolution` parameter to `true` like this:
```js
new ol.interaction.PinchZoom({constrainResolution: true})
```
See the new `pinch-zoom` example for a complete implementation.
## Detailed changes
* [#6230](https://github.com/openlayers/ol3/pull/6230) - Ignore duplicated attributions ([@tschaub](https://github.com/tschaub))
* [#6192](https://github.com/openlayers/ol3/pull/6192) - Modify interaction: always stop event propagation when removing vertex ([@tchandelle](https://github.com/tchandelle))
* [#6228](https://github.com/openlayers/ol3/pull/6228) - Rename the pinch zoom example ([@tschaub](https://github.com/tschaub))
* [#6229](https://github.com/openlayers/ol3/pull/6229) - Update phantomjs-prebuilt to version 2.1.14 🚀 ([@openlayers](https://github.com/openlayers))
* [#6196](https://github.com/openlayers/ol3/pull/6196) - KML ExtendedData Export ([@raiyni](https://github.com/raiyni))
* [#6227](https://github.com/openlayers/ol3/pull/6227) - Update eslint to version 3.12.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6224](https://github.com/openlayers/ol3/pull/6224) - Pinch zoom: allow fractional zoom ([@aAXEe](https://github.com/aAXEe))
* [#6226](https://github.com/openlayers/ol3/pull/6226) - Improve the headers styles in the api doc ([@tchandelle](https://github.com/tchandelle))
* [#5995](https://github.com/openlayers/ol3/pull/5995) - Add hit tolerance parameter to ol.Map#forEachFeatureAtPixel ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6220](https://github.com/openlayers/ol3/pull/6220) - Fix ol.Collection#push return value ([@fredj](https://github.com/fredj))
* [#6213](https://github.com/openlayers/ol3/pull/6213) - Add preload option to olx.layer.VectorTileOptions ([@drnextgis](https://github.com/drnextgis))
* [#6222](https://github.com/openlayers/ol3/pull/6222) - Fix forEachLayerAtPixel and improve class hierarchy ([@ahocevar](https://github.com/ahocevar))
* [#6075](https://github.com/openlayers/ol3/pull/6075) - Keep the other dim from the original segment when modifying vertex ([@tchandelle](https://github.com/tchandelle))
* [#6218](https://github.com/openlayers/ol3/pull/6218) - Make modify interaction more robust ([@gberaudo](https://github.com/gberaudo))
* [#6205](https://github.com/openlayers/ol3/pull/6205) - Rework remaining modules with multiple provides ([@tschaub](https://github.com/tschaub))
* [#6207](https://github.com/openlayers/ol3/pull/6207) - Require all when generating exports ([@tschaub](https://github.com/tschaub))
* [#6204](https://github.com/openlayers/ol3/pull/6204) - Refactored proj modules ([@tschaub](https://github.com/tschaub))
* [#6209](https://github.com/openlayers/ol3/pull/6209) - Test array with to.eql(), not to.be.eql() ([@ahocevar](https://github.com/ahocevar))
* [#6091](https://github.com/openlayers/ol3/pull/6091) - Apply pixelRatio to line dash ([@tchandelle](https://github.com/tchandelle))
* [#6082](https://github.com/openlayers/ol3/pull/6082) - Unified canvas rendering ([@ahocevar](https://github.com/ahocevar))
* [#6173](https://github.com/openlayers/ol3/pull/6173) - Topolis example ([@bjornharrtell](https://github.com/bjornharrtell))
* [#6206](https://github.com/openlayers/ol3/pull/6206) - Stop asserting that zero duration animations take time ([@tschaub](https://github.com/tschaub))
* [#6203](https://github.com/openlayers/ol3/pull/6203) - Address a few missing requires ([@tschaub](https://github.com/tschaub))
* [#6201](https://github.com/openlayers/ol3/pull/6201) - Remove assertion in TileArcGISRest source ([@tschaub](https://github.com/tschaub))
* [#6202](https://github.com/openlayers/ol3/pull/6202) - Allow animation duration to be zero ([@tschaub](https://github.com/tschaub))
* [#6198](https://github.com/openlayers/ol3/pull/6198) - Fix sourceResolution value in view.animate ([@oterral](https://github.com/oterral))
* [#6177](https://github.com/openlayers/ol3/pull/6177) - Add duration and easing options to view.fit() for animations ([@tchandelle](https://github.com/tchandelle))
* [#6078](https://github.com/openlayers/ol3/pull/6078) - Use winding number algorithm for linearRingContainsXY ([@bjornharrtell](https://github.com/bjornharrtell))
* [#6187](https://github.com/openlayers/ol3/pull/6187) - Update pbf to version 3.0.5 🚀 ([@openlayers](https://github.com/openlayers))
* [#6175](https://github.com/openlayers/ol3/pull/6175) - Generate projection transform function only when requested ([@tchandelle](https://github.com/tchandelle))
* [#6181](https://github.com/openlayers/ol3/pull/6181) - Replace expired Bing key with a new one ([@ahocevar](https://github.com/ahocevar))
* [#6164](https://github.com/openlayers/ol3/pull/6164) - Simplify color parsing and allow more decimals ([@marcjansen](https://github.com/marcjansen))
* [#6178](https://github.com/openlayers/ol3/pull/6178) - Add missing goog.require ([@fredj](https://github.com/fredj))
* [#6176](https://github.com/openlayers/ol3/pull/6176) - Doc: easing option is optional ([@tchandelle](https://github.com/tchandelle))
* [#6180](https://github.com/openlayers/ol3/pull/6180) - Update eslint to version 3.11.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#6179](https://github.com/openlayers/ol3/pull/6179) - Remove unused ol.Map.removePreRenderFunction function ([@fredj](https://github.com/fredj))
* [#6052](https://github.com/openlayers/ol3/pull/6052) - Remove the use of ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_ when … ([@oterral](https://github.com/oterral))
* [#6159](https://github.com/openlayers/ol3/pull/6159) - Remove carriage return after goog.require in examples ([@tchandelle](https://github.com/tchandelle))
* [#6169](https://github.com/openlayers/ol3/pull/6169) - Image rotation in WebGL was anti-clockwise ([@tchandelle](https://github.com/tchandelle))
* [#5590](https://github.com/openlayers/ol3/pull/5590) - Kml format: improved support for region and extendeddata ([@thhomas](https://github.com/thhomas))
* [#5462](https://github.com/openlayers/ol3/pull/5462) - WebGL vector support ([@GaborFarkas](https://github.com/GaborFarkas))
* [#6168](https://github.com/openlayers/ol3/pull/6168) - Update mocha to version 3.2.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#5589](https://github.com/openlayers/ol3/pull/5589) - Wmts tilematrixlimits ([@thhomas](https://github.com/thhomas))
* [#6155](https://github.com/openlayers/ol3/pull/6155) - Set GeometryLayout correctly when reading GPX ([@romanzoller](https://github.com/romanzoller))
* [#6161](https://github.com/openlayers/ol3/pull/6161) - Update async to version 2.1.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#6153](https://github.com/openlayers/ol3/pull/6153) - Remove legacy licenses folder ([@romanzoller](https://github.com/romanzoller))
* [#6154](https://github.com/openlayers/ol3/pull/6154) - Update mocha-phantomjs-core to version 2.1.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6146](https://github.com/openlayers/ol3/pull/6146) - Merge ol.style.Circle and RegularShape together ([@tchandelle](https://github.com/tchandelle))
* [#6139](https://github.com/openlayers/ol3/pull/6139) - Match equivalent projections from WMTS caps ([@bartvde](https://github.com/bartvde))
* [#6138](https://github.com/openlayers/ol3/pull/6138) - Update clean-css to version 3.4.21 🚀 ([@openlayers](https://github.com/openlayers))
* [#6132](https://github.com/openlayers/ol3/pull/6132) - Add getter for color property to ol.style.Icon ([@tohu12](https://github.com/tohu12))
* [#6127](https://github.com/openlayers/ol3/pull/6127) - Format WKT Z, M and ZM ([@omarkljung](https://github.com/omarkljung))
* [#6136](https://github.com/openlayers/ol3/pull/6136) - Update eslint to version 3.10.2 🚀 ([@openlayers](https://github.com/openlayers))
* [#6133](https://github.com/openlayers/ol3/pull/6133) - Doc clarification ol.MapBrowserEvent#pixel, ol.MapBrowserEvent#coordinate, ol.Map#getEventCoordinate ([@KlausBenndorf](https://github.com/KlausBenndorf))
* [#6134](https://github.com/openlayers/ol3/pull/6134) - Add setter methods for fill, image, stroke and text styles ([@dnlkoch](https://github.com/dnlkoch))
* [#6129](https://github.com/openlayers/ol3/pull/6129) - Update pbf to version 3.0.4 🚀 ([@openlayers](https://github.com/openlayers))
* [#6121](https://github.com/openlayers/ol3/pull/6121) - Hint change means view change ([@tschaub](https://github.com/tschaub))
* [#6120](https://github.com/openlayers/ol3/pull/6120) - Set interacting hint during trackpad scroll ([@tschaub](https://github.com/tschaub))
* [#6128](https://github.com/openlayers/ol3/pull/6128) - Update pbf to version 3.0.3 🚀 ([@openlayers](https://github.com/openlayers))
* [#6124](https://github.com/openlayers/ol3/pull/6124) - Allow up to 16 decimals for alpha channel when parsing rgba strings to colors ([@marcjansen](https://github.com/marcjansen))
* [#6117](https://github.com/openlayers/ol3/pull/6117) - Update handlebars to version 4.0.6 🚀 ([@openlayers](https://github.com/openlayers))
* [#6113](https://github.com/openlayers/ol3/pull/6113) - Smooth trackpad zooming ([@tschaub](https://github.com/tschaub))
* [#6105](https://github.com/openlayers/ol3/pull/6105) - Move vector tile loader functions into vector tile module ([@tschaub](https://github.com/tschaub))
* [#6114](https://github.com/openlayers/ol3/pull/6114) - Updated linter config and curly conditional blocks ([@tschaub](https://github.com/tschaub))
* [#6106](https://github.com/openlayers/ol3/pull/6106) - Add type annotations for vector tiles ([@tschaub](https://github.com/tschaub))
* [#6107](https://github.com/openlayers/ol3/pull/6107) - Reset hint first and notify of change when cancelling animations ([@tschaub](https://github.com/tschaub))
* [#6112](https://github.com/openlayers/ol3/pull/6112) - Update eslint to version 3.10.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6110](https://github.com/openlayers/ol3/pull/6110) - Update coveralls to version 2.11.15 🚀 ([@openlayers](https://github.com/openlayers))
* [#6077](https://github.com/openlayers/ol3/pull/6077) - Optionally enable hidpi support for Bing ([@bartvde](https://github.com/bartvde))
* [#6103](https://github.com/openlayers/ol3/pull/6103) - Properly complete multiple parallel animations ([@tschaub](https://github.com/tschaub))
* [#6101](https://github.com/openlayers/ol3/pull/6101) - Avoid starting new zoom animation while already animating ([@tschaub](https://github.com/tschaub))
* [#6099](https://github.com/openlayers/ol3/pull/6099) - Modify interaction tests : check for change events ([@tchandelle](https://github.com/tchandelle))
* [#6069](https://github.com/openlayers/ol3/pull/6069) - If there is no features option, all features will be translated. ([@tchandelle](https://github.com/tchandelle))
* [#6097](https://github.com/openlayers/ol3/pull/6097) - API index page : Fix link anchor to static members ([@tchandelle](https://github.com/tchandelle))
* [#6095](https://github.com/openlayers/ol3/pull/6095) - LineString Arrows example: rotate with the view ([@tchandelle](https://github.com/tchandelle))
* [#6093](https://github.com/openlayers/ol3/pull/6093) - Update mustache to version 2.3.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6079](https://github.com/openlayers/ol3/pull/6079) - Add view animation ([@tschaub](https://github.com/tschaub))
* [#6081](https://github.com/openlayers/ol3/pull/6081) - Update metalsmith-layouts to version 1.7.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6074](https://github.com/openlayers/ol3/pull/6074) - Fix typo on style name on Modify Features Test example ([@tchandelle](https://github.com/tchandelle))
* [#6073](https://github.com/openlayers/ol3/pull/6073) - Fix link to errors doc ([@tchandelle](https://github.com/tchandelle))
* [#6072](https://github.com/openlayers/ol3/pull/6072) - Update metalsmith to version 2.3.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6068](https://github.com/openlayers/ol3/pull/6068) - Fix GeoJSON writeGeometry tests ([@ahocevar](https://github.com/ahocevar))
* [#6067](https://github.com/openlayers/ol3/pull/6067) - Do not draw circle when pointer not moved ([@ahocevar](https://github.com/ahocevar))
* [#6064](https://github.com/openlayers/ol3/pull/6064) - Make vertex candidate selection work better on rotated views ([@ahocevar](https://github.com/ahocevar))
* [#6054](https://github.com/openlayers/ol3/pull/6054) - Update eslint to version 3.9.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#6058](https://github.com/openlayers/ol3/pull/6058) - Update fs-extra to version 1.0.0 🚀 ([@openlayers](https://github.com/openlayers))
* [#6053](https://github.com/openlayers/ol3/pull/6053) - Update glob to version 7.1.1 🚀 ([@openlayers](https://github.com/openlayers))
* [#6045](https://github.com/openlayers/ol3/pull/6045) - Add an example using Mapbox Terrain-RGB tiles ([@tschaub](https://github.com/tschaub))
* [#6042](https://github.com/openlayers/ol3/pull/6042) - Set constants of KML format even if a default style is provided ([@oterral](https://github.com/oterral))

View File

@@ -15,11 +15,11 @@
</tr><tr>
<th>Controls</th><th>Interactions</th><th>Sources and formats</th>
</tr><tr>
<td>[Map default controls](ol.control.html#defaults)<br>
<td>[Map default controls](ol.control.html#.defaults)<br>
[All controls](ol.control.html)
</td>
<td>
[Map default interactions](ol.interaction.html#defaults)<br>
[Map default interactions](ol.interaction.html#.defaults)<br>
Interactions for [vector features](ol.Feature.html)
<ul><li>[ol.interaction.Select](ol.interaction.Select.html)</li>
<li>[ol.interaction.Draw](ol.interaction.Draw.html)</li>
@@ -32,9 +32,9 @@ Interactions for [vector features](ol.Feature.html)
<br>[Formats](ol.format.Feature.html) for reading/writing vector data
<br>[ol.format.WMSCapabilities](ol.format.WMSCapabilities.html)</td></tr>
<tr><th>Projections</th><th>Observable objects</th><th>Other components</th></tr>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#transform) and [ol.proj.transformExtent()](ol.proj.html#transformExtent).</p>
<tr><td><p>All coordinates and extents need to be provided in view projection (default: EPSG:3857). To transform, use [ol.proj.transform()](ol.proj.html#.transform) and [ol.proj.transformExtent()](ol.proj.html#.transformExtent).</p>
[ol.proj](ol.proj.html)</td>
<td><p>Changes to all [ol.Objects](ol.Object.html) can observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.ObjectEvent](ol.ObjectEvent.html) with information on the changed property and old value.</p>
<td><p>Changes to all [ol.Objects](ol.Object.html) can observed by calling the [object.on('propertychange')](ol.Object.html#on) method. Listeners receive an [ol.Object.Event](ol.Object.Event.html) with information on the changed property and old value.</p>
<td>[ol.DeviceOrientation](ol.DeviceOrientation.html)<br>
[ol.Geolocation](ol.Geolocation.html)<br>
[ol.Overlay](ol.Overlay.html)<br></td>

View File

@@ -47,7 +47,7 @@ exports.handlers = {
if (!cls.fires) {
cls.fires = [];
}
event = 'ol.ObjectEvent#event:change:' + name;
event = 'ol.Object.Event#event:change:' + name;
if (cls.fires.indexOf(event) == -1) {
cls.fires.push(event);
}

View File

@@ -45,9 +45,11 @@
body {
padding-top: 50px;
}
.nameContainer .name, .prettyprint.source .pln {
.nameContainer .anchor {
padding-top: 50px;
margin-top: -50px;
width: 0px;
height: 0px;
}
a {
position: relative;
@@ -294,6 +296,7 @@ span.type-signature.static {
color: gray;
}
.main .nameContainer h4 {
margin-top: 0px;
margin-right: 150px;
line-height: 1.3;
}

View File

@@ -11,7 +11,9 @@ if (data.type && data.type.names) {
?>
<dt class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
<div class="nameContainer">
<h4 class="name" id="<?js= id ?>">
<div class="anchor" id="<?js= id ?>">
</div>
<h4 class="name">
<?js= data.attribs + (data.scope === 'static' ? longname : name) + typeSignature ?>
<?js= this.partial('stability.tmpl', data) ?>
</h4>

View File

@@ -5,7 +5,9 @@ var self = this;
<dt class="<?js= (data.stability && data.stability !== 'stable') ? 'unstable' : '' ?>">
<div class="nameContainer<?js if (data.inherited) { ?> inherited<?js } ?>">
<?js if (data.stability || kind !== 'class') { ?>
<h4 class="name" id="<?js= id ?>">
<div class="anchor" id="<?js= id ?>">
</div>
<h4 class="name">
<?js= data.attribs + (kind === 'class' ? 'new ' : '') + (data.scope === 'static' ? longname : name) + (kind !== 'event' ? data.signature : '') ?>
<?js if (data.inherited || data.inherits) { ?>
<span class="inherited"><?js= this.linkto(data.inherits, 'inherited') ?></span>

View File

@@ -8,7 +8,7 @@
<th>Name</th>
<th>Type</th>
<th>Settable</th>
<th><a href="ol.ObjectEvent.html">ol.ObjectEvent</a> type</th>
<th><a href="ol.Object.Event.html">ol.Object.Event</a> type</th>
<th class="last">Description</th>
</tr>
</thead>

View File

@@ -9,7 +9,7 @@ If you're eager to get your first OpenLayers 3 map on a page, dive into the [qui
For a more in-depth overview of OpenLayers 3 core concepts, check out the [tutorials](tutorials/).
Make sure to also check out the [OpenLayers 3 workshop](/workshop/en/).
Make sure to also check out the [OpenLayers 3 workshop](/workshop/).
Find additional reference material in the [API docs](../apidoc).

View File

@@ -34,7 +34,7 @@ The library is intended for use on both desktop/laptop and mobile devices.
OL3 uses a similar object hierarchy to the Closure library. There is a top-level `ol` namespace (basically, `var ol = {};`). Subdivisions of this are:
* further namespaces, such as `ol.layer`; these have a lower-case initial
* simple objects containing static properties and methods, such as `ol.animation`; these also have a lower-case initial
* simple objects containing static properties and methods, such as `ol.easing`; these also have a lower-case initial
* types, which have an upper-case initial. These are mainly 'classes', which here means a constructor function with prototypal inheritance, such as `ol.Map` or `ol.layer.Vector` (the Vector class within the layer namespace). There are however other, simpler, types, such as `ol.Extent`, which is an array.
Class namespaces, such as `ol.layer` have a base class type with the same name, such as `ol.layer.Layer`. These are mainly abstract classes, from which the other subclasses inherit.

View File

@@ -7,6 +7,8 @@
"d3": false,
"jsPDF": false,
"jsts": false,
"topolis": false,
"toastr": false,
"saveAs": false,
"topojson": false,
"turf": false

View File

@@ -3,17 +3,17 @@ layout: example.html
title: View Animation
shortdesc: Demonstrates animated pan, zoom, and rotation.
docs: >
This example shows how to use the beforeRender function on the Map to run one
or more animations.
This example shows how to use the <code>view.animate()</code> method to run
one or more animations.
tags: "animation"
---
<div id="map" class="map"></div>
<button id="rotate-left" title="Rotate clockwise"></button>
<button id="rotate-right" title="Rotate counterclockwise"></button>
<button id="rotate-around-rome">Rotate around Rome</button>
<button id="pan-to-london">Pan to London</button>
<button id="elastic-to-moscow">Elastic to Moscow</button>
<button id="bounce-to-istanbul">Bounce to Istanbul</button>
<button id="spin-to-rome">Spin to Rome</button>
<button id="fly-to-bern">Fly to Bern</button>
<button id="spiral-to-madrid">Spiral to Madrid</button>
<button id="rotate-around-rome">Rotate around Rome</button>
<button id="tour">Take a tour</button>

View File

@@ -1,13 +1,35 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.control');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.OSM');
var london = ol.proj.fromLonLat([-0.12755, 51.507222]);
var moscow = ol.proj.fromLonLat([37.6178, 55.7517]);
var istanbul = ol.proj.fromLonLat([28.9744, 41.0128]);
var rome = ol.proj.fromLonLat([12.5, 41.9]);
var bern = ol.proj.fromLonLat([7.4458, 46.95]);
// from https://github.com/DmitryBaranovskiy/raphael
var view = new ol.View({
center: istanbul,
zoom: 6
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
preload: 4,
source: new ol.source.OSM()
})
],
// Improve user experience by loading tiles while animating. Will make
// animations stutter on mobile or slow devices.
loadTilesWhileAnimating: true,
view: view
});
// A bounce easing method (from https://github.com/DmitryBaranovskiy/raphael).
function bounce(t) {
var s = 7.5625, p = 2.75, l;
if (t < (1 / p)) {
@@ -29,159 +51,116 @@ function bounce(t) {
return l;
}
// from https://github.com/DmitryBaranovskiy/raphael
// An elastic easing method (from https://github.com/DmitryBaranovskiy/raphael).
function elastic(t) {
return Math.pow(2, -10 * t) * Math.sin((t - 0.075) * (2 * Math.PI) / 0.3) + 1;
}
var london = ol.proj.fromLonLat([-0.12755, 51.507222]);
var moscow = ol.proj.fromLonLat([37.6178, 55.7517]);
var istanbul = ol.proj.fromLonLat([28.9744, 41.0128]);
var rome = ol.proj.fromLonLat([12.5, 41.9]);
var bern = ol.proj.fromLonLat([7.4458, 46.95]);
var madrid = ol.proj.fromLonLat([-3.683333, 40.4]);
function onClick(id, callback) {
document.getElementById(id).addEventListener('click', callback);
}
var view = new ol.View({
// the view's initial state
center: istanbul,
zoom: 6
onClick('rotate-left', function() {
view.animate({
rotation: view.getRotation() + Math.PI / 2
});
});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
preload: 4,
source: new ol.source.OSM()
})
],
// Improve user experience by loading tiles while animating. Will make
// animations stutter on mobile or slow devices.
loadTilesWhileAnimating: true,
target: 'map',
controls: ol.control.defaults({
attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
collapsible: false
})
}),
view: view
onClick('rotate-right', function() {
view.animate({
rotation: view.getRotation() - Math.PI / 2
});
});
var rotateLeft = document.getElementById('rotate-left');
rotateLeft.addEventListener('click', function() {
var rotateLeft = ol.animation.rotate({
duration: 2000,
rotation: -4 * Math.PI
onClick('rotate-around-rome', function() {
view.animate({
rotation: view.getRotation() + 2 * Math.PI,
anchor: rome
});
map.beforeRender(rotateLeft);
}, false);
var rotateRight = document.getElementById('rotate-right');
rotateRight.addEventListener('click', function() {
var rotateRight = ol.animation.rotate({
duration: 2000,
rotation: 4 * Math.PI
});
map.beforeRender(rotateRight);
}, false);
});
var rotateAroundRome = document.getElementById('rotate-around-rome');
rotateAroundRome.addEventListener('click', function() {
var currentRotation = view.getRotation();
var rotateAroundRome = ol.animation.rotate({
anchor: rome,
duration: 1000,
rotation: currentRotation
onClick('pan-to-london', function() {
view.animate({
center: london,
duration: 2000
});
map.beforeRender(rotateAroundRome);
view.rotate(currentRotation + (Math.PI / 2), rome);
}, false);
});
var panToLondon = document.getElementById('pan-to-london');
panToLondon.addEventListener('click', function() {
var pan = ol.animation.pan({
onClick('elastic-to-moscow', function() {
view.animate({
center: moscow,
duration: 2000,
source: /** @type {ol.Coordinate} */ (view.getCenter())
easing: elastic
});
map.beforeRender(pan);
view.setCenter(london);
}, false);
});
var elasticToMoscow = document.getElementById('elastic-to-moscow');
elasticToMoscow.addEventListener('click', function() {
var pan = ol.animation.pan({
onClick('bounce-to-istanbul', function() {
view.animate({
center: istanbul,
duration: 2000,
easing: elastic,
source: /** @type {ol.Coordinate} */ (view.getCenter())
easing: bounce
});
map.beforeRender(pan);
view.setCenter(moscow);
}, false);
});
var bounceToIstanbul = document.getElementById('bounce-to-istanbul');
bounceToIstanbul.addEventListener('click', function() {
var pan = ol.animation.pan({
duration: 2000,
easing: bounce,
source: /** @type {ol.Coordinate} */ (view.getCenter())
});
map.beforeRender(pan);
view.setCenter(istanbul);
}, false);
var spinToRome = document.getElementById('spin-to-rome');
spinToRome.addEventListener('click', function() {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var rotate = ol.animation.rotate({
duration: duration,
onClick('spin-to-rome', function() {
view.animate({
center: rome,
rotation: 2 * Math.PI,
start: start
duration: 2000
});
map.beforeRender(pan, rotate);
view.setCenter(rome);
}, false);
});
var flyToBern = document.getElementById('fly-to-bern');
flyToBern.addEventListener('click', function() {
function flyTo(location, done) {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var bounce = ol.animation.bounce({
duration: duration,
resolution: 4 * view.getResolution(),
start: start
});
map.beforeRender(pan, bounce);
view.setCenter(bern);
}, false);
var zoom = view.getZoom();
var parts = 2;
var called = false;
function callback(complete) {
--parts;
if (called) {
return;
}
if (parts === 0 || !complete) {
called = true;
done(complete);
}
}
view.animate({
center: location,
duration: duration
}, callback);
view.animate({
zoom: zoom - 1,
duration: duration / 2
}, {
zoom: zoom,
duration: duration / 2
}, callback);
}
var spiralToMadrid = document.getElementById('spiral-to-madrid');
spiralToMadrid.addEventListener('click', function() {
var duration = 2000;
var start = +new Date();
var pan = ol.animation.pan({
duration: duration,
source: /** @type {ol.Coordinate} */ (view.getCenter()),
start: start
});
var bounce = ol.animation.bounce({
duration: duration,
resolution: 2 * view.getResolution(),
start: start
});
var rotate = ol.animation.rotate({
duration: duration,
rotation: -4 * Math.PI,
start: start
});
map.beforeRender(pan, bounce, rotate);
view.setCenter(madrid);
}, false);
onClick('fly-to-bern', function() {
flyTo(bern, function() {});
});
function tour() {
var locations = [london, bern, rome, moscow, istanbul];
var index = -1;
function next(more) {
if (more) {
++index;
if (index < locations.length) {
var delay = index === 0 ? 0 : 750;
setTimeout(function() {
flyTo(locations[index], next);
}, delay);
} else {
alert('Tour complete');
}
} else {
alert('Tour cancelled');
}
}
next(true);
}
onClick('tour', tour);

View File

@@ -6,7 +6,7 @@ docs: >
<p>When the Bing Maps tile service doesn't have tiles for a given resolution and region it returns "placeholder" tiles indicating that. Zoom the map beyond level 19 to see the "placeholder" tiles. If you want OpenLayers to display stretched tiles in place of "placeholder" tiles beyond zoom level 19 then set <code>maxZoom</code> to <code>19</code> in the options passed to <code>ol.source.BingMaps</code>.</p>
tags: "bing, bing-maps"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<select id="layer-select">

View File

@@ -18,7 +18,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) {
visible: false,
preload: Infinity,
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: styles[i]
// use maxZoom 19 to see stretched tiles instead of the BingMaps
// "no photos at this zoom level" tiles

View File

@@ -1,5 +1,6 @@
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.extent');
goog.require('ol.format.GeoJSON');
goog.require('ol.has');
goog.require('ol.layer.Vector');
@@ -20,11 +21,11 @@ var pixelRatio = ol.has.DEVICE_PIXEL_RATIO;
function gradient(feature, resolution) {
var extent = feature.getGeometry().getExtent();
// Gradient starts on the left edge of each feature, and ends on the right.
// Coordinate origin is [0, 0], so we just divide by resolution and multiply
// with pixelRatio to match the renderer's pixel coordinate system.
var grad = context.createLinearGradient(
extent[0] / resolution * pixelRatio, 0,
extent[2] / resolution * pixelRatio, 0);
// Coordinate origin is the top-left corner of the extent of the geometry, so
// we just divide the geometry's extent width by resolution and multiply with
// pixelRatio to match the renderer's pixel coordinate system.
var grad = context.createLinearGradient(0, 0,
ol.extent.getWidth(extent) / resolution * pixelRatio, 0);
grad.addColorStop(0, 'red');
grad.addColorStop(1 / 6, 'orange');
grad.addColorStop(2 / 6, 'yellow');

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the drag-and-drop interaction with a ol.source.ImageVector. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. Each file is rendered to an image on the client.
tags: "drag-and-drop-image-vector, gpx, geojson, igc, kml, topojson, vector, image"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -100,7 +100,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
})
],

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the drag-and-drop interaction. Drag and drop GPX, GeoJSON, IGC, KML, or TopoJSON files on to the map. There is no projection transform support, so this will only work with data in EPSG:4326 and EPSG:3857.
tags: "drag-and-drop, gpx, geojson, igc, kml, topojson"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -99,7 +99,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
})
],

View File

@@ -7,6 +7,8 @@ docs: >
animate a (marker) feature along a line. In this example an encoded polyline
is being used.
tags: "animation, feature, postcompose, polyline"
cloak:
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<label for="speed">

View File

@@ -140,7 +140,7 @@ var map = new ol.Map({
new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'AerialWithLabels',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
}),
vectorLayer

View File

@@ -7,6 +7,6 @@ docs: >
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
tags: "full-screen, drag, rotate, zoom, bing, bing-maps"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
})

View File

@@ -7,6 +7,6 @@ docs: >
<p>If there is no button on the map, your browser does not support the <a href="http://caniuse.com/#feat=fullscreen">Full Screen API</a>.</p>
tags: "full-screen, bing, bing-maps"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -18,7 +18,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
})

View File

@@ -130,26 +130,6 @@ function addPosition(position, heading, m, speed) {
}
}
var previousM = 0;
// change center and rotation before render
map.beforeRender(function(map, frameState) {
if (frameState !== null) {
// use sampling period to get a smooth transition
var m = frameState.time - deltaMean * 1.5;
m = Math.max(m, previousM);
previousM = m;
// interpolate position along positions LineString
var c = positions.getCoordinateAtM(m, true);
var view = frameState.viewState;
if (c) {
view.center = getCenterWithHeading(c, -c[2], view.resolution);
view.rotation = -c[2];
marker.setPosition(c);
}
}
return true; // Force animation to continue
});
// recenters the view by putting the given coordinates at 3/4 from the top or
// the screen
function getCenterWithHeading(position, rotation, resolution) {
@@ -162,9 +142,19 @@ function getCenterWithHeading(position, rotation, resolution) {
];
}
// postcompose callback
function render() {
map.render();
var previousM = 0;
function updateView() {
// use sampling period to get a smooth transition
var m = Date.now() - deltaMean * 1.5;
m = Math.max(m, previousM);
previousM = m;
// interpolate position along positions LineString
var c = positions.getCoordinateAtM(m, true);
if (c) {
view.setCenter(getCenterWithHeading(c, -c[2], view.getResolution()));
view.setRotation(-c[2]);
marker.setPosition(c);
}
}
// geolocate device
@@ -172,7 +162,7 @@ var geolocateBtn = document.getElementById('geolocate');
geolocateBtn.addEventListener('click', function() {
geolocation.setTracking(true); // Start position tracking
map.on('postcompose', render);
map.on('postcompose', updateView);
map.render();
disableButtons();
@@ -214,7 +204,7 @@ simulateBtn.addEventListener('click', function() {
}
geolocate();
map.on('postcompose', render);
map.on('postcompose', updateView);
map.render();
disableButtons();

View File

@@ -6,7 +6,7 @@ docs: >
Example of using the GPX source.
tags: "GPX"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -13,7 +13,7 @@ goog.require('ol.style.Style');
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});

View File

@@ -8,7 +8,7 @@ docs: >
In this example, the <code>postcompose</code> listener applies a filter to the image data.</p>
tags: "filter, image manipulation"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<select id="kernel" name="kernel">

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
var imagery = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})

View File

@@ -6,7 +6,7 @@ docs: >
This example uses the <code>ol.format.KML</code> to parse KML for rendering with a vector source.
tags: "KML"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<div id="info">&nbsp;</div>

View File

@@ -12,7 +12,7 @@ var projection = ol.proj.get('EPSG:3857');
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});

View File

@@ -10,6 +10,6 @@ docs: >
<p>Move around the map to see the effect. Use the ↑ up and ↓ down arrow keys to adjust the spyglass size.</p>
tags: "spy, image manipulation"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -4,7 +4,7 @@ goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.BingMaps');
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
var roads = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Road'})

View File

@@ -6,7 +6,7 @@ docs: >
Example of a Layer swipe map.
tags: "swipe, openstreetmap"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>
<input id="swipe" type="range" style="width: 100%">

View File

@@ -10,7 +10,7 @@ var osm = new ol.layer.Tile({
});
var bing = new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
});

View File

@@ -38,7 +38,7 @@ var styleFunction = function(feature) {
image: new ol.style.Icon({
src: 'data/arrow.png',
anchor: [0.75, 0.5],
rotateWithView: false,
rotateWithView: true,
rotation: -rotation
})
}));

View File

@@ -4,7 +4,7 @@ title: Full-Screen Mobile
shortdesc: Example of a full screen map.
tags: "fullscreen, geolocation, mobile"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<!doctype html>
<html lang="en">

View File

@@ -14,7 +14,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Road'
})
})

View File

@@ -29,7 +29,7 @@ var styleFunction = (function() {
color: 'rgba(0, 0, 255, 0.1)'
})
});
styles['MultiLinestring'] = new ol.style.Style({
styles['MultiLineString'] = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'green',
width: 3

11
examples/pinch-zoom.html Normal file
View File

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

25
examples/pinch-zoom.js Normal file
View File

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

View File

@@ -6,7 +6,7 @@ docs: >
<p>The map on the top preloads low resolution tiles. The map on the bottom does not use any preloading. Try zooming out and panning to see the difference.</p>
tags: "preload, bing"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map1" class="map"></div>
<div id="map2" class="map"></div>

View File

@@ -14,7 +14,7 @@ var map1 = new ol.Map({
new ol.layer.Tile({
preload: Infinity,
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
})
@@ -28,7 +28,7 @@ var map2 = new ol.Map({
new ol.layer.Tile({
preload: 0, // default value
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'AerialWithLabels'
})
})

View File

@@ -22,7 +22,7 @@ tags: "raster, pixel"
resources:
- https://d3js.org/d3.v3.min.js
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div class="rel">
<div id="map" class="map"></div>

View File

@@ -50,7 +50,7 @@ function summarize(value, counts) {
* Use aerial imagery as the input data for the raster source.
*/
var bing = new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
});

View File

@@ -25,7 +25,7 @@ docs: >
</p>
tags: "raster, region growing"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map" style="cursor: pointer"></div>
<table class="controls">

View File

@@ -72,7 +72,7 @@ function next4Edges(edge) {
];
}
var key = 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF';
var key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
var imagery = new ol.layer.Tile({
source: new ol.source.BingMaps({key: key, imagerySet: 'Aerial'})

9
examples/sea-level.css Normal file
View File

@@ -0,0 +1,9 @@
#level {
display: inline-block;
width: 150px;
vertical-align: text-bottom;
}
a.location {
cursor: pointer;
}

26
examples/sea-level.html Normal file
View File

@@ -0,0 +1,26 @@
---
layout: example.html
title: Sea Level
shortdesc: Render sea level at different elevations
docs: >
<p>
This example uses a <code>ol.source.Raster</code> with
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
to "flood" areas below the elevation shown on the sea level slider.
</p>
tags: "raster, pixel operation, flood"
cloak:
pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>
<label>
Sea level
<input id="level" type="range" min="0" max="100" value="1"/>
+<span id="output"></span> m
</label>
<br>
Go to
<a class="location" data-center="-122.3267,37.8377" data-zoom="11">San Francisco</a>,
<a class="location" data-center="-73.9338,40.6861" data-zoom="11">New York</a>,
<a class="location" data-center="72.9481,18.9929" data-zoom="11">Mumbai</a>, or
<a class="location" data-center="120.831,31.160" data-zoom="9">Shanghai</a>

78
examples/sea-level.js Normal file
View File

@@ -0,0 +1,78 @@
// NOCOMPILE
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
goog.require('ol.proj');
goog.require('ol.source.Raster');
goog.require('ol.source.XYZ');
function flood(pixels, data) {
var pixel = pixels[0];
if (pixel[3]) {
var height = -10000 + ((pixel[0] * 256 * 256 + pixel[1] * 256 + pixel[2]) * 0.1);
if (height <= data.level) {
pixel[0] = 145;
pixel[1] = 175;
pixel[2] = 186;
pixel[3] = 255;
} else {
pixel[3] = 0;
}
}
return pixel;
}
var key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
var elevation = new ol.source.XYZ({
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
crossOrigin: 'anonymous'
});
var raster = new ol.source.Raster({
sources: [elevation],
operation: flood
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.XYZ({
url: 'https://api.mapbox.com/styles/v1/tschaub/ciutc102t00c62js5fqd47kqw/tiles/256/{z}/{x}/{y}?access_token=' + key
})
}),
new ol.layer.Image({
opacity: 0.6,
source: raster
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-122.3267, 37.8377]),
zoom: 11
})
});
var control = document.getElementById('level');
var output = document.getElementById('output');
control.addEventListener('input', function() {
output.innerText = control.value;
raster.changed();
});
output.innerText = control.value;
raster.on('beforeoperations', function(event) {
event.data.level = control.value;
});
var locations = document.getElementsByClassName('location');
for (var i = 0, ii = locations.length; i < ii; ++i) {
locations[i].addEventListener('click', relocate);
}
function relocate(event) {
var data = event.target.dataset;
var view = map.getView();
view.setCenter(ol.proj.fromLonLat(data.center.split(',').map(Number)));
view.setZoom(Number(data.zoom));
}

View File

@@ -18,5 +18,13 @@ tags: "select, vector"
<option value="altclick">Alt+Click</option>
<option value="none">None</option>
</select>
<span id="status">&nbsp;0 selected features</span>
<span id="status">&nbsp;0 selected features</span>
<br />
<label>Hit tolerance for selecting features </label>
<select id="hitTolerance" class="form-control">
<option value="0" selected>0 Pixels</option>
<option value="5">5 Pixels</option>
<option value="10">10 Pixels</option>
</select>
<canvas id="circle" style="vertical-align: middle"/>
</form>

View File

@@ -31,23 +31,28 @@ var map = new ol.Map({
var select = null; // ref to currently selected interaction
// select interaction working on "singleclick"
var selectSingleClick = new ol.interaction.Select();
var selectSingleClick = new ol.interaction.Select({
multi: true // multi is used in this example if hitTolerance > 0
});
// select interaction working on "click"
var selectClick = new ol.interaction.Select({
condition: ol.events.condition.click
condition: ol.events.condition.click,
multi: true
});
// select interaction working on "pointermove"
var selectPointerMove = new ol.interaction.Select({
condition: ol.events.condition.pointerMove
condition: ol.events.condition.pointerMove,
multi: true
});
var selectAltClick = new ol.interaction.Select({
condition: function(mapBrowserEvent) {
return ol.events.condition.click(mapBrowserEvent) &&
ol.events.condition.altKeyOnly(mapBrowserEvent);
}
},
multi: true
});
var selectElement = document.getElementById('type');
@@ -85,3 +90,27 @@ var changeInteraction = function() {
*/
selectElement.onchange = changeInteraction;
changeInteraction();
var selectHitToleranceElement = document.getElementById('hitTolerance');
var circleCanvas = document.getElementById('circle');
var changeHitTolerance = function() {
var value = parseInt(selectHitToleranceElement.value, 10);
selectSingleClick.setHitTolerance(value);
selectClick.setHitTolerance(value);
selectPointerMove.setHitTolerance(value);
selectAltClick.setHitTolerance(value);
var size = 2 * value + 2;
circleCanvas.width = size;
circleCanvas.height = size;
var ctx = circleCanvas.getContext('2d');
ctx.clearRect(0, 0, size, size);
ctx.beginPath();
ctx.arc(value + 1, value + 1, value + 0.5, 0, 2 * Math.PI);
ctx.fill();
ctx.stroke();
};
selectHitToleranceElement.onchange = changeHitTolerance;
changeHitTolerance();

View File

@@ -0,0 +1,7 @@
@media (min-width: 800px) {
.half {
padding: 0 10px;
width: 50%;
float: left;
}
}

View File

@@ -6,10 +6,14 @@ docs: >
Two maps (one with the Canvas renderer, one with the WebGL renderer) share the same center, resolution, rotation and layers.
tags: "side-by-side, canvas, webgl"
---
<h4>Canvas</h4>
<div id="canvasMap" class="map"></div>
<h4>WebGL</h4>
<div id="webglMap" class="map"></div>
<div id="no-webgl" class="alert alert-danger" style="display: none">
This map requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
<div class="half">
<h4>Canvas</h4>
<div id="canvasMap" class="map"></div>
</div>
<div class="half">
<h4>WebGL</h4>
<div id="webglMap" class="map"></div>
<div id="no-webgl" class="alert alert-danger" style="display: none">
This map requires a browser that supports <a href="http://get.webgl.org/">WebGL</a>.
</div>
</div>

15
examples/topolis.html Normal file
View File

@@ -0,0 +1,15 @@
---
layout: example.html
title: topolis integration
shortdesc: Example on how to use topolis with OpenLayers 3.
docs: >
Example showing the integration of <a href="https://github.com/bjornharrtell/topolis">topolis</a>
with OpenLayers 3, enabling creating and editing topological geometry. Standard interaction draws edges, snapping to existing edges. Delete an edge by drawing a new edge crossing the one to delete.
tags: "draw, edit, vector, topology, topolis"
resources:
- https://cdn.rawgit.com/bjornharrtell/topolis/releases/0.1.1/topolis.min.js
- https://code.jquery.com/jquery-3.1.1.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.js
- https://cdnjs.cloudflare.com/ajax/libs/toastr.js/2.1.3/toastr.min.css
---
<div id="map" class="map"></div>

216
examples/topolis.js Normal file
View File

@@ -0,0 +1,216 @@
// NOCOMPILE
// this example uses topolis and toastr for which we don't have an externs file.
goog.require('ol.Feature');
goog.require('ol.Map');
goog.require('ol.View');
goog.require('ol.geom.Point');
goog.require('ol.geom.LineString');
goog.require('ol.geom.Polygon');
goog.require('ol.interaction.Draw');
goog.require('ol.interaction.Snap');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Vector');
goog.require('ol.source.OSM');
goog.require('ol.source.Vector');
goog.require('ol.style.Style');
goog.require('ol.style.Stroke');
goog.require('ol.style.Fill');
goog.require('ol.style.Circle');
goog.require('ol.style.Text');
goog.require('ol.control.MousePosition');
var raster = new ol.layer.Tile({
source: new ol.source.OSM()
});
var nodes = new ol.source.Vector({wrapX: false});
var nodesLayer = new ol.layer.Vector({
source: nodes,
style: function(f) {
var style = new ol.style.Style({
image: new ol.style.Circle({
radius: 8,
fill: new ol.style.Fill({color: 'rgba(255, 0, 0, 0.2)'}),
stroke: new ol.style.Stroke({color: 'red', width: 1})
}),
text: new ol.style.Text({
text: f.get('node').id.toString(),
fill: new ol.style.Fill({color: 'red'}),
stroke: new ol.style.Stroke({
color: 'white',
width: 3
})
})
});
return [style];
}
});
var edges = new ol.source.Vector({wrapX: false});
var edgesLayer = new ol.layer.Vector({
source: edges,
style: function(f) {
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'blue',
width: 1
}),
text: new ol.style.Text({
text: f.get('edge').id.toString(),
fill: new ol.style.Fill({color: 'blue'}),
stroke: new ol.style.Stroke({
color: 'white',
width: 2
})
})
});
return [style];
}
});
var faces = new ol.source.Vector({wrapX: false});
var facesLayer = new ol.layer.Vector({
source: faces,
style: function(f) {
var style = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'black',
width: 1
}),
fill: new ol.style.Fill({
color: 'rgba(0, 255, 0, 0.2)'
}),
text: new ol.style.Text({
font: 'bold 12px sans-serif',
text: f.get('face').id.toString(),
fill: new ol.style.Fill({color: 'green'}),
stroke: new ol.style.Stroke({
color: 'white',
width: 2
})
})
});
return [style];
}
});
var map = new ol.Map({
layers: [raster, facesLayer, edgesLayer, nodesLayer],
target: 'map',
view: new ol.View({
center: [-11000000, 4600000],
zoom: 16
})
});
var topo = topolis.createTopology();
topo.on('addnode', nodeToFeature);
topo.on('removenode', function(e) {
removeElementFeature(nodes, e);
});
topo.on('addedge', edgeToFeature);
topo.on('modedge', function(e) {
var feature = edges.getFeatureById(e.id);
feature.setGeometry(new ol.geom.LineString(e.coordinates));
});
topo.on('removeedge', function(e) {
removeElementFeature(edges, e);
});
topo.on('addface', faceToFeature);
topo.on('removeface', function(e) {
removeElementFeature(faces, e);
});
function removeElementFeature(source, element) {
var feature = source.getFeatureById(element.id);
source.removeFeature(feature);
}
function nodeToFeature(node) {
var feature = new ol.Feature({
geometry: new ol.geom.Point(node.coordinate),
node: node
});
feature.setId(node.id);
nodes.addFeature(feature);
}
function edgeToFeature(edge) {
var feature = new ol.Feature({
geometry: new ol.geom.LineString(edge.coordinates),
edge: edge
});
feature.setId(edge.id);
edges.addFeature(feature);
}
function faceToFeature(face) {
var coordinates = topo.getFaceGeometry(face);
var feature = new ol.Feature({
geometry: new ol.geom.Polygon(coordinates),
face: face
});
feature.setId(face.id);
faces.addFeature(feature);
}
function createNode(topo, coord) {
var node;
var existingEdge = topo.getEdgeByPoint(coord, 5)[0];
if (existingEdge) {
node = topo.modEdgeSplit(existingEdge, coord);
} else {
node = topo.addIsoNode(coord);
}
return node;
}
function onDrawend(e) {
var edgeGeom = e.feature.getGeometry().getCoordinates();
var startCoord = edgeGeom[0];
var endCoord = edgeGeom[edgeGeom.length - 1];
var start, end;
try {
start = topo.getNodeByPoint(startCoord);
end = topo.getNodeByPoint(endCoord);
var edgesAtStart = topo.getEdgeByPoint(startCoord, 5);
var edgesAtEnd = topo.getEdgeByPoint(endCoord, 5);
var crossing = topo.getEdgesByLine(edgeGeom);
if (crossing.length === 1 && !start && !end && edgesAtStart.length === 0 && edgesAtEnd.length === 0) {
topo.remEdgeNewFace(crossing[0]);
start = crossing[0].start;
if (start.face) {
topo.removeIsoNode(start);
}
end = crossing[0].end;
if (end.face) {
topo.removeIsoNode(end);
}
return;
}
if (!start) {
start = createNode(topo, startCoord);
edgeGeom[0] = start.coordinate;
}
if (!end) {
end = createNode(topo, endCoord);
edgeGeom[edgeGeom.length - 1] = end.coordinate;
}
topo.addEdgeNewFaces(start, end, edgeGeom);
} catch (e) {
toastr.warning(e.toString());
}
}
var draw = new ol.interaction.Draw({
type: 'LineString'
});
draw.on('drawend', onDrawend);
map.addInteraction(draw);
var snap = new ol.interaction.Snap({
source: edges
});
map.addInteraction(snap);
map.addControl(new ol.control.MousePosition());

View File

@@ -6,6 +6,6 @@ docs: >
OSM XML vector data is loaded dynamically from a the [Overpass API](http://overpass-api.de) using a bbox strategy. Note that panning and zooming will eventually lead to "Too many requests" errors from the Overpass API.
tags: "vector, osmxml, loading, server, strategy, bbox"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -119,7 +119,7 @@ var vector = new ol.layer.Vector({
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});

View File

@@ -8,6 +8,6 @@ docs: >
that match the query.
tags: "vector, WFS, GetFeature, filter"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -25,7 +25,7 @@ var vector = new ol.layer.Vector({
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});

View File

@@ -6,6 +6,6 @@ docs: >
This example loads new features from GeoServer WFS when the view extent changes.
tags: "vector, WFS, bbox, loading, server"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -35,7 +35,7 @@ var vector = new ol.layer.Vector({
var raster = new ol.layer.Tile({
source: new ol.source.BingMaps({
imagerySet: 'Aerial',
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF'
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
});

View File

@@ -6,6 +6,6 @@ docs: >
This map has a view that is constrained between zoom levels 9 and 13. This is done using the `minZoom` and `maxZoom` view options.
tags: "bing, zoom, minZoom, maxZoom"
cloak:
AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF: Your Bing Maps Key from http://www.bingmapsportal.com/ here
As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5: Your Bing Maps Key from http://www.bingmapsportal.com/ here
---
<div id="map" class="map"></div>

View File

@@ -9,7 +9,7 @@ var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.BingMaps({
key: 'AkGbxXx6tDWf1swIhPJyoAVp06H0s0gDTYslNWWHZ6RoPqMpB9ld5FY1WutX8UoF',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Aerial'
})
})

View File

@@ -109,22 +109,28 @@ oli.ModifyEvent.prototype.features;
oli.ModifyEvent.prototype.mapBrowserEvent;
/**
* @type {Object}
*/
oli.Object;
/**
* @interface
*/
oli.ObjectEvent = function() {};
oli.Object.Event = function() {};
/**
* @type {string}
*/
oli.ObjectEvent.prototype.key;
oli.Object.Event.prototype.key;
/**
* @type {*}
*/
oli.ObjectEvent.prototype.oldValue;
oli.Object.Event.prototype.oldValue;
/**

View File

@@ -302,6 +302,36 @@ olx.MapOptions.prototype.target;
olx.MapOptions.prototype.view;
/**
* Object literal with options for the {@link ol.Map#forEachFeatureAtPixel} and
* {@link ol.Map#hasFeatureAtPixel} methods.
* @typedef {{layerFilter: ((function(ol.layer.Layer): boolean)|undefined),
* hitTolerance: (number|undefined)}}
*/
olx.AtPixelOptions;
/**
* Layer filter function. The filter function will receive one argument, the
* {@link ol.layer.Layer layer-candidate} and it should return a boolean value.
* Only layers which are visible and for which this function returns `true`
* will be tested for features. By default, all visible layers will be tested.
* @type {((function(ol.layer.Layer): boolean)|undefined)}
* @api stable
*/
olx.AtPixelOptions.prototype.layerFilter;
/**
* Hit-detection tolerance in pixels. Pixels inside the radius around the given position
* will be checked for features. This only works for the canvas renderer and
* not for WebGL.
* @type {number|undefined}
* @api
*/
olx.AtPixelOptions.prototype.hitTolerance;
/**
* Object literal with config options for the overlay.
* @typedef {{id: (number|string|undefined),
@@ -312,7 +342,7 @@ olx.MapOptions.prototype.view;
* stopEvent: (boolean|undefined),
* insertFirst: (boolean|undefined),
* autoPan: (boolean|undefined),
* autoPanAnimation: (olx.animation.PanOptions|undefined),
* autoPanAnimation: (olx.OverlayPanOptions|undefined),
* autoPanMargin: (number|undefined)}}
*/
olx.OverlayOptions;
@@ -398,10 +428,10 @@ olx.OverlayOptions.prototype.autoPan;
/**
* The options used to create a `ol.animation.pan` animation. This animation
* is only used when `autoPan` is enabled. By default the default options for
* `ol.animation.pan` are used. If set to `null` the panning is not animated.
* @type {olx.animation.PanOptions|undefined}
* The animation options used to pan the overlay into view. This animation
* is only used when `autoPan` is enabled. A `duration` and `easing` may be
* provided to customize the animation.
* @type {olx.OverlayPanOptions|undefined}
* @api
*/
olx.OverlayOptions.prototype.autoPanAnimation;
@@ -416,6 +446,32 @@ olx.OverlayOptions.prototype.autoPanAnimation;
olx.OverlayOptions.prototype.autoPanMargin;
/**
* @typedef {{
* duration: (number|undefined),
* easing: (undefined|function(number):number)
* }}
*/
olx.OverlayPanOptions;
/**
* The duration of the animation in milliseconds. Default is `1000`.
* @type {number|undefined}
* @api
*/
olx.OverlayPanOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.inAndOut}.
* @type {undefined|function(number):number}
* @api
*/
olx.OverlayPanOptions.prototype.easing;
/**
* Object literal with config options for the projection.
* @typedef {{code: string,
@@ -661,6 +717,81 @@ olx.ViewOptions.prototype.zoom;
olx.ViewOptions.prototype.zoomFactor;
/**
* @typedef {{
* center: (ol.Coordinate|undefined),
* zoom: (number|undefined),
* resolution: (number|undefined),
* rotation: (number|undefined),
* anchor: (ol.Coordinate|undefined),
* duration: (number|undefined),
* easing: (undefined|function(number):number)
* }}
*/
olx.AnimationOptions;
/**
* The center of the view at the end of the animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.center;
/**
* The zoom level of the view at the end of the animation. This takes
* precedence over `resolution`.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.zoom;
/**
* The resolution of the view at the end of the animation. If `zoom` is also
* provided, this option will be ignored.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.resolution;
/**
* The rotation of the view at the end of the animation.
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.rotation;
/**
* Optional anchor to remained fixed during a rotation or resolution animation.
* @type {ol.Coordinate|undefined}
* @api
*/
olx.AnimationOptions.prototype.anchor;
/**
* The duration of the animation in milliseconds (defaults to `1000`).
* @type {number|undefined}
* @api
*/
olx.AnimationOptions.prototype.duration;
/**
* The easing function used during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
* @type {undefined|function(number):number}
* @api
*/
olx.AnimationOptions.prototype.easing;
/**
* Namespace.
* @type {Object}
@@ -672,7 +803,7 @@ olx.animation;
* @typedef {{resolution: number,
* start: (number|undefined),
* duration: (number|undefined),
* easing: (function(number):number|undefined)}}
* easing: (undefined|function(number):number)}}
*/
olx.animation.BounceOptions;
@@ -705,7 +836,7 @@ olx.animation.BounceOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.upAndDown}.
* @type {function(number):number|undefined}
* @type {undefined|function(number):number}
* @api
*/
olx.animation.BounceOptions.prototype.easing;
@@ -715,7 +846,7 @@ olx.animation.BounceOptions.prototype.easing;
* @typedef {{source: ol.Coordinate,
* start: (number|undefined),
* duration: (number|undefined),
* easing: (function(number):number|undefined)}}
* easing: (undefined|function(number):number)}}
*/
olx.animation.PanOptions;
@@ -747,7 +878,7 @@ olx.animation.PanOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.inAndOut}.
* @type {function(number):number|undefined}
* @type {undefined|function(number):number}
* @api
*/
olx.animation.PanOptions.prototype.easing;
@@ -758,7 +889,7 @@ olx.animation.PanOptions.prototype.easing;
* anchor: (ol.Coordinate|undefined),
* start: (number|undefined),
* duration: (number|undefined),
* easing: (function(number):number|undefined)}}
* easing: (undefined|function(number):number)}}
*/
olx.animation.RotateOptions;
@@ -800,7 +931,7 @@ olx.animation.RotateOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.inAndOut}.
* @type {function(number):number|undefined}
* @type {undefined|function(number):number}
* @api
*/
olx.animation.RotateOptions.prototype.easing;
@@ -810,7 +941,7 @@ olx.animation.RotateOptions.prototype.easing;
* @typedef {{resolution: number,
* start: (number|undefined),
* duration: (number|undefined),
* easing: (function(number):number|undefined)}}
* easing: (undefined|function(number):number)}}
*/
olx.animation.ZoomOptions;
@@ -843,7 +974,7 @@ olx.animation.ZoomOptions.prototype.duration;
/**
* The easing function to use. Can be an {@link ol.easing} or a custom function.
* Default is {@link ol.easing.inAndOut}.
* @type {function(number):number|undefined}
* @type {undefined|function(number):number}
* @api
*/
olx.animation.ZoomOptions.prototype.easing;
@@ -2770,7 +2901,8 @@ olx.interaction.ExtentOptions.prototype.wrapX;
/**
* @typedef {{
* features: (ol.Collection.<ol.Feature>|undefined),
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean)
* layers: (undefined|Array.<ol.layer.Layer>|function(ol.layer.Layer): boolean),
* hitTolerance: (number|undefined)
* }}
*/
olx.interaction.TranslateOptions;
@@ -2797,6 +2929,16 @@ olx.interaction.TranslateOptions.prototype.features;
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.
* @type {number|undefined}
* @api
*/
olx.interaction.TranslateOptions.prototype.hitTolerance;
/**
* @typedef {{condition: (ol.EventsConditionType|undefined),
* duration: (number|undefined),
@@ -2935,6 +3077,7 @@ olx.interaction.ModifyOptions.prototype.wrapX;
/**
* @typedef {{duration: (number|undefined),
* timeout: (number|undefined),
* useAnchor: (boolean|undefined)}}
*/
olx.interaction.MouseWheelZoomOptions;
@@ -2948,6 +3091,14 @@ olx.interaction.MouseWheelZoomOptions;
olx.interaction.MouseWheelZoomOptions.prototype.duration;
/**
* Mouse wheel timeout duration in milliseconds. Default is `80`.
* @type {number|undefined}
* @api
*/
olx.interaction.MouseWheelZoomOptions.prototype.timeout;
/**
* Enable zooming using the mouse's location as the anchor. Default is `true`.
* When set to false, zooming in and out will zoom to the center of the screen
@@ -2994,6 +3145,13 @@ olx.interaction.PinchZoomOptions;
*/
olx.interaction.PinchZoomOptions.prototype.duration;
/**
* Zoom to the closest integer zoom level after the pinch gesture ends. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.interaction.PinchZoomOptions.prototype.constrainResolution;
/**
* @typedef {{handleDownEvent: (function(ol.MapBrowserPointerEvent):boolean|undefined),
@@ -3063,7 +3221,8 @@ olx.interaction.PointerOptions.prototype.handleUpEvent;
* multi: (boolean|undefined),
* features: (ol.Collection.<ol.Feature>|undefined),
* filter: (ol.SelectFilterFunction|undefined),
* wrapX: (boolean|undefined)}}
* wrapX: (boolean|undefined),
* hitTolerance: (number|undefined)}}
*/
olx.interaction.SelectOptions;
@@ -3177,6 +3336,16 @@ olx.interaction.SelectOptions.prototype.filter;
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.
* @type {number|undefined}
* @api
*/
olx.interaction.SelectOptions.prototype.hitTolerance;
/**
* Options for snap
* @typedef {{
@@ -3843,6 +4012,7 @@ olx.layer.VectorOptions.prototype.visible;
* minResolution: (number|undefined),
* maxResolution: (number|undefined),
* opacity: (number|undefined),
* preload: (number|undefined),
* renderBuffer: (number|undefined),
* renderMode: (ol.layer.VectorTile.RenderType|string|undefined),
* renderOrder: (function(ol.Feature, ol.Feature):number|undefined),
@@ -3937,6 +4107,15 @@ olx.layer.VectorTileOptions.prototype.maxResolution;
olx.layer.VectorTileOptions.prototype.opacity;
/**
* Preload. Load low-resolution tiles up to `preload` levels. By default
* `preload` is `0`, which means no preloading.
* @type {number|undefined}
* @api stable
*/
olx.layer.VectorTileOptions.prototype.preload;
/**
* Source.
* @type {ol.source.VectorTile|undefined}
@@ -4025,6 +4204,7 @@ olx.source;
/**
* @typedef {{cacheSize: (number|undefined),
* culture: (string|undefined),
* hidpi: (boolean|undefined),
* key: string,
* imagerySet: string,
* maxZoom: (number|undefined),
@@ -4043,6 +4223,14 @@ olx.source.BingMapsOptions;
olx.source.BingMapsOptions.prototype.cacheSize;
/**
* If `true` hidpi tiles will be requested. Default is `false`.
* @type {boolean|undefined}
* @api
*/
olx.source.BingMapsOptions.prototype.hidpi;
/**
* Culture code. Default is `en-us`.
* @type {string|undefined}
@@ -5138,7 +5326,7 @@ olx.source.ImageVectorOptions.prototype.style;
* operation: (ol.RasterOperation|undefined),
* lib: (Object|undefined),
* threads: (number|undefined),
* operationType: (ol.RasterOperationType|undefined)}}
* operationType: (ol.source.Raster.OperationType|undefined)}}
* @api
*/
olx.source.RasterOptions;
@@ -5186,7 +5374,7 @@ olx.source.RasterOptions.prototype.threads;
* `'pixel'` operations are assumed, and operations will be called with an
* array of pixels from input sources. If set to `'image'`, operations will
* be called with an array of ImageData objects from input sources.
* @type {ol.RasterOperationType|undefined}
* @type {ol.source.Raster.OperationType|undefined}
* @api
*/
olx.source.RasterOptions.prototype.operationType;
@@ -7443,7 +7631,10 @@ olx.view;
* constrainResolution: (boolean|undefined),
* nearest: (boolean|undefined),
* maxZoom: (number|undefined),
* minResolution: (number|undefined)}}
* minResolution: (number|undefined),
* duration: (number|undefined),
* easing: (undefined|function(number):number)
* }}
*/
olx.view.FitOptions;
@@ -7490,6 +7681,26 @@ olx.view.FitOptions.prototype.minResolution;
olx.view.FitOptions.prototype.maxZoom;
/**
* The duration of the animation in milliseconds. By default, there is no
* animations.
* @type {number|undefined}
* @api
*/
olx.view.FitOptions.prototype.duration;
/**
* The easing function used during the animation (defaults to {@link ol.easing.inAndOut}).
* The function will be called for each frame with a number representing a
* fraction of the animation's duration. The function should return a number
* between 0 and 1 representing the progress toward the destination state.
* @type {undefined|function(number):number}
* @api
*/
olx.view.FitOptions.prototype.easing;
/* typedefs for object literals exposed by the library */

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,28 +0,0 @@
Redistribution and use of this software in source and binary forms, with or
without modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of Yahoo! Inc. nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of Yahoo! Inc.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -1,18 +0,0 @@
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,6 +1,6 @@
{
"name": "openlayers",
"version": "3.19.0",
"version": "3.20.0",
"description": "Build tools and sources for developing OpenLayers based mapping applications",
"keywords": [
"map",
@@ -30,19 +30,19 @@
"css/ol.css"
],
"dependencies": {
"async": "2.1.2",
"browserify": "13.1.0",
"async": "2.1.4",
"browserify": "13.1.1",
"closure-util": "1.15.1",
"derequire": "2.0.3",
"fs-extra": "0.30.0",
"glob": "7.1.0",
"handlebars": "4.0.5",
"fs-extra": "1.0.0",
"glob": "7.1.1",
"handlebars": "4.0.6",
"jsdoc": "3.4.2",
"marked": "0.3.6",
"metalsmith": "2.2.0",
"metalsmith-layouts": "1.6.5",
"metalsmith": "2.3.0",
"metalsmith-layouts": "1.7.0",
"nomnom": "1.8.1",
"pbf": "3.0.2",
"pbf": "3.0.5",
"pixelworks": "1.1.0",
"rbush": "2.0.1",
"temp": "0.8.3",
@@ -50,20 +50,20 @@
"walk": "2.3.9"
},
"devDependencies": {
"clean-css": "3.4.20",
"coveralls": "2.11.14",
"clean-css": "3.4.21",
"coveralls": "2.11.15",
"debounce": "^1.0.0",
"eslint": "3.8.1",
"eslint-config-openlayers": "5.0.0",
"eslint": "3.12.0",
"eslint-config-openlayers": "6.0.0",
"eslint-plugin-openlayers-internal": "2.2.0",
"expect.js": "0.3.1",
"gaze": "^1.0.0",
"istanbul": "0.4.5",
"jquery": "3.1.1",
"mocha": "3.1.2",
"mocha-phantomjs-core": "^1.3.0",
"mustache": "2.2.1",
"phantomjs-prebuilt": "2.1.13",
"mocha": "3.2.0",
"mocha-phantomjs-core": "^2.1.0",
"mustache": "2.3.0",
"phantomjs-prebuilt": "2.1.14",
"proj4": "2.3.15",
"resemblejs": "2.2.2",
"serve-files": "1.0.0",
@@ -91,7 +91,8 @@
2,
{
"allow": [
"assert"
"assert",
"warn"
]
}
],
@@ -99,7 +100,7 @@
"openlayers-internal/no-duplicate-requires": 2,
"openlayers-internal/no-missing-requires": 1,
"openlayers-internal/no-unused-requires": 2,
"openlayers-internal/one-provide": 1,
"openlayers-internal/one-provide": 2,
"openlayers-internal/requires-first": 2,
"openlayers-internal/valid-provide": 2,
"openlayers-internal/valid-requires": 2

View File

@@ -7,6 +7,7 @@ goog.require('ol.easing');
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition that will "bounce" the resolution as it
* approaches the final value.
* @param {olx.animation.BounceOptions} options Bounce options.
@@ -14,6 +15,7 @@ goog.require('ol.easing');
* @api
*/
ol.animation.bounce = function(options) {
ol.DEBUG && console.warn('ol.animation.bounce() is deprecated. Use view.animate() instead.');
var resolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -45,12 +47,14 @@ ol.animation.bounce = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view center.
* @param {olx.animation.PanOptions} options Pan options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.pan = function(options) {
ol.DEBUG && console.warn('ol.animation.pan() is deprecated. Use view.animate() instead.');
var source = options.source;
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
@@ -86,12 +90,14 @@ ol.animation.pan = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view rotation.
* @param {olx.animation.RotateOptions} options Rotate options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.rotate = function(options) {
ol.DEBUG && console.warn('ol.animation.rotate() is deprecated. Use view.animate() instead.');
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -133,12 +139,14 @@ ol.animation.rotate = function(options) {
/**
* Deprecated (use {@link ol.View#animate} instead).
* Generate an animated transition while updating the view resolution.
* @param {olx.animation.ZoomOptions} options Zoom options.
* @return {ol.PreRenderFunction} Pre-render function.
* @api
*/
ol.animation.zoom = function(options) {
ol.DEBUG && console.warn('ol.animation.zoom() is deprecated. Use view.animate() instead.');
var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;

View File

@@ -22,7 +22,7 @@ ol.AssertionError = function(code) {
/**
* Error code. The meaning of the code can be found on
* {@link https://openlayers.org/en/latest/errors.html} (replace `latest` with
* {@link https://openlayers.org/en/latest/doc/errors/} (replace `latest` with
* the version found in the OpenLayers script's header comment if a version
* other than the latest is used).
* @type {number}

View File

@@ -145,13 +145,13 @@ ol.Collection.prototype.pop = function() {
/**
* Insert the provided element at the end of the collection.
* @param {T} elem Element.
* @return {number} Length.
* @return {number} New length of the collection.
* @api stable
*/
ol.Collection.prototype.push = function(elem) {
var n = this.array_.length;
var n = this.getLength();
this.insertAt(n, elem);
return n;
return this.getLength();
};

View File

@@ -13,34 +13,13 @@ goog.require('ol.math');
ol.color.HEX_COLOR_RE_ = /^#(?:[0-9a-f]{3}){1,2}$/i;
/**
* Regular expression for matching and capturing RGB style strings.
* @const
* @type {RegExp}
* @private
*/
ol.color.RGB_COLOR_RE_ =
/^(?:rgb)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2})\)$/i;
/**
* Regular expression for matching and capturing RGBA style strings.
* @const
* @type {RegExp}
* @private
*/
ol.color.RGBA_COLOR_RE_ =
/^(?:rgba)?\((0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|[1-9]\d{0,2}),\s?(0|1|0\.\d{0,10})\)$/i;
/**
* Regular expression for matching potential named color style strings.
* @const
* @type {RegExp}
* @private
*/
ol.color.NAMED_COLOR_RE_ =
/^([a-z]*)$/i;
ol.color.NAMED_COLOR_RE_ = /^([a-z]*)$/i;
/**
@@ -151,7 +130,7 @@ ol.color.fromString = (
* @return {ol.Color} Color.
*/
ol.color.fromStringInternal_ = function(s) {
var r, g, b, a, color, match;
var r, g, b, a, color, parts;
if (ol.color.NAMED_COLOR_RE_.exec(s)) {
s = ol.color.fromNamed(s);
@@ -171,17 +150,13 @@ ol.color.fromStringInternal_ = function(s) {
}
a = 1;
color = [r, g, b, a];
} else if ((match = ol.color.RGBA_COLOR_RE_.exec(s))) { // rgba()
r = Number(match[1]);
g = Number(match[2]);
b = Number(match[3]);
a = Number(match[4]);
color = ol.color.normalize([r, g, b, a]);
} else if ((match = ol.color.RGB_COLOR_RE_.exec(s))) { // rgb()
r = Number(match[1]);
g = Number(match[2]);
b = Number(match[3]);
color = ol.color.normalize([r, g, b, 1]);
} else if (s.indexOf('rgba(') == 0) { // rgba()
parts = s.slice(5, -1).split(',').map(Number);
color = ol.color.normalize(parts);
} else if (s.indexOf('rgb(') == 0) { // rgb()
parts = s.slice(4, -1).split(',').map(Number);
parts.push(1);
color = ol.color.normalize(parts);
} else {
ol.asserts.assert(false, 14); // Invalid color
}

View File

@@ -157,6 +157,7 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
var attributions = ol.obj.assign({}, frameState.attributions);
/** @type {Object.<string, ol.Attribution>} */
var hiddenAttributions = {};
var uniqueAttributions = {};
var projection = /** @type {!ol.proj.Projection} */ (frameState.viewState.projection);
for (i = 0, ii = layerStatesArray.length; i < ii; i++) {
source = layerStatesArray[i].layer.getSource();
@@ -186,7 +187,11 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
if (sourceAttributionKey in hiddenAttributions) {
delete hiddenAttributions[sourceAttributionKey];
}
attributions[sourceAttributionKey] = sourceAttribution;
var html = sourceAttribution.getHTML();
if (!(html in uniqueAttributions)) {
uniqueAttributions[html] = true;
attributions[sourceAttributionKey] = sourceAttribution;
}
} else {
hiddenAttributions[sourceAttributionKey] = sourceAttribution;
}

View File

@@ -5,7 +5,6 @@ goog.require('ol.Collection');
goog.require('ol.Map');
goog.require('ol.MapEvent');
goog.require('ol.Object');
goog.require('ol.ObjectEventType');
goog.require('ol.Overlay');
goog.require('ol.View');
goog.require('ol.control.Control');
@@ -166,7 +165,7 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
if (map) {
this.listenerKeys.push(ol.events.listen(
map, ol.ObjectEventType.PROPERTYCHANGE,
map, ol.Object.EventType.PROPERTYCHANGE,
this.handleMapPropertyChange_, this));
// TODO: to really support map switching, this would need to be reworked
@@ -188,7 +187,7 @@ ol.control.OverviewMap.prototype.setMap = function(map) {
/**
* Handle map property changes. This only deals with changes to the map's view.
* @param {ol.ObjectEvent} event The propertychange event.
* @param {ol.Object.Event} event The propertychange event.
* @private
*/
ol.control.OverviewMap.prototype.handleMapPropertyChange_ = function(event) {

View File

@@ -3,7 +3,6 @@ goog.provide('ol.control.Rotate');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -131,13 +130,14 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
if (currentRotation > Math.PI) {
currentRotation -= 2 * Math.PI;
}
map.beforeRender(ol.animation.rotate({
rotation: currentRotation,
view.animate({
rotation: 0,
duration: this.duration_,
easing: ol.easing.easeOut
}));
});
} else {
view.setRotation(0);
}
view.setRotation(0);
}
};

View File

@@ -6,7 +6,7 @@ goog.require('ol.asserts');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.events');
goog.require('ol.proj.METERS_PER_UNIT');
goog.require('ol.proj');
goog.require('ol.proj.Units');
@@ -169,7 +169,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
var projection = viewState.projection;
var metersPerUnit = projection.getMetersPerUnit();
var pointResolution =
projection.getPointResolution(viewState.resolution, center) *
ol.proj.getPointResolution(projection, viewState.resolution, center) *
metersPerUnit;
var nominalCount = this.minWidth_ * pointResolution;

View File

@@ -3,7 +3,6 @@ goog.provide('ol.control.Zoom');
goog.require('ol');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -105,14 +104,18 @@ ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
}
var currentResolution = view.getResolution();
if (currentResolution) {
var newResolution = view.constrainResolution(currentResolution, delta);
if (this.duration_ > 0) {
map.beforeRender(ol.animation.zoom({
resolution: currentResolution,
if (view.getAnimating()) {
view.cancelAnimations();
}
view.animate({
resolution: newResolution,
duration: this.duration_,
easing: ol.easing.easeOut
}));
});
} else {
view.setResolution(newResolution);
}
var newResolution = view.constrainResolution(currentResolution, delta);
view.setResolution(newResolution);
}
};

View File

@@ -4,7 +4,6 @@ goog.provide('ol.control.ZoomSlider');
goog.require('ol');
goog.require('ol.View');
goog.require('ol.animation');
goog.require('ol.control.Control');
goog.require('ol.css');
goog.require('ol.easing');
@@ -233,19 +232,19 @@ ol.control.ZoomSlider.render = function(mapEvent) {
* @private
*/
ol.control.ZoomSlider.prototype.handleContainerClick_ = function(event) {
var map = this.getMap();
var view = map.getView();
var currentResolution = view.getResolution();
map.beforeRender(ol.animation.zoom({
resolution: /** @type {number} */ (currentResolution),
duration: this.duration_,
easing: ol.easing.easeOut
}));
var view = this.getMap().getView();
var relativePosition = this.getRelativePosition_(
event.offsetX - this.thumbSize_[0] / 2,
event.offsetY - this.thumbSize_[1] / 2);
var resolution = this.getResolutionForPosition_(relativePosition);
view.setResolution(view.constrainResolution(resolution));
view.animate({
resolution: view.constrainResolution(resolution),
duration: this.duration_,
easing: ol.easing.easeOut
});
};
@@ -306,16 +305,15 @@ ol.control.ZoomSlider.prototype.handleDraggerDrag_ = function(event) {
*/
ol.control.ZoomSlider.prototype.handleDraggerEnd_ = function(event) {
if (this.dragging_) {
var map = this.getMap();
var view = map.getView();
var view = this.getMap().getView();
view.setHint(ol.View.Hint.INTERACTING, -1);
map.beforeRender(ol.animation.zoom({
resolution: /** @type {number} */ (this.currentResolution_),
view.animate({
resolution: view.constrainResolution(this.currentResolution_),
duration: this.duration_,
easing: ol.easing.easeOut
}));
var resolution = view.constrainResolution(this.currentResolution_);
view.setResolution(resolution);
});
this.dragging_ = false;
this.previousX_ = undefined;
this.previousY_ = undefined;

View File

@@ -1,4 +1,4 @@
/**
* Easing functions for {@link ol.animation}.
* Easing functions for {@link ol.View#animate}.
* @namespace ol.easing
*/

View File

@@ -1,6 +1,6 @@
goog.provide('ol.events.condition');
goog.require('ol.MapBrowserEvent.EventType');
goog.require('ol.MapBrowserEvent');
goog.require('ol.asserts');
goog.require('ol.functions');
goog.require('ol.has');

12
src/ol/extent/corner.js Normal file
View File

@@ -0,0 +1,12 @@
goog.provide('ol.extent.Corner');
/**
* Extent corner.
* @enum {string}
*/
ol.extent.Corner = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right'
};

View File

@@ -1,35 +1,9 @@
goog.provide('ol.extent');
goog.provide('ol.extent.Corner');
goog.provide('ol.extent.Relationship');
goog.require('ol');
goog.require('ol.asserts');
/**
* Extent corner.
* @enum {string}
*/
ol.extent.Corner = {
BOTTOM_LEFT: 'bottom-left',
BOTTOM_RIGHT: 'bottom-right',
TOP_LEFT: 'top-left',
TOP_RIGHT: 'top-right'
};
/**
* Relationship to an extent.
* @enum {number}
*/
ol.extent.Relationship = {
UNKNOWN: 0,
INTERSECTING: 1,
ABOVE: 2,
RIGHT: 4,
BELOW: 8,
LEFT: 16
};
goog.require('ol.extent.Corner');
goog.require('ol.extent.Relationship');
/**
@@ -307,18 +281,6 @@ ol.extent.createOrUpdateFromRings = function(rings, opt_extent) {
};
/**
* Empty an extent in place.
* @param {ol.Extent} extent Extent.
* @return {ol.Extent} Extent.
*/
ol.extent.empty = function(extent) {
extent[0] = extent[1] = Infinity;
extent[2] = extent[3] = -Infinity;
return extent;
};
/**
* Determine if two extents are equivalent.
* @param {ol.Extent} extent1 Extent 1.
@@ -720,29 +682,6 @@ ol.extent.isEmpty = function(extent) {
};
/**
* @param {ol.Extent} extent Extent.
* @return {boolean} Is infinite.
*/
ol.extent.isInfinite = function(extent) {
return extent[0] == -Infinity || extent[1] == -Infinity ||
extent[2] == Infinity || extent[3] == Infinity;
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Coordinate} coordinate Coordinate.
* @return {ol.Coordinate} Coordinate.
*/
ol.extent.normalize = function(extent, coordinate) {
return [
(coordinate[0] - extent[0]) / (extent[2] - extent[0]),
(coordinate[1] - extent[1]) / (extent[3] - extent[1])
];
};
/**
* @param {ol.Extent} extent Extent.
* @param {ol.Extent=} opt_extent Extent.
@@ -831,19 +770,6 @@ ol.extent.intersectsSegment = function(extent, start, end) {
};
/**
* @param {ol.Extent} extent1 Extent 1.
* @param {ol.Extent} extent2 Extent 2.
* @return {boolean} Touches.
*/
ol.extent.touches = function(extent1, extent2) {
var intersects = ol.extent.intersects(extent1, extent2);
return intersects &&
(extent1[0] == extent2[2] || extent1[2] == extent2[0] ||
extent1[1] == extent2[3] || extent1[3] == extent2[1]);
};
/**
* Apply a transform function to the extent.
* @param {ol.Extent} extent Extent.

View File

@@ -0,0 +1,15 @@
goog.provide('ol.extent.Relationship');
/**
* Relationship to an extent.
* @enum {number}
*/
ol.extent.Relationship = {
UNKNOWN: 0,
INTERSECTING: 1,
ABOVE: 2,
RIGHT: 4,
BELOW: 8,
LEFT: 16
};

View File

@@ -1,7 +1,6 @@
goog.provide('ol.featureloader');
goog.require('ol');
goog.require('ol.Tile');
goog.require('ol.format.FormatType');
goog.require('ol.xml');
@@ -70,35 +69,6 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
};
/**
* Create an XHR feature loader for a `url` and `format`. The feature loader
* loads features (with XHR), parses the features, and adds them to the
* vector tile.
* @param {string|ol.FeatureUrlFunction} url Feature URL service.
* @param {ol.format.Feature} format Feature format.
* @return {ol.FeatureLoader} The feature loader.
* @api
*/
ol.featureloader.tile = function(url, format) {
return ol.featureloader.loadFeaturesXhr(url, format,
/**
* @param {Array.<ol.Feature>} features The loaded features.
* @param {ol.proj.Projection} dataProjection Data projection.
* @this {ol.VectorTile}
*/
function(features, dataProjection) {
this.setProjection(dataProjection);
this.setFeatures(features);
},
/**
* @this {ol.VectorTile}
*/
function() {
this.setState(ol.Tile.State.ERROR);
});
};
/**
* Create an XHR feature loader for a `url` and `format`. The feature loader
* loads features (with XHR), parses the features, and adds them to the

View File

@@ -66,12 +66,13 @@ ol.format.GPX.SCHEMA_LOCATION_ = 'http://www.topografix.com/GPX/1/1 ' +
/**
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {ol.LayoutOptions} layoutOptions Layout options.
* @param {Node} node Node.
* @param {Object} values Values.
* @private
* @return {Array.<number>} Flat coordinates.
*/
ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) {
ol.format.GPX.appendCoordinate_ = function(flatCoordinates, layoutOptions, node, values) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
flatCoordinates.push(
@@ -80,12 +81,14 @@ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) {
if ('ele' in values) {
flatCoordinates.push(/** @type {number} */ (values['ele']));
delete values['ele'];
layoutOptions.hasZ = true;
} else {
flatCoordinates.push(0);
}
if ('time' in values) {
flatCoordinates.push(/** @type {number} */ (values['time']));
delete values['time'];
layoutOptions.hasM = true;
} else {
flatCoordinates.push(0);
}
@@ -93,6 +96,51 @@ ol.format.GPX.appendCoordinate_ = function(flatCoordinates, node, values) {
};
/**
* Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates
* and ends arrays by shrinking them accordingly (removing unused zero entries).
*
* @param {ol.LayoutOptions} layoutOptions Layout options.
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {Array.<number>=} ends Ends.
* @return {ol.geom.GeometryLayout} Layout.
*/
ol.format.GPX.applyLayoutOptions_ = function(layoutOptions, flatCoordinates, ends) {
var layout = ol.geom.GeometryLayout.XY;
var stride = 2;
if (layoutOptions.hasZ && layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYZM;
stride = 4;
} else if (layoutOptions.hasZ) {
layout = ol.geom.GeometryLayout.XYZ;
stride = 3;
} else if (layoutOptions.hasM) {
layout = ol.geom.GeometryLayout.XYM;
stride = 3;
}
if (stride !== 4) {
var i, ii;
for (i = 0, ii = flatCoordinates.length / 4; i < ii; i++) {
flatCoordinates[i * stride] = flatCoordinates[i * 4];
flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1];
if (layoutOptions.hasZ) {
flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2];
}
if (layoutOptions.hasM) {
flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3];
}
}
flatCoordinates.length = flatCoordinates.length / 4 * stride;
if (ends) {
for (i = 0, ii = ends.length; i < ii; i++) {
ends[i] = ends[i] / 4 * stride;
}
}
}
return layout;
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
@@ -141,7 +189,9 @@ ol.format.GPX.parseRtePt_ = function(node, objectStack) {
var rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(rteValues['flatCoordinates']);
ol.format.GPX.appendCoordinate_(flatCoordinates, node, values);
var layoutOptions = /** @type {ol.LayoutOptions} */
(rteValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -161,7 +211,9 @@ ol.format.GPX.parseTrkPt_ = function(node, objectStack) {
var trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var flatCoordinates = /** @type {Array.<number>} */
(trkValues['flatCoordinates']);
ol.format.GPX.appendCoordinate_(flatCoordinates, node, values);
var layoutOptions = /** @type {ol.LayoutOptions} */
(trkValues['layoutOptions']);
ol.format.GPX.appendCoordinate_(flatCoordinates, layoutOptions, node, values);
}
};
@@ -197,7 +249,8 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.localName == 'rte', 'localName should be rte');
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
'flatCoordinates': []
'flatCoordinates': [],
'layoutOptions': {}
}, ol.format.GPX.RTE_PARSERS_, node, objectStack);
if (!values) {
return undefined;
@@ -205,8 +258,11 @@ ol.format.GPX.readRte_ = function(node, objectStack) {
var flatCoordinates = /** @type {Array.<number>} */
(values['flatCoordinates']);
delete values['flatCoordinates'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates);
var geometry = new ol.geom.LineString(null);
geometry.setFlatCoordinates(ol.geom.GeometryLayout.XYZM, flatCoordinates);
geometry.setFlatCoordinates(layout, flatCoordinates);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
feature.setProperties(values);
@@ -227,7 +283,8 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
var values = ol.xml.pushParseAndPop({
'flatCoordinates': [],
'ends': []
'ends': [],
'layoutOptions': {}
}, ol.format.GPX.TRK_PARSERS_, node, objectStack);
if (!values) {
return undefined;
@@ -237,9 +294,11 @@ ol.format.GPX.readTrk_ = function(node, objectStack) {
delete values['flatCoordinates'];
var ends = /** @type {Array.<number>} */ (values['ends']);
delete values['ends'];
var layoutOptions = /** @type {ol.LayoutOptions} */ (values['layoutOptions']);
delete values['layoutOptions'];
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, flatCoordinates, ends);
var geometry = new ol.geom.MultiLineString(null);
geometry.setFlatCoordinates(
ol.geom.GeometryLayout.XYZM, flatCoordinates, ends);
geometry.setFlatCoordinates(layout, flatCoordinates, ends);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
feature.setProperties(values);
@@ -263,9 +322,10 @@ ol.format.GPX.readWpt_ = function(node, objectStack) {
if (!values) {
return undefined;
}
var coordinates = ol.format.GPX.appendCoordinate_([], node, values);
var geometry = new ol.geom.Point(
coordinates, ol.geom.GeometryLayout.XYZM);
var layoutOptions = /** @type {ol.LayoutOptions} */ ({});
var coordinates = ol.format.GPX.appendCoordinate_([], layoutOptions, node, values);
var layout = ol.format.GPX.applyLayoutOptions_(layoutOptions, coordinates);
var geometry = new ol.geom.Point(coordinates, layout);
ol.format.Feature.transformWithOptions(geometry, false, options);
var feature = new ol.Feature(geometry);
feature.setProperties(values);

View File

@@ -51,6 +51,10 @@ ol.format.KML = function(opt_options) {
ol.format.XMLFeature.call(this);
if (!ol.format.KML.DEFAULT_STYLE_ARRAY_) {
ol.format.KML.createStyleDefaults_();
}
/**
* @inheritDoc
*/
@@ -61,8 +65,7 @@ ol.format.KML = function(opt_options) {
* @type {Array.<ol.style.Style>}
*/
this.defaultStyle_ = options.defaultStyle ?
options.defaultStyle :
(ol.format.KML.DEFAULT_STYLE_ARRAY_ || ol.format.KML.createStyleDefaults_());
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
/**
* @private
@@ -308,11 +311,8 @@ ol.format.KML.createNameStyleFunction_ = function(foundStyle, name) {
if (imageSize === null) {
imageSize = ol.format.KML.DEFAULT_IMAGE_STYLE_SIZE_;
}
var imageScale = foundStyle.getImage().getScale();
if (isNaN(imageScale)) {
imageScale = ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_;
}
if (imageSize.length == 2) {
var imageScale = foundStyle.getImage().getScale();
// Offset the label to be centered to the right of the icon, if there is
// one.
textOffset[0] = imageScale * imageSize[0] / 2;
@@ -540,9 +540,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
@@ -618,11 +616,6 @@ ol.format.KML.IconStyleParser_ = function(node, objectStack) {
var scale = /** @type {number|undefined} */
(object['scale']);
if (isNaN(scale) || scale === undefined) {
scale = ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_;
} else {
scale = scale * ol.format.KML.DEFAULT_IMAGE_SCALE_MULTIPLIER_;
}
if (drawIcon) {
if (src == ol.format.KML.DEFAULT_IMAGE_STYLE_SRC_) {
@@ -1163,14 +1156,13 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'Data', 'localName should be Data');
var name = node.getAttribute('name');
ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack);
var featureObject =
/** @type {Object} */ (objectStack[objectStack.length - 1]);
if (name !== null) {
var data = ol.xml.pushParseAndPop(
undefined, ol.format.KML.DATA_PARSERS_, node, objectStack);
if (data) {
var featureObject =
/** @type {Object} */ (objectStack[objectStack.length - 1]);
featureObject[name] = data;
}
featureObject[name] = featureObject.value;
} else if (featureObject.displayName !== null) {
featureObject[featureObject.displayName] = featureObject.value;
}
};
@@ -1188,6 +1180,18 @@ ol.format.KML.ExtendedDataParser_ = function(node, objectStack) {
ol.xml.parseNode(ol.format.KML.EXTENDED_DATA_PARSERS_, node, objectStack);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.KML.RegionParser_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'Region',
'localName should be Region');
ol.xml.parseNode(ol.format.KML.REGION_PARSERS_, node, objectStack);
};
/**
* @param {Node} node Node.
@@ -1279,6 +1283,56 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) {
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.KML.LatLonAltBoxParser_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'LatLonAltBox',
'localName should be LatLonAltBox');
var object = ol.xml.pushParseAndPop({}, ol.format.KML.LAT_LON_ALT_BOX_PARSERS_, node, objectStack);
if (!object) {
return;
}
var regionObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
var extent = [
parseFloat(object['west']),
parseFloat(object['south']),
parseFloat(object['east']),
parseFloat(object['north'])
];
regionObject['extent'] = extent;
regionObject['altitudeMode'] = object['altitudeMode'];
regionObject['minAltitude'] = parseFloat(object['minAltitude']);
regionObject['maxAltitude'] = parseFloat(object['maxAltitude']);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.KML.LodParser_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'Lod',
'localName should be Lod');
var object = ol.xml.pushParseAndPop({}, ol.format.KML.LOD_PARSERS_, node, objectStack);
if (!object) {
return;
}
var lodObject = /** @type {Object} */ (objectStack[objectStack.length - 1]);
lodObject['minLodPixels'] = parseFloat(object['minLodPixels']);
lodObject['maxLodPixels'] = parseFloat(object['maxLodPixels']);
lodObject['minFadeExtent'] = parseFloat(object['minFadeExtent']);
lodObject['maxFadeExtent'] = parseFloat(object['maxFadeExtent']);
};
/**
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
@@ -1367,7 +1421,8 @@ ol.format.KML.whenParser_ = function(node, objectStack) {
*/
ol.format.KML.DATA_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'value': ol.xml.makeReplacer(ol.format.XSD.readString)
'displayName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'value': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
});
@@ -1383,6 +1438,49 @@ ol.format.KML.EXTENDED_DATA_PARSERS_ = ol.xml.makeStructureNS(
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.KML.REGION_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'LatLonAltBox': ol.format.KML.LatLonAltBoxParser_,
'Lod': ol.format.KML.LodParser_
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.KML.LAT_LON_ALT_BOX_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'altitudeMode': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'minAltitude': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'maxAltitude': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'north': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'south': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'east': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'west': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal)
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.KML.LOD_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'minLodPixels': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'maxLodPixels': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'minFadeExtent': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal),
'maxFadeExtent': ol.xml.makeObjectPropertySetter(ol.format.XSD.readDecimal)
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
@@ -1543,6 +1641,7 @@ ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NETWORK_LINK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'ExtendedData': ol.format.KML.ExtendedDataParser_,
'Region': ol.format.KML.RegionParser_,
'Link': ol.format.KML.LinkParser_,
'address': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'description': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
@@ -1596,6 +1695,7 @@ ol.format.KML.PAIR_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.PLACEMARK_PARSERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'ExtendedData': ol.format.KML.ExtendedDataParser_,
'Region': ol.format.KML.RegionParser_,
'MultiGeometry': ol.xml.makeObjectPropertySetter(
ol.format.KML.readMultiGeometry_, 'geometry'),
'LineString': ol.xml.makeObjectPropertySetter(
@@ -2041,6 +2141,72 @@ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
};
/**
* Read the regions of the KML.
*
* @param {Document|Node|string} source Source.
* @return {Array.<Object>} Regions.
* @api
*/
ol.format.KML.prototype.readRegion = function(source) {
var regions = [];
if (ol.xml.isDocument(source)) {
ol.array.extend(regions, this.readRegionFromDocument(
/** @type {Document} */ (source)));
} else if (ol.xml.isNode(source)) {
ol.array.extend(regions, this.readRegionFromNode(
/** @type {Node} */ (source)));
} else if (typeof source === 'string') {
var doc = ol.xml.parse(source);
ol.array.extend(regions, this.readRegionFromDocument(doc));
}
return regions;
};
/**
* @param {Document} doc Document.
* @return {Array.<Object>} Region.
*/
ol.format.KML.prototype.readRegionFromDocument = function(doc) {
var n, regions = [];
for (n = doc.firstChild; n; n = n.nextSibling) {
if (n.nodeType == Node.ELEMENT_NODE) {
ol.array.extend(regions, this.readRegionFromNode(n));
}
}
return regions;
};
/**
* @param {Node} node Node.
* @return {Array.<Object>} Region.
* @api
*/
ol.format.KML.prototype.readRegionFromNode = function(node) {
var n, regions = [];
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
n.localName == 'Region') {
var obj = ol.xml.pushParseAndPop({}, ol.format.KML.REGION_PARSERS_,
n, []);
regions.push(obj);
}
}
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
var localName = n.localName;
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
(localName == 'Document' ||
localName == 'Folder' ||
localName == 'kml')) {
ol.array.extend(regions, this.readRegionFromNode(n));
}
}
return regions;
};
/**
* Read the projection from a KML source.
*
@@ -2112,6 +2278,54 @@ ol.format.KML.writeCoordinatesTextNode_ = function(node, coordinates, objectStac
};
/**
* @param {Node} node Node.
* @param {{name: *, value: *}} pair Name value pair.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.KML.writeDataNode_ = function(node, pair, objectStack) {
node.setAttribute('name', pair.name);
var /** @type {ol.XmlNodeStackItem} */ context = {node: node};
var value = pair.value;
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']);
}
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']);
}
} else {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
}
};
/**
* @param {Node} node Node to append a TextNode with the name to.
* @param {string} name DisplayName.
* @private
*/
ol.format.KML.writeDataNodeName_ = function(node, name) {
ol.format.XSD.writeCDATASection(node, name);
};
/**
* @param {Node} node Node to append a CDATA Section with the value to.
* @param {string} value Value.
* @private
*/
ol.format.KML.writeDataNodeValue_ = function(node, value) {
ol.format.XSD.writeStringTextNode(node, value);
};
/**
* @param {Node} node Node.
* @param {Array.<ol.Feature>} features Features.
@@ -2127,6 +2341,24 @@ ol.format.KML.writeDocument_ = function(node, features, objectStack) {
};
/**
* @param {Node} node Node.
* @param {{names: Array<string>, values: (Array<*>)}} namesAndValues Names and values.
* @param {Array.<*>} objectStack Object stack.
* @private
*/
ol.format.KML.writeExtendedData_ = function(node, namesAndValues, objectStack) {
var /** @type {ol.XmlNodeStackItem} */ context = {node: node};
var names = namesAndValues.names, values = namesAndValues.values;
var length = names.length;
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);
}
};
/**
* @param {Node} node Node.
* @param {Object} icon Icon object.
@@ -2324,6 +2556,21 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
// serialize properties (properties unknown to KML are not serialized)
var properties = feature.getProperties();
// don't export these to ExtendedData
var filter = {'address': 1, 'description': 1, 'name': 1, 'open': 1,
'phoneNumber': 1, 'styleUrl': 1, 'visibility': 1};
filter[feature.getGeometryName()] = 1;
var keys = Object.keys(properties || {}).sort().filter(function(v) {
return !filter[v];
});
if (keys.length > 0) {
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);
}
var styleFunction = feature.getStyleFunction();
if (styleFunction) {
// FIXME the styles returned by the style function are supposed to be
@@ -2428,7 +2675,7 @@ ol.format.KML.writePolyStyle_ = function(node, style, objectStack) {
ol.format.KML.writeScaleTextNode_ = function(node, scale) {
// the Math is to remove any excess decimals created by float arithmetic
ol.format.XSD.writeDecimalTextNode(node,
Math.round(scale * scale * 1e6) / 1e6);
Math.round(scale * 1e6) / 1e6);
};
@@ -2512,6 +2759,19 @@ ol.format.KML.DOCUMENT_SERIALIZERS_ = ol.xml.makeStructureNS(
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private
*/
ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'Data': ol.xml.makeChildAppender(ol.format.KML.writeDataNode_),
'value': ol.xml.makeChildAppender(ol.format.KML.writeDataNodeValue_),
'displayName': ol.xml.makeChildAppender(ol.format.KML.writeDataNodeName_)
});
/**
* @const
* @type {Object.<string, string>}
@@ -2679,6 +2939,8 @@ ol.format.KML.PLACEMARK_SEQUENCE_ = ol.xml.makeStructureNS(
*/
ol.format.KML.PLACEMARK_SERIALIZERS_ = ol.xml.makeStructureNS(
ol.format.KML.NAMESPACE_URIS_, {
'ExtendedData': ol.xml.makeChildAppender(
ol.format.KML.writeExtendedData_),
'MultiGeometry': ol.xml.makeChildAppender(
ol.format.KML.writeMultiGeometry_),
'LineString': ol.xml.makeChildAppender(
@@ -2834,6 +3096,26 @@ ol.format.KML.COORDINATES_NODE_FACTORY_ =
ol.xml.makeSimpleNodeFactory('coordinates');
/**
* A factory for creating Data nodes.
* @const
* @type {function(*, Array.<*>): (Node|undefined)}
* @private
*/
ol.format.KML.DATA_NODE_FACTORY_ =
ol.xml.makeSimpleNodeFactory('Data');
/**
* A factory for creating ExtendedData nodes.
* @const
* @type {function(*, Array.<*>): (Node|undefined)}
* @private
*/
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_ =
ol.xml.makeSimpleNodeFactory('ExtendedData');
/**
* A factory for creating innerBoundaryIs nodes.
* @const

View File

@@ -6,12 +6,14 @@ goog.require('ol.format.Feature');
goog.require('ol.format.TextFeature');
goog.require('ol.geom.GeometryCollection');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.GeometryLayout');
goog.require('ol.geom.LineString');
goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Point');
goog.require('ol.geom.Polygon');
goog.require('ol.geom.SimpleGeometry');
/**
@@ -49,6 +51,27 @@ ol.inherits(ol.format.WKT, ol.format.TextFeature);
ol.format.WKT.EMPTY = 'EMPTY';
/**
* @const
* @type {string}
*/
ol.format.WKT.Z = 'Z';
/**
* @const
* @type {string}
*/
ol.format.WKT.M = 'M';
/**
* @const
* @type {string}
*/
ol.format.WKT.ZM = 'ZM';
/**
* @param {ol.geom.Point} geom Point geometry.
* @return {string} Coordinates part of Point as WKT.
@@ -59,7 +82,7 @@ ol.format.WKT.encodePointGeometry_ = function(geom) {
if (coordinates.length === 0) {
return '';
}
return coordinates[0] + ' ' + coordinates[1];
return coordinates.join(' ');
};
@@ -102,7 +125,7 @@ ol.format.WKT.encodeLineStringGeometry_ = function(geom) {
var coordinates = geom.getCoordinates();
var array = [];
for (var i = 0, ii = coordinates.length; i < ii; ++i) {
array.push(coordinates[i][0] + ' ' + coordinates[i][1]);
array.push(coordinates[i].join(' '));
}
return array.join(',');
};
@@ -155,6 +178,23 @@ ol.format.WKT.encodeMultiPolygonGeometry_ = function(geom) {
return array.join(',');
};
/**
* @param {ol.geom.SimpleGeometry} geom SimpleGeometry geometry.
* @return {string} Potential dimensional information for WKT type.
* @private
*/
ol.format.WKT.encodeGeometryLayout_ = function(geom) {
var layout = geom.getLayout();
var dimInfo = '';
if (layout === ol.geom.GeometryLayout.XYZ || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.Z;
}
if (layout === ol.geom.GeometryLayout.XYM || layout === ol.geom.GeometryLayout.XYZM) {
dimInfo += ol.format.WKT.M;
}
return dimInfo;
};
/**
* Encode a geometry as WKT.
@@ -168,6 +208,12 @@ ol.format.WKT.encode_ = function(geom) {
ol.DEBUG && console.assert(geometryEncoder, 'geometryEncoder should be defined');
var enc = geometryEncoder(geom);
type = type.toUpperCase();
if (geom instanceof ol.geom.SimpleGeometry) {
var dimInfo = ol.format.WKT.encodeGeometryLayout_(geom);
if (dimInfo.length > 0) {
type += ' ' + dimInfo;
}
}
if (enc.length === 0) {
return type + ' ' + ol.format.WKT.EMPTY;
}
@@ -194,7 +240,7 @@ ol.format.WKT.GeometryEncoder_ = {
/**
* Parse a WKT string.
* @param {string} wkt WKT string.
* @return {ol.geom.Geometry|ol.geom.GeometryCollection|undefined}
* @return {ol.geom.Geometry|undefined}
* The geometry created.
* @private
*/
@@ -535,10 +581,10 @@ ol.format.WKT.Parser = function(lexer) {
this.token_;
/**
* @type {number}
* @type {ol.geom.GeometryLayout}
* @private
*/
this.dimension_ = 2;
this.layout_ = ol.geom.GeometryLayout.XY;
};
@@ -550,6 +596,16 @@ ol.format.WKT.Parser.prototype.consume_ = function() {
this.token_ = this.lexer_.nextToken();
};
/**
* Tests if the given type matches the type of the current token.
* @param {ol.format.WKT.TokenType} type Token type.
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.isTokenType = function(type) {
var isMatch = this.token_.type == type;
return isMatch;
};
/**
* If the given type matches the current token, consume it.
@@ -557,7 +613,7 @@ ol.format.WKT.Parser.prototype.consume_ = function() {
* @return {boolean} Whether the token matches the given type.
*/
ol.format.WKT.Parser.prototype.match = function(type) {
var isMatch = this.token_.type == type;
var isMatch = this.isTokenType(type);
if (isMatch) {
this.consume_();
}
@@ -567,7 +623,7 @@ ol.format.WKT.Parser.prototype.match = function(type) {
/**
* Try to parse the tokens provided by the lexer.
* @return {ol.geom.Geometry|ol.geom.GeometryCollection} The geometry.
* @return {ol.geom.Geometry} The geometry.
*/
ol.format.WKT.Parser.prototype.parse = function() {
this.consume_();
@@ -579,13 +635,39 @@ ol.format.WKT.Parser.prototype.parse = function() {
/**
* @return {!(ol.geom.Geometry|ol.geom.GeometryCollection)} The geometry.
* Try to parse the dimensional info.
* @return {ol.geom.GeometryLayout} The layout.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometryLayout_ = function() {
var layout = ol.geom.GeometryLayout.XY;
var dimToken = this.token_;
if (this.isTokenType(ol.format.WKT.TokenType.TEXT)) {
var dimInfo = dimToken.value;
if (dimInfo === ol.format.WKT.Z) {
layout = ol.geom.GeometryLayout.XYZ;
} else if (dimInfo === ol.format.WKT.M) {
layout = ol.geom.GeometryLayout.XYM;
} else if (dimInfo === ol.format.WKT.ZM) {
layout = ol.geom.GeometryLayout.XYZM;
}
if (layout !== ol.geom.GeometryLayout.XY) {
this.consume_();
}
}
return layout;
};
/**
* @return {!ol.geom.Geometry} The geometry.
* @private
*/
ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType.TEXT)) {
var geomType = token.value;
this.layout_ = this.parseGeometryLayout_();
if (geomType == ol.geom.GeometryType.GEOMETRY_COLLECTION.toUpperCase()) {
var geometries = this.parseGeometryCollectionText_();
return new ol.geom.GeometryCollection(geometries);
@@ -596,7 +678,7 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
throw new Error('Invalid geometry type: ' + geomType);
}
var coordinates = parser.call(this);
return new ctor(coordinates);
return new ctor(coordinates, this.layout_);
}
}
throw new Error(this.formatErrorMessage_());
@@ -737,7 +819,8 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
*/
ol.format.WKT.Parser.prototype.parsePoint_ = function() {
var coordinates = [];
for (var i = 0; i < this.dimension_; ++i) {
var dimensions = this.layout_.length;
for (var i = 0; i < dimensions; ++i) {
var token = this.token_;
if (this.match(ol.format.WKT.TokenType.NUMBER)) {
coordinates.push(token.value);
@@ -745,7 +828,7 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
break;
}
}
if (coordinates.length == this.dimension_) {
if (coordinates.length == dimensions) {
return coordinates;
}
throw new Error(this.formatErrorMessage_());
@@ -809,7 +892,7 @@ ol.format.WKT.Parser.prototype.parsePolygonTextList_ = function() {
* @private
*/
ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
var isEmpty = this.token_.type == ol.format.WKT.TokenType.TEXT &&
var isEmpty = this.isTokenType(ol.format.WKT.TokenType.TEXT) &&
this.token_.value == ol.format.WKT.EMPTY;
if (isEmpty) {
this.consume_();

View File

@@ -251,6 +251,32 @@ ol.format.WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
};
/**
* @private
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixSetLimits Object.
*/
ol.format.WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
objectStack) {
return ol.xml.pushParseAndPop([],
ol.format.WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_, node,
objectStack);
};
/**
* @private
* @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixLimits Array.
*/
ol.format.WMTSCapabilities.readTileMatrixLimits_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.TMS_LIMITS_PARSERS_, node, objectStack);
};
/**
* @const
* @private
@@ -353,7 +379,40 @@ ol.format.WMTSCapabilities.STYLE_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.TMS_LINKS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixSet': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString)
ol.format.XSD.readString),
'TileMatrixSetLimits': ol.xml.makeObjectPropertySetter(
ol.format.WMTSCapabilities.readTileMatrixLimitsList_)
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrixLimits': ol.xml.makeArrayPusher(
ol.format.WMTSCapabilities.readTileMatrixLimits_)
});
/**
* @const
* @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private
*/
ol.format.WMTSCapabilities.TMS_LIMITS_PARSERS_ = ol.xml.makeStructureNS(
ol.format.WMTSCapabilities.NAMESPACE_URIS_, {
'TileMatrix': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString),
'MinTileRow': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxTileRow': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MinTileCol': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger),
'MaxTileCol': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readNonNegativeInteger)
});

View File

@@ -114,6 +114,15 @@ ol.format.XSD.writeBooleanTextNode = function(node, bool) {
};
/**
* @param {Node} node Node to append a CDATA Section with the string to.
* @param {string} string String.
*/
ol.format.XSD.writeCDATASection = function(node, string) {
node.appendChild(ol.xml.DOCUMENT.createCDATASection(string));
};
/**
* @param {Node} node Node to append a TextNode with the dateTime to.
* @param {number} dateTime DateTime in seconds.

View File

@@ -36,22 +36,30 @@ ol.geom.flat.contains.linearRingContainsExtent = function(flatCoordinates, offse
* @return {boolean} Contains (x, y).
*/
ol.geom.flat.contains.linearRingContainsXY = function(flatCoordinates, offset, end, stride, x, y) {
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
var contains = false;
// http://geomalgorithms.com/a03-_inclusion.html
// Copyright 2000 softSurfer, 2012 Dan Sunday
// This code may be freely used and modified for any purpose
// providing that this copyright notice is included with it.
// SoftSurfer makes no warranty for this code, and cannot be held
// liable for any real or imagined damage resulting from its use.
// Users of this code must verify correctness for their application.
var wn = 0;
var x1 = flatCoordinates[end - stride];
var y1 = flatCoordinates[end - stride + 1];
for (; offset < end; offset += stride) {
var x2 = flatCoordinates[offset];
var y2 = flatCoordinates[offset + 1];
var intersect = ((y1 > y) != (y2 > y)) &&
(x < (x2 - x1) * (y - y1) / (y2 - y1) + x1);
if (intersect) {
contains = !contains;
if (y1 <= y) {
if (y2 > y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) > 0) {
wn++;
}
} else if (y2 <= y && ((x2 - x1) * (y - y1)) - ((x - x1) * (y2 - y1)) < 0) {
wn--;
}
x1 = x2;
y1 = y2;
}
return contains;
return wn !== 0;
};

View File

@@ -80,7 +80,7 @@ ol.geom.flat.interpolate.lineString = function(flatCoordinates, offset, end, str
* @param {boolean} extrapolate Extrapolate.
* @return {ol.Coordinate} Coordinate.
*/
ol.geom.flat.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
ol.geom.flat.interpolate.lineStringCoordinateAtM = function(flatCoordinates, offset, end, stride, m, extrapolate) {
if (end == offset) {
return null;
}
@@ -147,10 +147,10 @@ ol.geom.flat.lineStringCoordinateAtM = function(flatCoordinates, offset, end, st
* @param {boolean} interpolate Interpolate.
* @return {ol.Coordinate} Coordinate.
*/
ol.geom.flat.lineStringsCoordinateAtM = function(
ol.geom.flat.interpolate.lineStringsCoordinateAtM = function(
flatCoordinates, offset, ends, stride, m, extrapolate, interpolate) {
if (interpolate) {
return ol.geom.flat.lineStringCoordinateAtM(
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
flatCoordinates, offset, ends[ends.length - 1], stride, m, extrapolate);
}
var coordinate;
@@ -181,12 +181,12 @@ ol.geom.flat.lineStringsCoordinateAtM = function(
if (m < flatCoordinates[offset + stride - 1]) {
return null;
} else if (m <= flatCoordinates[end - 1]) {
return ol.geom.flat.lineStringCoordinateAtM(
return ol.geom.flat.interpolate.lineStringCoordinateAtM(
flatCoordinates, offset, end, stride, m, false);
}
offset = end;
}
ol.DEBUG && console.assert(false,
'ol.geom.flat.lineStringsCoordinateAtM should have returned');
'ol.geom.flat.interpolate.lineStringsCoordinateAtM should have returned');
return null;
};

View File

@@ -0,0 +1,20 @@
goog.provide('ol.geom.flat.topology');
goog.require('ol.geom.flat.area');
/**
* Check if the linestring is a boundary.
* @param {Array.<number>} flatCoordinates Flat coordinates.
* @param {number} offset Offset.
* @param {number} end End.
* @param {number} stride Stride.
* @return {boolean} The linestring is a boundary.
*/
ol.geom.flat.topology.lineStringIsClosed = function(flatCoordinates, offset, end, stride) {
var lastCoord = end - stride;
if (flatCoordinates[offset] === flatCoordinates[lastCoord] &&
flatCoordinates[offset + 1] === flatCoordinates[lastCoord + 1] && (end - offset) / stride > 3) {
return !!ol.geom.flat.area.linearRing(flatCoordinates, offset, end, stride);
}
return false;
};

View File

@@ -1,48 +1,13 @@
goog.provide('ol.geom.Geometry');
goog.provide('ol.geom.GeometryLayout');
goog.provide('ol.geom.GeometryType');
goog.require('ol');
goog.require('ol.functions');
goog.require('ol.Object');
goog.require('ol.extent');
goog.require('ol.functions');
goog.require('ol.proj');
goog.require('ol.proj.Units');
/**
* The geometry type. One of `'Point'`, `'LineString'`, `'LinearRing'`,
* `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,
* `'GeometryCollection'`, `'Circle'`.
* @enum {string}
*/
ol.geom.GeometryType = {
POINT: 'Point',
LINE_STRING: 'LineString',
LINEAR_RING: 'LinearRing',
POLYGON: 'Polygon',
MULTI_POINT: 'MultiPoint',
MULTI_LINE_STRING: 'MultiLineString',
MULTI_POLYGON: 'MultiPolygon',
GEOMETRY_COLLECTION: 'GeometryCollection',
CIRCLE: 'Circle'
};
/**
* The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')
* or measure ('M') coordinate is available. Supported values are `'XY'`,
* `'XYZ'`, `'XYM'`, `'XYZM'`.
* @enum {string}
*/
ol.geom.GeometryLayout = {
XY: 'XY',
XYZ: 'XYZ',
XYM: 'XYM',
XYZM: 'XYZM'
};
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not

View File

@@ -0,0 +1,15 @@
goog.provide('ol.geom.GeometryLayout');
/**
* The coordinate layout for geometries, indicating whether a 3rd or 4th z ('Z')
* or measure ('M') coordinate is available. Supported values are `'XY'`,
* `'XYZ'`, `'XYM'`, `'XYZM'`.
* @enum {string}
*/
ol.geom.GeometryLayout = {
XY: 'XY',
XYZ: 'XYZ',
XYM: 'XYM',
XYZM: 'XYZM'
};

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