Compare commits

..

314 Commits

Author SHA1 Message Date
ahocevar
e0381bfd6a Tag for v6.0.0-beta.4 2019-04-03 15:17:02 +02:00
Marc Jansen
7c1df60d06 Merge pull request #9387 from openlayers/greenkeeper/puppeteer-1.14.0
Update puppeteer to the latest version 🚀
2019-03-30 10:59:37 +01:00
greenkeeper[bot]
0583bc0cc8 chore(package): update puppeteer to version 1.14.0 2019-03-30 00:13:09 +00:00
Andreas Hocevar
c9de49e56e Merge pull request #9385 from Kai-W/master
PointsLayer added clear of the render Buffers on Source Change
2019-03-29 12:50:16 +01:00
Kai-W
275a22b685 Added clear of the render Buffers on Source Change 2019-03-28 17:21:43 +01:00
Andreas Hocevar
7091ed3de6 Merge pull request #9379 from openlayers/vectortile-typo
Fix typo in vector tile source docs
2019-03-27 12:50:35 +01:00
Andreas Hocevar
7ebae2ba80 Fix typo in vector tile source docs 2019-03-26 14:54:44 +01:00
Andreas Hocevar
9eb9fffc94 Merge pull request #9368 from ahocevar/multiworld
Show only one world
2019-03-26 14:17:21 +01:00
Marc Jansen
061965ecb7 Merge pull request #9362 from KaiVolland/text-rendering
Use local font "Ubuntu Regular" for rendering tests
2019-03-25 22:08:05 +01:00
Andreas Hocevar
3a7f9d93f4 Merge pull request #9357 from ahocevar/vectortile-view-resolution-2
Render vector tiles at the view resolution
2019-03-25 17:44:31 +01:00
ahocevar
3940b5ec88 Show only one world 2019-03-25 14:49:13 +01:00
Andreas Hocevar
a95481a8fe Merge pull request #9374 from jahow/fix-initialzoom
Fix view initialization with min/max resolution constraint
2019-03-25 14:33:25 +01:00
Olivier Guyot
77a1628610 Tests / remove view extent constraint on zoomify tests 2019-03-25 14:03:40 +01:00
Olivier Guyot
c08da3c694 Map / resolve view constraints when resized/view changed
This makes the `resolveConstraints` view method public but not part of the
api.
2019-03-25 13:38:51 +01:00
Olivier Guyot
98994cad61 View / tests now pass without smoothResolutionConstraint: false 2019-03-25 13:21:10 +01:00
Olivier Guyot
91dda5e5ca View / refactor initialization with resolution constraint
This also makes it possible to call `solveConstraints_` with a duration of 0,
which means the target values are modified straight away without triggering
an animation or leaving the current flow.
2019-03-25 13:21:10 +01:00
Olivier Guyot
b63c4188e4 View / add tests for parameter initialization with constraints 2019-03-25 13:18:49 +01:00
Olivier Guyot
10423ddbe4 Fix View method name in upgrade notes
See #9349
2019-03-25 13:18:49 +01:00
Andreas Hocevar
f32e097051 Merge pull request #9364 from KaiVolland/clip-rendering
Replace clip.test.js with new tests
2019-03-25 12:18:37 +01:00
Andreas Hocevar
1be6050da8 Merge pull request #9360 from KaiVolland/9281-rastersouce-attributions
Enables attributions for the RasterSource
2019-03-25 12:10:57 +01:00
Kai Volland
62ebe29ead Enables attributions for the RasterSource
Attributions included in the passed sources are concatenated.
2019-03-25 11:47:45 +01:00
Kai Volland
ef061dd4c3 Updates font settings for rendering tests
This updates font name and size for renderinge tests that
include TextStyles.
2019-03-25 11:39:10 +01:00
Kai Volland
bff3e88343 Replaces clip.test.js with new tests
Transforms the old rendering test for
layer clipping to the new rendering test approach.
2019-03-25 11:13:04 +01:00
ahocevar
3d2711d35e Add missing arg type 2019-03-24 21:24:30 +01:00
Andreas Hocevar
927a98ac5b Merge pull request #9365 from jahow/patch-1
Fix View method name in upgrade notes
2019-03-22 15:30:56 +01:00
Olivier Guyot
8983ebdc69 Fix View method name in upgrade notes
See #9349
2019-03-22 13:30:58 +01:00
Kai Volland
681a8f1d9c Replaces remaining vectorimage.tests.js
Transforms the old rendering tests for the VectorImageLayer
decluttering to the new rendering test approach.
2019-03-22 10:14:41 +01:00
Andreas Hocevar
447117be4f Merge pull request #9361 from lutzhelm/9343-zdirection
Add a zDirection option for Zoomify - implements #9343
2019-03-21 19:12:41 +01:00
ahocevar
681c3169c1 Add zDirection memeber to the baes class, for type checking 2019-03-21 18:50:03 +01:00
Kai Volland
5665da6518 Use local font "Ubuntu Regular" for rendering tests
Set local font for all rendering tests including
TextStyles to enhance comparability on different
systems.
2019-03-21 15:06:07 +01:00
Lutz Helm
085c60af49 Remove tile source zDirection getter
The renderer now accesses the zDirection member directly if it exists.
This also has the advantage of not advertising any object methods that
hav no use for most tile sources.
2019-03-21 14:47:09 +01:00
Lutz Helm
2bf217207e Test renderer behavior for Zoomify zDirection
The zDirection addition to the Zoomify tile source only takes effect through
the renderer, so these two renderer cases are added to test the behavior.

zoomify-no-zdirection expects the default behavior.
zoomify-zdirection expects the tiles for the next better resolution.
2019-03-21 11:51:42 +01:00
Lutz Helm
f5abb45de0 Add a zDirection option for Zoomify
Via zDirection, the renderer's selection of a tile source's resolution can be
controlled if the view's resolution does not match any tile source resolution.

Currently the zDirection option is only available for Zoomify. The comment
https://github.com/openlayers/openlayers/issues/9343#issuecomment-474341033
describes why caution is advised when using zDirection for other sources.

