Rename extent
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth} from '../src/ol/extent.js';
|
||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||
import {DEVICE_PIXEL_RATIO} from '../src/ol/has.js';
|
||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||
@@ -25,7 +25,7 @@ function gradient(feature, resolution) {
|
||||
// we just divide the geometry's extent width by resolution and multiply with
|
||||
// pixelRatio to match the renderer's pixel coordinate system.
|
||||
const grad = context.createLinearGradient(0, 0,
|
||||
_ol_extent_.getWidth(extent) / resolution * pixelRatio, 0);
|
||||
getWidth(extent) / resolution * pixelRatio, 0);
|
||||
grad.addColorStop(0, 'red');
|
||||
grad.addColorStop(1 / 6, 'orange');
|
||||
grad.addColorStop(2 / 6, 'yellow');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {createEmpty, getWidth, getHeight, extend} from '../src/ol/extent.js';
|
||||
import KML from '../src/ol/format/KML.js';
|
||||
import {defaults as defaultInteractions} from '../src/ol/interaction.js';
|
||||
import Select from '../src/ol/interaction/Select.js';
|
||||
@@ -65,13 +65,13 @@ const calculateClusterInfo = function(resolution) {
|
||||
for (let i = features.length - 1; i >= 0; --i) {
|
||||
feature = features[i];
|
||||
const originalFeatures = feature.get('features');
|
||||
const extent = _ol_extent_.createEmpty();
|
||||
const extent = createEmpty();
|
||||
let j, jj;
|
||||
for (j = 0, jj = originalFeatures.length; j < jj; ++j) {
|
||||
_ol_extent_.extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
extend(extent, originalFeatures[j].getGeometry().getExtent());
|
||||
}
|
||||
maxFeatureCount = Math.max(maxFeatureCount, jj);
|
||||
radius = 0.25 * (_ol_extent_.getWidth(extent) + _ol_extent_.getHeight(extent)) /
|
||||
radius = 0.25 * (getWidth(extent) + getHeight(extent)) /
|
||||
resolution;
|
||||
feature.set('radius', radius);
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getBottomLeft, getTopRight} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {toLonLat} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
@@ -37,8 +37,8 @@ function wrapLon(value) {
|
||||
function onMoveEnd(evt) {
|
||||
const map = evt.map;
|
||||
const extent = map.getView().calculateExtent(map.getSize());
|
||||
const bottomLeft = toLonLat(_ol_extent_.getBottomLeft(extent));
|
||||
const topRight = toLonLat(_ol_extent_.getTopRight(extent));
|
||||
const bottomLeft = toLonLat(getBottomLeft(extent));
|
||||
const topRight = toLonLat(getTopRight(extent));
|
||||
display('left', wrapLon(bottomLeft[0]));
|
||||
display('bottom', bottomLeft[1]);
|
||||
display('right', wrapLon(topRight[0]));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {applyTransform} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {get as getProjection, getTransform} from '../src/ol/proj.js';
|
||||
import {register} from '../src/ol/proj/proj4.js';
|
||||
@@ -49,7 +49,7 @@ function setProjection(code, name, proj4def, bbox) {
|
||||
const fromLonLat = getTransform('EPSG:4326', newProj);
|
||||
|
||||
// very approximate calculation of projection extent
|
||||
const extent = _ol_extent_.applyTransform(
|
||||
const extent = applyTransform(
|
||||
[bbox[1], bbox[2], bbox[3], bbox[0]], fromLonLat);
|
||||
newProj.setExtent(extent);
|
||||
const newView = new View({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth, getCenter} from '../src/ol/extent.js';
|
||||
import WMTSCapabilities from '../src/ol/format/WMTSCapabilities.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {get as getProjection} from '../src/ol/proj.js';
|
||||
@@ -128,7 +128,7 @@ layers['grandcanyon'] = new TileLayer({
|
||||
});
|
||||
|
||||
const startResolution =
|
||||
_ol_extent_.getWidth(getProjection('EPSG:3857').getExtent()) / 256;
|
||||
getWidth(getProjection('EPSG:3857').getExtent()) / 256;
|
||||
const resolutions = new Array(22);
|
||||
for (let i = 0, ii = resolutions.length; i < ii; ++i) {
|
||||
resolutions[i] = startResolution / Math.pow(2, i);
|
||||
@@ -175,7 +175,7 @@ function updateViewProjection() {
|
||||
const newProjExtent = newProj.getExtent();
|
||||
const newView = new View({
|
||||
projection: newProj,
|
||||
center: _ol_extent_.getCenter(newProjExtent || [0, 0, 0, 0]),
|
||||
center: getCenter(newProjExtent || [0, 0, 0, 0]),
|
||||
zoom: 0,
|
||||
extent: newProjExtent || undefined
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getCenter} from '../src/ol/extent.js';
|
||||
import ImageLayer from '../src/ol/layer/Image.js';
|
||||
import Projection from '../src/ol/proj/Projection.js';
|
||||
import Static from '../src/ol/source/ImageStatic.js';
|
||||
@@ -30,7 +30,7 @@ const map = new Map({
|
||||
target: 'map',
|
||||
view: new View({
|
||||
projection: projection,
|
||||
center: _ol_extent_.getCenter(extent),
|
||||
center: getCenter(extent),
|
||||
zoom: 2,
|
||||
maxZoom: 8
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getCenter} from '../src/ol/extent.js';
|
||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||
@@ -41,7 +41,7 @@ const map = new Map({
|
||||
target: 'map',
|
||||
view: new View({
|
||||
extent: viewExtent,
|
||||
center: _ol_extent_.getCenter(viewExtent),
|
||||
center: getCenter(viewExtent),
|
||||
zoom: 17,
|
||||
minZoom: 14
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth} from '../src/ol/extent.js';
|
||||
import GeoJSON from '../src/ol/format/GeoJSON.js';
|
||||
import VectorLayer from '../src/ol/layer/Vector.js';
|
||||
import VectorSource from '../src/ol/source/Vector.js';
|
||||
@@ -26,7 +26,7 @@ const labelStyle = new Style({
|
||||
let widest = 0;
|
||||
for (let i = 0, ii = polygons.length; i < ii; ++i) {
|
||||
const polygon = polygons[i];
|
||||
const width = _ol_extent_.getWidth(polygon.getExtent());
|
||||
const width = getWidth(polygon.getExtent());
|
||||
if (width > widest) {
|
||||
widest = width;
|
||||
geometry = polygon;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {get as getProjection} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
@@ -9,7 +9,7 @@ import TileGrid from '../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
const projExtent = getProjection('EPSG:3857').getExtent();
|
||||
const startResolution = _ol_extent_.getWidth(projExtent) / 256;
|
||||
const startResolution = getWidth(projExtent) / 256;
|
||||
const resolutions = new Array(22);
|
||||
for (let i = 0, ii = resolutions.length; i < ii; ++i) {
|
||||
resolutions[i] = startResolution / Math.pow(2, i);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getCenter} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {transformExtent} from '../src/ol/proj.js';
|
||||
import Stamen from '../src/ol/source/Stamen.js';
|
||||
@@ -34,7 +34,7 @@ const map = new Map({
|
||||
layers: layers,
|
||||
target: 'map',
|
||||
view: new View({
|
||||
center: _ol_extent_.getCenter(extent),
|
||||
center: getCenter(extent),
|
||||
zoom: 4
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth, getTopLeft} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {get as getProjection} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
@@ -11,7 +11,7 @@ import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
|
||||
// create the WMTS tile grid in the google projection
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const tileSizePixels = 256;
|
||||
const tileSizeMtrs = _ol_extent_.getWidth(projection.getExtent()) / tileSizePixels;
|
||||
const tileSizeMtrs = getWidth(projection.getExtent()) / tileSizePixels;
|
||||
const matrixIds = [];
|
||||
const resolutions = [];
|
||||
for (let i = 0; i <= 14; i++) {
|
||||
@@ -19,7 +19,7 @@ for (let i = 0; i <= 14; i++) {
|
||||
resolutions[i] = tileSizeMtrs / Math.pow(2, i);
|
||||
}
|
||||
const tileGrid = new WMTSTileGrid({
|
||||
origin: _ol_extent_.getTopLeft(projection.getExtent()),
|
||||
origin: getTopLeft(projection.getExtent()),
|
||||
resolutions: resolutions,
|
||||
matrixIds: matrixIds
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {fromLonLat, get as getProjection} from '../src/ol/proj.js';
|
||||
import WMTS from '../src/ol/source/WMTS.js';
|
||||
@@ -24,7 +24,7 @@ const map = new Map({
|
||||
const resolutions = [];
|
||||
const matrixIds = [];
|
||||
const proj3857 = getProjection('EPSG:3857');
|
||||
const maxResolution = _ol_extent_.getWidth(proj3857.getExtent()) / 256;
|
||||
const maxResolution = getWidth(proj3857.getExtent()) / 256;
|
||||
|
||||
for (let i = 0; i < 18; i++) {
|
||||
matrixIds[i] = i.toString();
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
import * as _ol_extent_ from '../src/ol/extent.js';
|
||||
import {getWidth, getTopLeft} from '../src/ol/extent.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {get as getProjection} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
@@ -11,7 +11,7 @@ import WMTSTileGrid from '../src/ol/tilegrid/WMTS.js';
|
||||
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const projectionExtent = projection.getExtent();
|
||||
const size = _ol_extent_.getWidth(projectionExtent) / 256;
|
||||
const size = getWidth(projectionExtent) / 256;
|
||||
const resolutions = new Array(14);
|
||||
const matrixIds = new Array(14);
|
||||
for (let z = 0; z < 14; ++z) {
|
||||
@@ -38,7 +38,7 @@ const map = new Map({
|
||||
format: 'image/png',
|
||||
projection: projection,
|
||||
tileGrid: new WMTSTileGrid({
|
||||
origin: _ol_extent_.getTopLeft(projectionExtent),
|
||||
origin: getTopLeft(projectionExtent),
|
||||
resolutions: resolutions,
|
||||
matrixIds: matrixIds
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user