Compare commits

..

1 Commits

Author SHA1 Message Date
ahocevar
937b57c7d9 Update package version to 6.0.0-beta.3 2019-03-11 10:44:51 +01:00
237 changed files with 3322 additions and 53368 deletions

View File

@@ -1,25 +1,26 @@
BSD 2-Clause License
Copyright 2005-present OpenLayers Contributors. All rights reserved.
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:
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 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.
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.

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 [BSD 2-Clause License](https://opensource.org/licenses/BSD-2-Clause).
[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).
## Getting Started

View File

@@ -4,16 +4,6 @@
#### Backwards incompatible changes
#### Removal of optional this arguments
The optional this (i.e. opt_this) arguments were removed from the following methods.
Please use closures, the es6 arrow function or the bind method to achieve this effect (Bind is explained here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind).
* `forEachCorner` in `ol/extent`
* `LRUCache#forEach`
* `RBush#forEach` and `RBush#forEachInExtent`
##### 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.
@@ -22,7 +12,7 @@ target values are provided and constraints are applied on these to determine the
##### 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.
The `constrainResolution` option is now only supported by the `View` class. A `View.setResolutionConstrained` method was added as well.
Generally, the responsibility of applying center/rotation/resolutions constraints was moved from interactions and controls to the `View` class.
@@ -32,10 +22,6 @@ Previously, this options only constrained the view *center*. This behaviour can
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.

View File

@@ -1,8 +1,12 @@
/*
* 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,
@@ -88,15 +92,10 @@ 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

@@ -100,7 +100,8 @@ function xyz2rgb(x) {
const raster = new RasterSource({
sources: [new Stamen({
layer: 'watercolor'
layer: 'watercolor',
transition: 0
})],
operation: function(pixels, data) {
const hcl = rgb2hcl(pixels[0]);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
#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

@@ -1,25 +0,0 @@
---
layout: example.html
title: Filtering features with WebGL
shortdesc: Using WebGL to filter large quantities of features
docs: >
This example shows how to use `ol/renderer/webgl/PointsLayer` to dynamically filter a large amount
of point geometries. The above map is based on a dataset from the NASA containing 45k recorded meteorite
landing sites. Each meteorite is marked by a circle on the map (the bigger the circle, the heavier
the object). A pulse effect has been added, which is slightly offset by the year of the impact.
Adjusting the sliders causes the objects outside of the date range to be filtered out of the map. This is done using
a custom fragment shader on the layer renderer, and by using the `v_opacity` attribute of the rendered objects
to store the year of impact.
tags: "webgl, icon, sprite, filter, feature"
---
<div id="map" class="map"></div>
<form>
<div id="status">Show impacts between <span class="min-year"></span> and <span class="max-year"></span></div>
<label>Minimum year:</label>
<input id="min-year" type="range" min="1850" max="2015" step="1" value="1850"/>
<label>Maximum year:</label>
<input id="max-year" type="range" min="1850" max="2015" step="1" value="2015"/>
</form>

View File

@@ -1,162 +0,0 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import Feature from '../src/ol/Feature';
import Point from '../src/ol/geom/Point';
import VectorLayer from '../src/ol/layer/Vector';
import {Vector} from '../src/ol/source';
import {fromLonLat} from '../src/ol/proj';
import WebGLPointsLayerRenderer from '../src/ol/renderer/webgl/PointsLayer';
import {clamp, lerp} from '../src/ol/math';
import Stamen from '../src/ol/source/Stamen';
const features = [];
const vectorSource = new Vector({
features: [],
attributions: 'NASA'
});
const oldColor = [180, 140, 140];
const newColor = [255, 80, 80];
const startTime = Date.now() * 0.001;
// hanle input values & events
const minYearInput = document.getElementById('min-year');
const maxYearInput = document.getElementById('max-year');
function updateStatusText() {
const div = document.getElementById('status');
div.querySelector('span.min-year').textContent = minYearInput.value;
div.querySelector('span.max-year').textContent = maxYearInput.value;
}
minYearInput.addEventListener('input', updateStatusText);
minYearInput.addEventListener('change', updateStatusText);
maxYearInput.addEventListener('input', updateStatusText);
maxYearInput.addEventListener('change', updateStatusText);
updateStatusText();
class WebglPointsLayer extends VectorLayer {
createRenderer() {
return new WebGLPointsLayerRenderer(this, {
colorCallback: function(feature, vertex, component) {
// component at index 3 is alpha
if (component === 3) {
return 1;
}
// color is interpolated based on year
const ratio = clamp((feature.get('year') - 1800) / (2013 - 1800), 0, 1);
return lerp(oldColor[component], newColor[component], ratio) / 255;
},
sizeCallback: function(feature) {
return 18 * clamp(feature.get('mass') / 200000, 0, 1) + 8;
},
fragmentShader: [
'precision mediump float;',
'uniform float u_time;',
'uniform float u_minYear;',
'uniform float u_maxYear;',
'varying vec2 v_texCoord;',
'varying float v_opacity;',
'varying vec4 v_color;',
'void main(void) {',
' float impactYear = v_opacity;',
// filter out pixels if the year is outside of the given range
' if (impactYear < u_minYear || v_opacity > u_maxYear) {',
' discard;',
' }',
' vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);',
' float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;',
' float value = 2.0 * (1.0 - sqRadius);',
' float alpha = smoothstep(0.0, 1.0, value);',
' vec3 color = v_color.rgb;',
' float period = 8.0;',
' color.g *= 2.0 * (1.0 - sqrt(mod(u_time + impactYear * 0.025, period) / period));',
' gl_FragColor = vec4(color, v_color.a);',
' gl_FragColor.a *= alpha;',
' gl_FragColor.rgb *= gl_FragColor.a;',
'}'
].join(' '),
opacityCallback: function(feature) {
// here the opacity channel of the vertices is used to store the year of impact
return feature.get('year');
},
uniforms: {
u_time: function() {
return Date.now() * 0.001 - startTime;
},
u_minYear: function() {
return parseInt(minYearInput.value);
},
u_maxYear: function() {
return parseInt(maxYearInput.value);
}
}
});
}
}
function loadData() {
const client = new XMLHttpRequest();
client.open('GET', 'data/csv/meteorite_landings.csv');
client.onload = function() {
const csv = client.responseText;
let curIndex;
let prevIndex = 0;
let line;
while ((curIndex = csv.indexOf('\n', prevIndex)) > 0) {
line = csv.substr(prevIndex, curIndex - prevIndex).split(',');
prevIndex = curIndex + 1;
// skip header
if (prevIndex === 0) {
continue;
}
const coords = fromLonLat([parseFloat(line[4]), parseFloat(line[3])]);
features.push(new Feature({
mass: parseFloat(line[1]) || 0,
year: parseInt(line[2]) || 0,
geometry: new Point(coords)
}));
}
vectorSource.addFeatures(features);
};
client.send();
}
loadData();
const map = new Map({
layers: [
new TileLayer({
source: new Stamen({
layer: 'toner'
})
}),
new WebglPointsLayer({
source: vectorSource
})
],
target: document.getElementById('map'),
view: new View({
center: [0, 0],
zoom: 2
})
});
// animate the map
function animate() {
map.render();
window.requestAnimationFrame(animate);
}
animate();

3
examples/icon-color.css Normal file
View File

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

3
examples/icon.css Normal file
View File

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

View File

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

View File

@@ -225,7 +225,7 @@ function addInteraction() {
draw.on('drawend',
function() {
measureTooltipElement.className = 'ol-tooltip ol-tooltip-static';
measureTooltipElement.className = 'tooltip 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 = 'ol-tooltip hidden';
helpTooltipElement.className = '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 = 'ol-tooltip ol-tooltip-measure';
measureTooltipElement.className = 'tooltip tooltip-measure';
measureTooltip = new Overlay({
element: measureTooltipElement,
offset: [0, -15],

View File

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

View File

@@ -24,7 +24,8 @@ function flood(pixels, data) {
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
const elevation = new XYZ({
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
crossOrigin: 'anonymous'
crossOrigin: 'anonymous',
transition: 0
});
const raster = new RasterSource({

View File

@@ -100,7 +100,8 @@ function shade(inputs, data) {
const elevation = new XYZ({
url: 'https://{a-d}.tiles.mapbox.com/v3/aj.sf-dem/{z}/{x}/{y}.png',
crossOrigin: 'anonymous'
crossOrigin: 'anonymous',
transition: 0
});
const raster = new Raster({

View File

@@ -127,13 +127,9 @@
&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}}
{{ indent extraHead.remote spaces=4 }}{{/if}}{{#if css.source}}
&lt;style&gt;
.map {
width: 100%;
height:400px;
}
{{#if css.source}}{{ indent css.source spaces=6 }}{{/if}} &lt;/style&gt;
{{ indent css.source spaces=6 }} &lt;/style&gt;{{/if}}
&lt;/head&gt;
&lt;body&gt;
{{ indent contents spaces=4 }} &lt;script src="index.js"&gt;&lt;/script&gt;

View File

@@ -1,6 +1,6 @@
{
"name": "ol",
"version": "6.0.0-beta.6",
"version": "6.0.0-beta.3",
"description": "OpenLayers mapping library",
"keywords": [
"map",
@@ -41,31 +41,31 @@
"rbush": "2.0.2"
},
"devDependencies": {
"@openlayers/eslint-plugin": "^4.0.0-beta.2",
"@openlayers/eslint-plugin": "^4.0.0-beta.1",
"@types/arcgis-rest-api": "^10.4.4",
"@types/geojson": "^7946.0.7",
"@types/geojson": "^7946.0.6",
"@types/pbf": "^3.0.1",
"@types/rbush": "^2.0.2",
"@types/topojson-specification": "^1.0.1",
"buble": "^0.19.7",
"buble": "^0.19.6",
"buble-loader": "^0.5.1",
"chaikin-smooth": "^1.0.4",
"clean-css-cli": "4.3.0",
"copy-webpack-plugin": "^5.0.2",
"clean-css-cli": "4.2.1",
"copy-webpack-plugin": "^5.0.0",
"coveralls": "3.0.3",
"eslint": "^5.16.0",
"eslint": "^5.13.0",
"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": "^9.2.0",
"handlebars": "4.1.2",
"globby": "^9.1.0",
"handlebars": "4.1.0",
"istanbul": "0.4.5",
"jquery": "3.4.0",
"jquery": "3.3.1",
"jsdoc": "3.5.5",
"jsdoc-plugin-typescript": "^1.0.7",
"karma": "^4.0.1",
"karma": "^4.0.0",
"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.2",
"mocha": "6.1.3",
"ol-mapbox-style": "^4.3.1",
"marked": "0.6.1",
"mocha": "6.0.2",
"ol-mapbox-style": "^4.1.0",
"pixelmatch": "^4.0.2",
"pngjs": "^3.4.0",
"pngjs": "^3.3.3",
"proj4": "2.5.0",
"puppeteer": "~1.14.0",
"puppeteer": "~1.11.0",
"serve-static": "^1.13.2",
"shx": "^0.3.2",
"sinon": "^7.3.1",
"terser-webpack-plugin": "^1.2.3",
"sinon": "^7.2.3",
"terser-webpack-plugin": "^1.2.2",
"typescript": "^3.2.2",
"url-polyfill": "^1.1.5",
"url-polyfill": "^1.1.3",
"walk": "^2.3.9",
"webpack": "4.30.0",
"webpack-cli": "^3.3.0",
"webpack-dev-middleware": "^3.6.2",
"webpack-dev-server": "^3.3.1",
"yargs": "^13.2.2"
"webpack": "4.29.6",
"webpack-cli": "^3.2.3",
"webpack-dev-middleware": "^3.5.2",
"webpack-dev-server": "^3.1.14",
"yargs": "^13.2.0"
},
"eslintConfig": {
"extends": "openlayers",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -1,61 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1,28 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

View File

@@ -1,30 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 70 KiB

View File

@@ -1,26 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -1,35 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -1,162 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 1016 B

View File

@@ -1,54 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -1,43 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -1,110 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -1,79 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -1,110 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 135 KiB

View File

@@ -1,31 +0,0 @@
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: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 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: 1.2 KiB

View File

@@ -1,29 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -1,27 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,169 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -1,169 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

View File

@@ -1,114 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -1,32 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -1,26 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -1,26 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 904 B

After

Width:  |  Height:  |  Size: 891 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -1,134 +0,0 @@
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.021});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

View File

@@ -1,138 +0,0 @@
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.

Before

Width:  |  Height:  |  Size: 9.3 KiB

View File

@@ -1,106 +0,0 @@
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.024});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

View File

@@ -1,24 +0,0 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import Zoomify from '../../../src/ol/source/Zoomify.js';
const layer = new TileLayer({
source: new Zoomify({
url: '/data/tiles/zoomify/',
size: [200, 200],
tileSize: 100
})
});
new Map({
layers: [layer],
target: 'map',
view: new View({
resolutions: [2, 1],
center: [100, -100],
zoom: 0.4
})
});
render();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 B

View File

@@ -1,25 +0,0 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import Zoomify from '../../../src/ol/source/Zoomify.js';
const layer = new TileLayer({
source: new Zoomify({
url: '/data/tiles/zoomify/',
size: [200, 200],
tileSize: 100,
zDirection: -1
})
});
new Map({
layers: [layer],
target: 'map',
view: new View({
resolutions: [2, 1],
center: [100, -100],
zoom: 0.4
})
});
render();

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 440 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 422 KiB

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