ol/source/Tile~TileSource#getZDirection has been added to avoid having the
getZDirection method solely in the Zoomify source - just to document the
possibility.
2019-03-21 10:06:22 +01:00
ahocevar
fefcc9f0ca Return directly when all we do is render queued images 2019-03-20 23:04:48 +01:00
ahocevar
d2f60a70d1 Recreate instructions for the view resolution 2019-03-20 22:45:17 +01:00
ahocevar
a25ca03040 Do not use tile.load() for getting source tiles 2019-03-20 22:45:17 +01:00
ahocevar
461256767e Make pattern fills work on a scaled canvas 2019-03-20 22:25:25 +01:00
Tim Schaub
c4279ff665 Merge pull request #9333 from KaiVolland/unify-rendering-tests
Unify rendering tests
2019-03-20 08:34:54 -07:00
Frédéric Junod
ad5c9ac589 Merge pull request #9350 from fredj/cleanup_examples
Remove unnecessary css in examples
2019-03-19 16:21:51 +01:00
Andreas Hocevar
458f1d0f64 Merge pull request #9351 from ahocevar/default-styles
More efficient default styles
2019-03-19 15:56:49 +01:00
ahocevar
b06c84cef9 More efficient default stroke style 2019-03-19 13:58:20 +01:00
ahocevar
b33ceaa400 More efficient default fill color 2019-03-19 13:57:10 +01:00
Kai Volland
7510a19c73 Replaces vectorimage.tests.js (partially)
Transforms the old rendering tests for the VectorImageLayer
to the new rendering test approach.
The declutter tests are kept in the old format for know.
2019-03-19 11:30:45 +01:00
Kai Volland
ac3a2d960a Replaces tile.tests.js (partially) with new tests
Transforms the old rendering tests for the TileLayer
to the new rendering test approach.
The render-listener test is kept in the old format for know.
2019-03-18 16:39:37 +01:00
Frederic Junod
d5f92843a9 Remove unnecessary css in examples 2019-03-18 16:19:01 +01:00
Kai Volland
fc878fd539 Replaces vectortile.tests.js with new tests
Transforms the old rendering tests for the VectorTileLayer
to the new rendering test approach.
2019-03-18 16:15:58 +01:00
Frédéric Junod
84bf801b52 Merge pull request #9346 from fredj/cleanup
Remove tilePixelRatio options from ol.source.VectorTile
2019-03-18 16:12:28 +01:00
Kai Volland
f555048319 Replaces vector.tests.js with new tests
Transforms the old rendering tests for the LayerVector
to the new rendering test approach.
2019-03-18 15:39:48 +01:00
Frederic Junod
72788187c8 Remove tilePixelRatio options from ol.source.VectorTile
Was removed in #7070
2019-03-18 14:35:58 +01:00
Kai Volland
6759641715 Replaces image.tests.js with new tests
Transforms the old rendering tests for the ImageLayer
to the new rendering test approach.
2019-03-18 13:56:45 +01:00
Frédéric Junod
e12a0ea0ff Merge pull request #9345 from fredj/devDependencies
Update all dev dependencies
2019-03-18 11:53:01 +01:00
greenkeeper[bot]
508d980514 chore(package): update webpack-cli to version 3.3.0 2019-03-18 11:13:50 +01:00
greenkeeper[bot]
c52566a244 chore(package): update eslint to version 5.15.2 2019-03-18 11:13:02 +01:00
greenkeeper[bot]
5803727409 chore(package): update ol-mapbox-style to version 4.2.1 2019-03-18 11:12:50 +01:00
greenkeeper[bot]
1d88528686 chore(package): update buble to version 0.19.7 2019-03-18 11:12:39 +01:00
greenkeeper[bot]
3a4be21a25 chore(package): update copy-webpack-plugin to version 5.0.1 2019-03-18 11:12:11 +01:00
greenkeeper[bot]
16419b3281 chore(package): update pngjs to version 3.4.0 2019-03-18 11:11:58 +01:00
greenkeeper[bot]
6d50f43448 chore(package): update webpack-dev-middleware to version 3.6.1 2019-03-18 11:11:40 +01:00
greenkeeper[bot]
f1bfccbfe6 chore(package): update yargs to version 13.2.2 2019-03-18 11:10:50 +01:00
greenkeeper[bot]
a56e8719d3 chore(package): update url-polyfill to version 1.1.5 2019-03-18 11:10:15 +01:00
greenkeeper[bot]
85e2ffa63f chore(package): update sinon to version 7.2.7 2019-03-18 11:09:57 +01:00
greenkeeper[bot]
1b91400ebc chore(package): update karma to version 4.0.1 2019-03-18 11:08:53 +01:00
greenkeeper[bot]
48156af617 chore(package): update terser-webpack-plugin to version 1.2.3 2019-03-18 11:08:34 +01:00
greenkeeper[bot]
c510fe268b chore(package): update webpack-dev-server to version 3.2.1 2019-03-18 11:08:19 +01:00
Kai Volland
912fb03564 Fixes RasterSource tests
Puppeteer/TestSuite seems to have
problems with webworker so threads is set
to 0
2019-03-18 10:33:05 +01:00
Andreas Hocevar
3f7c52c29f Merge pull request #9342 from openlayers/greenkeeper/handlebars-4.1.1
Update handlebars to the latest version 🚀
2019-03-17 11:53:10 +01:00
Andreas Hocevar
9284ba47a4 Merge pull request #9341 from ahocevar/remove-unused
Remove unused ExecutorGroup methods
2019-03-17 11:46:08 +01:00
greenkeeper[bot]
4a405cc975 chore(package): update handlebars to version 4.1.1 2019-03-16 21:30:46 +00:00
ahocevar
5857117625 Remove unused ExecutorGroup methods 2019-03-16 21:29:49 +01:00
Frédéric Junod
75d9ade613 Merge pull request #9337 from fredj/codesandbox_div_size
Set map div size in example send to codesandbox
2019-03-15 15:15:59 +01:00
Kai Volland
58cebcc97f Replaces tilewms.tests.js with new tests
Transforms the old rendering tests for the TileWMSSource
to the new rendering test approach.
2019-03-15 14:30:23 +01:00
Kai Volland
3f8da79893 Replaces raster.tests.js with new tests
Transforms the old rendering tests for the RasterSource
to the new rendering test approach.
2019-03-15 14:04:23 +01:00
Frederic Junod
5f8450d67d Set map div size in example send to codesandbox 2019-03-15 13:53:58 +01:00
Kai Volland
d89b909187 Replaces text.tests.js with new tests
Transforms the old rendering tests for the TextStyle
to the new rendering test approach.
2019-03-15 12:11:13 +01:00
Kai Volland
f79b358c92 Replaces regularshape.tests.js with new tests
Transforms the old rendering tests for the regularshape
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Kai Volland
e4ef5c789c Removes map.tests.js renders 2019-03-15 10:42:47 +01:00
Kai Volland
d871196e16 Removes linestring.test.js
Removes linestring.test.js and related pngs as linestring
style is already tested with the new approach.
2019-03-15 10:42:47 +01:00
Kai Volland
595b74d04e Replaces map.tests.js with new tests
Transforms the old rendering test for the Map
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Kai Volland
de0f5d44a3 Replaces circle.tests.js with new tests
Transforms the old rendering test for the CircleStyle
to the new rendering test approach.
2019-03-15 10:42:47 +01:00
Frédéric Junod
1637cffbe9 Merge pull request #9335 from openlayers/codesandbox_template
Create codesandbox using the 'parcel' template
2019-03-14 16:24:24 +01:00
Frederic Junod
2f28f89c59 Create codesandbox using the 'parcel' template
The default template is `create-react-app` and this one ignores the `head` tag defined in out `index.html`
2019-03-14 15:08:01 +01:00
Frédéric Junod
de7afee96d Merge pull request #9329 from fredj/cluster_refresh
Don't refresh the layer after addFeatures call
2019-03-14 11:04:28 +01:00
Frederic Junod
92cb9f1c51 Don't refresh the layer after addFeatures call 2019-03-14 10:25:19 +01:00
Frédéric Junod
7896fa894d Merge pull request #9328 from fredj/cleanup
Mark layerFilter in AtPixelOptions as optional
2019-03-14 09:17:28 +01:00
Andreas Hocevar
d6f7533c76 Merge pull request #9325 from ahocevar/no-round
Create a more accurate origin for tile positioning
2019-03-14 09:12:19 +01:00
ahocevar
4a9d2e689e Create a more accurate origin for tile positioning 2019-03-13 18:34:23 +01:00
Andreas Hocevar
df3d771c53 Merge pull request #9320 from RobertOrthofer/master
enhance tile-debug readability
2019-03-13 12:16:23 +01:00
Robert Orthofer
0aa14db88b move stroke behind text to achieve halo 2019-03-13 09:31:01 +01:00
Andreas Hocevar
d75caaa3df Merge pull request #9318 from ahocevar/smart-cache-size
Smart cache size
2019-03-13 08:17:24 +01:00
Andreas Hocevar
cfc79254d0 Merge pull request #9322 from ahocevar/render-to-source-resolution
Use closest lower source resolution for render tiles
2019-03-13 08:15:25 +01:00
ahocevar
ac0d67b273 Use closest lower source resolution for render tiles 2019-03-12 16:51:20 +01:00
Andreas Hocevar
17b37a90da Merge pull request #9321 from KaiVolland/inheritdoc
Fixes #9294 (missing documention for methods with `@inheritDoc`)
2019-03-12 15:26:26 +01:00
Kai Volland
72d38fa929 Fixes missing methods with @inheritdoc
- This sets ignore to false if a method tagged with
inheritdoc has a matching ancestor. It also stops iterating
when a match is found.
- Outdated TODO is removed, too.
2019-03-12 15:07:03 +01:00
Robert Orthofer
a051892b92 enhance tile-debug readability
this commit enhances the readability of
tile debug coordinates by adding a stroke
for better readability on aerial imagery
and a maxWidth for high zoom levels
2019-03-12 12:48:26 +01:00
Tim Schaub
c573d53297 Merge pull request #9319 from tschaub/licensed
Add title to license to clarify that it is BSD 2-Clause
2019-03-12 04:21:54 -06:00
ahocevar
b4fc249991 Faster calculation of target size
Since usedTiles and wantedTiles will never have an overlap, we can use their
key count directly.
2019-03-12 08:53:52 +01:00
Frédéric Junod
c321c90497 Merge pull request #9300 from fredj/f9299
Fix documentation about zoomDelta for ol.interaction.default function
2019-03-12 08:31:30 +01:00
ahocevar
cb2b57232c Add tests 2019-03-12 08:11:17 +01:00
Tim Schaub
90c3c1db81 Add title to license to clarify that it is BSD 2-Clause
The BSD 2-Clause License is a simplified version of the BSD 3-Clause License.  This license was popularized by the FreeBSD project and is sometimes referred to as the "FreeBSD License" (see https://opensource.org/licenses/BSD-2-Clause and https://en.wikipedia.org/wiki/BSD_licenses#2-clause).  To clarify that the OpenLayers License uses the BSD 2-Clause License template, this change adds "The 2-Clause BSD License" to the top of our license file.  In addition, this change makes our license a verbatim copy of the template at https://opensource.org/licenses/BSD-2-Clause with only the copyright holders added.  This change is not intended to change the project's license, only to clarify the template used for that license.  See https://lists.osgeo.org/pipermail/openlayers-dev/2011-May/007555.html for the original motion to switch to the BSD 2-Clause License (also known as the FreeBSD License).
2019-03-11 22:27:35 -06:00
ahocevar
11f5a4c5b8 Move tile specific methods to the tile layer renderer 2019-03-12 00:19:51 +01:00
ahocevar
0f217392d7 Adjust tile cache size when too small 2019-03-12 00:19:13 +01:00
Andreas Hocevar
b54b7c5989 Merge pull request #9305 from KaiVolland/fix-scaleline-test
Fixes failing tests for Chrome v74
2019-03-11 15:30:01 +01:00
Kai Volland
1348d76a33 Updates test renders
Rendering has changed due to change of browser test version.
2019-03-11 15:13:13 +01:00
Frederic Junod
4a13bf2fa9 Mark layerFilter in AtPixelOptions as optional 2019-03-11 15:11:16 +01:00
Frederic Junod
d71fa78ee2 Remove unused template tag 2019-03-11 15:10:32 +01:00
Frédéric Junod
c0d4cdbabf Merge pull request #9315 from fredj/f9290
Change CSS class for tooltips in measure example
2019-03-11 14:37:43 +01:00
Frederic Junod
76aa26e3e9 Change CSS class for tooltips in measure example 2019-03-11 14:24:57 +01:00
Kai Volland
fcf6e81430 Fixes issue with ScaleLine
Math.pow with negative exponents is inaccurate in chrome v74. `toFixed`
is called on the result to fix this.
2019-03-11 13:31:49 +01:00
Andreas Hocevar
dfabcc0c66 Merge pull request #9137 from jahow/add-view-constrain-extent-2
Refactor the way view constraints are handled & add a view extent constraint
2019-03-11 10:38:31 +01:00
Andreas Hocevar
3282c74de6 Merge pull request #9311 from openlayers/greenkeeper/pbf-3.2.0
Update pbf to the latest version 🚀
2019-03-11 10:29:17 +01:00
Andreas Hocevar
dee36639bd Merge pull request #9313 from ahocevar/interpolate-tests
Re-enable and fix disabled tests
2019-03-11 10:18:00 +01:00
Andreas Hocevar
5a578c00a7 Merge pull request #9314 from ahocevar/fix-transpile
Fix transpilation
2019-03-11 10:17:32 +01:00
ahocevar
e8243b73b5 Fix transpilation 2019-03-11 10:11:05 +01:00
ahocevar
404b04ae59 Re-enable and fix disabled tests 2019-03-11 09:30:04 +01:00
Andreas Hocevar
8a02a6f9f1 Merge pull request #9308 from ahocevar/vectortile-loader-projection
Simplify vector tile projection handling
2019-03-11 09:28:48 +01:00
Bart van den Eijnden
4a67bd86a8 Merge pull request #9312 from bartvde/stamen-minzoom
Update zoom levels for Stamen source
2019-03-11 09:17:50 +01:00
Frédéric Junod
feb1a9f31b Merge pull request #9310 from fredj/stamen_transition
Add transition options to Stamen source
2019-03-11 09:11:38 +01:00
greenkeeper[bot]
8a5720e8cb fix(package): update pbf to version 3.2.0 2019-03-11 07:51:32 +00:00
bartvde
9ad2924f00 Update zoom levels for Stamen source 2019-03-11 08:50:28 +01:00
Frederic Junod
0401aed6e3 Add transition options to Stamen source 2019-03-11 08:34:42 +01:00
ahocevar
b2722542fe Simplify vector tile projection handling 2019-03-10 09:37:58 +01:00
Andreas Hocevar
7002053678 Merge pull request #9307 from ahocevar/line-height
Take line-height into account when measuring text height
2019-03-09 10:07:16 +01:00
Frederic Junod
425cd19922 Add a new font line height option in vector-label example 2019-03-09 09:59:57 +01:00
ahocevar
4a7b3cde56 Take line-height into account when measuring text height 2019-03-09 08:25:09 +01:00
Frédéric Junod
9c1c71b8e5 Merge pull request #9306 from fredj/dispose_layer_renderer
Set the canvas size to 0 on dispose
2019-03-09 08:00:35 +01:00
Frederic Junod
6de566d95b Set the canvas size to 0 on dispose 2019-03-08 13:25:49 +01:00
Kai Volland
b31715e86e Updates puppeteer to 1.13.0
Will use Chromium 74.0.3723.0 (r637110) to run the tests
2019-03-08 11:23:41 +01:00
Frederic Junod
9e89047e6a Fix documentation about zoomDelta for ol.interaction.default function 2019-03-07 14:22:33 +01:00
Andreas Hocevar
a372ca0569 Merge pull request #9295 from ahocevar/update-ol-mapbox-style
Update ol-mapbox-style to fix broken mapbox-style example
2019-03-07 10:10:08 +01:00
Marc Jansen
1e06dd979e Merge pull request #9292 from KaiVolland/downgrade-puppeteer
Downgrades puppeteer to `~1.11.0`
2019-03-06 19:15:35 +01:00
ahocevar
c44e6ebe1d Update ol-mapbox-style to fix broken mapbox-style example 2019-03-06 19:13:33 +01:00
Kai Volland
c8fab42d75 Downgrades puppeteer to ~1.11.0
This downgrades puppeteer to version `~1.11.0`.
This will download the stable version of chromium
(72.0.3582.0). The current puppeteer version
(`^1.12.2`) downloads the beta version of
chromium (73.0.3679.0).
2019-03-06 16:53:45 +01:00
Andreas Hocevar
0995f95ef1 Fix typo in extent-constrained example
Co-Authored-By: jahow <olivier.guyot@camptocamp.com>
2019-03-04 18:11:15 +01:00
Olivier Guyot
447266cbe8 Better smoothing of resolution and center constraints
Previously the formula for the resolution constraint allowed going way past
the minimum zoom.
Also adjusted the center constraint to avoid a zigzag effect when going out
of resolution bounds.
2019-03-04 10:14:06 +01:00
Andreas Hocevar
d25a534dea Merge pull request #9285 from openlayers/greenkeeper/globby-9.1.0
Update globby to the latest version 🚀
2019-03-04 09:53:25 +01:00
greenkeeper[bot]
90749cd80f chore(package): update globby to version 9.1.0 2019-03-03 13:21:03 +00:00
Andreas Hocevar
f1aca67882 Merge pull request #9280 from openlayers/greenkeeper/ol-mapbox-style-4.0.0
Update ol-mapbox-style to the latest version 🚀
2019-03-01 09:56:49 +01:00
Tim Schaub
d7905896f7 Merge pull request #9266 from tschaub/vector-image-options
Full type definition for image vector layer options
2019-02-28 21:43:23 -07:00
greenkeeper[bot]
a7af9a0697 chore(package): update ol-mapbox-style to version 4.0.0 2019-02-28 16:31:06 +00:00
Andreas Hocevar
eea67868f7 Merge pull request #9279 from openlayers/greenkeeper/webpack-4.29.6
Update webpack to the latest version 🚀
2019-02-28 14:24:54 +01:00
Frédéric Junod
d99405feeb Merge pull request #9278 from fredj/bing_imagerySet
Update Bing's imagerySet used in examples
2019-02-28 12:59:17 +01:00
greenkeeper[bot]
14831a0d61 chore(package): update webpack to version 4.29.6 2019-02-28 10:53:28 +00:00
Marc Jansen
43bc53b20b Merge pull request #9270 from bvx89/patch-1
Update faq.md
2019-02-28 10:49:35 +01:00
Frederic Junod
c01dee0884 Update Bing's imagerySet used in examples 2019-02-28 10:43:59 +01:00
Andreas Hocevar
6fd83b9a8e Merge pull request #9277 from ahocevar/rotate-token
Rotate API token
2019-02-27 18:38:34 +01:00
ahocevar
05712acfef Rotate API token 2019-02-27 18:31:50 +01:00
Frédéric Junod
cd17f4b0d6 Merge pull request #9276 from fredj/graticule_cleanup
Use the constructor options instead of changing the private variables
2019-02-27 17:02:41 +01:00
Frederic Junod
7c7b43ee91 Use the constructor options instead of changing the private variables 2019-02-27 15:11:08 +01:00
Frédéric Junod
02f9411c6b Merge pull request #9275 from fredj/rm_setDeclutter
Remove setDeclutter function
2019-02-27 14:03:38 +01:00
Frederic Junod
1338a868e9 Remove setDeclutter function
Changing the declutter value after the layer creating doesn't work, remove the function to avoid confusion.
2019-02-27 11:41:08 +01:00
Lasse Brudeskar Vikås
6b1f9e681c Update faq.md 2019-02-27 11:30:55 +01:00
Andreas Hocevar
65d8b5f26b Merge pull request #9273 from chrismayer/9269-fix-gfi-examples
Fix WMS GetFeatureInfo examples
2019-02-27 10:15:16 +01:00
Christian Mayer
530e47d26c Remove IFrame usage in GetFeatureInfo img example
This replaces the loading of the GetFeatureInfo request via IFrame by a
fetch operation in the GetFeatureInfo image example.
2019-02-27 09:55:59 +01:00
Christian Mayer
85f2312370 Remove IFrame usage in GetFeatureInfo tile example
This replaces the loading of the GetFeatureInfo request via IFrame by a
fetch operation in the GetFeatureInfo tile example.
2019-02-27 09:55:59 +01:00
Lasse Brudeskar Vikås
301b45cb7c Update faq.md
Fixed typos in description, and tried to make the text more readable.
2019-02-26 16:13:06 +01:00
Frédéric Junod
3aa93014c0 Merge pull request #9246 from openlayers/mobile-full-screen
Add missing ol.css in mobile-full-screen example
2019-02-26 12:36:42 +01:00
Frederic Junod
734900f1d7 Add missing ol.css in mobile-full-screen example 2019-02-26 08:39:39 +01:00
Andreas Hocevar
fb2ea83838 Merge pull request #9268 from openlayers/greenkeeper/mocha-6.0.2
Update mocha to the latest version 🚀
2019-02-25 20:51:51 +01:00
greenkeeper[bot]
8534aaa304 chore(package): update mocha to version 6.0.2 2019-02-25 19:09:43 +00:00
Tim Schaub
36cf654f09 Full type definition for image vector layer options 2019-02-25 08:37:30 -07:00
Andreas Hocevar
4e8522e696 Merge pull request #9261 from openlayers/greenkeeper/coveralls-3.0.3
Update coveralls to the latest version 🚀
2019-02-25 15:43:05 +01:00
Frédéric Junod
88760de64b Merge pull request #9264 from tpluscode/patch-1
add question about resizing map element
2019-02-25 10:43:54 +01:00
Tomasz Pluskiewicz
b5f7705e1d Update faq.md 2019-02-25 10:02:52 +01:00
Tomasz Pluskiewicz
9efe10f747 add question about resizing map element 2019-02-25 09:42:54 +01:00
Frédéric Junod
73744de14e Merge pull request #9260 from fredj/rm_geom_param
Remove unused 'geometry' param from ol/render/canvas/Builder
2019-02-25 08:25:06 +01:00
greenkeeper[bot]
d6c18667f4 chore(package): update coveralls to version 3.0.3 2019-02-22 19:13:45 +00:00
Frederic Junod
cd28c8a301 Remove unused 'geometry' param from 'createFill' function 2019-02-22 16:52:32 +01:00
Frederic Junod
79c6cc5159 Remove unused 'geometry' param from '{begin,end}Geometry' functions 2019-02-22 16:45:25 +01:00
Frédéric Junod
345607be28 Merge pull request #9256 from openlayers/greenkeeper/mocha-6.0.1
Update mocha to the latest version 🚀
2019-02-22 15:14:35 +01:00
Olivier Guyot
f67baa0dc0 Interactions / fix zoom level when a zoom interaction ends 2019-02-22 15:04:54 +01:00
Olivier Guyot
75c379beeb View / allow specifying an anchor on interaction end
This also fixes a bug where the animation anchor would be lost when outside
the allowed resolution.
2019-02-22 15:04:54 +01:00
Olivier Guyot
405e206717 View / better names for getValid* and applyParameters_ methods 2019-02-22 15:04:54 +01:00
Olivier Guyot
c2af03f152 Update the View documentation & document breaking changes 2019-02-22 15:04:54 +01:00
Olivier Guyot
7835869582 Add an extent restriction on the mapbox layer example
This fixes a bug where the OL map would allow much larger resolution than
mapbox.
2019-02-22 15:01:30 +01:00
Olivier Guyot
78e8f23df5 View / add getValidCenter method to improve interactions
The DragPan, KeyboardPan and DragZoom interactions now make sure to
animate to a valid center/resolution target to avoid
a chained "resolve" animation which looks weird.

The `View.fit` method was also fixed to use this.
2019-02-22 15:01:30 +01:00
Olivier Guyot
433bccd207 Linting and fixes for unit tests 2019-02-22 15:01:30 +01:00
Olivier Guyot
ef6d17d817 View / add a 'smoothResolutionConstraint' options
When enabled (true by default), the resolution min/max values will be applied with
a smoothing effect for a better user experience.
2019-02-22 15:01:30 +01:00
Olivier Guyot
e023c144bb View / add adjust* methods to manipulate the view more easily
API changes:
* (breaking) the `rotate` method is gone
* the `adjustRotation`, `adjustResolution` and `adjustZoom` methods are now
  available and allow using an anchor.

This means interactions do not have to do the anchor computation themselves
and this also fix anchor computation when constraints must be applied.
2019-02-22 15:01:30 +01:00
Olivier Guyot
b5273babb5 View / handle resolutions array with length=1 2019-02-22 15:01:30 +01:00
Olivier Guyot
49662b019c View / add a constrainResolution option
This introduces a breaking change.

This options replaces the various `constrainResolution` options on interactions
and the `fit` method.

Since constraints are now the responsibility of the View, the fact that intermediary
zoom levels are allowed or not is now set in the view options.

By default, the view resolution is unconstrained.
2019-02-22 15:01:30 +01:00
jahow
48ad1ffcbf View / implement a smooth rebound effect when a max extent is given
This is done by applying the center constraint differently when we're in the
middle of an interaction/animation or not.

When the view is moving, the center constraint will restrain the given value
in an "elastic" way, using a logarithmic function.

This can be disabled using the `smoothCenterConstrain` view parameter.
2019-02-22 15:01:30 +01:00
jahow
cd186ada7f Add new tests for View & Interaction w/ fixes 2019-02-22 15:01:30 +01:00
Olivier Guyot
a6f65df8c4 View / add a resolveConstraints method to end interactions
This will help making sure that the view will come back to a "rested" state
once the interactions are over.

Interactions no longer need to handle the animation back to a rested state,
they simply call `endInteraction` with the desired duration and direction.
2019-02-22 15:01:30 +01:00
Olivier Guyot
1c5fd62e43 View / refactor how zoom and resolution are computed
This commit aims to simplify the computation of zoom and resolution in the
View class.

Previously zoom levels and resolution computations were mixed in different places,
ie resolution constraints, initial values, etc.

Now the View class only has the `getZoomForResolution` and `getResolutionForZoom`
methods to convert from one system to another.

Other than that, most computations use the resolution system internally.

The `constrainResolution` method also does not exist anymore, and is replaced
by `getValidResolution` and `getValidZoomLevel` public methods.
2019-02-22 15:01:30 +01:00
Olivier Guyot
1f379a06a4 View / add support for viewport extent constraint
This introduces a breaking change:

The `extent` view option now constrains the whole viewport and not just the
view center.
The option `constrainOnlyCenter` was added to keep the previous behaviour.

Constraining the whole viewport and not only the view center means
that the center and resolution constraints must be applied with a knowledge of
the viewport size.
2019-02-22 15:01:30 +01:00
jahow
e52fab636c View / apply constraints automatically based on hints
All constraints can now function differently if they are applied during
interaction or animation.
2019-02-22 15:01:30 +01:00
jahow
d991dfa54a View / remove constrainCenter method 2019-02-22 15:01:30 +01:00
jahow
c2c1aa01d3 View / removed the constrainRotation method 2019-02-22 15:01:30 +01:00
Olivier Guyot
e6c4b2ffd1 View / make the constrainResolution function private
Other classes should not need to worry about constraining the resolution
or not, as the View will eventually do this on its own.
2019-02-22 15:01:30 +01:00
Olivier Guyot
3c1e3779e2 View / add a method to compute a valid zoom level
The `getValidZoomLevel` apply the current resolution constraint to return
a value that is guaranteed valid.

This is used for interactions & controls which need a target value to work:
the +/- buttons, the zoom clider, the dragbox zoom and the mouse wheel zoom.
2019-02-22 15:01:30 +01:00
Olivier Guyot
4e1ece16ed View / implemented begin- and endInteraction methods 2019-02-22 15:01:30 +01:00
Olivier Guyot
1cb934dbe3 View / implement intermediate values for center/rot/res
The view now has targetCenter, targetRotation and targetResolution members.

These hold the new values given by set* methods. The actual view parameters are then changed by
calling `applyParameters_`.
2019-02-22 15:01:30 +01:00
Andreas Hocevar
767c765524 Merge pull request #9254 from petrsloup/tilejson-tilesize
Add tileSize option to ol/source/TileJSON
2019-02-22 11:14:19 +01:00
Petr Sloup
67ee5a41b0 Add note about ignoring tileSize TileJSON property 2019-02-22 09:05:18 +01:00
greenkeeper[bot]
5c280e8114 chore(package): update mocha to version 6.0.1 2019-02-21 22:59:15 +00:00
Petr Sloup
bc25097899 Add tileSize option to ol/source/TileJSON
The TileJSON spec does not specify the tile size
and there is no TileJSON property specifying the value.

Many providers nowadays provide 512x512 with TileJSON.
2019-02-21 19:00:07 +01:00
Andreas Hocevar
6ce499532c Merge pull request #9250 from ahocevar/clear-refresh
Clearer behaviour of clear() and refresh() on sources
2019-02-21 17:12:26 +01:00
Andreas Hocevar
386f2dc67c Merge pull request #9247 from openlayers/greenkeeper/copy-webpack-plugin-5.0.0
Update copy-webpack-plugin to the latest version 🚀
2019-02-21 15:17:54 +01:00
Andreas Hocevar
90034e4d48 Merge pull request #9251 from ahocevar/cache-size
Fix cache size calculation
2019-02-21 01:57:40 +01:00
ahocevar
4166c80c6e Test cache size 2019-02-21 01:35:40 +01:00
ahocevar
d06d00ccbb Fix typo 2019-02-21 01:29:15 +01:00
Andreas Hocevar
959dba169d Merge pull request #9110 from crubier/master
Add TilePixelRatio to Zoomify
2019-02-21 00:29:42 +01:00
Vincent Lecrubier
900adaaffb Update Zoomify.js 2019-02-20 22:40:24 +00:00
ahocevar
94cd126189 Add setUrl function and don't reset loaded extents in setLoader 2019-02-20 21:55:29 +01:00
ahocevar
1416a3d162 Add upgrade notes 2019-02-20 20:40:33 +01:00
ahocevar
e4873a9952 Improve documentation for ol/Source#refresh 2019-02-20 20:40:09 +01:00
ahocevar
8d1022046e Clear loaded extents when a new loader is set 2019-02-20 20:39:26 +01:00
ahocevar
f40cbf2cac Do not reload on clear(), but on refresh() 2019-02-20 20:39:04 +01:00
ahocevar
a0ba8dd8c6 Add a clear() method for tile sources 2019-02-20 20:37:58 +01:00
ahocevar
8557bd96b5 Test refresh() for image sources 2019-02-20 20:36:40 +01:00
greenkeeper[bot]
3d4f77be51 chore(package): update copy-webpack-plugin to version 5.0.0 2019-02-20 13:19:25 +00:00
Andreas Hocevar
62d82411c8 Merge pull request #9244 from huyngkh/stylus-support
add stylus only and touch only mode to drawing a shape
2019-02-20 11:30:11 +01:00
Huy Nguyen
c3709ef51a remove arrow function, add JSDoc and restore original Draw 2019-02-20 17:23:50 +07:00
Andreas Hocevar
071e9a4735 Merge pull request #9242 from openlayers/greenkeeper/marked-0.6.1
Update marked to the latest version 🚀
2019-02-20 08:42:13 +01:00
Huy Nguyen
0c889da99c add stylus and touch mode to drawing a shape 2019-02-20 13:55:22 +07:00
greenkeeper[bot]
a41f51c437 chore(package): update marked to version 0.6.1 2019-02-19 21:23:11 +00:00
Frédéric Junod
4cb3e24048 Merge pull request #9240 from fredj/text_rotateWithView
Add setRotateWithView function to ol/style/Text
2019-02-19 15:29:00 +01:00
Frederic Junod
4cb9b1eeb3 Add setRotateWithView function to ol/style/Text 2019-02-19 14:20:58 +01:00
Frederic Junod
f0a97ee460 Fix comments indentation 2019-02-19 14:12:14 +01:00
Andreas Hocevar
7c1e16abc3 Merge pull request #9230 from ahocevar/hitdetect-declutter
Consider all tiles for hit detection when decluttering
2019-02-19 12:58:07 +01:00
Andreas Hocevar
84995c688c Merge pull request #9237 from umbe1987/export-to-pdf-example
Fix zoom after export to PDF is done
2019-02-19 11:46:26 +01:00
Umberto Minora
cefb5d4d32 fixed indents checked with npm run lint 2019-02-19 11:25:12 +01:00
Umberto Minora
8eadb3d04c Fixed indent spaces so that hopefully ci/circleci: build does not fail 2019-02-19 10:57:21 +01:00
Umberto Minora
a6023a710a Cleared mixed spaces and tabs 2019-02-19 10:48:11 +01:00
Umberto Minora
33ac3e34ee constrainResolution: false on view fit instead of setting the zoom 2019-02-19 10:38:23 +01:00
Andreas Hocevar
3c64018b37 Merge pull request #9239 from ahocevar/tests-puppeteer
Run tests in Puppeteer and non headless mode
2019-02-19 09:43:13 +01:00
Frédéric Junod
b01970cb86 Merge pull request #9236 from fredj/cleanup
Move params list to the constructor function
2019-02-19 09:26:46 +01:00
Andreas Hocevar
ffa24bfd22 Merge pull request #9238 from openlayers/greenkeeper/mocha-6.0.0
Update mocha to the latest version 🚀
2019-02-18 23:57:33 +01:00
ahocevar
be17bfe85a Avoid render test issues by not running Puppeteer in headless mode 2019-02-18 23:54:20 +01:00
ahocevar
974684ed2b Use Puppeteer for tests 2019-02-18 23:54:20 +01:00
greenkeeper[bot]
f90a41a7ca chore(package): update mocha to version 6.0.0 2019-02-18 21:57:28 +00:00
Firstname Lastname
df847ae35c Fix zoom after export to PDF is done 2019-02-18 22:12:38 +01:00
Frederic Junod
746455a9b9 Move params list to the constructor function 2019-02-18 17:33:07 +01:00
Frederic Junod
3557247b27 Fix comments indentation 2019-02-18 17:31:36 +01:00
Frédéric Junod
658a4a9194 Merge pull request #9233 from fredj/rm_deprecated
Remove deprecated {get,set}SnapToPixel functions
2019-02-18 15:35:42 +01:00
Andreas Hocevar
ec6371d7a0 Merge pull request #9232 from openlayers/greenkeeper/webpack-4.29.5
Update webpack to the latest version 🚀
2019-02-18 14:41:58 +01:00
Frederic Junod
6bab8793a2 Remove deprecated {get,set}SnapToPixel functions 2019-02-18 14:07:27 +01:00
Andreas Hocevar
45b2e8885a Merge pull request #9231 from ahocevar/vectortile-extent
Set vector tile extent earlier
2019-02-18 13:48:25 +01:00
greenkeeper[bot]
40b5891ea7 chore(package): update webpack to version 4.29.5 2019-02-18 11:32:20 +00:00
ahocevar
667cadc403 Remove extent default so we catch errors when extent is not set 2019-02-18 12:07:10 +01:00
ahocevar
08be6cf9bc Set extent berfore features 2019-02-18 11:54:59 +01:00
ahocevar
fd07de39ad Consider all tiles for hit detection when decluttering 2019-02-18 11:40:52 +01:00
Vincent Lecrubier
44942dffb5 Update Zoomify.js 2019-02-18 10:04:02 +00:00
Andreas Hocevar
f7b1fe07d0 Merge pull request #9225 from openlayers/greenkeeper/webpack-4.29.4
Update webpack to the latest version 🚀
2019-02-16 17:46:04 +01:00
greenkeeper[bot]
9a7e5747eb chore(package): update webpack to version 4.29.4 2019-02-15 16:07:50 +00:00
Frédéric Junod
e4264b94ed Merge pull request #9224 from fredj/less_vendor_prefix
Remove vendor prefix for the 'transform' CSS property and fullscreen api
2019-02-15 16:09:24 +01:00
Frederic Junod
e9ecea3bb7 Remove 'moz' prefix for the Full Screen API
Browser support: https://caniuse.com/#feat=fullscreen
2019-02-15 14:37:49 +01:00
Frederic Junod
391dfc5025 Remove vendor prefix for the 'transform' CSS property
Browser support: https://caniuse.com/#feat=transforms2d
2019-02-15 14:29:15 +01:00
Frédéric Junod
3da449d77e Merge pull request #9222 from fredj/devDependencies
Update all dev dependencies
2019-02-15 12:49:08 +01:00
greenkeeper[bot]
7a66dc5774 chore(package): update yargs to version 13.2.0 2019-02-15 10:36:02 +01:00
greenkeeper[bot]
74f7b1974d chore(package): update @types/topojson-specification to version 1.0.1 2019-02-15 10:35:44 +01:00
greenkeeper[bot]
6b94aaa424 chore(package): update @types/arcgis-rest-api to version 10.4.4 2019-02-15 10:33:42 +01:00
greenkeeper[bot]
c4ed80dd92 chore(package): update @types/geojson to version 7946.0.6 2019-02-15 10:32:38 +01:00
greenkeeper[bot]
7a73638fb2 chore(package): update ol-mapbox-style to version 3.7.1 2019-02-15 10:32:21 +01:00
greenkeeper[bot]
0ece4a7dae chore(package): update webpack-dev-middleware to version 3.5.2 2019-02-15 10:31:59 +01:00
greenkeeper[bot]
6fe8b5c49d chore(package): update puppeteer to version 1.12.2 2019-02-15 10:30:37 +01:00
greenkeeper[bot]
2ba4be2661 chore(package): update webpack-cli to version 3.2.3 2019-02-15 10:30:15 +01:00
Andreas Hocevar
a2a3bda5c9 Merge pull request #9221 from ahocevar/remove-unused-sortbyzindex
Remove unused sortByZIndex function
2019-02-15 09:45:26 +01:00
Frédéric Junod
f28b7c7bcf Merge pull request #9220 from fredj/rm_extra_canvas_resize
Don't resize/clear the vector renderer canvas
2019-02-15 09:34:57 +01:00
Frédéric Junod
27d025327f Merge pull request #9217 from fredj/f_9211
Don't use loadImage function to avoid infinite loading loop
2019-02-15 08:47:59 +01:00
ahocevar
020f513ed5 Remove unused sortByZIndex function 2019-02-14 17:40:38 +01:00
Frederic Junod
30fb0b1ed1 Don't resize/clear the vector renderer canvas
Already done in the `renderFrame` function
2019-02-14 13:49:31 +01:00
Frederic Junod
40605d7c53 Don't use loadImage function to avoid infinite loading loop 2019-02-14 13:47:52 +01:00
Frédéric Junod
666c14d190 Merge pull request #9212 from fredj/cleanup
Remove unnecessary type cast
2019-02-14 09:41:15 +01:00
Andreas Hocevar
0a005527e7 Merge pull request #9207 from openlayers/greenkeeper/yargs-13.1.0
Update yargs to the latest version 🚀
2019-02-14 07:46:17 +01:00
Frederic Junod
c0a860a31f Remove unnecessary type cast 2019-02-13 11:42:22 +01:00
greenkeeper[bot]
3e82da4beb chore(package): update yargs to version 13.1.0 2019-02-12 06:35:53 +00:00
Andreas Hocevar
b71d7773d3 Merge pull request #9201 from ahocevar/drawable-child-range
Only consider child range with drawable tiles
2019-02-11 11:05:20 +01:00
Andreas Hocevar
7d5b2d8c3b Merge pull request #9204 from ahocevar/intellisense-notes-addendum
Add missing 'include' section
2019-02-10 22:50:32 +01:00
ahocevar
dc298b8895 Add missing 'include' section 2019-02-10 22:44:22 +01:00
Andreas Hocevar
693c763710 Merge pull request #9203 from ahocevar/intellisense-notes
Only promise what we can deliver regarding IntelliSense
2019-02-10 22:42:42 +01:00
Andreas Hocevar
680f3cde3c Merge pull request #9200 from ahocevar/vectorimage-note
Add upgrade note about renderMode: 'image' for vector layers
2019-02-10 09:55:25 +01:00
ahocevar
3ef6635c09 Only promise what we can deliver regarding IntelliSense 2019-02-10 09:10:01 +01:00
ahocevar
8028ce3ac5 Add upgrade note about renderMode: 'image' for vector layers 2019-02-10 08:47:16 +01:00
ahocevar
3557a13147 Only consider child range with drawable tiles 2019-02-09 19:35:31 +01:00
Frédéric Junod
f6e625f21a Merge pull request #9197 from fredj/cleanup
Remove unused opt_this param
2019-02-08 08:43:31 +01:00
Andreas Hocevar
d1c71c3c61 Merge pull request #9196 from ahocevar/pointresolution-scaleline
getPointResolution returns resolution in projection units
2019-02-07 15:32:32 +01:00
Frederic Junod
6f8ffddace Remove opt_this param in manageTilePyramid function 2019-02-07 13:18:52 +01:00
Frederic Junod
438736068e Remove opt_this param in forEach function 2019-02-07 13:07:36 +01:00
Andreas Hocevar
bfe8ee5309 Merge pull request #9195 from openlayers/greenkeeper/handlebars-4.1.0
Update handlebars to the latest version 🚀
2019-02-07 12:50:05 +01:00
ahocevar
703dadfcde Fix ScaleLine control now that getPointResolution works correctly 2019-02-07 12:26:18 +01:00
ahocevar
fecb8de769 getPointResolution returns proj units 2019-02-07 12:25:37 +01:00
ahocevar
b3bc78daec Provide center in the correct projection 2019-02-07 12:23:45 +01:00
ahocevar
d24ae3c2ac Fix expectation for degree point resolution 2019-02-07 12:22:18 +01:00
Frederic Junod
2879c0b6ad Remove opt_this param in forDataAtCoordinate function 2019-02-07 11:51:28 +01:00
greenkeeper[bot]
5ef1b51c02 chore(package): update handlebars to version 4.1.0 2019-02-07 10:45:15 +00:00
Frederic Junod
41d231a4c7 Remove opt_this param in forEachTileCoordParentTileRange function
The function is only called by `ol/renderer/canvas/TileLayer` and `opt_this` was always `null`.
2019-02-07 11:43:52 +01:00
Frédéric Junod
f4fe1babd2 Merge pull request #9194 from openlayers/greenkeeper/webpack-4.29.3
chore(package): update webpack to version 4.29.3
2019-02-07 11:08:44 +01:00
greenkeeper[bot]
efc85ed0ed chore(package): update webpack to version 4.29.3
Closes #9192
2019-02-07 09:29:38 +00:00
Andreas Hocevar
be16c2357d Merge pull request #9190 from romanzoller/multi-polygon-area
Fix MultiPolygon area calculation
2019-02-05 20:43:37 +01:00
Andreas Hocevar
88c213078e Merge pull request #9179 from gberaudo/allow_image_declutter
Allow declutter with image render mode
2019-02-05 20:29:15 +01:00
Roman Zoller
ee57b197e5 Fix offset passed from linearRingssAreOriented to linearRingsAreOriented
The offset needs to be set to the end of the previous Polygon,
see `offset = orientLinearRings(...)` in function orientLinearRingsArray

Fixes #9189
2019-02-05 17:56:52 +01:00
Roman Zoller
2c859b1196 Rename misnamed functions in geom/flat/orient
- Rename linearRingIsOriented => linearRingsAreOriented
  The function checks all linear rings of a Polygon, so
  the plural "rings" is more appropriate
- Rename linearRingsAreOriented => linearRingssAreOriented
  The double s is appropriate because the check is done for
  all Polygons of a MultiPolygon

This commit restores the function names from OpenLayers v4,
they were changed (wrongly IMHO) in #7820.
2019-02-05 17:49:21 +01:00
Roman Zoller
c4be22b1b6 Add failing test for MultiPolygon#getArea 2019-02-05 17:48:42 +01:00
Guillaume Beraudo
b00b877ca1 Update upgrade notes 2019-02-05 17:25:00 +01:00
Guillaume Beraudo
168edac4a6 Allow declutter with image render mode
Using declutter in image render mode is legitimate: each tile is
decluttered, avoiding symbol/text overlaps.
2019-02-05 17:25:00 +01:00
Frédéric Junod
caa9153dd0 Merge pull request #9187 from fredj/cleanup
Remove unnecessary type cast
2019-02-05 16:36:16 +01:00
Frederic Junod
ba02320fcc Remove unused layerState param 2019-02-05 11:46:12 +01:00
Frederic Junod
427c73ddf9 Remove unnecessary type cast
`npx tsc` output is the same before and after the changes.
2019-02-05 11:46:12 +01:00
Frédéric Junod
2c3ffdfdf8 Merge pull request #9186 from fredj/cleanup
Simplify typing in EsriJSON format
2019-02-05 10:57:36 +01:00
Frederic Junod
97b21145c4 Simplify typing in EsriJSON format 2019-02-05 10:27:26 +01:00
Frédéric Junod
2428c0984e Merge pull request #9161 from fredj/template_type
Use type template for the source type of layers
2019-02-05 10:07:52 +01:00
Frédéric Junod
e0aad192af Merge pull request #9184 from fredj/devDependencies
Update all dev dependencies
2019-02-05 09:22:03 +01:00
Frédéric Junod
e34806ad70 Merge pull request #9185 from openlayers/greenkeeper/webpack-4.29.1
Update webpack to the latest version 🚀
2019-02-05 09:21:22 +01:00
greenkeeper[bot]
a0fde2b24d chore(package): update webpack to version 4.29.1 2019-02-04 18:43:37 +00:00
Frederic Junod
abfe6b4359 Update jsdoc-plugin-typescript to version 1.0.7 2019-02-04 16:27:25 +01:00
greenkeeper[bot]
acd8c34535 chore(package): update terser-webpack-plugin to version 1.2.2 2019-02-04 16:14:46 +01:00
greenkeeper[bot]
1a1c7dec87 chore(package): update puppeteer to version 1.12.1 2019-02-04 16:14:36 +01:00
greenkeeper[bot]
5e4ee77968 chore(package): update eslint to version 5.13.0 2019-02-04 16:14:28 +01:00
greenkeeper[bot]
9f54e9cb4d chore(package): update ol-mapbox-style to version 3.6.4 2019-02-04 16:14:17 +01:00
Frederic Junod
0b53a3229b Remove unneeded type cast 2019-02-04 09:58:49 +01:00
Frederic Junod
5318d52036 Use type template for the source type of layers 2019-02-04 09:58:48 +01:00
Vincent Lecrubier
4d54ad0daf Update Zoomify.js 2019-01-12 13:44:17 +01:00
Vincent Lecrubier
37b1cca027 Add TilePixelRatio to Zoomify 2019-01-12 13:23:18 +01:00
310 changed files with 9689 additions and 4807 deletions

View File

@@ -1,26 +1,25 @@
Copyright 2005-present OpenLayers Contributors. All rights reserved.
BSD 2-Clause License
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Copyright 2005-present, OpenLayers Contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
list of conditions and the following disclaimer.
2. 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.
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY OPENLAYERS 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 COPYRIGHT HOLDER 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.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of OpenLayers Contributors.
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 HOLDER 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,6 +1,6 @@
# OpenLayers
[OpenLayers](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).
[OpenLayers](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 [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).
## Getting Started
@@ -41,14 +41,13 @@ See the following examples for more detail on bundling OpenLayers with your appl
* Using [Parcel](https://github.com/openlayers/ol-parcel)
* Using [Browserify](https://github.com/openlayers/ol-browserify)
## TypeScript and VS Code IntelliSense support
## IntelliSense support and type checking for VS Code
The `ol` package contains a `src/` folder with JSDoc annotated sources. TypeScript can get type definitions from these sources with a `tsconfig.json` like this:
The `ol` package contains a `src/` folder with JSDoc annotated sources. TypeScript can get type definitions from these sources with a `jsconfig.json` config file in the project root:
```js
{
"compilerOptions": {
// Enable JavaScript support
"allowJs": true,
"checkJs": true,
// Point to the JSDoc typed sources when using modules from the ol package
"baseUrl": "./",
"paths": {
@@ -57,11 +56,14 @@ The `ol` package contains a `src/` folder with JSDoc annotated sources. TypeScri
}
},
"include": [
// Include JavaScript files from the ol package
"**/*.js",
"node_modules/ol/**/*.js"
]
}
```
Project template with this configuration: https://gist.github.com/9a7253cb4712e8bf38d75d8ac898e36c.
Note that the above only works when authoring in plain JavaScript. For similar configurations with a `tsconfig.json` in TypeScript projects, your mileage may vary.
## Supported Browsers

View File

@@ -4,11 +4,35 @@
#### Backwards incompatible changes
##### Removal of the deprecated "inherits" function
##### The `setCenter`, `setZoom`, `setResolution` and `setRotation` methods on `ol/View` do not bypass constraints anymore
Previously, these methods allowed setting values that were inconsistent with the given view constraints.
This is no longer the case and all changes to the view state now follow the same logic:
target values are provided and constraints are applied on these to determine the actual values to be used.
##### Removal of the `constrainResolution` option on `View.fit`, `PinchZoom`, `MouseWheelZoom` and `ol/interaction.js`
The `constrainResolution` option is now only supported by the `View` class. A `View.setConstrainResolution` method was added as well.
Generally, the responsibility of applying center/rotation/resolutions constraints was moved from interactions and controls to the `View` class.
##### The view `extent` option now applies to the whole viewport
Previously, this options only constrained the view *center*. This behaviour can still be obtained by specifying `constrainCenterOnly` in the view options.
As a side effect, the view `rotate` method is gone and has been replaced with `adjustRotation` which takes a delta as input.
##### Zoom is constrained so only one world is visible
Previously, maps showed multiple worlds at low zoom levels. Now, the view is restricted to show only one world. To get the previous behavior, configure the `ol/View` with `multiWorld: true`.
##### Removal of deprecated methods
The `inherits` function that was used to inherit the prototype methods from one constructor into another has been removed.
The standard ECMAScript classes should be used instead.
The deprecated `getSnapToPixel` and `setSnapToPixel` functions from the `ImageStyle` class have been removed.
##### New internal tile coordinates
Previously, the internal tile coordinates used in the library had an unusual row order the origin of the tile coordinate system was at the top left as expected, but the rows increased upwards. This meant that all tile coordinates within a tile grid's extent had negative `y` values.
@@ -60,6 +84,10 @@ In addition (this should be exceedingly rare), if you previously created a `ol/t
If you were previously using `VectorTile` layers with `renderMode: 'vector'`, you have to remove this configuration option. That mode was removed. `'hybrid'` (default) and `'image'` are still available.
##### Removal of the "renderMode" option for vector layers
If you were previously using `Vector` layers with `renderMode: 'image'`, you have to remove this configuration option. Instead, use the new `ol/layer/VectorImage` layer with your `ol/source/Vector`.
##### New `prerender` and `postrender` layer events replace old `precompose`, `render` and `postcompose` events
If you were previously registering for `precompose` and `postcompose` events, you should now register for `prerender` and `postrender` events on layers. Instead of the previous `render` event, you should now listen for `postrender`. Layers are no longer composed to a single Canvas element. Instead, they are added to the map viewport as individual elements.
@@ -93,6 +121,58 @@ Due to the constraint above (layers can only be added to a single map), the over
Previously, a graticule was not a layer. Now it is. See the graticule example for details on how to add a graticule layer to your map.
##### `ol/format/Feature` API change
The `getLastExtent()` method, which was required for custom `tileLoadFunction`s in `ol/source/Vector`, has been removed because it is no longer needed (see below).
##### `ol/VectorTile` API changes
* Removal of the `getProjection()` and `setProjection()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
* Removal of the `getExtent()` and `setExtent()` methods. These were used in custom `tileLoadFunction`s on `ol/source/VectorTile`, which work differently now (see below).
##### Custom tileLoadFunction on a VectorTile source needs changes
Previously, applications needed to call `setProjection()` and `setExtent()` on the tile in a custom `tileLoadFunction` on `ol/source/VectorTile`. The format's `getLastExtent()` method was used to get the extent. All this is no longer needed. Instead, the `extent` (first argument to the loader function) and `projection` (third argument to the loader function) are simply passed as `extent` and `featureProjection` options to the format's `readFeatures()` method.
Example for an old `tileLoadFunction`:
```js
function(tile, url) {
tile.setLoader(function() {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setProjection(format.readProjection(data));
tile.setFeatures(format.readFeatures(data, {
// featureProjection is not required for ol/format/MVT
featureProjection: map.getView().getProjection()
}));
tile.setExtent(format.getLastExtent());
})
})
}
});
```
This function needs to be changed to:
```js
function(tile, url) {
tile.setLoader(function(extent, resolution, projection) {
fetch(url).then(function(response) {
response.arrayBuffer().then(function(data) {
var format = tile.getFormat();
tile.setFeatures(format.readFeatures(data, {
// extent is only required for ol/format/MVT
extent: extent,
featureProjection: projection
}));
})
})
}
});
```
##### Drop of support for the experimental WebGL renderer
The WebGL map and layers renderers are gone, replaced by a `WebGLHelper` function that provides a lightweight,
@@ -118,8 +198,19 @@ The removed classes and components are:
Following the removal of the experimental WebGL renderer, the AtlasManager has been removed as well. The atlas was only used by this renderer.
The non API `getChecksum` functions of the style is also removed.
##### Change of the behavior of the vector source's clear() and refresh() methods
The `ol/source/Vector#clear()` method no longer triggers a reload of the data from the server. If you were previously using `clear()` to refetch from the server, you now have to use `refresh()`.
The `ol/source/Vector#refresh()` method now removes all features from the source and triggers a reload of the data from the server. If you were previously using the `refresh()` method to re-render a vector layer, you should instead call `ol/layer/Vector#changed()`.
#### Other changes
##### Allow declutter in image render mode
It is now possible to configure vector tile layers with `declutter: true` and `renderMode: 'image'`. However, note that decluttering will be done per tile, resulting in labels and point symbols getting cut off at tile boundaries.
Until now, using both options forced the render mode to be `hybrid`.
##### Always load tiles while animating or interacting
`ol/PluggableMap` and subclasses no longer support the `loadTilesWhileAnimating` and `loadTilesWhileInteracting` options. These options were used to enable tile loading during animations and interactions. With the new DOM composition render strategy, it is no longer necessary to postpone tile loading until after animations or interactions.

View File

@@ -1,12 +1,8 @@
/*
* This is a hack to prevent inheritDoc tags from entirely removing
* documentation of the method that inherits the documentation.
*
* TODO: Remove this hack when https://github.com/jsdoc3/jsdoc/issues/53
* is addressed.
*/
exports.defineTags = function(dictionary) {
dictionary.defineTag('inheritDoc', {
mustHaveValue: false,
@@ -92,10 +88,15 @@ exports.handlers = {
incompleteDoclet.stability = stability;
for (key in candidate) {
if (candidate.hasOwnProperty(key) &&
keepKeys.indexOf(key) == -1) {
keepKeys.indexOf(key) == -1) {
incompleteDoclet[key] = candidate[key];
}
}
// We have found a matching parent doc and applied it so we
// don't want to ignore this doclet anymore.
incompleteDoclet.ignore = false;
// We found a match so we can stop break
break;
}
}
}

View File

@@ -37,7 +37,7 @@
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */

View File

@@ -21,7 +21,7 @@ Table of contents:
* [Why aren't there any features in my source?](#why-aren-t-there-any-features-in-my-source-)
* [How do I force a re-render of the map?](#how-do-i-force-a-re-render-of-the-map-)
* [Why are my features not found?](#why-are-my-features-not-found-)
* [Why is zooming or clicking off, inaccurate?](#user-content-why-is-zooming-or-clicking-off-inaccurate)
## What projection is OpenLayers using?
@@ -371,3 +371,30 @@ const vectorLayer = new VectorLayer({
```
The recommended value is the size of the largest symbol, line width or label.
## Why is zooming or clicking in the map off/inaccurate?
OpenLayers does not update the map when the container element is resized. This can be caused by progressive updates
to CSS styles or manually resizing the map. When that happens, any interaction will become inaccurate: the map would zoom in and out, and end up not being centered on the pointer. This makes it hard to do certain interactions, e.g. selecting the desired feature.
There is currently no built-in way to react to element's size changes, as [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) is only implemented in Chrome.
There is however an easy to use [polyfill](https://github.com/que-etc/resize-observer-polyfill):
```javascript
import Map from 'ol/Map';
import ResizeObserver from 'resize-observer-polyfill';
const mapElement = document.querySelector('#map')
const map = new Map({
target: mapElement
})
const sizeObserver = new ResizeObserver(() => {
map.updateSize()
})
sizeObserver.observe(mapElement)
// called when the map is destroyed
// sizeObserver.disconnect()
```

View File

@@ -12,9 +12,8 @@ cloak:
<div id="map" class="map"></div>
<select id="layer-select">
<option value="Aerial">Aerial</option>
<option value="AerialWithLabels" selected>Aerial with labels</option>
<option value="Road">Road (static)</option>
<option value="RoadOnDemand">Road (dynamic)</option>
<option value="collinsBart">Collins Bart</option>
<option value="ordnanceSurvey">Ordnance Survey</option>
<option value="AerialWithLabelsOnDemand" selected>Aerial with labels</option>
<option value="RoadOnDemand">Road</option>
<option value="CanvasDark">Road dark</option>
<option value="OrdnanceSurvey">Ordnance Survey</option>
</select>

View File

@@ -5,12 +5,11 @@ import BingMaps from '../src/ol/source/BingMaps.js';
const styles = [
'Road',
'RoadOnDemand',
'Aerial',
'AerialWithLabels',
'collinsBart',
'ordnanceSurvey'
'AerialWithLabelsOnDemand',
'CanvasDark',
'OrdnanceSurvey'
];
const layers = [];
let i, ii;

View File

@@ -21,8 +21,6 @@ tags: "center, rotation, openstreetmap"
<div class="padding-bottom"></div>
<div class="center"></div>
</div>
<button id="zoomtoswitzerlandbest">Zoom to Switzerland</button> (best fit),<br/>
<button id="zoomtoswitzerlandconstrained">Zoom to Switzerland</button> (respect resolution constraint).<br/>
<button id="zoomtoswitzerlandnearest">Zoom to Switzerland</button> (nearest),<br/>
<button id="zoomtoswitzerland">Zoom to Switzerland</button> (best fit).<br/>
<button id="zoomtolausanne">Zoom to Lausanne</button> (with min resolution),<br/>
<button id="centerlausanne">Center on Lausanne</button>

View File

@@ -47,29 +47,14 @@ const map = new Map({
view: view
});
const zoomtoswitzerlandbest = document.getElementById('zoomtoswitzerlandbest');
zoomtoswitzerlandbest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], constrainResolution: false});
}, false);
const zoomtoswitzerlandconstrained =
document.getElementById('zoomtoswitzerlandconstrained');
zoomtoswitzerlandconstrained.addEventListener('click', function() {
const zoomtoswitzerland =
document.getElementById('zoomtoswitzerland');
zoomtoswitzerland.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150]});
}, false);
const zoomtoswitzerlandnearest =
document.getElementById('zoomtoswitzerlandnearest');
zoomtoswitzerlandnearest.addEventListener('click', function() {
const feature = source.getFeatures()[0];
const polygon = /** @type {import("../src/ol/geom/SimpleGeometry.js").default} */ (feature.getGeometry());
view.fit(polygon, {padding: [170, 50, 30, 150], nearest: true});
}, false);
const zoomtolausanne = document.getElementById('zoomtolausanne');
zoomtolausanne.addEventListener('click', function() {
const feature = source.getFeatures()[1];

View File

@@ -1,18 +0,0 @@
#map {
position: relative;
}
#info {
position: absolute;
height: 1px;
width: 1px;
z-index: 100;
}
.tooltip.in {
opacity: 1;
}
.tooltip.top .tooltip-arrow {
border-top-color: white;
}
.tooltip-inner {
border: 2px solid white;
}

View File

@@ -26,9 +26,8 @@ const styleFunction = function(feature) {
scale = size / 10;
let style = styleCache[size];
if (!style) {
const canvas = /** @type {HTMLCanvasElement} */ (document.createElement('canvas'));
const vectorContext = toContext(
/** @type {CanvasRenderingContext2D} */ (canvas.getContext('2d')),
const canvas = document.createElement('canvas');
const vectorContext = toContext(canvas.getContext('2d'),
{size: [size, size], pixelRatio: 1});
vectorContext.setStyle(new Style({
fill: new Fill({color: 'rgba(255, 153, 0, 0.4)'}),

View File

@@ -63,7 +63,10 @@ exportButton.addEventListener('click', function() {
pdf.save('map.pdf');
// Reset original map size
map.setSize(size);
map.getView().fit(extent, {size});
map.getView().fit(extent, {
size: size,
constrainResolution: false
});
exportButton.disabled = false;
document.body.style.cursor = 'auto';
});

View File

@@ -0,0 +1,9 @@
---
layout: example.html
title: Constrained Extent
shortdesc: Example of a view with a constrained extent.
docs: >
This map has a view that is constrained in an extent. This is done using the `extent` view option. Please note that specifying `constrainOnlyCenter: true` would only apply the extent restriction to the view center.
tags: "view, extent, constrain, restrict"
---
<div id="map" class="map"></div>

View File

@@ -0,0 +1,25 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
import {defaults as defaultControls} from '../src/ol/control/util';
import ZoomSlider from '../src/ol/control/ZoomSlider';
const view = new View({
center: [328627.563458, 5921296.662223],
zoom: 8,
extent: [-572513.341856, 5211017.966314,
916327.095083, 6636950.728974]
});
new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
keyboardEventTarget: document,
target: 'map',
view: view,
controls: defaultControls().extend([new ZoomSlider()])
});

View File

@@ -133,7 +133,7 @@ const map = new Map({
layers: [
new TileLayer({
source: new BingMaps({
imagerySet: 'AerialWithLabels',
imagerySet: 'AerialWithLabelsOnDemand',
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5'
})
}),

View File

@@ -1,6 +1,3 @@
.map:-moz-full-screen {
height: 100%;
}
.map:-webkit-full-screen {
height: 100%;
}

View File

@@ -1,6 +1,3 @@
.fullscreen:-moz-full-screen {
height: 100%;
}
.fullscreen:-webkit-full-screen {
height: 100%;
}

View File

@@ -1,6 +1,3 @@
.map:-moz-full-screen {
height: 100%;
}
.map:-webkit-full-screen {
height: 100%;
}

View File

@@ -33,8 +33,11 @@ map.on('singleclick', function(evt) {
evt.coordinate, viewResolution, 'EPSG:3857',
{'INFO_FORMAT': 'text/html'});
if (url) {
document.getElementById('info').innerHTML =
'<iframe seamless src="' + url + '"></iframe>';
fetch(url)
.then((response) => response.text())
.then((html) => {
document.getElementById('info').innerHTML = html;
});
}
});

View File

@@ -33,8 +33,11 @@ map.on('singleclick', function(evt) {
evt.coordinate, viewResolution, 'EPSG:3857',
{'INFO_FORMAT': 'text/html'});
if (url) {
document.getElementById('info').innerHTML =
'<iframe seamless src="' + url + '"></iframe>';
fetch(url)
.then((response) => response.text())
.then((html) => {
document.getElementById('info').innerHTML = html;
});
}
});

View File

@@ -1,3 +0,0 @@
#map {
position: relative;
}

View File

@@ -1,3 +0,0 @@
#map {
position: relative;
}

View File

@@ -4,16 +4,11 @@ title: Interaction Options
shortdesc: Shows interaction options for custom scroll and zoom behavior.
docs: >
This example uses a custom `ol/interaction/defaults` configuration:
* By default, wheel/trackpad zoom and drag panning is always active, which
can be unexpected on pages with a lot of scrollable content and an embedded
map. To perform wheel/trackpad zoom and drag-pan actions only when the map
has the focus, set `onFocusOnly: true` as option. This requires a map div
with a `tabindex` attribute set.
* By default, pinch-zoom and wheel/trackpad zoom interactions can leave the
map at fractional zoom levels. If instead you want to constrain
wheel/trackpad zooming to integer zoom levels, set
`constrainResolution: true`.
by default, wheel/trackpad zoom and drag panning is always active, which
can be unexpected on pages with a lot of scrollable content and an embedded
map. To perform wheel/trackpad zoom and drag-pan actions only when the map
has the focus, set `onFocusOnly: true` as option. This requires a map div
with a `tabindex` attribute set.
tags: "trackpad, mousewheel, zoom, scroll, interaction, fractional"
---
<div tabindex="1" id="map" class="map"></div>

View File

@@ -7,7 +7,7 @@ import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({
constrainResolution: true, onFocusOnly: true
onFocusOnly: true
}),
layers: [
new TileLayer({

View File

@@ -7,7 +7,7 @@ import BingMaps from '../src/ol/source/BingMaps.js';
const key = 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5';
const roads = new TileLayer({
source: new BingMaps({key: key, imagerySet: 'Road'})
source: new BingMaps({key: key, imagerySet: 'RoadOnDemand'})
});
const imagery = new TileLayer({

View File

@@ -203,7 +203,11 @@ const map = new Map({
target: 'map',
view: new View({
center: [-10997148, 4569099],
zoom: 4
zoom: 4,
minZoom: 1,
extent: [-Infinity, -20048966.10, Infinity, 20048966.10],
smoothExtentConstraint: false,
smoothResolutionConstraint: false
})
});

View File

@@ -8,7 +8,7 @@ tags: "mapbox, vector, tiles, mobile"
resources:
- resources/mapbox-streets-v6-style.js
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -8,7 +8,7 @@ import {Fill, Icon, Stroke, Style, Text} from '../src/ol/style.js';
import TileGrid from '../src/ol/tilegrid/TileGrid.js';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q';
// Calculation of resolutions that match zoom levels 1, 3, 5, 7, 9, 11, 13, 15.
const resolutions = [];

View File

@@ -8,7 +8,7 @@ tags: "simple, mapbox, vector, tiles"
resources:
- resources/mapbox-streets-v6-style.js
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -6,7 +6,7 @@ import VectorTileSource from '../src/ol/source/VectorTile.js';
import {Fill, Icon, Stroke, Style, Text} from '../src/ol/style.js';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q';
const map = new Map({
layers: [

View File

@@ -1,4 +1,4 @@
.tooltip {
.ol-tooltip {
position: relative;
background: rgba(0, 0, 0, 0.5);
border-radius: 4px;
@@ -6,18 +6,19 @@
padding: 4px 8px;
opacity: 0.7;
white-space: nowrap;
font-size: 12px;
}
.tooltip-measure {
.ol-tooltip-measure {
opacity: 1;
font-weight: bold;
}
.tooltip-static {
.ol-tooltip-static {
background-color: #ffcc33;
color: black;
border: 1px solid white;
}
.tooltip-measure:before,
.tooltip-static:before {
.ol-tooltip-measure:before,
.ol-tooltip-static:before {
border-top: 6px solid rgba(0, 0, 0, 0.5);
border-right: 6px solid transparent;
border-left: 6px solid transparent;
@@ -27,6 +28,6 @@
margin-left: -7px;
left: 50%;
}
.tooltip-static:before {
.ol-tooltip-static:before {
border-top-color: #ffcc33;
}
}

View File

@@ -225,7 +225,7 @@ function addInteraction() {
draw.on('drawend',
function() {
measureTooltipElement.className = 'tooltip tooltip-static';
measureTooltipElement.className = 'ol-tooltip ol-tooltip-static';
measureTooltip.setOffset([0, -7]);
// unset sketch
sketch = null;
@@ -245,7 +245,7 @@ function createHelpTooltip() {
helpTooltipElement.parentNode.removeChild(helpTooltipElement);
}
helpTooltipElement = document.createElement('div');
helpTooltipElement.className = 'tooltip hidden';
helpTooltipElement.className = 'ol-tooltip hidden';
helpTooltip = new Overlay({
element: helpTooltipElement,
offset: [15, 0],
@@ -263,7 +263,7 @@ function createMeasureTooltip() {
measureTooltipElement.parentNode.removeChild(measureTooltipElement);
}
measureTooltipElement = document.createElement('div');
measureTooltipElement.className = 'tooltip tooltip-measure';
measureTooltipElement.className = 'ol-tooltip ol-tooltip-measure';
measureTooltip = new Overlay({
element: measureTooltipElement,
offset: [0, -15],

View File

@@ -14,6 +14,7 @@ cloak:
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>Mobile full screen example</title>
<link rel="stylesheet" href="../css/ol.css" type="text/css">
<style type="text/css">
html, body, .map {
margin: 0;

View File

@@ -15,7 +15,7 @@ const map = new Map({
new TileLayer({
source: new BingMaps({
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'Road'
imagerySet: 'RoadOnDemand'
})
})
],

View File

@@ -5,7 +5,7 @@ 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.
<code>constrainResolution: true</code> when constructing the view.
tags: "pinch, zoom, interaction"
---
<div id="map" class="map"></div>

View File

@@ -6,10 +6,8 @@ import OSM from '../src/ol/source/OSM.js';
const map = new Map({
interactions: defaultInteractions({pinchZoom: false}).extend([
new PinchZoom({
constrainResolution: true // force zooming to a integer zoom
})
interactions: defaultInteractions().extend([
new PinchZoom()
]),
layers: [
new TileLayer({
@@ -19,6 +17,7 @@ const map = new Map({
target: 'map',
view: new View({
center: [0, 0],
zoom: 2
zoom: 2,
constrainResolution: true
})
});

View File

@@ -29,7 +29,7 @@ const map2 = new Map({
preload: 0, // default value
source: new BingMaps({
key: 'As1HiMj1PvLPlqc_gtM7AqZfBL8ZL3VrjaS3zIb22Uvb9WKhuJObROC-qUpa81U5',
imagerySet: 'AerialWithLabels'
imagerySet: 'AerialWithLabelsOnDemand'
})
})
],

View File

@@ -38,6 +38,9 @@
},
"package.json": {
content: pkgJson
},
'sandbox.config.json': {
content: '{"template": "parcel"}'
}
}
});

View File

@@ -127,9 +127,13 @@
&lt;title&gt;{{ title }}&lt;/title&gt;
&lt;!-- The line below is only needed for old environments like Internet Explorer and Android 4.x --&gt;
&lt;script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"&gt;&lt;/script&gt;{{#if extraHead.remote}}
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
{{ indent extraHead.remote spaces=4 }}{{/if}}
&lt;style&gt;
{{ indent css.source spaces=6 }} &lt;/style&gt;{{/if}}
.map {
width: 100%;
height:400px;
}
{{#if css.source}}{{ indent css.source spaces=6 }}{{/if}} &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
{{ indent contents spaces=4 }} &lt;script src="index.js"&gt;&lt;/script&gt;

View File

@@ -7,7 +7,7 @@ docs: >
Tiles made with [TileMill](http://tilemill.com). Hosting on MapBox.com or with open-source [TileServer](https://github.com/klokantech/tileserver-php/).
tags: "utfgrid, tilejson"
cloak:
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg
- key: pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q
value: Your Mapbox access token from http://mapbox.com/ here
---
<div id="map" class="map"></div>

View File

@@ -5,7 +5,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import TileJSON from '../src/ol/source/TileJSON.js';
import UTFGrid from '../src/ol/source/UTFGrid.js';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
const key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiY2pzbmg0Nmk5MGF5NzQzbzRnbDNoeHJrbiJ9.7_-_gL8ur7ZtEiNwRfCy7Q';
const mapLayer = new TileLayer({
source: new TileJSON({

View File

@@ -103,6 +103,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="12px" id="points-size" />
<br />
<label>Line height: </label>
<input type="text" value="1" id="points-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="points-offset-x" />
<br />
@@ -212,6 +215,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="12px" id="lines-size" />
<br />
<label>Line height: </label>
<input type="text" value="1.2" id="lines-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="lines-offset-x" />
<br />
@@ -321,6 +327,9 @@ tags: "geojson, vector, openstreetmap, label"
<label>Size: </label>
<input type="text" value="10px" id="polygons-size" />
<br />
<label>Line height: </label>
<input type="text" value="1" id="polygons-height" />
<br />
<label>Offset X:</label>
<input type="text" value="0" id="polygons-offset-x" />
<br />

View File

@@ -16,6 +16,7 @@ const myDom = {
font: document.getElementById('points-font'),
weight: document.getElementById('points-weight'),
size: document.getElementById('points-size'),
height: document.getElementById('points-height'),
offsetX: document.getElementById('points-offset-x'),
offsetY: document.getElementById('points-offset-y'),
color: document.getElementById('points-color'),
@@ -34,6 +35,7 @@ const myDom = {
maxangle: document.getElementById('lines-maxangle'),
overflow: document.getElementById('lines-overflow'),
size: document.getElementById('lines-size'),
height: document.getElementById('lines-height'),
offsetX: document.getElementById('lines-offset-x'),
offsetY: document.getElementById('lines-offset-y'),
color: document.getElementById('lines-color'),
@@ -52,6 +54,7 @@ const myDom = {
maxangle: document.getElementById('polygons-maxangle'),
overflow: document.getElementById('polygons-overflow'),
size: document.getElementById('polygons-size'),
height: document.getElementById('polygons-height'),
offsetX: document.getElementById('polygons-offset-x'),
offsetY: document.getElementById('polygons-offset-y'),
color: document.getElementById('polygons-color'),
@@ -84,6 +87,7 @@ const createTextStyle = function(feature, resolution, dom) {
const align = dom.align.value;
const baseline = dom.baseline.value;
const size = dom.size.value;
const height = dom.height.value;
const offsetX = parseInt(dom.offsetX.value, 10);
const offsetY = parseInt(dom.offsetY.value, 10);
const weight = dom.weight.value;
@@ -98,7 +102,7 @@ const createTextStyle = function(feature, resolution, dom) {
document.getElementsByTagName('head')[0].appendChild(openSans);
openSansAdded = true;
}
const font = weight + ' ' + size + ' ' + dom.font.value;
const font = weight + ' ' + size + '/' + height + ' ' + dom.font.value;
const fillColor = dom.color.value;
const outlineColor = dom.outline.value;
const outlineWidth = parseInt(dom.outlineWidth.value, 10);

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "6.0.0-beta.1",
"version": "6.0.0-beta.4",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -36,36 +36,36 @@
"url": "https://github.com/openlayers/openlayers/issues"
},
"dependencies": {
"pbf": "3.1.0",
"pbf": "3.2.0",
"pixelworks": "1.1.0",
"rbush": "2.0.2"
},
"devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.1",
"@types/arcgis-rest-api": "^10.4.3",
"@types/geojson": "^7946.0.5",
"@types/arcgis-rest-api": "^10.4.4",
"@types/geojson": "^7946.0.6",
"@types/pbf": "^3.0.1",
"@types/rbush": "^2.0.2",
"@types/topojson-specification": "^1.0.0",
"buble": "^0.19.6",
"@types/topojson-specification": "^1.0.1",
"buble": "^0.19.7",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.2.1",
"copy-webpack-plugin": "^4.6.0",
"coveralls": "3.0.1",
"eslint": "^5.8.0",
"copy-webpack-plugin": "^5.0.1",
"coveralls": "3.0.3",
"eslint": "^5.15.2",
"eslint-config-openlayers": "^11.0.0",
"expect.js": "0.3.1",
"front-matter": "^3.0.1",
"fs-extra": "^7.0.1",
"glob": "^7.1.2",
"globby": "^8.0.1",
"handlebars": "4.0.11",
"globby": "^9.1.0",
"handlebars": "4.1.1",
"istanbul": "0.4.5",
"jquery": "3.3.1",
"jsdoc": "3.5.5",
"jsdoc-plugin-typescript": "^1.0.6",
"karma": "^4.0.0",
"jsdoc-plugin-typescript": "^1.0.7",
"karma": "^4.0.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.2",
"karma-firefox-launcher": "^1.1.0",
@@ -73,25 +73,25 @@
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^4.0.0-rc.2",
"loglevelnext": "^3.0.0",
"marked": "0.6.0",
"mocha": "5.2.0",
"ol-mapbox-style": "^3.6.3",
"marked": "0.6.1",
"mocha": "6.0.2",
"ol-mapbox-style": "^4.2.1",
"pixelmatch": "^4.0.2",
"pngjs": "^3.3.3",
"pngjs": "^3.4.0",
"proj4": "2.5.0",
"puppeteer": "^1.11.0",
"puppeteer": "~1.14.0",
"serve-static": "^1.13.2",
"shx": "^0.3.2",
"sinon": "^7.2.3",
"terser-webpack-plugin": "^1.2.1",
"sinon": "^7.2.7",
"terser-webpack-plugin": "^1.2.3",
"typescript": "^3.2.2",
"url-polyfill": "^1.1.3",
"url-polyfill": "^1.1.5",
"walk": "^2.3.9",
"webpack": "4.29.0",
"webpack-cli": "^3.2.0",
"webpack-dev-middleware": "^3.5.1",
"webpack-dev-server": "^3.1.14",
"yargs": "^12.0.2"
"webpack": "4.29.6",
"webpack-cli": "^3.3.0",
"webpack-dev-middleware": "^3.6.1",
"webpack-dev-server": "^3.2.1",
"yargs": "^13.2.2"
},
"eslintConfig": {
"extends": "openlayers",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,61 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import XYZ from '../../../src/ol/source/XYZ.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import MultiPolygon from '../../../src/ol/geom/MultiPolygon.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import {getVectorContext} from '../../../src/ol/render.js';
const source = new XYZ({
url: '/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
});
const layer = new TileLayer({
source: source
});
const geometry = new MultiPolygon([
[[[-80, -40], [-40, 0], [-80, 40], [-120, 0], [-80, -40]]],
[[[80, -40], [120, 0], [80, 40], [40, 0], [80, -40]]]
]).transform('EPSG:4326', 'EPSG:3857');
const style = new Style({
stroke: new Stroke({
width: 2,
color: 'blue'
})
});
layer.on('prerender', function(event) {
const context = event.context;
context.save();
const vectorContext = getVectorContext(event);
vectorContext.setStyle(style);
vectorContext.drawGeometry(geometry);
context.clip();
});
layer.on('postrender', function(event) {
const context = event.context;
context.restore();
const vectorContext = getVectorContext(event);
vectorContext.setStyle(style);
vectorContext.drawGeometry(geometry);
});
new Map({
pixelRatio: 1,
target: 'map',
layers: [layer],
view: new View({
center: [0, 0],
zoom: 0
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,28 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Static from '../../../src/ol/source/ImageStatic.js';
import {
get as getProjection,
transform,
transformExtent
} from '../../../src/ol/proj';
import ImageLayer from '../../../src/ol/layer/Image.js';
const center = transform([-122.416667, 37.783333], 'EPSG:4326', 'EPSG:3857');
new Map({
pixelRatio: 1,
target: 'map',
layers: [new ImageLayer({
source: new Static({
url: '/data/tiles/osm/5/5/12.png',
imageExtent: transformExtent([-123, 37, -122, 38], 'EPSG:4326', 'EPSG:3857'),
projection: getProjection('EPSG:3857')
})
})],
view: new View({
center,
zoom: 8
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -0,0 +1,30 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import XYZ from '../../../src/ol/source/XYZ';
import {createXYZ} from '../../../src/ol/tilegrid.js';
const center = [-10997148, 4569099];
const layer = new TileLayer({
source: new XYZ({
url: '/data/tiles/512x256/{z}/{x}/{y}.png',
tileGrid: createXYZ({
tileSize: [512, 256]
}),
transition: 0
})
});
const map = new Map({
target: 'map',
pixelRatio: 1,
view: new View({
center: center,
zoom: 5
})
});
map.addLayer(layer);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -0,0 +1,26 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj';
import XYZ from '../../../src/ol/source/XYZ';
const center = fromLonLat([8.6, 50.1]);
new Map({
layers: [
new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
transition: 0
}),
opacity: 0.2
})
],
target: 'map',
view: new View({
center: center,
zoom: 3
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -0,0 +1,35 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import {fromLonLat} from '../../../src/ol/proj';
import XYZ from '../../../src/ol/source/XYZ';
const center = fromLonLat([8.6, 50.1]);
const layer1 = new TileLayer({
source: new XYZ({
url: '/data/tiles/satellite/{z}/{x}/{y}.jpg',
transition: 0
}),
opacity: 0.2
});
const layer2 = new TileLayer({
source: new XYZ({
url: '/data/tiles/stamen-labels/{z}/{x}/{y}.png',
transition: 0
})
});
const map = new Map({
pixelRatio: 1,
layers: [layer1, layer2],
target: 'map',
view: new View({
center: center,
zoom: 3
})
});
map.getView().setRotation(Math.PI / 2);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@@ -0,0 +1,162 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Style from '../../../src/ol/style/Style.js';
import Text from '../../../src/ol/style/Text.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
let center = [1825927.7316762917, 6143091.089223046];
const map = new Map({
pixelRatio: 1,
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
const source1 = new VectorSource();
const layer1 = new VectorLayer({
declutter: true,
source: source1
});
const source2 = new VectorSource();
const layer2 = new VectorLayer({
declutter: true,
source: source2
});
const source3 = new VectorSource();
const layer3 = new VectorLayer({
declutter: true,
source: source3
});
const source4 = new VectorSource();
const layer4 = new VectorLayer({
declutter: true,
source: source4
});
const feature1 = new Feature({
geometry: new Point(center),
zIndex: 2
});
source1.addFeature(feature1);
source1.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
zIndex: 3
}));
source1.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
zIndex: 1
}));
layer1.setStyle(function(feature) {
return new Style({
image: new CircleStyle({
radius: 15,
stroke: new Stroke({
color: 'blue'
})
})
});
});
map.addLayer(layer1);
center = [center[0] + 500, center[1] + 500];
const feature2 = new Feature({
geometry: new Point(center),
text: 'center',
zIndex: 2
});
source2.addFeature(feature2);
source2.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west',
zIndex: 3
}));
source2.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east',
zIndex: 1
}));
layer2.setStyle(function(feature) {
return new Style({
text: new Text({
text: feature.get('text'),
font: '16px Ubuntu'
})
});
});
map.addLayer(layer2);
center = [center[0] + 500, center[1] + 500];
source3.addFeature(new Feature({
geometry: new Point(center),
text: 'center'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west'
}));
source3.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east'
}));
layer3.setStyle(function(feature) {
return new Style({
image: new CircleStyle({
radius: 5,
stroke: new Stroke({
color: 'red'
})
}),
text: new Text({
text: feature.get('text'),
font: '16px Ubuntu',
textBaseline: 'bottom',
offsetY: -5
})
});
});
map.addLayer(layer3);
center = [center[0] - 2000, center[1] - 2000];
const point = new Feature(new Point(center));
point.setStyle(new Style({
zIndex: 2,
image: new CircleStyle({
radius: 8,
stroke: new Stroke({
color: 'blue'
})
})
}));
const line = new Feature(new LineString([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new Style({
zIndex: 1,
stroke: new Stroke({
color: '#CCC',
width: 12
}),
text: new Text({
placement: 'line',
text: 'east-west',
font: '16px Ubuntu',
overflow: true
})
}));
source4.addFeature(point);
source4.addFeature(line);
map.addLayer(layer4);
render({tolerance: 0.02});

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

View File

@@ -0,0 +1,54 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Fill from '../../../src/ol/style/Fill.js';
const src = new VectorSource({
features: [
new Feature(new Polygon([[
[-22, 18],
[-22, 78],
[-9, 78],
[-9, 18],
[-22, 18]
]])),
new Feature(new Polygon([[
[-9, 18],
[-9, 78],
[4, 78],
[4, 18],
[-9, 18]
]]))
]
});
const layer = new VectorLayer({
renderBuffer: 0,
source: src,
style: new Style({
stroke: new Stroke({
color: [0, 0, 0, 1],
width: 2
}),
fill: new Fill({
color: [255, 0, 0, 1]
})
})
});
const view = new View({
center: [-9.5, 78],
zoom: 2,
projection: 'EPSG:4326'
});
new Map({
pixelRatio: 1,
layers: [layer],
target: 'map',
view: view
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,43 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Feature from '../../../src/ol/Feature.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Style from '../../../src/ol/style/Style.js';
import Fill from '../../../src/ol/style/Fill.js';
const feature = new Feature({
geometry: new Polygon([
[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]],
[[0, 60], [-17.6336, 24.2705], [-57.0634, 18.5410], [-28.5317, -9.2705], [-35.2671, -48.5410], [0, -30], [35.2671, -48.5410], [28.5317, -9.2705], [57.0634, 18.5410], [17.6336, 24.2705], [0, 60]]
])
});
const src = new VectorSource({
features: [
feature
]
});
const layer = new VectorLayer({
renderBuffer: 0,
source: src,
style: new Style({
fill: new Fill({
color: 'blue'
})
})
});
const view = new View({
center: [0, 0],
zoom: 1,
projection: 'EPSG:4326'
});
new Map({
pixelRatio: 1,
layers: [layer],
target: 'map',
view: view
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,110 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Circle from '../../../src/ol/geom/Circle.js';
import LineString from '../../../src/ol/geom/LineString.js';
const center = [1825927.7316762917, 6143091.089223046];
const source1 = new VectorSource();
const source2 = new VectorSource();
const vectorLayer1 = new VectorLayer({
source: source1,
style: new Style({
stroke: new Stroke({
color: '#3399CC',
width: 1.25
})
})
});
const vectorLayer2 = new VectorLayer({
source: source2,
opacity: 0.6
});
function addCircle(r, source) {
source.addFeature(new Feature(new Circle(center, r)));
}
function addPolygon(r, source) {
source.addFeature(new Feature(new Polygon([
[
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
[center[0] + r, center[1] + r],
[center[0] - r, center[1] + r],
[center[0] - r, center[1] - r]
]
])));
}
const smallLine = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new Style({
zIndex: -99,
stroke: new Stroke({width: 75, color: 'red'})
}));
smallLine.getGeometry().translate(-1000, 1000);
source1.addFeature(smallLine);
addPolygon(100, source1);
addCircle(200, source1);
addPolygon(250, source1);
addCircle(500, source1);
addPolygon(600, source1);
addPolygon(720, source1);
const smallLine2 = new Feature(new LineString([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new Style({
stroke: new Stroke({width: 35, color: 'blue'})
}),
new Style({
stroke: new Stroke({width: 15, color: 'green'})
})
]);
smallLine2.getGeometry().translate(1000, 1000);
source1.addFeature(smallLine2);
const smallLine3 = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine3.setStyle([
new Style({
stroke: new Stroke({width: 75, color: 'red'})
}),
new Style({
stroke: new Stroke({width: 45, color: 'white'})
})
]);
smallLine3.getGeometry().translate(-1000, -1000);
addPolygon(400, source2);
addCircle(400, source2);
source2.addFeature(smallLine3);
const map = new Map({
layers: [
vectorLayer1,
vectorLayer2
],
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
map.getView().setRotation(Math.PI + Math.PI / 4);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -0,0 +1,79 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Point from '../../../src/ol/geom/Point.js';
import LineString from '../../../src/ol/geom/LineString.js';
import Text from '../../../src/ol/style/Text.js';
const center = [1825927.7316762917, 6143091.089223046];
const source = new VectorSource();
const vectorLayer1 = new VectorImageLayer({
source: source,
style: function(feature) {
return new Style({
image: new CircleStyle({
radius: 15,
stroke: new Stroke({
color: 'blue'
})
}),
text: new Text({
text: feature.get('text'),
font: '16px Ubuntu'
})
});
}
});
const centerFeature = new Feature({
geometry: new Point(center),
text: 'center'
});
source.addFeature(centerFeature);
source.addFeature(new Feature({
geometry: new Point([center[0] - 540, center[1]]),
text: 'west'
}));
source.addFeature(new Feature({
geometry: new Point([center[0] + 540, center[1]]),
text: 'east'
}));
const line = new Feature(new LineString([
[center[0] - 650, center[1] - 200],
[center[0] + 650, center[1] - 200]
]));
line.setStyle(new Style({
stroke: new Stroke({
color: '#CCC',
width: 12
}),
text: new Text({
placement: 'line',
text: 'east-west',
font: '16px Ubuntu'
})
}));
source.addFeature(line);
const map = new Map({
pixelRatio: 1,
layers: [
vectorLayer1
],
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
map.getView().fit(source.getExtent());
render({tolerance: 0.02});

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,110 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Polygon from '../../../src/ol/geom/Polygon.js';
import Circle from '../../../src/ol/geom/Circle.js';
import LineString from '../../../src/ol/geom/LineString.js';
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
const center = [1825927.7316762917, 6143091.089223046];
const source1 = new VectorSource();
const source2 = new VectorSource();
const vectorLayer1 = new VectorImageLayer({
source: source1,
style: new Style({
stroke: new Stroke({
color: '#3399CC',
width: 1.25
})
})
});
const vectorLayer2 = new VectorImageLayer({
source: source2,
opacity: 0.6
});
function addCircle(r, source) {
source.addFeature(new Feature(new Circle(center, r)));
}
function addPolygon(r, source) {
source.addFeature(new Feature(new Polygon([
[
[center[0] - r, center[1] - r],
[center[0] + r, center[1] - r],
[center[0] + r, center[1] + r],
[center[0] - r, center[1] + r],
[center[0] - r, center[1] - r]
]
])));
}
const smallLine = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine.setStyle(new Style({
zIndex: -99,
stroke: new Stroke({width: 75, color: 'red'})
}));
smallLine.getGeometry().translate(-1000, 1000);
source1.addFeature(smallLine);
addPolygon(100, source1);
addCircle(200, source1);
addPolygon(250, source1);
addCircle(500, source1);
addPolygon(600, source1);
addPolygon(720, source1);
const smallLine2 = new Feature(new LineString([
[center[0], center[1] - 1000],
[center[0], center[1] + 1000]
]));
smallLine2.setStyle([
new Style({
stroke: new Stroke({width: 35, color: 'blue'})
}),
new Style({
stroke: new Stroke({width: 15, color: 'green'})
})
]);
smallLine2.getGeometry().translate(1000, 1000);
source1.addFeature(smallLine2);
const smallLine3 = new Feature(new LineString([
[center[0], center[1] - 1],
[center[0], center[1] + 1]
]));
smallLine3.setStyle([
new Style({
stroke: new Stroke({width: 75, color: 'red'})
}),
new Style({
stroke: new Stroke({width: 45, color: 'white'})
})
]);
smallLine3.getGeometry().translate(-1000, -1000);
addPolygon(400, source2);
addCircle(1000, source2);
source2.addFeature(smallLine3);
const map = new Map({
layers: [
vectorLayer1,
vectorLayer2
],
target: 'map',
view: new View({
center: center,
zoom: 13
})
});
map.getView().setRotation(Math.PI + Math.PI / 4);
render({tolerance: 0.005});

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

View File

@@ -0,0 +1,31 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorTileSource from '../../../src/ol/source/VectorTile';
import MVT from '../../../src/ol/format/MVT';
import {createXYZ} from '../../../src/ol/tilegrid';
import VectorTileLayer from '../../../src/ol/layer/VectorTile';
const map = new Map({
pixelRatio: 2,
layers: [
new VectorTileLayer({
source: new VectorTileSource({
format: new MVT(),
tileGrid: createXYZ(),
url: '/data/tiles/mapbox-streets-v6/{z}/{x}/{y}.vector.pbf',
transition: 0
})
})
],
target: 'map',
view: new View({
center: [1825927.7316762917, 6143091.089223046],
zoom: 14
})
});
map.getView().setRotation(Math.PI / 4);
render({
message: 'Vector tile layer rotates (hidip)',
tolerance: 0.01
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,29 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
const map = new Map({
pixelRatio: 1,
target: 'map',
layers: [
new VectorLayer({
source: new VectorSource({
features: [new Feature({
geometry: new Point([0, 0])
})]
})
})
],
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1,
multiWorld: true
})
});
map.getView().setCenter([10, 10]);
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,27 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
new Map({
pixelRatio: 1,
target: 'map',
layers: [
new VectorLayer({
source: new VectorSource({
features: [new Feature({
geometry: new Point([0, 0])
})]
})
})
],
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,169 @@
import Feature from '../../../src/ol/Feature.js';
import MultiPoint from '../../../src/ol/geom/MultiPoint.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
const vectorSource = new VectorSource();
let feature;
feature = new Feature({
geometry: new MultiPoint([[-20, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, 18]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-20, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
}),
stroke: new Stroke({
color: '#000000',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
}),
stroke: new Stroke({
color: '#000000',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, 3]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
}),
stroke: new Stroke({
color: '#000000',
width: 3
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-20, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
stroke: new Stroke({
color: '#256308',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[-10, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: 'rgba(0, 0, 255, 0.3)'
}),
stroke: new Stroke({
color: '#256308',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new MultiPoint([[4, -15]])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: 'rgba(235, 45, 70, 0.6)'
}),
stroke: new Stroke({
color: '#256308',
width: 3
})
})
}));
vectorSource.addFeature(feature);
const vectorLayer = new VectorLayer({
source: vectorSource
});
new Map({
layers: [
vectorLayer
],
target: 'map',
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
zoom: 1
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,169 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import CircleStyle from '../../../src/ol/style/Circle.js';
import Fill from '../../../src/ol/style/Fill.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
const vectorSource = new VectorSource();
let feature;
feature = new Feature({
geometry: new Point([-20, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, 18])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-20, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({
color: '#91E339'
}),
stroke: new Stroke({
color: '#000000',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: '#5447E6'
}),
stroke: new Stroke({
color: '#000000',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, 3])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: '#92A8A6'
}),
stroke: new Stroke({
color: '#000000',
width: 3
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-20, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 2,
stroke: new Stroke({
color: '#256308',
width: 1
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 4,
fill: new Fill({
color: 'rgba(0, 0, 255, 0.3)'
}),
stroke: new Stroke({
color: '#256308',
width: 2
})
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([4, -15])
});
feature.setStyle(new Style({
image: new CircleStyle({
radius: 6,
fill: new Fill({
color: 'rgba(235, 45, 70, 0.6)'
}),
stroke: new Stroke({
color: '#256308',
width: 3
})
})
}));
vectorSource.addFeature(feature);
const vectorLayer = new VectorLayer({
source: vectorSource
});
new Map({
layers: [
vectorLayer
],
target: 'map',
view: new View({
projection: 'EPSG:4326',
center: [0, 0],
zoom: 1
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -0,0 +1,114 @@
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Fill from '../../../src/ol/style/Fill.js';
import RegularShape from '../../../src/ol/style/RegularShape.js';
import Style from '../../../src/ol/style/Style.js';
import Stroke from '../../../src/ol/style/Stroke.js';
const vectorSource = new VectorSource();
function createFeatures(stroke, fill, offSet = [0, 0]) {
let feature;
feature = new Feature({
geometry: new Point([-15 + offSet[0], 15 + offSet[1]])
});
// square
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
angle: Math.PI / 4
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([8 + offSet[0], 15 + offSet[1]])
});
// triangle
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 3,
radius: 10,
rotation: Math.PI / 4,
angle: 0
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([-10 + offSet[0], -8 + offSet[1]])
});
// star
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 5,
radius: 10,
radius2: 4,
angle: 0
})
}));
vectorSource.addFeature(feature);
feature = new Feature({
geometry: new Point([12 + offSet[0], -8 + offSet[1]])
});
// cross
feature.setStyle(new Style({
image: new RegularShape({
fill: fill,
stroke: stroke,
points: 4,
radius: 10,
radius2: 0,
angle: 0
})
}));
vectorSource.addFeature(feature);
}
createFeatures(
new Stroke({width: 2}),
new Fill({color: 'red'})
);
createFeatures(
new Stroke({
lineDash: [10, 5]
}),
null,
[50, 50]
);
createFeatures(
new Stroke({
lineDash: [10, 5],
lineDashOffset: 5
}),
null,
[-50, -50]
);
createFeatures(new Stroke(), new Fill(), [50, -50]);
const vectorLayer = new VectorLayer({
source: vectorSource
});
new Map({
target: 'map',
layers: [vectorLayer],
view: new View({
center: [0, 0],
resolution: 1
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,32 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import ImageLayer from '../../../src/ol/layer/Image.js';
import RasterSource from '../../../src/ol/source/Raster.js';
import XYZ from '../../../src/ol/source/XYZ.js';
const raster = new RasterSource({
sources: [new XYZ({
url: '/data/tiles/osm/{z}/{x}/{y}.png',
transition: 0
})],
threads: 0, // Avoid using workers to work with puppeteer
operation: function(pixels) {
const pixel = pixels[0];
const red = pixel[0];
pixel[0] = pixel[2];
pixel[2] = red;
return pixel;
}
});
new Map({
layers: [new ImageLayer({source: raster})],
target: 'map',
view: new View({
center: [0, 0],
zoom: 0
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,26 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import TileWMS from '../../../src/ol/source/TileWMS.js';
const tileWms = new TileWMS({
params: {
'LAYERS': 'layer'
},
gutter: 0,
url: '/data/tiles/wms/wms0.png',
transition: 0
});
new Map({
pixelRatio: 1,
layers: [new TileLayer({source: tileWms})],
target: 'map',
view: new View({
center: [0, 0],
zoom: 5
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1,26 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import TileWMS from '../../../src/ol/source/TileWMS.js';
const tileWms = new TileWMS({
params: {
'LAYERS': 'layer'
},
gutter: 20,
url: '/data/tiles/wms/wms20.png',
transition: 0
});
new Map({
pixelRatio: 1,
layers: [new TileLayer({source: tileWms})],
target: 'map',
view: new View({
center: [0, 0],
zoom: 5
})
});
render();

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -0,0 +1,134 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Feature from '../../../src/ol/Feature.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Text from '../../../src/ol/style/Text.js';
import Style from '../../../src/ol/style/Style.js';
import Fill from '../../../src/ol/style/Fill.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
const vectorSource = new VectorSource();
const nicePath = [
20, 33, 40, 31, 60, 30, 80, 31, 100, 33, 120, 37, 140, 39, 160, 40,
180, 39, 200, 37, 220, 33, 240, 31, 260, 30, 280, 31, 300, 33
];
const lineString1 = new LineString(nicePath, 'XY');
const feature1 = new Feature({geometry: lineString1});
feature1.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Hello world',
font: '10px Ubuntu',
placement: 'line'
})
}));
vectorSource.addFeature(feature1);
const lineString2 = lineString1.clone();
lineString2.translate(0, 30);
const feature2 = new Feature({geometry: lineString2});
feature2.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Scale 2',
font: 'normal 400 12px/1 Ubuntu',
scale: 2,
textBaseline: 'bottom',
textAlign: 'right',
placement: 'line'
})
}));
vectorSource.addFeature(feature2);
const lineString3 = lineString2.clone();
lineString3.translate(0, 30);
const feature3 = new Feature({geometry: lineString3});
feature3.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
font: 'italic bold 0.75em Ubuntu',
text: 'Set properties'
})
}));
feature3.getStyle().getText().setTextAlign('left');
feature3.getStyle().getText().setOffsetX(10);
feature3.getStyle().getText().setOffsetY(-10);
feature3.getStyle().getText().setPlacement('line');
feature3.getStyle().getText().setScale(1.1);
feature3.getStyle().getText().setStroke(new Stroke({color: '#00F7F8'}));
feature3.getStyle().getText().setFill(new Fill({color: '#006772'}));
vectorSource.addFeature(feature3);
const lineString4 = lineString3.clone();
lineString4.translate(0, 30);
const feature4 = new Feature({geometry: lineString4});
feature4.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'negative offsetX',
font: 'normal 400 10px/1 Ubuntu',
offsetX: -10,
textAlign: 'start',
textBaseline: 'top',
placement: 'line'
})
}));
vectorSource.addFeature(feature4);
const lineString5 = lineString4.clone();
lineString5.translate(0, 30);
const feature5 = new Feature({geometry: lineString5});
feature5.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Small text',
font: '10px Ubuntu',
offsetY: 5,
scale: 0.7,
textAlign: 'end',
placement: 'line'
})
}));
vectorSource.addFeature(feature5);
const lineString6 = lineString5.clone();
lineString6.translate(0, 30);
const feature6 = new Feature({geometry: lineString6});
feature6.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'FILL AND STROKE',
font: '10px Ubuntu',
placement: 'line',
fill: new Fill({color: '#FFC0CB'}),
stroke: new Stroke({
color: '#00FF00',
width: 1
})
})
}));
vectorSource.addFeature(feature6);
const map = new Map({
pixelRatio: 1,
layers: [
new VectorLayer({
source: vectorSource
})
],
target: 'map',
view: new View({
center: [0, 0],
resolution: 1,
rotation: Math.PI / 4
})
});
map.getView().fit(vectorSource.getExtent());
render({tolerance: 0.02});

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

@@ -0,0 +1,138 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Feature from '../../../src/ol/Feature.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Text from '../../../src/ol/style/Text.js';
import Style from '../../../src/ol/style/Style.js';
import Fill from '../../../src/ol/style/Fill.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
const vectorSource = new VectorSource();
const uglyPath = [163, 22, 159, 30, 150, 30, 143, 24, 151, 17];
const lineString1 = new LineString(uglyPath, 'XY');
const feature1 = new Feature({geometry: lineString1});
feature1.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Hello world',
font: '10px Ubuntu',
placement: 'line',
overflow: true
})
}));
vectorSource.addFeature(feature1);
const lineString2 = lineString1.clone();
lineString2.translate(0, 30);
const feature2 = new Feature({geometry: lineString2});
feature2.setStyle(new Style({
stroke: new Stroke({color: 'red'}),
text: new Text({
text: 'Scale 2',
scale: 2,
textBaseline: 'bottom',
textAlign: 'right',
placement: 'line',
font: 'italic bold 0.5em Ubuntu',
overflow: true
})
}));
vectorSource.addFeature(feature2);
const lineString3 = lineString2.clone();
lineString3.translate(0, 30);
const feature3 = new Feature({geometry: lineString3});
feature3.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Set properties'
})
}));
feature3.getStyle().getText().setTextAlign('left');
feature3.getStyle().getText().setOffsetX(10);
feature3.getStyle().getText().setOffsetY(-10);
feature3.getStyle().getText().setOverflow(true);
feature3.getStyle().getText().setPlacement('line');
feature3.getStyle().getText().setScale(1.2);
feature3.getStyle().getText().setStroke(new Stroke({color: '#00F7F8'}));
feature3.getStyle().getText().setFill(new Fill({color: '#006772'}));
feature3.getStyle().getText().setMaxAngle(Math.PI);
vectorSource.addFeature(feature3);
const lineString4 = lineString3.clone();
lineString4.translate(0, 30);
const feature4 = new Feature({geometry: lineString4});
feature4.setStyle(new Style({
stroke: new Stroke({color: 'red'}),
text: new Text({
text: 'PLEASE OMIT ME IM UGLY',
font: '10px Ubuntu',
offsetX: -10,
textAlign: 'start',
textBaseline: 'top',
placement: 'line',
overflow: true
})
}));
vectorSource.addFeature(feature4);
const lineString5 = lineString4.clone();
lineString5.translate(0, 30);
const feature5 = new Feature({geometry: lineString5});
feature5.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Small text',
font: '10px Ubuntu',
offsetY: 5,
scale: 0.7,
rotation: 4,
textAlign: 'end',
placement: 'line',
maxAngle: Math.PI,
overflow: true
})
}));
vectorSource.addFeature(feature5);
const lineString6 = lineString5.clone();
lineString6.translate(0, 30);
const feature6 = new Feature({geometry: lineString6});
feature6.setStyle(new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'FILL AND STROKE',
font: '10px Ubuntu',
placement: 'line',
overflow: true,
fill: new Fill({color: '#FFC0CB'}),
stroke: new Stroke({
color: '#00FF00'
})
})
}));
vectorSource.addFeature(feature6);
const map = new Map({
pixelRatio: 1,
layers: [
new VectorLayer({
source: vectorSource
})
],
target: 'map',
view: new View({
center: [0, 0],
resolution: 1,
rotation: -(Math.PI / 4)
})
});
map.getView().fit(vectorSource.getExtent());
render({tolerance: 0.02});

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,106 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import Feature from '../../../src/ol/Feature.js';
import Point from '../../../src/ol/geom/Point.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import Text from '../../../src/ol/style/Text.js';
import Style from '../../../src/ol/style/Style.js';
import Fill from '../../../src/ol/style/Fill.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import LineString from '../../../src/ol/geom/LineString.js';
const nicePath = [
20, 33, 40, 31, 60, 30, 80, 31, 100, 33, 120, 37, 140, 39, 160, 40,
180, 39, 200, 37, 220, 33, 240, 31, 260, 30, 280, 31, 300, 33
];
const vectorSource = new VectorSource();
const pointStyle = new Style({
text: new Text({
text: 'Point Label',
font: 'Ubuntu',
fill: new Fill({
color: 'red'
}),
stroke: new Stroke({
color: 'black'
})
})
});
const lineStyle = new Style({
stroke: new Stroke({color: 'blue'}),
text: new Text({
text: 'Line Label',
font: 'Ubuntu',
fill: new Fill({
color: 'red'
}),
stroke: new Stroke({
color: 'black'
}),
placement: 'line'
})
});
const pointFeature1 = new Feature({
geometry: new Point([160, 100])
});
pointFeature1.setStyle(pointStyle.clone());
pointFeature1.getStyle().getText().setText('POINT ONE');
vectorSource.addFeature(pointFeature1);
const pointFeature2 = new Feature({
geometry: new Point([170, 105])
});
pointFeature2.setStyle(pointStyle.clone());
pointFeature2.getStyle().getText().setText('POINT TWO');
pointFeature2.getStyle().getText().setFill(new Fill({color: 'green'}));
vectorSource.addFeature(pointFeature2);
const pointFeature3 = new Feature({
geometry: new Point([150, 95])
});
pointFeature3.setStyle(pointStyle.clone());
pointFeature3.getStyle().getText().setText('POINT THREE');
pointFeature3.getStyle().getText().setFill(new Fill({color: 'yellow'}));
vectorSource.addFeature(pointFeature3);
const lineString1 = new LineString(nicePath, 'XY');
const lineFeature1 = new Feature({geometry: lineString1});
lineFeature1.setStyle(lineStyle);
lineFeature1.getStyle().getText().setText('LINE ONE');
vectorSource.addFeature(lineFeature1);
const lineString2 = lineString1.clone();
lineString2.translate(10, 10);
const lineFeature2 = new Feature({geometry: lineString2});
lineFeature2.setStyle(lineStyle.clone());
lineFeature2.getStyle().getText().setText('LINE TWO');
lineFeature2.getStyle().getText().setFill(new Fill({color: 'green'}));
vectorSource.addFeature(lineFeature2);
const lineString3 = lineString1.clone();
lineString3.translate(-10, 10);
const lineFeature3 = new Feature({geometry: lineString3});
lineFeature3.setStyle(lineStyle.clone());
lineFeature3.getStyle().getText().setText('LINE THREE');
lineFeature3.getStyle().getText().setFill(new Fill({color: 'yellow'}));
vectorSource.addFeature(lineFeature3);
const map = new Map({
pixelRatio: 1,
layers: [
new VectorLayer({
source: vectorSource
})
],
target: 'map',
view: new View({
center: [0, 0],
resolution: 1
})
});
map.getView().fit(vectorSource.getExtent());
render({tolerance: 0.02});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@@ -20,7 +20,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '12px Ubuntu',
scale: 2,
fill: new Fill({
color: 'red'
@@ -39,7 +39,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'upside down',
font: '14px sans-serif',
font: '12px Ubuntu',
rotation: Math.PI,
stroke: new Stroke({
color: 'red',
@@ -55,6 +55,7 @@ feature = new Feature({
});
feature.setStyle(new Style({
text: new Text({
font: 'Ubuntu',
text: 'rotateWithView',
rotateWithView: true,
stroke: new Stroke({
@@ -71,7 +72,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '12px Ubuntu',
padding: [1, 2, 3, 5],
backgroundFill: new Fill({
color: 'rgba(55, 55, 55, 0.25)'
@@ -91,7 +92,7 @@ feature = new Feature({
feature.setStyle(new Style({
text: new Text({
text: 'hello',
font: '14px sans-serif',
font: '12px Ubuntu',
padding: [1, 2, 3, 5],
backgroundFill: new Fill({
color: 'rgba(55, 55, 55, 0.25)'

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

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