@@ -2,12 +2,12 @@ import Map from '../src/ol/Map.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import {defaults as defaultControls} from '../src/ol/control.js';
|
||||
import MousePosition from '../src/ol/control/MousePosition.js';
|
||||
import _ol_coordinate_ from '../src/ol/coordinate.js';
|
||||
import {createStringXY} from '../src/ol/coordinate.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
|
||||
const mousePositionControl = new MousePosition({
|
||||
coordinateFormat: _ol_coordinate_.createStringXY(4),
|
||||
coordinateFormat: createStringXY(4),
|
||||
projection: 'EPSG:4326',
|
||||
// comment the following two lines to have the mouse position
|
||||
// be placed within the map.
|
||||
@@ -41,6 +41,6 @@ projectionSelect.addEventListener('change', function(event) {
|
||||
|
||||
const precisionInput = document.getElementById('precision');
|
||||
precisionInput.addEventListener('change', function(event) {
|
||||
const format = _ol_coordinate_.createStringXY(event.target.valueAsNumber);
|
||||
const format = createStringXY(event.target.valueAsNumber);
|
||||
mousePositionControl.setCoordinateFormat(format);
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import Overlay from '../src/ol/Overlay.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import _ol_coordinate_ from '../src/ol/coordinate.js';
|
||||
import {toStringHDMS} from '../src/ol/coordinate.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {fromLonLat, toLonLat} from '../src/ol/proj.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
@@ -47,7 +47,7 @@ map.addOverlay(popup);
|
||||
map.on('click', function(evt) {
|
||||
const element = popup.getElement();
|
||||
const coordinate = evt.coordinate;
|
||||
const hdms = _ol_coordinate_.toStringHDMS(toLonLat(coordinate));
|
||||
const hdms = toStringHDMS(toLonLat(coordinate));
|
||||
|
||||
$(element).popover('destroy');
|
||||
popup.setPosition(coordinate);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Map from '../src/ol/Map.js';
|
||||
import Overlay from '../src/ol/Overlay.js';
|
||||
import View from '../src/ol/View.js';
|
||||
import _ol_coordinate_ from '../src/ol/coordinate.js';
|
||||
import {toStringHDMS} from '../src/ol/coordinate.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import {toLonLat} from '../src/ol/proj.js';
|
||||
import TileJSON from '../src/ol/source/TileJSON.js';
|
||||
@@ -64,7 +64,7 @@ const map = new Map({
|
||||
*/
|
||||
map.on('singleclick', function(evt) {
|
||||
const coordinate = evt.coordinate;
|
||||
const hdms = _ol_coordinate_.toStringHDMS(toLonLat(coordinate));
|
||||
const hdms = toStringHDMS(toLonLat(coordinate));
|
||||
|
||||
content.innerHTML = '<p>You clicked here:</p><code>' + hdms +
|
||||
'</code>';
|
||||
|
||||
@@ -11,7 +11,7 @@ import {tile as tileStrategy} from '../src/ol/loadingstrategy.js';
|
||||
import {fromLonLat} from '../src/ol/proj.js';
|
||||
import VectorSource from '../src/ol/source/Vector.js';
|
||||
import XYZ from '../src/ol/source/XYZ.js';
|
||||
import _ol_tilegrid_ from '../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
const serviceUrl = 'https://services.arcgis.com/rOo16HdIMeOBI4Mb/arcgis/rest/' +
|
||||
@@ -44,7 +44,7 @@ const vectorSource = new VectorSource({
|
||||
}
|
||||
}});
|
||||
},
|
||||
strategy: tileStrategy(_ol_tilegrid_.createXYZ({
|
||||
strategy: tileStrategy(createXYZ({
|
||||
tileSize: 512
|
||||
}))
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import XYZ from '../src/ol/source/XYZ.js';
|
||||
import Fill from '../src/ol/style/Fill.js';
|
||||
import Stroke from '../src/ol/style/Stroke.js';
|
||||
import Style from '../src/ol/style/Style.js';
|
||||
import _ol_tilegrid_ from '../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
const serviceUrl = 'https://sampleserver3.arcgisonline.com/ArcGIS/rest/services/' +
|
||||
@@ -82,7 +82,7 @@ const vectorSource = new VectorSource({
|
||||
}
|
||||
}});
|
||||
},
|
||||
strategy: tileStrategy(_ol_tilegrid_.createXYZ({
|
||||
strategy: tileStrategy(createXYZ({
|
||||
tileSize: 512
|
||||
}))
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/Graticule
|
||||
*/
|
||||
import _ol_coordinate_ from './coordinate.js';
|
||||
import {degreesToStringHDMS} from './coordinate.js';
|
||||
import {intersects, getCenter} from './extent.js';
|
||||
import GeometryLayout from './geom/GeometryLayout.js';
|
||||
import LineString from './geom/LineString.js';
|
||||
@@ -244,7 +244,7 @@ const Graticule = function(opt_options) {
|
||||
this.parallelsLabels_ = null;
|
||||
|
||||
if (options.showLabels == true) {
|
||||
const degreesToString = _ol_coordinate_.degreesToStringHDMS;
|
||||
const degreesToString = degreesToStringHDMS;
|
||||
|
||||
/**
|
||||
* @type {null|function(number):string}
|
||||
|
||||
@@ -11,7 +11,7 @@ import ViewHint from './ViewHint.js';
|
||||
import ViewProperty from './ViewProperty.js';
|
||||
import {linearFindNearest} from './array.js';
|
||||
import {assert} from './asserts.js';
|
||||
import _ol_coordinate_ from './coordinate.js';
|
||||
import {add as addCoordinate, rotate as rotateCoordinate, equals as coordinatesEqual} from './coordinate.js';
|
||||
import {inAndOut} from './easing.js';
|
||||
import {getForViewAndSize, getCenter, getHeight, getWidth, isEmpty} from './extent.js';
|
||||
import GeometryType from './geom/GeometryType.js';
|
||||
@@ -480,8 +480,8 @@ View.prototype.calculateCenterRotate = function(rotation, anchor) {
|
||||
const currentCenter = this.getCenter();
|
||||
if (currentCenter !== undefined) {
|
||||
center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];
|
||||
_ol_coordinate_.rotate(center, rotation - this.getRotation());
|
||||
_ol_coordinate_.add(center, anchor);
|
||||
rotateCoordinate(center, rotation - this.getRotation());
|
||||
addCoordinate(center, anchor);
|
||||
}
|
||||
return center;
|
||||
};
|
||||
@@ -1215,7 +1215,7 @@ View.createRotationConstraint_ = function(options) {
|
||||
*/
|
||||
View.isNoopAnimation = function(animation) {
|
||||
if (animation.sourceCenter && animation.targetCenter) {
|
||||
if (!_ol_coordinate_.equals(animation.sourceCenter, animation.targetCenter)) {
|
||||
if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import Overlay from '../Overlay.js';
|
||||
import OverlayPositioning from '../OverlayPositioning.js';
|
||||
import ViewProperty from '../ViewProperty.js';
|
||||
import Control from '../control/Control.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {rotateCoordinate, add as addCoordinate} from '../coordinate.js';
|
||||
import {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';
|
||||
import {replaceNode} from '../dom.js';
|
||||
import {listen, listenOnce, unlisten} from '../events.js';
|
||||
@@ -470,8 +470,8 @@ OverviewMap.prototype.calculateCoordinateRotate_ = function(
|
||||
coordinate[0] - currentCenter[0],
|
||||
coordinate[1] - currentCenter[1]
|
||||
];
|
||||
_ol_coordinate_.rotate(coordinateRotate, rotation);
|
||||
_ol_coordinate_.add(coordinateRotate, currentCenter);
|
||||
rotateCoordinate(coordinateRotate, rotation);
|
||||
addCoordinate(coordinateRotate, currentCenter);
|
||||
}
|
||||
return coordinateRotate;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import {modulo} from './math.js';
|
||||
import {padNumber} from './string.js';
|
||||
const _ol_coordinate_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -21,11 +20,11 @@ const _ol_coordinate_ = {};
|
||||
* @return {ol.Coordinate} The input coordinate adjusted by the given delta.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.add = function(coordinate, delta) {
|
||||
export function add(coordinate, delta) {
|
||||
coordinate[0] += delta[0];
|
||||
coordinate[1] += delta[1];
|
||||
return coordinate;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@ _ol_coordinate_.add = function(coordinate, delta) {
|
||||
* @param {ol.geom.Circle} circle The circle.
|
||||
* @return {ol.Coordinate} Closest point on the circumference
|
||||
*/
|
||||
_ol_coordinate_.closestOnCircle = function(coordinate, circle) {
|
||||
export function closestOnCircle(coordinate, circle) {
|
||||
const r = circle.getRadius();
|
||||
const center = circle.getCenter();
|
||||
const x0 = center[0];
|
||||
@@ -54,7 +53,7 @@ _ol_coordinate_.closestOnCircle = function(coordinate, circle) {
|
||||
const y = y0 + r * dy / d;
|
||||
|
||||
return [x, y];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -68,7 +67,7 @@ _ol_coordinate_.closestOnCircle = function(coordinate, circle) {
|
||||
* @return {ol.Coordinate} The foot of the perpendicular of the coordinate to
|
||||
* the segment.
|
||||
*/
|
||||
_ol_coordinate_.closestOnSegment = function(coordinate, segment) {
|
||||
export function closestOnSegment(coordinate, segment) {
|
||||
const x0 = coordinate[0];
|
||||
const y0 = coordinate[1];
|
||||
const start = segment[0];
|
||||
@@ -93,7 +92,7 @@ _ol_coordinate_.closestOnSegment = function(coordinate, segment) {
|
||||
y = y1 + along * dy;
|
||||
}
|
||||
return [x, y];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -119,17 +118,17 @@ _ol_coordinate_.closestOnSegment = function(coordinate, segment) {
|
||||
* @return {ol.CoordinateFormatType} Coordinate format.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.createStringXY = function(opt_fractionDigits) {
|
||||
export function createStringXY(opt_fractionDigits) {
|
||||
return (
|
||||
/**
|
||||
* @param {ol.Coordinate|undefined} coordinate Coordinate.
|
||||
* @return {string} String XY.
|
||||
*/
|
||||
function(coordinate) {
|
||||
return _ol_coordinate_.toStringXY(coordinate, opt_fractionDigits);
|
||||
return toStringXY(coordinate, opt_fractionDigits);
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -139,7 +138,7 @@ _ol_coordinate_.createStringXY = function(opt_fractionDigits) {
|
||||
* after the decimal point. Default is `0`.
|
||||
* @return {string} String.
|
||||
*/
|
||||
_ol_coordinate_.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionDigits) {
|
||||
export function degreesToStringHDMS(hemispheres, degrees, opt_fractionDigits) {
|
||||
const normalizedDegrees = modulo(degrees + 180, 360) - 180;
|
||||
const x = Math.abs(3600 * normalizedDegrees);
|
||||
const dflPrecision = opt_fractionDigits || 0;
|
||||
@@ -163,7 +162,7 @@ _ol_coordinate_.degreesToStringHDMS = function(hemispheres, degrees, opt_fractio
|
||||
return deg + '\u00b0 ' + padNumber(min, 2) + '\u2032 ' +
|
||||
padNumber(sec, 2, dflPrecision) + '\u2033' +
|
||||
(normalizedDegrees == 0 ? '' : ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0));
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -193,7 +192,7 @@ _ol_coordinate_.degreesToStringHDMS = function(hemispheres, degrees, opt_fractio
|
||||
* @return {string} Formatted coordinate.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.format = function(coordinate, template, opt_fractionDigits) {
|
||||
export function format(coordinate, template, opt_fractionDigits) {
|
||||
if (coordinate) {
|
||||
return template
|
||||
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
|
||||
@@ -201,15 +200,15 @@ _ol_coordinate_.format = function(coordinate, template, opt_fractionDigits) {
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Coordinate} coordinate1 First coordinate.
|
||||
* @param {ol.Coordinate} coordinate2 Second coordinate.
|
||||
* @return {boolean} Whether the passed coordinates are equal.
|
||||
* @return {boolean} The two coordinates are equal.
|
||||
*/
|
||||
_ol_coordinate_.equals = function(coordinate1, coordinate2) {
|
||||
export function equals(coordinate1, coordinate2) {
|
||||
let equals = true;
|
||||
for (let i = coordinate1.length - 1; i >= 0; --i) {
|
||||
if (coordinate1[i] != coordinate2[i]) {
|
||||
@@ -218,7 +217,7 @@ _ol_coordinate_.equals = function(coordinate1, coordinate2) {
|
||||
}
|
||||
}
|
||||
return equals;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -237,7 +236,7 @@ _ol_coordinate_.equals = function(coordinate1, coordinate2) {
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.rotate = function(coordinate, angle) {
|
||||
export function rotate(coordinate, angle) {
|
||||
const cosAngle = Math.cos(angle);
|
||||
const sinAngle = Math.sin(angle);
|
||||
const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;
|
||||
@@ -245,7 +244,7 @@ _ol_coordinate_.rotate = function(coordinate, angle) {
|
||||
coordinate[0] = x;
|
||||
coordinate[1] = y;
|
||||
return coordinate;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -263,26 +262,11 @@ _ol_coordinate_.rotate = function(coordinate, angle) {
|
||||
* @param {number} scale Scale factor.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
_ol_coordinate_.scale = function(coordinate, scale) {
|
||||
export function scale(coordinate, scale) {
|
||||
coordinate[0] *= scale;
|
||||
coordinate[1] *= scale;
|
||||
return coordinate;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Subtract `delta` to `coordinate`. `coordinate` is modified in place and
|
||||
* returned by the function.
|
||||
*
|
||||
* @param {ol.Coordinate} coordinate Coordinate.
|
||||
* @param {ol.Coordinate} delta Delta.
|
||||
* @return {ol.Coordinate} Coordinate.
|
||||
*/
|
||||
_ol_coordinate_.sub = function(coordinate, delta) {
|
||||
coordinate[0] -= delta[0];
|
||||
coordinate[1] -= delta[1];
|
||||
return coordinate;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -290,11 +274,11 @@ _ol_coordinate_.sub = function(coordinate, delta) {
|
||||
* @param {ol.Coordinate} coord2 Second coordinate.
|
||||
* @return {number} Squared distance between coord1 and coord2.
|
||||
*/
|
||||
_ol_coordinate_.squaredDistance = function(coord1, coord2) {
|
||||
export function squaredDistance(coord1, coord2) {
|
||||
const dx = coord1[0] - coord2[0];
|
||||
const dy = coord1[1] - coord2[1];
|
||||
return dx * dx + dy * dy;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -302,9 +286,9 @@ _ol_coordinate_.squaredDistance = function(coord1, coord2) {
|
||||
* @param {ol.Coordinate} coord2 Second coordinate.
|
||||
* @return {number} Distance between coord1 and coord2.
|
||||
*/
|
||||
_ol_coordinate_.distance = function(coord1, coord2) {
|
||||
return Math.sqrt(_ol_coordinate_.squaredDistance(coord1, coord2));
|
||||
};
|
||||
export function distance(coord1, coord2) {
|
||||
return Math.sqrt(squaredDistance(coord1, coord2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -314,10 +298,10 @@ _ol_coordinate_.distance = function(coord1, coord2) {
|
||||
* @param {Array.<ol.Coordinate>} segment Line segment (2 coordinates).
|
||||
* @return {number} Squared distance from the point to the line segment.
|
||||
*/
|
||||
_ol_coordinate_.squaredDistanceToSegment = function(coordinate, segment) {
|
||||
return _ol_coordinate_.squaredDistance(coordinate,
|
||||
_ol_coordinate_.closestOnSegment(coordinate, segment));
|
||||
};
|
||||
export function squaredDistanceToSegment(coordinate, segment) {
|
||||
return squaredDistance(coordinate,
|
||||
closestOnSegment(coordinate, segment));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -342,14 +326,14 @@ _ol_coordinate_.squaredDistanceToSegment = function(coordinate, segment) {
|
||||
* @return {string} Hemisphere, degrees, minutes and seconds.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.toStringHDMS = function(coordinate, opt_fractionDigits) {
|
||||
export function toStringHDMS(coordinate, opt_fractionDigits) {
|
||||
if (coordinate) {
|
||||
return _ol_coordinate_.degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
|
||||
_ol_coordinate_.degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
|
||||
return degreesToStringHDMS('NS', coordinate[1], opt_fractionDigits) + ' ' +
|
||||
degreesToStringHDMS('EW', coordinate[0], opt_fractionDigits);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -373,7 +357,6 @@ _ol_coordinate_.toStringHDMS = function(coordinate, opt_fractionDigits) {
|
||||
* @return {string} XY.
|
||||
* @api
|
||||
*/
|
||||
_ol_coordinate_.toStringXY = function(coordinate, opt_fractionDigits) {
|
||||
return _ol_coordinate_.format(coordinate, '{x}, {y}', opt_fractionDigits);
|
||||
};
|
||||
export default _ol_coordinate_;
|
||||
export function toStringXY(coordinate, opt_fractionDigits) {
|
||||
return format(coordinate, '{x}, {y}', opt_fractionDigits);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import ViewHint from '../ViewHint.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {scale as scaleCoordinate, rotate as rotateCoordinate, add as addCoordinate} from '../coordinate.js';
|
||||
import {easeOut} from '../easing.js';
|
||||
import {noModifierKeys} from '../events/condition.js';
|
||||
import {FALSE} from '../functions.js';
|
||||
@@ -81,9 +81,9 @@ DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
const view = map.getView();
|
||||
const viewState = view.getState();
|
||||
let center = [deltaX, deltaY];
|
||||
_ol_coordinate_.scale(center, viewState.resolution);
|
||||
_ol_coordinate_.rotate(center, viewState.rotation);
|
||||
_ol_coordinate_.add(center, viewState.center);
|
||||
scaleCoordinate(center, viewState.resolution);
|
||||
rotateCoordinate(center, viewState.rotation);
|
||||
addCoordinate(center, viewState.center);
|
||||
center = view.constrainCenter(center);
|
||||
view.setCenter(center);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import BaseObject from '../Object.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {squaredDistance as squaredCoordinateDistance} from '../coordinate.js';
|
||||
import {listen} from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
import {noModifierKeys, always, shiftKeyOnly} from '../events/condition.js';
|
||||
@@ -158,7 +158,7 @@ const Draw = function(options) {
|
||||
geometryFunction = function(coordinates, opt_geometry) {
|
||||
const circle = opt_geometry ? /** @type {ol.geom.Circle} */ (opt_geometry) :
|
||||
new Circle([NaN, NaN]);
|
||||
const squaredLength = _ol_coordinate_.squaredDistance(
|
||||
const squaredLength = squaredCoordinateDistance(
|
||||
coordinates[0], coordinates[1]);
|
||||
circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength));
|
||||
return circle;
|
||||
@@ -853,7 +853,7 @@ Draw.createRegularPolygon = function(opt_sides, opt_angle) {
|
||||
const center = coordinates[0];
|
||||
const end = coordinates[1];
|
||||
const radius = Math.sqrt(
|
||||
_ol_coordinate_.squaredDistance(center, end));
|
||||
squaredCoordinateDistance(center, end));
|
||||
const geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
|
||||
fromCircle(new Circle(center), opt_sides);
|
||||
const angle = opt_angle ? opt_angle :
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {squaredDistanceToSegment, closestOnSegment, distance as coordinateDistance, squaredDistance as squaredCoordinateDistance} from '../coordinate.js';
|
||||
import Event from '../events/Event.js';
|
||||
import {boundingExtent, getArea} from '../extent.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
@@ -316,8 +316,8 @@ ExtentInteraction.getSegments_ = function(extent) {
|
||||
ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) {
|
||||
const pixelCoordinate = map.getCoordinateFromPixel(pixel);
|
||||
const sortByDistance = function(a, b) {
|
||||
return _ol_coordinate_.squaredDistanceToSegment(pixelCoordinate, a) -
|
||||
_ol_coordinate_.squaredDistanceToSegment(pixelCoordinate, b);
|
||||
return squaredDistanceToSegment(pixelCoordinate, a) -
|
||||
squaredDistanceToSegment(pixelCoordinate, b);
|
||||
};
|
||||
const extent = this.getExtent();
|
||||
if (extent) {
|
||||
@@ -326,17 +326,17 @@ ExtentInteraction.prototype.snapToVertex_ = function(pixel, map) {
|
||||
segments.sort(sortByDistance);
|
||||
const closestSegment = segments[0];
|
||||
|
||||
let vertex = (_ol_coordinate_.closestOnSegment(pixelCoordinate,
|
||||
let vertex = (closestOnSegment(pixelCoordinate,
|
||||
closestSegment));
|
||||
const vertexPixel = map.getPixelFromCoordinate(vertex);
|
||||
|
||||
//if the distance is within tolerance, snap to the segment
|
||||
if (_ol_coordinate_.distance(pixel, vertexPixel) <= this.pixelTolerance_) {
|
||||
if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {
|
||||
//test if we should further snap to a vertex
|
||||
const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
||||
const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
||||
const squaredDist1 = _ol_coordinate_.squaredDistance(vertexPixel, pixel1);
|
||||
const squaredDist2 = _ol_coordinate_.squaredDistance(vertexPixel, pixel2);
|
||||
const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);
|
||||
const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);
|
||||
const dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
||||
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
||||
if (this.snappedToVertex_) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/interaction/KeyboardPan
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {rotate as rotateCoordinate} from '../coordinate.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import KeyCode from '../events/KeyCode.js';
|
||||
import {noModifierKeys, targetNotEditable} from '../events/condition.js';
|
||||
@@ -100,7 +100,7 @@ KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
||||
deltaY = mapUnitsDelta;
|
||||
}
|
||||
const delta = [deltaX, deltaY];
|
||||
_ol_coordinate_.rotate(delta, view.getRotation());
|
||||
rotateCoordinate(delta, view.getRotation());
|
||||
Interaction.pan(view, delta, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ import Feature from '../Feature.js';
|
||||
import MapBrowserEventType from '../MapBrowserEventType.js';
|
||||
import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js';
|
||||
import {equals} from '../array.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {equals as coordinatesEqual, distance as coordinateDistance, squaredDistance as squaredCoordinateDistance, squaredDistanceToSegment, closestOnSegment} from '../coordinate.js';
|
||||
import {listen, unlisten} from '../events.js';
|
||||
import Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -637,15 +637,15 @@ Modify.handleDownEvent_ = function(evt) {
|
||||
segmentDataMatch.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||
|
||||
const closestVertex = Modify.closestOnSegmentData_(pixelCoordinate, segmentDataMatch);
|
||||
if (_ol_coordinate_.equals(closestVertex, vertex) && !componentSegments[uid][0]) {
|
||||
if (coordinatesEqual(closestVertex, vertex) && !componentSegments[uid][0]) {
|
||||
this.dragSegments_.push([segmentDataMatch, 0]);
|
||||
componentSegments[uid][0] = segmentDataMatch;
|
||||
}
|
||||
} else if (_ol_coordinate_.equals(segment[0], vertex) &&
|
||||
} else if (coordinatesEqual(segment[0], vertex) &&
|
||||
!componentSegments[uid][0]) {
|
||||
this.dragSegments_.push([segmentDataMatch, 0]);
|
||||
componentSegments[uid][0] = segmentDataMatch;
|
||||
} else if (_ol_coordinate_.equals(segment[1], vertex) &&
|
||||
} else if (coordinatesEqual(segment[1], vertex) &&
|
||||
!componentSegments[uid][1]) {
|
||||
|
||||
// prevent dragging closed linestrings by the connecting node
|
||||
@@ -737,7 +737,7 @@ Modify.handleDragEvent_ = function(evt) {
|
||||
this.changingFeature_ = false;
|
||||
} else { // We're dragging the circle's circumference:
|
||||
this.changingFeature_ = true;
|
||||
geometry.setRadius(_ol_coordinate_.distance(geometry.getCenter(), vertex));
|
||||
geometry.setRadius(coordinateDistance(geometry.getCenter(), vertex));
|
||||
this.changingFeature_ = false;
|
||||
}
|
||||
break;
|
||||
@@ -859,7 +859,7 @@ Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||
const closestSegment = node.segment;
|
||||
let vertex = Modify.closestOnSegmentData_(pixelCoordinate, node);
|
||||
const vertexPixel = map.getPixelFromCoordinate(vertex);
|
||||
let dist = _ol_coordinate_.distance(pixel, vertexPixel);
|
||||
let dist = coordinateDistance(pixel, vertexPixel);
|
||||
if (dist <= this.pixelTolerance_) {
|
||||
const vertexSegments = {};
|
||||
|
||||
@@ -871,8 +871,8 @@ Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||
} else {
|
||||
const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
||||
const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
||||
const squaredDist1 = _ol_coordinate_.squaredDistance(vertexPixel, pixel1);
|
||||
const squaredDist2 = _ol_coordinate_.squaredDistance(vertexPixel, pixel2);
|
||||
const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);
|
||||
const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);
|
||||
dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
||||
this.snappedToVertex_ = dist <= this.pixelTolerance_;
|
||||
if (this.snappedToVertex_) {
|
||||
@@ -883,10 +883,10 @@ Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||
let segment;
|
||||
for (let i = 1, ii = nodes.length; i < ii; ++i) {
|
||||
segment = nodes[i].segment;
|
||||
if ((_ol_coordinate_.equals(closestSegment[0], segment[0]) &&
|
||||
_ol_coordinate_.equals(closestSegment[1], segment[1]) ||
|
||||
(_ol_coordinate_.equals(closestSegment[0], segment[1]) &&
|
||||
_ol_coordinate_.equals(closestSegment[1], segment[0])))) {
|
||||
if ((coordinatesEqual(closestSegment[0], segment[0]) &&
|
||||
coordinatesEqual(closestSegment[1], segment[1]) ||
|
||||
(coordinatesEqual(closestSegment[0], segment[1]) &&
|
||||
coordinatesEqual(closestSegment[1], segment[0])))) {
|
||||
vertexSegments[getUid(segment)] = true;
|
||||
} else {
|
||||
break;
|
||||
@@ -923,13 +923,13 @@ Modify.pointDistanceToSegmentDataSquared_ = function(pointCoordinates, segmentDa
|
||||
|
||||
if (segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||
const distanceToCenterSquared =
|
||||
_ol_coordinate_.squaredDistance(circleGeometry.getCenter(), pointCoordinates);
|
||||
squaredCoordinateDistance(circleGeometry.getCenter(), pointCoordinates);
|
||||
const distanceToCircumference =
|
||||
Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();
|
||||
return distanceToCircumference * distanceToCircumference;
|
||||
}
|
||||
}
|
||||
return _ol_coordinate_.squaredDistanceToSegment(pointCoordinates, segmentData.segment);
|
||||
return squaredDistanceToSegment(pointCoordinates, segmentData.segment);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -948,7 +948,7 @@ Modify.closestOnSegmentData_ = function(pointCoordinates, segmentData) {
|
||||
segmentData.index === Modify.MODIFY_SEGMENT_CIRCLE_CIRCUMFERENCE_INDEX) {
|
||||
return geometry.getClosestPoint(pointCoordinates);
|
||||
}
|
||||
return _ol_coordinate_.closestOnSegment(pointCoordinates, segmentData.segment);
|
||||
return closestOnSegment(pointCoordinates, segmentData.segment);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import Collection from '../Collection.js';
|
||||
import CollectionEventType from '../CollectionEventType.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {distance as coordinateDistance, squaredDistance as squaredCoordinateDistance, closestOnCircle, closestOnSegment, squaredDistanceToSegment} from '../coordinate.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {boundingExtent, createEmpty} from '../extent.js';
|
||||
@@ -371,8 +371,8 @@ Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
|
||||
if (this.vertex_ && !this.edge_) {
|
||||
pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
||||
pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
||||
squaredDist1 = _ol_coordinate_.squaredDistance(pixel, pixel1);
|
||||
squaredDist2 = _ol_coordinate_.squaredDistance(pixel, pixel2);
|
||||
squaredDist1 = squaredCoordinateDistance(pixel, pixel1);
|
||||
squaredDist2 = squaredCoordinateDistance(pixel, pixel2);
|
||||
dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
||||
snappedToVertex = dist <= this.pixelTolerance_;
|
||||
if (snappedToVertex) {
|
||||
@@ -383,20 +383,20 @@ Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
|
||||
}
|
||||
} else if (this.edge_) {
|
||||
if (isCircle) {
|
||||
vertex = _ol_coordinate_.closestOnCircle(pixelCoordinate,
|
||||
vertex = closestOnCircle(pixelCoordinate,
|
||||
/** @type {ol.geom.Circle} */ (segments[0].feature.getGeometry()));
|
||||
} else {
|
||||
vertex = (_ol_coordinate_.closestOnSegment(pixelCoordinate,
|
||||
vertex = (closestOnSegment(pixelCoordinate,
|
||||
closestSegment));
|
||||
}
|
||||
vertexPixel = map.getPixelFromCoordinate(vertex);
|
||||
if (_ol_coordinate_.distance(pixel, vertexPixel) <= this.pixelTolerance_) {
|
||||
if (coordinateDistance(pixel, vertexPixel) <= this.pixelTolerance_) {
|
||||
snapped = true;
|
||||
if (this.vertex_ && !isCircle) {
|
||||
pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
|
||||
pixel2 = map.getPixelFromCoordinate(closestSegment[1]);
|
||||
squaredDist1 = _ol_coordinate_.squaredDistance(vertexPixel, pixel1);
|
||||
squaredDist2 = _ol_coordinate_.squaredDistance(vertexPixel, pixel2);
|
||||
squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);
|
||||
squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);
|
||||
dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));
|
||||
snappedToVertex = dist <= this.pixelTolerance_;
|
||||
if (snappedToVertex) {
|
||||
@@ -622,9 +622,9 @@ Snap.handleUpEvent_ = function(evt) {
|
||||
* @this {ol.interaction.Snap}
|
||||
*/
|
||||
Snap.sortByDistance = function(a, b) {
|
||||
return _ol_coordinate_.squaredDistanceToSegment(
|
||||
return squaredDistanceToSegment(
|
||||
this.pixelCoordinate_, a.segment) -
|
||||
_ol_coordinate_.squaredDistanceToSegment(
|
||||
squaredDistanceToSegment(
|
||||
this.pixelCoordinate_, b.segment);
|
||||
};
|
||||
export default Snap;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @module ol/renderer/canvas/IntermediateCanvas
|
||||
*/
|
||||
import {inherits, nullFunction} from '../../index.js';
|
||||
import _ol_coordinate_ from '../../coordinate.js';
|
||||
import {scale as scaleCoordinate} from '../../coordinate.js';
|
||||
import {createCanvasContext2D} from '../../dom.js';
|
||||
import {containsExtent, intersects} from '../../extent.js';
|
||||
import CanvasLayerRenderer from '../canvas/Layer.js';
|
||||
@@ -129,7 +129,7 @@ IntermediateCanvasRenderer.prototype.forEachLayerAtCoordinate = function(coordin
|
||||
return CanvasLayerRenderer.prototype.forEachLayerAtCoordinate.apply(this, arguments);
|
||||
} else {
|
||||
const pixel = _ol_transform_.apply(this.coordinateToCanvasPixelTransform, coordinate.slice());
|
||||
_ol_coordinate_.scale(pixel, frameState.viewState.resolution / this.renderedResolution);
|
||||
scaleCoordinate(pixel, frameState.viewState.resolution / this.renderedResolution);
|
||||
|
||||
if (!this.hitCanvasContext_) {
|
||||
this.hitCanvasContext_ = createCanvasContext2D(1, 1);
|
||||
|
||||
@@ -14,7 +14,7 @@ import _ol_render_canvas_ from '../../render/canvas.js';
|
||||
import CanvasReplayGroup from '../../render/canvas/ReplayGroup.js';
|
||||
import RendererType from '../Type.js';
|
||||
import CanvasLayerRenderer from '../canvas/Layer.js';
|
||||
import _ol_renderer_vector_ from '../vector.js';
|
||||
import {defaultOrder as defaultRenderOrder, getTolerance as getRenderTolerance, getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -321,7 +321,7 @@ CanvasVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerSta
|
||||
let vectorLayerRenderOrder = vectorLayer.getRenderOrder();
|
||||
|
||||
if (vectorLayerRenderOrder === undefined) {
|
||||
vectorLayerRenderOrder = _ol_renderer_vector_.defaultOrder;
|
||||
vectorLayerRenderOrder = defaultRenderOrder;
|
||||
}
|
||||
|
||||
const extent = buffer(frameStateExtent,
|
||||
@@ -355,14 +355,14 @@ CanvasVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerSta
|
||||
this.dirty_ = false;
|
||||
|
||||
const replayGroup = new CanvasReplayGroup(
|
||||
_ol_renderer_vector_.getTolerance(resolution, pixelRatio), extent, resolution,
|
||||
getRenderTolerance(resolution, pixelRatio), extent, resolution,
|
||||
pixelRatio, vectorSource.getOverlaps(), this.declutterTree_, vectorLayer.getRenderBuffer());
|
||||
vectorSource.loadFeatures(extent, resolution, projection);
|
||||
/**
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @this {ol.renderer.canvas.VectorLayer}
|
||||
*/
|
||||
const renderFeature = function(feature) {
|
||||
const render = function(feature) {
|
||||
let styles;
|
||||
let styleFunction = feature.getStyleFunction();
|
||||
if (styleFunction) {
|
||||
@@ -391,10 +391,10 @@ CanvasVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerSta
|
||||
}, this);
|
||||
features.sort(vectorLayerRenderOrder);
|
||||
for (let i = 0, ii = features.length; i < ii; ++i) {
|
||||
renderFeature(features[i]);
|
||||
render(features[i]);
|
||||
}
|
||||
} else {
|
||||
vectorSource.forEachFeatureInExtent(extent, renderFeature, this);
|
||||
vectorSource.forEachFeatureInExtent(extent, render, this);
|
||||
}
|
||||
replayGroup.finish();
|
||||
|
||||
@@ -425,15 +425,15 @@ CanvasVectorLayerRenderer.prototype.renderFeature = function(feature, resolution
|
||||
let loading = false;
|
||||
if (Array.isArray(styles)) {
|
||||
for (let i = 0, ii = styles.length; i < ii; ++i) {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles[i],
|
||||
_ol_renderer_vector_.getSquaredTolerance(resolution, pixelRatio),
|
||||
getSquaredRenderTolerance(resolution, pixelRatio),
|
||||
this.handleStyleImageChange_, this) || loading;
|
||||
}
|
||||
} else {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles,
|
||||
_ol_renderer_vector_.getSquaredTolerance(resolution, pixelRatio),
|
||||
getSquaredRenderTolerance(resolution, pixelRatio),
|
||||
this.handleStyleImageChange_, this);
|
||||
}
|
||||
return loading;
|
||||
|
||||
@@ -18,7 +18,7 @@ import CanvasReplayGroup from '../../render/canvas/ReplayGroup.js';
|
||||
import _ol_render_replay_ from '../../render/replay.js';
|
||||
import RendererType from '../Type.js';
|
||||
import CanvasTileLayerRenderer from '../canvas/TileLayer.js';
|
||||
import _ol_renderer_vector_ from '../vector.js';
|
||||
import {getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||
import _ol_transform_ from '../../transform.js';
|
||||
|
||||
/**
|
||||
@@ -192,14 +192,14 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(
|
||||
replayState.dirty = false;
|
||||
const replayGroup = new CanvasReplayGroup(0, sharedExtent, resolution,
|
||||
pixelRatio, source.getOverlaps(), this.declutterTree_, layer.getRenderBuffer());
|
||||
const squaredTolerance = _ol_renderer_vector_.getSquaredTolerance(
|
||||
const squaredTolerance = getSquaredRenderTolerance(
|
||||
resolution, pixelRatio);
|
||||
|
||||
/**
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @this {ol.renderer.canvas.VectorTileLayer}
|
||||
*/
|
||||
const renderFeature = function(feature) {
|
||||
const render = function(feature) {
|
||||
let styles;
|
||||
let styleFunction = feature.getStyleFunction();
|
||||
if (styleFunction) {
|
||||
@@ -234,7 +234,7 @@ CanvasVectorTileLayerRenderer.prototype.createReplayGroup_ = function(
|
||||
feature.getGeometry().transform(tileProjection, projection);
|
||||
}
|
||||
if (!bufferedExtent || intersects(bufferedExtent, feature.getGeometry().getExtent())) {
|
||||
renderFeature.call(this, feature);
|
||||
render.call(this, feature);
|
||||
}
|
||||
}
|
||||
replayGroup.finish();
|
||||
@@ -466,12 +466,12 @@ CanvasVectorTileLayerRenderer.prototype.renderFeature = function(feature, square
|
||||
let loading = false;
|
||||
if (Array.isArray(styles)) {
|
||||
for (let i = 0, ii = styles.length; i < ii; ++i) {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles[i], squaredTolerance,
|
||||
this.handleStyleImageChange_, this) || loading;
|
||||
}
|
||||
} else {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles, squaredTolerance,
|
||||
this.handleStyleImageChange_, this);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import {getUid} from '../index.js';
|
||||
import ImageState from '../ImageState.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import ReplayType from '../render/ReplayType.js';
|
||||
const _ol_renderer_vector_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,14 +14,32 @@ const _ol_renderer_vector_ = {};
|
||||
const SIMPLIFY_TOLERANCE = 0.5;
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<ol.geom.GeometryType,
|
||||
* function(ol.render.ReplayGroup, ol.geom.Geometry,
|
||||
* ol.style.Style, Object)>}
|
||||
*/
|
||||
const GEOMETRY_RENDERERS = {
|
||||
'Point': renderPointGeometry,
|
||||
'LineString': renderLineStringGeometry,
|
||||
'Polygon': renderPolygonGeometry,
|
||||
'MultiPoint': renderMultiPointGeometry,
|
||||
'MultiLineString': renderMultiLineStringGeometry,
|
||||
'MultiPolygon': renderMultiPolygonGeometry,
|
||||
'GeometryCollection': renderGeometryCollectionGeometry,
|
||||
'Circle': renderCircleGeometry
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Feature|ol.render.Feature} feature1 Feature 1.
|
||||
* @param {ol.Feature|ol.render.Feature} feature2 Feature 2.
|
||||
* @return {number} Order.
|
||||
*/
|
||||
_ol_renderer_vector_.defaultOrder = function(feature1, feature2) {
|
||||
export function defaultOrder(feature1, feature2) {
|
||||
return getUid(feature1) - getUid(feature2);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,10 +47,10 @@ _ol_renderer_vector_.defaultOrder = function(feature1, feature2) {
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Squared pixel tolerance.
|
||||
*/
|
||||
_ol_renderer_vector_.getSquaredTolerance = function(resolution, pixelRatio) {
|
||||
const tolerance = _ol_renderer_vector_.getTolerance(resolution, pixelRatio);
|
||||
export function getSquaredTolerance(resolution, pixelRatio) {
|
||||
const tolerance = getTolerance(resolution, pixelRatio);
|
||||
return tolerance * tolerance;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,9 +58,9 @@ _ol_renderer_vector_.getSquaredTolerance = function(resolution, pixelRatio) {
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @return {number} Pixel tolerance.
|
||||
*/
|
||||
_ol_renderer_vector_.getTolerance = function(resolution, pixelRatio) {
|
||||
export function getTolerance(resolution, pixelRatio) {
|
||||
return SIMPLIFY_TOLERANCE * resolution / pixelRatio;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,9 +68,8 @@ _ol_renderer_vector_.getTolerance = function(resolution, pixelRatio) {
|
||||
* @param {ol.geom.Circle} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderCircleGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderCircleGeometry(replayGroup, geometry, style, feature) {
|
||||
const fillStyle = style.getFill();
|
||||
const strokeStyle = style.getStroke();
|
||||
if (fillStyle || strokeStyle) {
|
||||
@@ -67,7 +83,7 @@ _ol_renderer_vector_.renderCircleGeometry_ = function(replayGroup, geometry, sty
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -80,8 +96,7 @@ _ol_renderer_vector_.renderCircleGeometry_ = function(replayGroup, geometry, sty
|
||||
* @return {boolean} `true` if style is loading.
|
||||
* @template T
|
||||
*/
|
||||
_ol_renderer_vector_.renderFeature = function(
|
||||
replayGroup, feature, style, squaredTolerance, listener, thisArg) {
|
||||
export function renderFeature(replayGroup, feature, style, squaredTolerance, listener, thisArg) {
|
||||
let loading = false;
|
||||
const imageStyle = style.getImage();
|
||||
if (imageStyle) {
|
||||
@@ -97,11 +112,10 @@ _ol_renderer_vector_.renderFeature = function(
|
||||
loading = true;
|
||||
}
|
||||
}
|
||||
_ol_renderer_vector_.renderFeature_(replayGroup, feature, style,
|
||||
squaredTolerance);
|
||||
renderFeatureInternal(replayGroup, feature, style, squaredTolerance);
|
||||
|
||||
return loading;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -109,10 +123,8 @@ _ol_renderer_vector_.renderFeature = function(
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {number} squaredTolerance Squared tolerance.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderFeature_ = function(
|
||||
replayGroup, feature, style, squaredTolerance) {
|
||||
function renderFeatureInternal(replayGroup, feature, style, squaredTolerance) {
|
||||
const geometry = style.getGeometryFunction()(feature);
|
||||
if (!geometry) {
|
||||
return;
|
||||
@@ -120,13 +132,12 @@ _ol_renderer_vector_.renderFeature_ = function(
|
||||
const simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance);
|
||||
const renderer = style.getRenderer();
|
||||
if (renderer) {
|
||||
_ol_renderer_vector_.renderGeometry_(replayGroup, simplifiedGeometry, style, feature);
|
||||
renderGeometry(replayGroup, simplifiedGeometry, style, feature);
|
||||
} else {
|
||||
const geometryRenderer =
|
||||
_ol_renderer_vector_.GEOMETRY_RENDERERS_[simplifiedGeometry.getType()];
|
||||
const geometryRenderer = GEOMETRY_RENDERERS[simplifiedGeometry.getType()];
|
||||
geometryRenderer(replayGroup, simplifiedGeometry, style, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -134,19 +145,18 @@ _ol_renderer_vector_.renderFeature_ = function(
|
||||
* @param {ol.geom.Geometry} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderGeometry(replayGroup, geometry, style, feature) {
|
||||
if (geometry.getType() == GeometryType.GEOMETRY_COLLECTION) {
|
||||
const geometries = /** @type {ol.geom.GeometryCollection} */ (geometry).getGeometries();
|
||||
for (let i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
_ol_renderer_vector_.renderGeometry_(replayGroup, geometries[i], style, feature);
|
||||
renderGeometry(replayGroup, geometries[i], style, feature);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const replay = replayGroup.getReplay(style.getZIndex(), ReplayType.DEFAULT);
|
||||
replay.drawCustom(/** @type {ol.geom.SimpleGeometry} */ (geometry), feature, style.getRenderer());
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -154,17 +164,16 @@ _ol_renderer_vector_.renderGeometry_ = function(replayGroup, geometry, style, fe
|
||||
* @param {ol.geom.GeometryCollection} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderGeometryCollectionGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderGeometryCollectionGeometry(replayGroup, geometry, style, feature) {
|
||||
const geometries = geometry.getGeometriesArray();
|
||||
let i, ii;
|
||||
for (i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
const geometryRenderer =
|
||||
_ol_renderer_vector_.GEOMETRY_RENDERERS_[geometries[i].getType()];
|
||||
GEOMETRY_RENDERERS[geometries[i].getType()];
|
||||
geometryRenderer(replayGroup, geometries[i], style, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -172,9 +181,8 @@ _ol_renderer_vector_.renderGeometryCollectionGeometry_ = function(replayGroup, g
|
||||
* @param {ol.geom.LineString|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderLineStringGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderLineStringGeometry(replayGroup, geometry, style, feature) {
|
||||
const strokeStyle = style.getStroke();
|
||||
if (strokeStyle) {
|
||||
const lineStringReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.LINE_STRING);
|
||||
@@ -187,7 +195,7 @@ _ol_renderer_vector_.renderLineStringGeometry_ = function(replayGroup, geometry,
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -195,9 +203,8 @@ _ol_renderer_vector_.renderLineStringGeometry_ = function(replayGroup, geometry,
|
||||
* @param {ol.geom.MultiLineString|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderMultiLineStringGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderMultiLineStringGeometry(replayGroup, geometry, style, feature) {
|
||||
const strokeStyle = style.getStroke();
|
||||
if (strokeStyle) {
|
||||
const lineStringReplay = replayGroup.getReplay(style.getZIndex(), ReplayType.LINE_STRING);
|
||||
@@ -210,7 +217,7 @@ _ol_renderer_vector_.renderMultiLineStringGeometry_ = function(replayGroup, geom
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -218,9 +225,8 @@ _ol_renderer_vector_.renderMultiLineStringGeometry_ = function(replayGroup, geom
|
||||
* @param {ol.geom.MultiPolygon} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderMultiPolygonGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderMultiPolygonGeometry(replayGroup, geometry, style, feature) {
|
||||
const fillStyle = style.getFill();
|
||||
const strokeStyle = style.getStroke();
|
||||
if (strokeStyle || fillStyle) {
|
||||
@@ -234,7 +240,7 @@ _ol_renderer_vector_.renderMultiPolygonGeometry_ = function(replayGroup, geometr
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -242,9 +248,8 @@ _ol_renderer_vector_.renderMultiPolygonGeometry_ = function(replayGroup, geometr
|
||||
* @param {ol.geom.Point|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderPointGeometry(replayGroup, geometry, style, feature) {
|
||||
const imageStyle = style.getImage();
|
||||
if (imageStyle) {
|
||||
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||
@@ -260,7 +265,7 @@ _ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, styl
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(!!imageStyle));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -268,9 +273,8 @@ _ol_renderer_vector_.renderPointGeometry_ = function(replayGroup, geometry, styl
|
||||
* @param {ol.geom.MultiPoint|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderMultiPointGeometry(replayGroup, geometry, style, feature) {
|
||||
const imageStyle = style.getImage();
|
||||
if (imageStyle) {
|
||||
if (imageStyle.getImageState() != ImageState.LOADED) {
|
||||
@@ -286,7 +290,7 @@ _ol_renderer_vector_.renderMultiPointGeometry_ = function(replayGroup, geometry,
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(!!imageStyle));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -294,9 +298,8 @@ _ol_renderer_vector_.renderMultiPointGeometry_ = function(replayGroup, geometry,
|
||||
* @param {ol.geom.Polygon|ol.render.Feature} geometry Geometry.
|
||||
* @param {ol.style.Style} style Style.
|
||||
* @param {ol.Feature|ol.render.Feature} feature Feature.
|
||||
* @private
|
||||
*/
|
||||
_ol_renderer_vector_.renderPolygonGeometry_ = function(replayGroup, geometry, style, feature) {
|
||||
function renderPolygonGeometry(replayGroup, geometry, style, feature) {
|
||||
const fillStyle = style.getFill();
|
||||
const strokeStyle = style.getStroke();
|
||||
if (fillStyle || strokeStyle) {
|
||||
@@ -310,24 +313,4 @@ _ol_renderer_vector_.renderPolygonGeometry_ = function(replayGroup, geometry, st
|
||||
textReplay.setTextStyle(textStyle, replayGroup.addDeclutter(false));
|
||||
textReplay.drawText(geometry, feature);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @private
|
||||
* @type {Object.<ol.geom.GeometryType,
|
||||
* function(ol.render.ReplayGroup, ol.geom.Geometry,
|
||||
* ol.style.Style, Object)>}
|
||||
*/
|
||||
_ol_renderer_vector_.GEOMETRY_RENDERERS_ = {
|
||||
'Point': _ol_renderer_vector_.renderPointGeometry_,
|
||||
'LineString': _ol_renderer_vector_.renderLineStringGeometry_,
|
||||
'Polygon': _ol_renderer_vector_.renderPolygonGeometry_,
|
||||
'MultiPoint': _ol_renderer_vector_.renderMultiPointGeometry_,
|
||||
'MultiLineString': _ol_renderer_vector_.renderMultiLineStringGeometry_,
|
||||
'MultiPolygon': _ol_renderer_vector_.renderMultiPolygonGeometry_,
|
||||
'GeometryCollection': _ol_renderer_vector_.renderGeometryCollectionGeometry_,
|
||||
'Circle': _ol_renderer_vector_.renderCircleGeometry_
|
||||
};
|
||||
export default _ol_renderer_vector_;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import ViewHint from '../../ViewHint.js';
|
||||
import {buffer, containsExtent, createEmpty} from '../../extent.js';
|
||||
import WebGLReplayGroup from '../../render/webgl/ReplayGroup.js';
|
||||
import RendererType from '../Type.js';
|
||||
import _ol_renderer_vector_ from '../vector.js';
|
||||
import {defaultOrder as defaultRenderOrder, getTolerance as getRenderTolerance, getSquaredTolerance as getSquaredRenderTolerance, renderFeature} from '../vector.js';
|
||||
import WebGLLayerRenderer from '../webgl/Layer.js';
|
||||
import _ol_transform_ from '../../transform.js';
|
||||
|
||||
@@ -235,7 +235,7 @@ WebGLVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerStat
|
||||
let vectorLayerRenderOrder = vectorLayer.getRenderOrder();
|
||||
|
||||
if (vectorLayerRenderOrder === undefined) {
|
||||
vectorLayerRenderOrder = _ol_renderer_vector_.defaultOrder;
|
||||
vectorLayerRenderOrder = defaultRenderOrder;
|
||||
}
|
||||
|
||||
const extent = buffer(frameStateExtent,
|
||||
@@ -257,14 +257,14 @@ WebGLVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerStat
|
||||
this.dirty_ = false;
|
||||
|
||||
const replayGroup = new WebGLReplayGroup(
|
||||
_ol_renderer_vector_.getTolerance(resolution, pixelRatio),
|
||||
getRenderTolerance(resolution, pixelRatio),
|
||||
extent, vectorLayer.getRenderBuffer());
|
||||
vectorSource.loadFeatures(extent, resolution, projection);
|
||||
/**
|
||||
* @param {ol.Feature} feature Feature.
|
||||
* @this {ol.renderer.webgl.VectorLayer}
|
||||
*/
|
||||
const renderFeature = function(feature) {
|
||||
const render = function(feature) {
|
||||
let styles;
|
||||
let styleFunction = feature.getStyleFunction();
|
||||
if (styleFunction) {
|
||||
@@ -292,9 +292,9 @@ WebGLVectorLayerRenderer.prototype.prepareFrame = function(frameState, layerStat
|
||||
features.push(feature);
|
||||
}, this);
|
||||
features.sort(vectorLayerRenderOrder);
|
||||
features.forEach(renderFeature.bind(this));
|
||||
features.forEach(render.bind(this));
|
||||
} else {
|
||||
vectorSource.forEachFeatureInExtent(extent, renderFeature, this);
|
||||
vectorSource.forEachFeatureInExtent(extent, render, this);
|
||||
}
|
||||
replayGroup.finish(context);
|
||||
|
||||
@@ -324,15 +324,15 @@ WebGLVectorLayerRenderer.prototype.renderFeature = function(feature, resolution,
|
||||
let loading = false;
|
||||
if (Array.isArray(styles)) {
|
||||
for (let i = styles.length - 1, ii = 0; i >= ii; --i) {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles[i],
|
||||
_ol_renderer_vector_.getSquaredTolerance(resolution, pixelRatio),
|
||||
getSquaredRenderTolerance(resolution, pixelRatio),
|
||||
this.handleStyleImageChange_, this) || loading;
|
||||
}
|
||||
} else {
|
||||
loading = _ol_renderer_vector_.renderFeature(
|
||||
loading = renderFeature(
|
||||
replayGroup, feature, styles,
|
||||
_ol_renderer_vector_.getSquaredTolerance(resolution, pixelRatio),
|
||||
getSquaredRenderTolerance(resolution, pixelRatio),
|
||||
this.handleStyleImageChange_, this) || loading;
|
||||
}
|
||||
return loading;
|
||||
|
||||
@@ -5,7 +5,6 @@ import {createCanvasContext2D} from './dom.js';
|
||||
import {containsCoordinate, createEmpty, extend, getHeight, getTopLeft, getWidth} from './extent.js';
|
||||
import {solveLinearSystem} from './math.js';
|
||||
import {getPointResolution, transform} from './proj.js';
|
||||
const _ol_reproj_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,7 +19,7 @@ const _ol_reproj_ = {};
|
||||
* @param {number} targetResolution Target resolution.
|
||||
* @return {number} The best resolution to use. Can be +-Infinity, NaN or 0.
|
||||
*/
|
||||
_ol_reproj_.calculateSourceResolution = function(sourceProj, targetProj,
|
||||
export function calculateSourceResolution(sourceProj, targetProj,
|
||||
targetCenter, targetResolution) {
|
||||
|
||||
const sourceCenter = transform(targetCenter, targetProj, sourceProj);
|
||||
@@ -51,7 +50,7 @@ _ol_reproj_.calculateSourceResolution = function(sourceProj, targetProj,
|
||||
}
|
||||
|
||||
return sourceResolution;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -63,14 +62,13 @@ _ol_reproj_.calculateSourceResolution = function(sourceProj, targetProj,
|
||||
* @param {number} x X coordinate of the point (in pixels).
|
||||
* @param {number} y Y coordinate of the point (in pixels).
|
||||
* @return {ol.Coordinate} New point 1 px farther from the centroid.
|
||||
* @private
|
||||
*/
|
||||
_ol_reproj_.enlargeClipPoint_ = function(centroidX, centroidY, x, y) {
|
||||
function enlargeClipPoint(centroidX, centroidY, x, y) {
|
||||
const dX = x - centroidX;
|
||||
const dY = y - centroidY;
|
||||
const distance = Math.sqrt(dX * dX + dY * dY);
|
||||
return [Math.round(x + dX / distance), Math.round(y + dY / distance)];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,7 +89,7 @@ _ol_reproj_.enlargeClipPoint_ = function(centroidX, centroidY, x, y) {
|
||||
* @param {boolean=} opt_renderEdges Render reprojection edges.
|
||||
* @return {HTMLCanvasElement} Canvas with reprojected data.
|
||||
*/
|
||||
_ol_reproj_.render = function(width, height, pixelRatio,
|
||||
export function render(width, height, pixelRatio,
|
||||
sourceResolution, sourceExtent, targetResolution, targetExtent,
|
||||
triangulation, sources, gutter, opt_renderEdges) {
|
||||
|
||||
@@ -193,9 +191,9 @@ _ol_reproj_.render = function(width, height, pixelRatio,
|
||||
context.beginPath();
|
||||
const centroidX = (u0 + u1 + u2) / 3;
|
||||
const centroidY = (v0 + v1 + v2) / 3;
|
||||
const p0 = _ol_reproj_.enlargeClipPoint_(centroidX, centroidY, u0, v0);
|
||||
const p1 = _ol_reproj_.enlargeClipPoint_(centroidX, centroidY, u1, v1);
|
||||
const p2 = _ol_reproj_.enlargeClipPoint_(centroidX, centroidY, u2, v2);
|
||||
const p0 = enlargeClipPoint(centroidX, centroidY, u0, v0);
|
||||
const p1 = enlargeClipPoint(centroidX, centroidY, u1, v1);
|
||||
const p2 = enlargeClipPoint(centroidX, centroidY, u2, v2);
|
||||
|
||||
context.moveTo(p1[0], p1[1]);
|
||||
context.lineTo(p0[0], p0[1]);
|
||||
@@ -241,5 +239,4 @@ _ol_reproj_.render = function(width, height, pixelRatio,
|
||||
context.restore();
|
||||
}
|
||||
return context.canvas;
|
||||
};
|
||||
export default _ol_reproj_;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import ImageState from '../ImageState.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import {calculateSourceResolution, render as renderReprojected} from '../reproj.js';
|
||||
import Triangulation from '../reproj/Triangulation.js';
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ const ReprojImage = function(sourceProj, targetProj,
|
||||
getIntersection(targetExtent, maxTargetExtent) : targetExtent;
|
||||
|
||||
const targetCenter = getCenter(limitedTargetExtent);
|
||||
const sourceResolution = _ol_reproj_.calculateSourceResolution(
|
||||
const sourceResolution = calculateSourceResolution(
|
||||
sourceProj, targetProj, targetCenter, targetResolution);
|
||||
|
||||
const errorThresholdInPixels = ERROR_THRESHOLD;
|
||||
@@ -148,7 +148,7 @@ ReprojImage.prototype.reproject_ = function() {
|
||||
const width = getWidth(this.targetExtent_) / this.targetResolution_;
|
||||
const height = getHeight(this.targetExtent_) / this.targetResolution_;
|
||||
|
||||
this.canvas_ = _ol_reproj_.render(width, height, this.sourcePixelRatio_,
|
||||
this.canvas_ = renderReprojected(width, height, this.sourcePixelRatio_,
|
||||
this.sourceImage_.getResolution(), this.maxSourceExtent_,
|
||||
this.targetResolution_, this.targetExtent_, this.triangulation_, [{
|
||||
extent: this.sourceImage_.getExtent(),
|
||||
|
||||
@@ -9,7 +9,7 @@ import {listen, unlistenByKey} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getArea, getCenter, getIntersection} from '../extent.js';
|
||||
import {clamp} from '../math.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import {calculateSourceResolution, render as renderReprojected} from '../reproj.js';
|
||||
import Triangulation from '../reproj/Triangulation.js';
|
||||
|
||||
/**
|
||||
@@ -125,7 +125,7 @@ const ReprojTile = function(sourceProj, sourceTileGrid,
|
||||
this.wrappedTileCoord_[0]);
|
||||
|
||||
const targetCenter = getCenter(limitedTargetExtent);
|
||||
const sourceResolution = _ol_reproj_.calculateSourceResolution(
|
||||
const sourceResolution = calculateSourceResolution(
|
||||
sourceProj, targetProj, targetCenter, targetResolution);
|
||||
|
||||
if (!isFinite(sourceResolution) || sourceResolution <= 0) {
|
||||
@@ -237,7 +237,7 @@ ReprojTile.prototype.reproject_ = function() {
|
||||
|
||||
const targetExtent = this.targetTileGrid_.getTileCoordExtent(
|
||||
this.wrappedTileCoord_);
|
||||
this.canvas_ = _ol_reproj_.render(width, height, this.pixelRatio_,
|
||||
this.canvas_ = renderReprojected(width, height, this.pixelRatio_,
|
||||
sourceResolution, this.sourceTileGrid_.getExtent(),
|
||||
targetResolution, targetExtent, this.triangulation_, sources,
|
||||
this.gutter_, this.renderEdges_);
|
||||
|
||||
@@ -9,7 +9,7 @@ import {get as getProjection, getTransformFromProjections} from '../proj.js';
|
||||
import SourceState from '../source/State.js';
|
||||
import TileImage from '../source/TileImage.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -129,10 +129,10 @@ BingMaps.prototype.handleImageryMetadataResponse = function(response) {
|
||||
const maxZoom = this.maxZoom_ == -1 ? resource.zoomMax : this.maxZoom_;
|
||||
|
||||
const sourceProjection = this.getProjection();
|
||||
const extent = _ol_tilegrid_.extentFromProjection(sourceProjection);
|
||||
const extent = extentFromProjection(sourceProjection);
|
||||
const tileSize = resource.imageWidth == resource.imageHeight ?
|
||||
resource.imageWidth : [resource.imageWidth, resource.imageHeight];
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({
|
||||
const tileGrid = createXYZ({
|
||||
extent: extent,
|
||||
minZoom: resource.zoomMin,
|
||||
maxZoom: maxZoom,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import Feature from '../Feature.js';
|
||||
import _ol_coordinate_ from '../coordinate.js';
|
||||
import {scale as scaleCoordinate, add as addCoordinate} from '../coordinate.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {buffer, createEmpty, createOrUpdateFromCoordinate} from '../extent.js';
|
||||
import Point from '../geom/Point.js';
|
||||
@@ -184,12 +184,12 @@ Cluster.prototype.createCluster = function(features) {
|
||||
for (let i = features.length - 1; i >= 0; --i) {
|
||||
const geometry = this.geometryFunction(features[i]);
|
||||
if (geometry) {
|
||||
_ol_coordinate_.add(centroid, geometry.getCoordinates());
|
||||
addCoordinate(centroid, geometry.getCoordinates());
|
||||
} else {
|
||||
features.splice(i, 1);
|
||||
}
|
||||
}
|
||||
_ol_coordinate_.scale(centroid, 1 / features.length);
|
||||
scaleCoordinate(centroid, 1 / features.length);
|
||||
|
||||
const cluster = new Feature(new Point(centroid));
|
||||
cluster.set('features', features);
|
||||
|
||||
@@ -11,7 +11,7 @@ import EventType from '../events/EventType.js';
|
||||
import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection, transform} from '../proj.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import {calculateSourceResolution} from '../reproj.js';
|
||||
import ImageSource from '../source/Image.js';
|
||||
import WMSServerType from '../source/WMSServerType.js';
|
||||
import {compareVersions} from '../string.js';
|
||||
@@ -141,7 +141,7 @@ ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, proje
|
||||
const sourceProjectionObj = this.getProjection();
|
||||
|
||||
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
|
||||
resolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
|
||||
resolution = calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, resolution);
|
||||
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import {equivalent} from '../proj.js';
|
||||
import {toSize, scale as scaleSize} from '../size.js';
|
||||
import Source from '../source/Source.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {wrapX, getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -215,7 +215,7 @@ TileSource.prototype.getTileGrid = function() {
|
||||
*/
|
||||
TileSource.prototype.getTileGridForProjection = function(projection) {
|
||||
if (!this.tileGrid) {
|
||||
return _ol_tilegrid_.getForProjection(projection);
|
||||
return getTileGridForProjection(projection);
|
||||
} else {
|
||||
return this.tileGrid;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ TileSource.prototype.getTileCoordForTileUrlFunction = function(tileCoord, opt_pr
|
||||
opt_projection : this.getProjection();
|
||||
const tileGrid = this.getTileGridForProjection(projection);
|
||||
if (this.getWrapX() && projection.isGlobal()) {
|
||||
tileCoord = _ol_tilegrid_.wrapX(tileGrid, tileCoord, projection);
|
||||
tileCoord = wrapX(tileGrid, tileCoord, projection);
|
||||
}
|
||||
return _ol_tilecoord_.withinExtentAndZ(tileCoord, tileGrid) ? tileCoord : null;
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ import {equivalent, get as getProjection} from '../proj.js';
|
||||
import ReprojTile from '../reproj/Tile.js';
|
||||
import UrlTile from '../source/UrlTile.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {getForProjection as getTileGridForProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -174,7 +174,7 @@ TileImage.prototype.getTileGridForProjection = function(projection) {
|
||||
const projKey = getUid(projection).toString();
|
||||
if (!(projKey in this.tileGridForProjection)) {
|
||||
this.tileGridForProjection[projKey] =
|
||||
_ol_tilegrid_.getForProjection(projection);
|
||||
getTileGridForProjection(projection);
|
||||
}
|
||||
return /** @type {!ol.tilegrid.TileGrid} */ (this.tileGridForProjection[projKey]);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import {jsonp as requestJSONP} from '../net.js';
|
||||
import {get as getProjection, getTransformFromProjections} from '../proj.js';
|
||||
import SourceState from '../source/State.js';
|
||||
import TileImage from '../source/TileImage.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -126,8 +126,8 @@ TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
|
||||
const minZoom = tileJSON.minzoom || 0;
|
||||
const maxZoom = tileJSON.maxzoom || 22;
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({
|
||||
extent: _ol_tilegrid_.extentFromProjection(sourceProjection),
|
||||
const tileGrid = createXYZ({
|
||||
extent: extentFromProjection(sourceProjection),
|
||||
maxZoom: maxZoom,
|
||||
minZoom: minZoom
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ import {get as getProjection, getTransformFromProjections} from '../proj.js';
|
||||
import SourceState from '../source/State.js';
|
||||
import TileSource from '../source/Tile.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -176,8 +176,8 @@ UTFGrid.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
|
||||
const minZoom = tileJSON.minzoom || 0;
|
||||
const maxZoom = tileJSON.maxzoom || 22;
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({
|
||||
extent: _ol_tilegrid_.extentFromProjection(sourceProjection),
|
||||
const tileGrid = createXYZ({
|
||||
extent: extentFromProjection(sourceProjection),
|
||||
maxZoom: maxZoom,
|
||||
minZoom: minZoom
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import {buffer, createEmpty} from '../extent.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {modulo} from '../math.js';
|
||||
import {get as getProjection, transform, transformExtent} from '../proj.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import {calculateSourceResolution} from '../reproj.js';
|
||||
import {toSize, buffer as bufferSize, scale as scaleSize} from '../size.js';
|
||||
import TileImage from '../source/TileImage.js';
|
||||
import WMSServerType from '../source/WMSServerType.js';
|
||||
@@ -135,7 +135,7 @@ TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projec
|
||||
}
|
||||
|
||||
if (sourceProjectionObj && sourceProjectionObj !== projectionObj) {
|
||||
tileResolution = _ol_reproj_.calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, tileResolution);
|
||||
tileResolution = calculateSourceResolution(sourceProjectionObj, projectionObj, coordinate, tileResolution);
|
||||
tileExtent = transformExtent(tileExtent, projectionObj, sourceProjectionObj);
|
||||
coordinate = transform(coordinate, projectionObj, sourceProjectionObj);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import VectorTile from '../VectorTile.js';
|
||||
import {toSize} from '../size.js';
|
||||
import UrlTile from '../source/UrlTile.js';
|
||||
import _ol_tilecoord_ from '../tilecoord.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {createXYZ, extentFromProjection, createForProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -29,9 +29,9 @@ import _ol_tilegrid_ from '../tilegrid.js';
|
||||
const VectorTileSource = function(options) {
|
||||
const projection = options.projection || 'EPSG:3857';
|
||||
|
||||
const extent = options.extent || _ol_tilegrid_.extentFromProjection(projection);
|
||||
const extent = options.extent || extentFromProjection(projection);
|
||||
|
||||
const tileGrid = options.tileGrid || _ol_tilegrid_.createXYZ({
|
||||
const tileGrid = options.tileGrid || createXYZ({
|
||||
extent: extent,
|
||||
maxZoom: options.maxZoom || 22,
|
||||
minZoom: options.minZoom,
|
||||
@@ -143,7 +143,7 @@ VectorTileSource.prototype.getTileGridForProjection = function(projection) {
|
||||
// A tile grid that matches the tile size of the source tile grid is more
|
||||
// likely to have 1:1 relationships between source tiles and rendered tiles.
|
||||
const sourceTileGrid = this.tileGrid;
|
||||
tileGrid = this.tileGrids_[code] = _ol_tilegrid_.createForProjection(projection, undefined,
|
||||
tileGrid = this.tileGrids_[code] = createForProjection(projection, undefined,
|
||||
sourceTileGrid ? sourceTileGrid.getTileSize(sourceTileGrid.getMinZoom()) : undefined);
|
||||
}
|
||||
return tileGrid;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {inherits} from '../index.js';
|
||||
import TileImage from '../source/TileImage.js';
|
||||
import _ol_tilegrid_ from '../tilegrid.js';
|
||||
import {createXYZ, extentFromProjection} from '../tilegrid.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -33,8 +33,8 @@ const XYZ = function(opt_options) {
|
||||
options.projection : 'EPSG:3857';
|
||||
|
||||
const tileGrid = options.tileGrid !== undefined ? options.tileGrid :
|
||||
_ol_tilegrid_.createXYZ({
|
||||
extent: _ol_tilegrid_.extentFromProjection(projection),
|
||||
createXYZ({
|
||||
extent: extentFromProjection(projection),
|
||||
maxZoom: options.maxZoom,
|
||||
minZoom: options.minZoom,
|
||||
tileSize: options.tileSize
|
||||
|
||||
@@ -9,21 +9,20 @@ import {assign} from './obj.js';
|
||||
import {get as getProjection, METERS_PER_UNIT} from './proj.js';
|
||||
import Units from './proj/Units.js';
|
||||
import TileGrid from './tilegrid/TileGrid.js';
|
||||
const _ol_tilegrid_ = {};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {!ol.tilegrid.TileGrid} Default tile grid for the passed projection.
|
||||
*/
|
||||
_ol_tilegrid_.getForProjection = function(projection) {
|
||||
export function getForProjection(projection) {
|
||||
let tileGrid = projection.getDefaultTileGrid();
|
||||
if (!tileGrid) {
|
||||
tileGrid = _ol_tilegrid_.createForProjection(projection);
|
||||
tileGrid = createForProjection(projection);
|
||||
projection.setDefaultTileGrid(tileGrid);
|
||||
}
|
||||
return tileGrid;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -32,10 +31,10 @@ _ol_tilegrid_.getForProjection = function(projection) {
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {ol.TileCoord} Tile coordinate.
|
||||
*/
|
||||
_ol_tilegrid_.wrapX = function(tileGrid, tileCoord, projection) {
|
||||
export function wrapX(tileGrid, tileCoord, projection) {
|
||||
const z = tileCoord[0];
|
||||
const center = tileGrid.getTileCoordCenter(tileCoord);
|
||||
const projectionExtent = _ol_tilegrid_.extentFromProjection(projection);
|
||||
const projectionExtent = extentFromProjection(projection);
|
||||
if (!containsCoordinate(projectionExtent, center)) {
|
||||
const worldWidth = getWidth(projectionExtent);
|
||||
const worldsAway = Math.ceil((projectionExtent[0] - center[0]) / worldWidth);
|
||||
@@ -44,7 +43,7 @@ _ol_tilegrid_.wrapX = function(tileGrid, tileCoord, projection) {
|
||||
} else {
|
||||
return tileCoord;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -57,10 +56,10 @@ _ol_tilegrid_.wrapX = function(tileGrid, tileCoord, projection) {
|
||||
* ol.extent.Corner.TOP_LEFT).
|
||||
* @return {!ol.tilegrid.TileGrid} TileGrid instance.
|
||||
*/
|
||||
_ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||
export function createForExtent(extent, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||
const corner = opt_corner !== undefined ? opt_corner : Corner.TOP_LEFT;
|
||||
|
||||
const resolutions = _ol_tilegrid_.resolutionsFromExtent(
|
||||
const resolutions = resolutionsFromExtent(
|
||||
extent, opt_maxZoom, opt_tileSize);
|
||||
|
||||
return new TileGrid({
|
||||
@@ -69,7 +68,7 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_
|
||||
resolutions: resolutions,
|
||||
tileSize: opt_tileSize
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -78,19 +77,19 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_
|
||||
* @return {!ol.tilegrid.TileGrid} Tile grid instance.
|
||||
* @api
|
||||
*/
|
||||
_ol_tilegrid_.createXYZ = function(opt_options) {
|
||||
export function createXYZ(opt_options) {
|
||||
const options = /** @type {olx.tilegrid.TileGridOptions} */ ({});
|
||||
assign(options, opt_options !== undefined ?
|
||||
opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({}));
|
||||
if (options.extent === undefined) {
|
||||
options.extent = getProjection('EPSG:3857').getExtent();
|
||||
}
|
||||
options.resolutions = _ol_tilegrid_.resolutionsFromExtent(
|
||||
options.resolutions = resolutionsFromExtent(
|
||||
options.extent, options.maxZoom, options.tileSize);
|
||||
delete options.maxZoom;
|
||||
|
||||
return new TileGrid(options);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -102,7 +101,7 @@ _ol_tilegrid_.createXYZ = function(opt_options) {
|
||||
* DEFAULT_TILE_SIZE).
|
||||
* @return {!Array.<number>} Resolutions array.
|
||||
*/
|
||||
_ol_tilegrid_.resolutionsFromExtent = function(extent, opt_maxZoom, opt_tileSize) {
|
||||
function resolutionsFromExtent(extent, opt_maxZoom, opt_tileSize) {
|
||||
const maxZoom = opt_maxZoom !== undefined ?
|
||||
opt_maxZoom : DEFAULT_MAX_ZOOM;
|
||||
|
||||
@@ -120,7 +119,7 @@ _ol_tilegrid_.resolutionsFromExtent = function(extent, opt_maxZoom, opt_tileSize
|
||||
resolutions[z] = maxResolution / Math.pow(2, z);
|
||||
}
|
||||
return resolutions;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -133,11 +132,11 @@ _ol_tilegrid_.resolutionsFromExtent = function(extent, opt_maxZoom, opt_tileSize
|
||||
* ol.extent.Corner.BOTTOM_LEFT).
|
||||
* @return {!ol.tilegrid.TileGrid} TileGrid instance.
|
||||
*/
|
||||
_ol_tilegrid_.createForProjection = function(projection, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||
const extent = _ol_tilegrid_.extentFromProjection(projection);
|
||||
return _ol_tilegrid_.createForExtent(
|
||||
export function createForProjection(projection, opt_maxZoom, opt_tileSize, opt_corner) {
|
||||
const extent = extentFromProjection(projection);
|
||||
return createForExtent(
|
||||
extent, opt_maxZoom, opt_tileSize, opt_corner);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -146,7 +145,7 @@ _ol_tilegrid_.createForProjection = function(projection, opt_maxZoom, opt_tileSi
|
||||
* @param {ol.ProjectionLike} projection Projection.
|
||||
* @return {ol.Extent} Extent.
|
||||
*/
|
||||
_ol_tilegrid_.extentFromProjection = function(projection) {
|
||||
export function extentFromProjection(projection) {
|
||||
projection = getProjection(projection);
|
||||
let extent = projection.getExtent();
|
||||
if (!extent) {
|
||||
@@ -155,5 +154,4 @@ _ol_tilegrid_.extentFromProjection = function(projection) {
|
||||
extent = createOrUpdate(-half, -half, half, half);
|
||||
}
|
||||
return extent;
|
||||
};
|
||||
export default _ol_tilegrid_;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import ImageLayer from '../../../../src/ol/layer/Image.js';
|
||||
import {assign} from '../../../../src/ol/obj.js';
|
||||
import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js';
|
||||
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.Image', function() {
|
||||
@@ -67,7 +67,7 @@ describe('ol.rendering.layer.Image', function() {
|
||||
beforeEach(function() {
|
||||
source = new Static({
|
||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent(
|
||||
imageExtent: createXYZ().getTileCoordExtent(
|
||||
[5, 5, -12 - 1]),
|
||||
projection: getProjection('EPSG:3857')
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import CircleStyle from '../../../../src/ol/style/Circle.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.Tile', function() {
|
||||
@@ -220,7 +220,7 @@ describe('ol.rendering.layer.Tile', function() {
|
||||
function createSource(tileSize) {
|
||||
return new TileImage({
|
||||
url: 'rendering/ol/data/tiles/' + tileSize + '/{z}/{x}/{y}.png',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({
|
||||
tileGrid: createXYZ({
|
||||
tileSize: tileSize.split('x')
|
||||
}),
|
||||
transition: 0
|
||||
|
||||
@@ -12,7 +12,7 @@ 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 Text from '../../../../src/ol/style/Text.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.layer.VectorTile', function() {
|
||||
@@ -71,7 +71,7 @@ describe('ol.rendering.layer.VectorTile', function() {
|
||||
beforeEach(function() {
|
||||
source = new VectorTileSource({
|
||||
format: new MVT(),
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
url: 'rendering/ol/data/tiles/mvt/{z}-{x}-{y}.vector.pbf',
|
||||
transition: 0
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import ReprojImage from '../../../../src/ol/reproj/Image.js';
|
||||
import Static from '../../../../src/ol/source/ImageStatic.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ, createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.rendering.reproj.Image', function() {
|
||||
@@ -37,21 +37,21 @@ describe('ol.rendering.reproj.Image', function() {
|
||||
beforeEach(function() {
|
||||
source = new Static({
|
||||
url: 'rendering/ol/data/tiles/osm/5/5/12.png',
|
||||
imageExtent: _ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
imageExtent: createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
projection: getProjection('EPSG:3857')
|
||||
});
|
||||
});
|
||||
|
||||
it('works for identity reprojection', function(done) {
|
||||
testSingleImage(source, 'EPSG:3857',
|
||||
_ol_tilegrid_.createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
createXYZ().getTileCoordExtent([5, 5, -13]),
|
||||
2 * HALF_SIZE / (256 * (1 << 5)), 1,
|
||||
'rendering/ol/data/tiles/osm/5/5/12.png', done);
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
testSingleImage(source, 'EPSG:4326',
|
||||
_ol_tilegrid_.createForProjection('EPSG:4326').
|
||||
createForProjection('EPSG:4326').
|
||||
getTileCoordExtent([6, 10, -10]),
|
||||
360 / (256 * (1 << 4)), 1,
|
||||
'rendering/ol/reproj/expected/image-3857-to-4326.png', done);
|
||||
|
||||
@@ -3,7 +3,7 @@ import {listen} from '../../../../src/ol/events.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 21, -20, 1,
|
||||
'rendering/ol/reproj/expected/osm4326.png', 1, done);
|
||||
});
|
||||
@@ -63,7 +63,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj5070 = getProjection('EPSG:5070');
|
||||
proj5070.setExtent([-6e6, 0, 4e6, 6e6]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:5070', 5, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:5070', 5, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:5070', tileGrid, 5, 13, -15, 1,
|
||||
'rendering/ol/reproj/expected/osm5070.png', 1, done);
|
||||
});
|
||||
@@ -75,7 +75,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj54009 = getProjection('ESRI:54009');
|
||||
proj54009.setExtent([-18e6, -9e6, 18e6, 9e6]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('ESRI:54009', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('ESRI:54009', 7, [64, 64]);
|
||||
testSingleTile(source, 'ESRI:54009', tileGrid, 7, 27, -16, 1,
|
||||
'rendering/ol/reproj/expected/osm54009.png', 1, done);
|
||||
});
|
||||
@@ -90,7 +90,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 23, -21, 1,
|
||||
'rendering/ol/reproj/expected/stitch-osm4326.png', 2, done);
|
||||
});
|
||||
@@ -103,7 +103,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj3740 = getProjection('EPSG:3740');
|
||||
proj3740.setExtent([318499.05, 2700792.39, 4359164.89, 7149336.98]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3740', 4, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3740', 4, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3740', tileGrid, 4, 4, -13, 1,
|
||||
'rendering/ol/reproj/expected/stitch-osm3740.png', 4, done);
|
||||
});
|
||||
@@ -124,7 +124,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to EPSG:3857', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3857', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3857', 0, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3857', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/4326-to-3857.png', 1, done);
|
||||
});
|
||||
@@ -145,7 +145,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
});
|
||||
|
||||
it('to 64x128 EPSG:4326', function(done) {
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 7, [64, 128]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 7, [64, 128]);
|
||||
testSingleTile(source, 'EPSG:4326', tileGrid, 7, 27, -10, 1,
|
||||
'rendering/ol/reproj/expected/512x256-to-64x128.png', 1, done);
|
||||
});
|
||||
@@ -166,7 +166,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj_ = getProjection('merc_180');
|
||||
proj_.setExtent([-20026376.39, -20048966.10, 20026376.39, 20048966.10]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('merc_180', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('merc_180', 0, [64, 64]);
|
||||
testSingleTile(source, 'merc_180', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/dateline-merc-180.png', 2, done);
|
||||
});
|
||||
@@ -178,7 +178,7 @@ describe('ol.rendering.reproj.Tile', function() {
|
||||
const proj3413 = getProjection('EPSG:3413');
|
||||
proj3413.setExtent([-4194304, -4194304, 4194304, 4194304]);
|
||||
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:3413', 0, [64, 64]);
|
||||
const tileGrid = createForProjection('EPSG:3413', 0, [64, 64]);
|
||||
testSingleTile(source, 'EPSG:3413', tileGrid, 0, 0, -1, 1,
|
||||
'rendering/ol/reproj/expected/dateline-pole.png', 2, done);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import View from '../../../../src/ol/View.js';
|
||||
import Attribution from '../../../../src/ol/control/Attribution.js';
|
||||
import TileLayer from '../../../../src/ol/layer/Tile.js';
|
||||
import TileSource from '../../../../src/ol/source/Tile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
describe('ol.control.Attribution', function() {
|
||||
|
||||
@@ -23,21 +23,21 @@ describe('ol.control.Attribution', function() {
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'foo'
|
||||
})
|
||||
}),
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'bar'
|
||||
})
|
||||
}),
|
||||
new TileLayer({
|
||||
source: new TileSource({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
attributions: 'foo'
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_coordinate_ from '../../../src/ol/coordinate.js';
|
||||
import {add as addCoordinate, scale as scaleCoordinate, rotate as rotateCoordinate, equals as coordinatesEqual, format as formatCoordinate, closestOnCircle, closestOnSegment, createStringXY, squaredDistanceToSegment, toStringXY, toStringHDMS} from '../../../src/ol/coordinate.js';
|
||||
import Circle from '../../../src/ol/geom/Circle.js';
|
||||
|
||||
|
||||
@@ -13,19 +13,19 @@ describe('ol.coordinate', function() {
|
||||
});
|
||||
|
||||
it('returns a coordinate', function() {
|
||||
const returnedCoordinate = _ol_coordinate_.add(coordinate, delta);
|
||||
const returnedCoordinate = addCoordinate(coordinate, delta);
|
||||
expect(returnedCoordinate).to.be.an('array');
|
||||
expect(returnedCoordinate).to.have.length(2);
|
||||
});
|
||||
|
||||
it('adds the delta', function() {
|
||||
const returnedCoordinate = _ol_coordinate_.add(coordinate, delta);
|
||||
const returnedCoordinate = addCoordinate(coordinate, delta);
|
||||
expect(returnedCoordinate[0]).to.eql(48.73);
|
||||
expect(returnedCoordinate[1]).to.eql(10.1);
|
||||
});
|
||||
|
||||
it('modifies in place', function() {
|
||||
_ol_coordinate_.add(coordinate, delta);
|
||||
addCoordinate(coordinate, delta);
|
||||
expect(coordinate[0]).to.eql(48.73);
|
||||
expect(coordinate[1]).to.eql(10.1);
|
||||
});
|
||||
@@ -37,8 +37,8 @@ describe('ol.coordinate', function() {
|
||||
const bonn2 = [50.73000, 7.10000];
|
||||
|
||||
it('compares correctly', function() {
|
||||
const bonnEqualsBonn = _ol_coordinate_.equals(bonn1, bonn2);
|
||||
const bonnEqualsCologne = _ol_coordinate_.equals(bonn1, cologne);
|
||||
const bonnEqualsBonn = coordinatesEqual(bonn1, bonn2);
|
||||
const bonnEqualsCologne = coordinatesEqual(bonn1, cologne);
|
||||
expect(bonnEqualsBonn).to.be(true);
|
||||
expect(bonnEqualsCologne).to.be(false);
|
||||
});
|
||||
@@ -51,12 +51,12 @@ describe('ol.coordinate', function() {
|
||||
});
|
||||
|
||||
it('rounds the values', function() {
|
||||
const string = _ol_coordinate_.format(coordinate, '{x} {y}', 0);
|
||||
const string = formatCoordinate(coordinate, '{x} {y}', 0);
|
||||
expect(string).to.eql('7 47');
|
||||
});
|
||||
|
||||
it('handles the optional fractionDigits param', function() {
|
||||
const string = _ol_coordinate_.format(coordinate, '{x} {y}', 3);
|
||||
const string = formatCoordinate(coordinate, '{x} {y}', 3);
|
||||
expect(string).to.eql('6.612 46.792');
|
||||
});
|
||||
});
|
||||
@@ -70,7 +70,7 @@ describe('ol.coordinate', function() {
|
||||
});
|
||||
|
||||
it('returns a CoordinateFormatType', function() {
|
||||
created = _ol_coordinate_.createStringXY();
|
||||
created = createStringXY();
|
||||
expect(created).to.be.a('function');
|
||||
|
||||
formatted = created(coordinate);
|
||||
@@ -79,7 +79,7 @@ describe('ol.coordinate', function() {
|
||||
});
|
||||
|
||||
it('respects opt_fractionDigits', function() {
|
||||
created = _ol_coordinate_.createStringXY(3);
|
||||
created = createStringXY(3);
|
||||
expect(created).to.be.a('function');
|
||||
|
||||
formatted = created(coordinate);
|
||||
@@ -92,11 +92,11 @@ describe('ol.coordinate', function() {
|
||||
const center = [5, 10];
|
||||
const circle = new Circle(center, 10);
|
||||
it('can find the closest point on circle', function() {
|
||||
expect(_ol_coordinate_.closestOnCircle([-20, 10], circle))
|
||||
expect(closestOnCircle([-20, 10], circle))
|
||||
.to.eql([-5, 10]);
|
||||
});
|
||||
it('can handle coordinate equal circle center', function() {
|
||||
expect(_ol_coordinate_.closestOnCircle(center, circle))
|
||||
expect(closestOnCircle(center, circle))
|
||||
.to.eql([15, 10]);
|
||||
});
|
||||
});
|
||||
@@ -106,27 +106,27 @@ describe('ol.coordinate', function() {
|
||||
function() {
|
||||
const point = [2, 5];
|
||||
const segment = [[-5, 0], [10, 0]];
|
||||
expect(_ol_coordinate_.closestOnSegment(point, segment))
|
||||
expect(closestOnSegment(point, segment))
|
||||
.to.eql([2, 0]);
|
||||
});
|
||||
it('can handle points where the foot of the perpendicular is not closest',
|
||||
function() {
|
||||
const point = [0, -6];
|
||||
const segment = [[-5, 0], [0, -1]];
|
||||
expect(_ol_coordinate_.closestOnSegment(point, segment))
|
||||
expect(closestOnSegment(point, segment))
|
||||
.to.eql([0, -1]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#format', function() {
|
||||
it('can deal with undefined coordinate', function() {
|
||||
expect(_ol_coordinate_.format()).to.be('');
|
||||
expect(formatCoordinate()).to.be('');
|
||||
});
|
||||
it('formats a coordinate into a template (default precision is 0)',
|
||||
function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const template = 'Coordinate is ({x}|{y}).';
|
||||
const got = _ol_coordinate_.format(coord, template);
|
||||
const got = formatCoordinate(coord, template);
|
||||
const expected = 'Coordinate is (8|48).';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
@@ -134,7 +134,7 @@ describe('ol.coordinate', function() {
|
||||
function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const template = 'Coordinate is ({x}|{y}).';
|
||||
const got = _ol_coordinate_.format(coord, template, 2);
|
||||
const got = formatCoordinate(coord, template, 2);
|
||||
const expected = 'Coordinate is (7.85|47.98).';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
@@ -144,14 +144,14 @@ describe('ol.coordinate', function() {
|
||||
it('can rotate point in place', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const rotateRadians = Math.PI / 2; // 90 degrees
|
||||
_ol_coordinate_.rotate(coord, rotateRadians);
|
||||
rotateCoordinate(coord, rotateRadians);
|
||||
expect(coord[0].toFixed(6)).to.eql('-47.983333');
|
||||
expect(coord[1].toFixed(6)).to.eql('7.850000');
|
||||
});
|
||||
it('returns the rotated point', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const rotateRadians = Math.PI / 2; // 90 degrees
|
||||
const rotated = _ol_coordinate_.rotate(coord, rotateRadians);
|
||||
const rotated = rotateCoordinate(coord, rotateRadians);
|
||||
expect(rotated[0].toFixed(7)).to.eql('-47.9833330');
|
||||
expect(rotated[1].toFixed(7)).to.eql('7.8500000');
|
||||
});
|
||||
@@ -161,49 +161,32 @@ describe('ol.coordinate', function() {
|
||||
it('can scale point in place', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const scale = 1.2;
|
||||
_ol_coordinate_.scale(coord, scale);
|
||||
scaleCoordinate(coord, scale);
|
||||
expect(coord[0].toFixed(7)).to.eql('9.4200000');
|
||||
expect(coord[1].toFixed(7)).to.eql('57.5799996');
|
||||
});
|
||||
it('returns the scaled point', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const scale = 1.2;
|
||||
const scaledCoord = _ol_coordinate_.scale(coord, scale);
|
||||
const scaledCoord = scaleCoordinate(coord, scale);
|
||||
expect(scaledCoord[0].toFixed(7)).to.eql('9.4200000');
|
||||
expect(scaledCoord[1].toFixed(7)).to.eql('57.5799996');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#sub', function() {
|
||||
it('can subtract from point in place', function() {
|
||||
const coord = [47, 11];
|
||||
const delta = [1, -1];
|
||||
_ol_coordinate_.sub(coord, delta);
|
||||
expect(coord[0]).to.eql(46);
|
||||
expect(coord[1]).to.eql(12);
|
||||
});
|
||||
it('can subtract from point in place', function() {
|
||||
const coord = [47, 11];
|
||||
const delta = [1, -1];
|
||||
const subtracted = _ol_coordinate_.sub(coord, delta);
|
||||
expect(subtracted[0]).to.eql(46);
|
||||
expect(subtracted[1]).to.eql(12);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#squaredDistanceToSegment', function() {
|
||||
it('can handle points where the foot of the perpendicular is closest',
|
||||
function() {
|
||||
const point = [2, 5];
|
||||
const segment = [[-5, 0], [10, 0]];
|
||||
expect(_ol_coordinate_.squaredDistanceToSegment(point, segment))
|
||||
expect(squaredDistanceToSegment(point, segment))
|
||||
.to.eql(25);
|
||||
});
|
||||
it('can handle points where the foot of the perpendicular is not closest',
|
||||
function() {
|
||||
const point = [0, -6];
|
||||
const segment = [[-5, 0], [0, -1]];
|
||||
expect(_ol_coordinate_.squaredDistanceToSegment(point, segment))
|
||||
expect(squaredDistanceToSegment(point, segment))
|
||||
.to.eql(25);
|
||||
});
|
||||
|
||||
@@ -211,19 +194,19 @@ describe('ol.coordinate', function() {
|
||||
|
||||
describe('#toStringHDMS', function() {
|
||||
it('returns the empty string on undefined input', function() {
|
||||
const got = _ol_coordinate_.toStringHDMS();
|
||||
const got = toStringHDMS();
|
||||
const expected = '';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
it('formats with zero fractional digits as default', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const got = _ol_coordinate_.toStringHDMS(coord);
|
||||
const got = toStringHDMS(coord);
|
||||
const expected = '47° 59′ 00″ N 7° 51′ 00″ E';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
it('formats with given fractional digits, if passed', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const got = _ol_coordinate_.toStringHDMS(coord, 3);
|
||||
const got = toStringHDMS(coord, 3);
|
||||
const expected = '47° 58′ 59.999″ N 7° 51′ 00.000″ E';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
@@ -232,13 +215,13 @@ describe('ol.coordinate', function() {
|
||||
describe('#toStringXY', function() {
|
||||
it('formats with zero fractional digits as default', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const got = _ol_coordinate_.toStringXY(coord);
|
||||
const got = toStringXY(coord);
|
||||
const expected = '8, 48';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
it('formats with given fractional digits, if passed', function() {
|
||||
const coord = [7.85, 47.983333];
|
||||
const got = _ol_coordinate_.toStringXY(coord, 2);
|
||||
const got = toStringXY(coord, 2);
|
||||
const expected = '7.85, 47.98';
|
||||
expect(got).to.be(expected);
|
||||
});
|
||||
|
||||
@@ -6,8 +6,6 @@ import RenderFeature from '../../../../src/ol/render/Feature.js';
|
||||
|
||||
|
||||
describe('ol.render.Feature', function() {
|
||||
|
||||
let renderFeature;
|
||||
const type = 'Point';
|
||||
const flatCoordinates = [0, 0];
|
||||
const ends = null;
|
||||
@@ -15,41 +13,46 @@ describe('ol.render.Feature', function() {
|
||||
|
||||
describe('Constructor', function() {
|
||||
it('creates an instance', function() {
|
||||
renderFeature =
|
||||
new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(renderFeature).to.be.a(RenderFeature);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature).to.be.a(RenderFeature);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#get()', function() {
|
||||
it('returns a single property', function() {
|
||||
expect(renderFeature.get('foo')).to.be('bar');
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.get('foo')).to.be('bar');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getEnds()', function() {
|
||||
it('returns the ends it was created with', function() {
|
||||
expect(renderFeature.getEnds()).to.equal(ends);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getEnds()).to.equal(ends);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getExtent()', function() {
|
||||
it('returns the correct extent for a point', function() {
|
||||
expect(renderFeature.getExtent()).to.eql([0, 0, 0, 0]);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getExtent()).to.eql([0, 0, 0, 0]);
|
||||
});
|
||||
|
||||
it('caches the extent', function() {
|
||||
expect(renderFeature.getExtent()).to.equal(renderFeature.extent_);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getExtent()).to.equal(feature.extent_);
|
||||
});
|
||||
|
||||
it('returns the correct extent for a linestring', function() {
|
||||
const feature =
|
||||
new RenderFeature('LineString', [-1, -2, 2, 1], null, {});
|
||||
const feature = new RenderFeature('LineString', [-1, -2, 2, 1], null, {});
|
||||
expect(feature.getExtent()).to.eql([-1, -2, 2, 1]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getFlatCoordinates()', function() {
|
||||
it('returns the flat coordinates it was created with', function() {
|
||||
expect(renderFeature.getFlatCoordinates()).to.equal(flatCoordinates);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getFlatCoordinates()).to.equal(flatCoordinates);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -100,43 +103,50 @@ describe('ol.render.Feature', function() {
|
||||
|
||||
describe('#getGeometry()', function() {
|
||||
it('returns itself as geometry', function() {
|
||||
expect(renderFeature.getGeometry()).to.equal(renderFeature);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getGeometry()).to.equal(feature);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getId()', function() {
|
||||
it('returns the feature id', function() {
|
||||
expect(renderFeature.getId()).to.be('foo');
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getId()).to.be('foo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getProperties()', function() {
|
||||
it('returns the properties it was created with', function() {
|
||||
expect(renderFeature.getProperties()).to.equal(properties);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getProperties()).to.equal(properties);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getSimplifiedGeometry()', function() {
|
||||
it('returns itself as simplified geometry', function() {
|
||||
expect(renderFeature.getSimplifiedGeometry()).to.equal(renderFeature);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getSimplifiedGeometry()).to.equal(feature);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getStride()', function() {
|
||||
it('returns 2', function() {
|
||||
expect(renderFeature.getStride()).to.be(2);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getStride()).to.be(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getStyleFunction()', function() {
|
||||
it('returns undefined', function() {
|
||||
expect(renderFeature.getStyleFunction()).to.be(undefined);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getStyleFunction()).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getType()', function() {
|
||||
it('returns the type it was created with', function() {
|
||||
expect(renderFeature.getType()).to.equal(type);
|
||||
const feature = new RenderFeature(type, flatCoordinates, ends, properties, 'foo');
|
||||
expect(feature.getType()).to.equal(type);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import CanvasLineStringReplay from '../../../../../src/ol/render/canvas/LineStri
|
||||
import CanvasPolygonReplay from '../../../../../src/ol/render/canvas/PolygonReplay.js';
|
||||
import CanvasReplay from '../../../../../src/ol/render/canvas/Replay.js';
|
||||
import CanvasReplayGroup from '../../../../../src/ol/render/canvas/ReplayGroup.js';
|
||||
import _ol_renderer_vector_ from '../../../../../src/ol/renderer/vector.js';
|
||||
import {renderFeature} from '../../../../../src/ol/renderer/vector.js';
|
||||
import Fill from '../../../../../src/ol/style/Fill.js';
|
||||
import Stroke from '../../../../../src/ol/style/Stroke.js';
|
||||
import Style from '../../../../../src/ol/style/Style.js';
|
||||
@@ -88,7 +88,7 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('omits lineTo for repeated coordinates', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature0, fill0, 1);
|
||||
renderFeature(replay, feature0, fill0, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(lineToCount).to.be(4);
|
||||
lineToCount = 0;
|
||||
@@ -98,16 +98,16 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('does not omit moveTo for repeated coordinates', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature0, fill0, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, fill1, 1);
|
||||
renderFeature(replay, feature0, fill0, 1);
|
||||
renderFeature(replay, feature1, fill1, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(moveToCount).to.be(2);
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for same style', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style1, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style1, 1);
|
||||
renderFeature(replay, feature3, style1, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(fillCount).to.be(1);
|
||||
expect(strokeCount).to.be(1);
|
||||
@@ -115,9 +115,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for different styles', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style2, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style1, 1);
|
||||
renderFeature(replay, feature3, style2, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(fillCount).to.be(2);
|
||||
expect(strokeCount).to.be(2);
|
||||
@@ -125,9 +125,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for changing styles', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style2, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style1, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style2, 1);
|
||||
renderFeature(replay, feature3, style1, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(fillCount).to.be(3);
|
||||
expect(strokeCount).to.be(3);
|
||||
@@ -135,9 +135,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for skipped feature at the beginning', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style2, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style2, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style2, 1);
|
||||
renderFeature(replay, feature3, style2, 1);
|
||||
const skippedUids = {};
|
||||
skippedUids[getUid(feature1)] = true;
|
||||
replay.replay(context, transform, 0, skippedUids);
|
||||
@@ -147,9 +147,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for skipped feature at the end', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style2, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style1, 1);
|
||||
renderFeature(replay, feature3, style2, 1);
|
||||
const skippedUids = {};
|
||||
skippedUids[getUid(feature3)] = true;
|
||||
replay.replay(context, transform, 0, skippedUids);
|
||||
@@ -159,9 +159,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
});
|
||||
|
||||
it('batches fill and stroke instructions for skipped features', function() {
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style2, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style1, 1);
|
||||
renderFeature(replay, feature3, style2, 1);
|
||||
const skippedUids = {};
|
||||
skippedUids[getUid(feature1)] = true;
|
||||
skippedUids[getUid(feature2)] = true;
|
||||
@@ -173,9 +173,9 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
|
||||
it('does not batch when overlaps is set to true', function() {
|
||||
replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 1, true);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style1, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature3, style1, 1);
|
||||
renderFeature(replay, feature1, style1, 1);
|
||||
renderFeature(replay, feature2, style1, 1);
|
||||
renderFeature(replay, feature3, style1, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(fillCount).to.be(3);
|
||||
expect(strokeCount).to.be(3);
|
||||
@@ -201,8 +201,8 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
}
|
||||
});
|
||||
|
||||
_ol_renderer_vector_.renderFeature(replay, feature1, style2, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, feature2, style2, 1);
|
||||
renderFeature(replay, feature1, style2, 1);
|
||||
renderFeature(replay, feature2, style2, 1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
|
||||
expect(lineDashCount).to.be(1);
|
||||
@@ -242,13 +242,13 @@ describe('ol.render.canvas.ReplayGroup', function() {
|
||||
const geometrycollection = new Feature(new GeometryCollection(
|
||||
[point.getGeometry(), linestring.getGeometry(), polygon.getGeometry()]));
|
||||
replay = new CanvasReplayGroup(1, [-180, -90, 180, 90], 1, 1, true);
|
||||
_ol_renderer_vector_.renderFeature(replay, point, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, multipoint, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, linestring, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, multilinestring, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, polygon, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, multipolygon, style, 1);
|
||||
_ol_renderer_vector_.renderFeature(replay, geometrycollection, style, 1);
|
||||
renderFeature(replay, point, style, 1);
|
||||
renderFeature(replay, multipoint, style, 1);
|
||||
renderFeature(replay, linestring, style, 1);
|
||||
renderFeature(replay, multilinestring, style, 1);
|
||||
renderFeature(replay, polygon, style, 1);
|
||||
renderFeature(replay, multipolygon, style, 1);
|
||||
renderFeature(replay, geometrycollection, style, 1);
|
||||
_ol_transform_.scale(transform, 0.1, 0.1);
|
||||
replay.replay(context, transform, 0, {});
|
||||
expect(calls.length).to.be(9);
|
||||
|
||||
@@ -18,7 +18,7 @@ import CanvasVectorTileLayerRenderer from '../../../../../src/ol/renderer/canvas
|
||||
import VectorTileSource from '../../../../../src/ol/source/VectorTile.js';
|
||||
import Style from '../../../../../src/ol/style/Style.js';
|
||||
import Text from '../../../../../src/ol/style/Text.js';
|
||||
import _ol_tilegrid_ from '../../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
@@ -70,7 +70,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
source = new VectorTileSource({
|
||||
format: new MVT(),
|
||||
tileClass: TileClass,
|
||||
tileGrid: _ol_tilegrid_.createXYZ()
|
||||
tileGrid: createXYZ()
|
||||
});
|
||||
source.getTile = function() {
|
||||
const tile = VectorTileSource.prototype.getTile.apply(source, arguments);
|
||||
@@ -241,7 +241,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
it('re-renders when layer changed', function() {
|
||||
const layer = new VectorTileLayer({
|
||||
source: new VectorTileSource({
|
||||
tileGrid: _ol_tilegrid_.createXYZ(),
|
||||
tileGrid: createXYZ(),
|
||||
transition: 0
|
||||
})
|
||||
});
|
||||
@@ -311,7 +311,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() {
|
||||
layer = new VectorTileLayer({
|
||||
source: new VectorTileSource({
|
||||
tileClass: TileClass,
|
||||
tileGrid: _ol_tilegrid_.createXYZ()
|
||||
tileGrid: createXYZ()
|
||||
})
|
||||
});
|
||||
renderer = new CanvasVectorTileLayerRenderer(layer);
|
||||
|
||||
@@ -7,7 +7,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import MultiPoint from '../../../../src/ol/geom/MultiPoint.js';
|
||||
import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import CanvasReplayGroup from '../../../../src/ol/render/canvas/ReplayGroup.js';
|
||||
import _ol_renderer_vector_ from '../../../../src/ol/renderer/vector.js';
|
||||
import {renderFeature} from '../../../../src/ol/renderer/vector.js';
|
||||
import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import Icon from '../../../../src/ol/style/Icon.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
@@ -50,7 +50,7 @@ describe('ol.renderer.vector', function() {
|
||||
let listeners;
|
||||
|
||||
// call #1
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
|
||||
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
||||
@@ -59,7 +59,7 @@ describe('ol.renderer.vector', function() {
|
||||
expect(listeners.length).to.eql(1);
|
||||
|
||||
// call #2
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
|
||||
expect(iconStyleLoadSpy.calledOnce).to.be.ok();
|
||||
@@ -78,7 +78,7 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), 'Image');
|
||||
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||
const drawPointSpy = sinon.stub(imageReplay, 'drawPoint').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setImageStyleSpy.called).to.be(false);
|
||||
setImageStyleSpy.restore();
|
||||
@@ -91,7 +91,7 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), 'Image');
|
||||
const setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||
const drawMultiPointSpy = sinon.stub(imageReplay, 'drawMultiPoint').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setImageStyleSpy.called).to.be(false);
|
||||
setImageStyleSpy.restore();
|
||||
@@ -105,7 +105,7 @@ describe('ol.renderer.vector', function() {
|
||||
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||
'setFillStrokeStyle');
|
||||
const drawLineStringSpy = sinon.stub(lineStringReplay, 'drawLineString').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawLineStringSpy.called).to.be(true);
|
||||
@@ -120,7 +120,7 @@ describe('ol.renderer.vector', function() {
|
||||
const setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||
'setFillStrokeStyle');
|
||||
const drawMultiLineStringSpy = sinon.stub(lineStringReplay, 'drawMultiLineString').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawMultiLineStringSpy.called).to.be(true);
|
||||
@@ -136,7 +136,7 @@ describe('ol.renderer.vector', function() {
|
||||
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||
'setFillStrokeStyle');
|
||||
const drawPolygonSpy = sinon.stub(polygonReplay, 'drawPolygon').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawPolygonSpy.called).to.be(true);
|
||||
@@ -152,7 +152,7 @@ describe('ol.renderer.vector', function() {
|
||||
const setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||
'setFillStrokeStyle');
|
||||
const drawMultiPolygonSpy = sinon.stub(polygonReplay, 'drawMultiPolygon').callsFake(nullFunction);
|
||||
_ol_renderer_vector_.renderFeature(replayGroup, feature,
|
||||
renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawMultiPolygonSpy.called).to.be(true);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ol_reproj_ from '../../../../src/ol/reproj.js';
|
||||
import {calculateSourceResolution} from '../../../../src/ol/reproj.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ describe('ol.reproj', function() {
|
||||
it('is identity for identical projection', function() {
|
||||
let result;
|
||||
const resolution = 500;
|
||||
result = _ol_reproj_.calculateSourceResolution(
|
||||
result = calculateSourceResolution(
|
||||
proj3857, proj3857, origin, resolution);
|
||||
expect(result).to.be(resolution);
|
||||
|
||||
result = _ol_reproj_.calculateSourceResolution(
|
||||
result = calculateSourceResolution(
|
||||
proj3857, proj3857, point3857, resolution);
|
||||
expect(result).to.be(resolution);
|
||||
|
||||
result = _ol_reproj_.calculateSourceResolution(
|
||||
result = calculateSourceResolution(
|
||||
proj4326, proj4326, point4326, resolution);
|
||||
expect(result).to.be(resolution);
|
||||
});
|
||||
@@ -30,13 +30,13 @@ describe('ol.reproj', function() {
|
||||
it('calculates correctly', function() {
|
||||
const resolution4326 = 5;
|
||||
|
||||
const resolution3857 = _ol_reproj_.calculateSourceResolution(
|
||||
const resolution3857 = calculateSourceResolution(
|
||||
proj3857, proj4326, point4326, resolution4326);
|
||||
expect(resolution3857).not.to.be(resolution4326);
|
||||
expect(resolution3857).to.roughlyEqual(
|
||||
5 * proj4326.getMetersPerUnit(), 1e-4);
|
||||
|
||||
const result = _ol_reproj_.calculateSourceResolution(
|
||||
const result = calculateSourceResolution(
|
||||
proj4326, proj3857, point3857, resolution3857);
|
||||
expect(result).to.be(resolution4326);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ import {listen} from '../../../../src/ol/events.js';
|
||||
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.reproj.Tile', function() {
|
||||
@@ -28,8 +28,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj3857 = getProjection('EPSG:3857');
|
||||
return new ReprojTile(
|
||||
proj3857, _ol_tilegrid_.createForProjection(proj3857), proj4326,
|
||||
_ol_tilegrid_.createForProjection(proj4326, 3, opt_tileSize),
|
||||
proj3857, createForProjection(proj3857), proj4326,
|
||||
createForProjection(proj4326, 3, opt_tileSize),
|
||||
[3, 2, -2], null, pixelRatio, 0, function(z, x, y, pixelRatio) {
|
||||
return new ImageTile([z, x, y], 0, // IDLE
|
||||
'data:image/gif;base64,' +
|
||||
@@ -55,8 +55,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj3857 = getProjection('EPSG:3857');
|
||||
const tile = new ReprojTile(
|
||||
proj3857, _ol_tilegrid_.createForProjection(proj3857),
|
||||
proj4326, _ol_tilegrid_.createForProjection(proj4326),
|
||||
proj3857, createForProjection(proj3857),
|
||||
proj4326, createForProjection(proj4326),
|
||||
[0, -1, 0], null, 1, 0, function() {
|
||||
expect().fail('No tiles should be required');
|
||||
});
|
||||
@@ -67,8 +67,8 @@ describe('ol.reproj.Tile', function() {
|
||||
const proj4326 = getProjection('EPSG:4326');
|
||||
const proj27700 = getProjection('EPSG:27700');
|
||||
const tile = new ReprojTile(
|
||||
proj27700, _ol_tilegrid_.createForProjection(proj27700),
|
||||
proj4326, _ol_tilegrid_.createForProjection(proj4326),
|
||||
proj27700, createForProjection(proj27700),
|
||||
proj4326, createForProjection(proj4326),
|
||||
[3, 2, -2], null, 1, 0, function() {
|
||||
expect().fail('No tiles should be required');
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import ReprojTile from '../../../../src/ol/reproj/Tile.js';
|
||||
import TileImage from '../../../../src/ol/source/TileImage.js';
|
||||
import _ol_tilecoord_ from '../../../../src/ol/tilecoord.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ, createForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.TileImage', function() {
|
||||
@@ -19,7 +19,7 @@ describe('ol.source.TileImage', function() {
|
||||
cacheSize: opt_cacheSize,
|
||||
projection: proj,
|
||||
tileGrid: opt_tileGrid ||
|
||||
_ol_tilegrid_.createForProjection(proj, undefined, [2, 2]),
|
||||
createForProjection(proj, undefined, [2, 2]),
|
||||
tileUrlFunction: createFromTemplate('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=')
|
||||
});
|
||||
}
|
||||
@@ -36,7 +36,7 @@ describe('ol.source.TileImage', function() {
|
||||
describe('#setTileGridForProjection', function() {
|
||||
it('uses the tilegrid for given projection', function() {
|
||||
const source = createSource();
|
||||
const tileGrid = _ol_tilegrid_.createForProjection('EPSG:4326', 3, [10, 20]);
|
||||
const tileGrid = createForProjection('EPSG:4326', 3, [10, 20]);
|
||||
source.setTileGridForProjection('EPSG:4326', tileGrid);
|
||||
const retrieved = source.getTileGridForProjection(getProjection('EPSG:4326'));
|
||||
expect(retrieved).to.be(tileGrid);
|
||||
@@ -141,7 +141,7 @@ describe('ol.source.TileImage', function() {
|
||||
});
|
||||
|
||||
it('can handle source projection without extent and units', function(done) {
|
||||
const source = createSource('4326_noextentnounits', _ol_tilegrid_.createXYZ({
|
||||
const source = createSource('4326_noextentnounits', createXYZ({
|
||||
extent: [-180, -90, 180, 90],
|
||||
tileSize: [2, 2]
|
||||
}));
|
||||
@@ -160,7 +160,7 @@ describe('ol.source.TileImage', function() {
|
||||
const proj = getProjection('4326_noextentnounits');
|
||||
const source = createSource();
|
||||
source.setTileGridForProjection(proj,
|
||||
_ol_tilegrid_.createXYZ({
|
||||
createXYZ({
|
||||
extent: WORLD_EXTENT,
|
||||
tileSize: [2, 2]
|
||||
}));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import ImageTile from '../../../../src/ol/ImageTile.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import TileWMS from '../../../../src/ol/source/TileWMS.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('ol.source.TileWMS', function() {
|
||||
it('can be constructed without url or urls params', function() {
|
||||
const source = new TileWMS({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6})
|
||||
tileGrid: createXYZ({maxZoom: 6})
|
||||
});
|
||||
expect(source).to.be.an(TileWMS);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import UrlTile from '../../../../src/ol/source/UrlTile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.UrlTile', function() {
|
||||
@@ -71,7 +71,7 @@ describe('ol.source.UrlTile', function() {
|
||||
beforeEach(function() {
|
||||
tileSource = new UrlTile({
|
||||
projection: 'EPSG:3857',
|
||||
tileGrid: _ol_tilegrid_.createXYZ({maxZoom: 6}),
|
||||
tileGrid: createXYZ({maxZoom: 6}),
|
||||
url: '{z}/{x}/{y}',
|
||||
wrapX: true
|
||||
});
|
||||
@@ -167,7 +167,7 @@ describe('ol.source.UrlTile', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
sourceOptions = {
|
||||
tileGrid: _ol_tilegrid_.createXYZ({
|
||||
tileGrid: createXYZ({
|
||||
extent: getProjection('EPSG:4326').getExtent()
|
||||
})
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import MVT from '../../../../src/ol/format/MVT.js';
|
||||
import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
import VectorTileSource from '../../../../src/ol/source/VectorTile.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
describe('ol.source.VectorTile', function() {
|
||||
@@ -29,7 +29,7 @@ describe('ol.source.VectorTile', function() {
|
||||
});
|
||||
|
||||
it('creates a 512 XYZ tilegrid by default', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({tileSize: 512});
|
||||
const tileGrid = createXYZ({tileSize: 512});
|
||||
expect(source.tileGrid.tileSize_).to.equal(tileGrid.tileSize_);
|
||||
expect(source.tileGrid.extent_).to.equal(tileGrid.extent_);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import TileSource from '../../../../src/ol/source/Tile.js';
|
||||
import TileImage from '../../../../src/ol/source/TileImage.js';
|
||||
import UrlTile from '../../../../src/ol/source/UrlTile.js';
|
||||
import XYZ from '../../../../src/ol/source/XYZ.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../../src/ol/tilegrid.js';
|
||||
|
||||
|
||||
describe('ol.source.XYZ', function() {
|
||||
@@ -18,7 +18,7 @@ describe('ol.source.XYZ', function() {
|
||||
});
|
||||
|
||||
it('can be constructed with a custom tile grid', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
const tileSource = new XYZ({
|
||||
tileGrid: tileGrid
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import {get as getProjection, METERS_PER_UNIT} from '../../../../src/ol/proj.js';
|
||||
import {HALF_SIZE} from '../../../../src/ol/proj/epsg3857.js';
|
||||
import Projection from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js';
|
||||
import {createForExtent, createForProjection, createXYZ, getForProjection as getTileGridForProjection} from '../../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('createForExtent', function() {
|
||||
it('allows creation of tile grid from extent', function() {
|
||||
const extent = _ol_extent_.createOrUpdate(-100, -100, 100, 100);
|
||||
const grid = _ol_tilegrid_.createForExtent(extent);
|
||||
const grid = createForExtent(extent);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -309,7 +309,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('allows easier creation of a tile grid', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -318,7 +318,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts a number of zoom levels', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection, 18);
|
||||
const grid = createForProjection(projection, 18);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -327,7 +327,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts a big number of zoom levels', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection, 23);
|
||||
const grid = createForProjection(projection, 23);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -337,7 +337,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
it('works for projections unknown to the client', function() {
|
||||
const projection = new Projection(
|
||||
{code: 'EPSG:31287', units: 'm'});
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
const resolutions = grid.getResolutions();
|
||||
expect(resolutions[5]).to.be(
|
||||
360 * METERS_PER_UNIT['degrees'] /
|
||||
@@ -346,7 +346,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('assumes origin is top-left', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(projection);
|
||||
const grid = createForProjection(projection);
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
expect(origin).to.eql([-half, half]);
|
||||
@@ -354,7 +354,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts bottom-left as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'bottom-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -363,7 +363,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts bottom-right as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'bottom-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -372,7 +372,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts top-left as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'top-left');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -381,7 +381,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('accepts top-right as corner', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.createForProjection(
|
||||
const grid = createForProjection(
|
||||
projection, undefined, undefined, 'top-right');
|
||||
const origin = grid.getOrigin();
|
||||
const half = HALF_SIZE;
|
||||
@@ -393,7 +393,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
describe('createXYZ()', function() {
|
||||
|
||||
it('uses defaults', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
expect(tileGrid.getExtent()).to.eql(
|
||||
getProjection('EPSG:3857').getExtent());
|
||||
expect(tileGrid.getMinZoom()).to.equal(0);
|
||||
@@ -402,7 +402,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
|
||||
it('respects configuration options', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({
|
||||
const tileGrid = createXYZ({
|
||||
extent: [10, 20, 30, 40],
|
||||
minZoom: 1,
|
||||
maxZoom: 2,
|
||||
@@ -420,7 +420,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('gets the default tile grid for a projection', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.getForProjection(projection);
|
||||
const grid = getTileGridForProjection(projection);
|
||||
expect(grid).to.be.a(TileGrid);
|
||||
|
||||
const resolutions = grid.getResolutions();
|
||||
@@ -430,8 +430,8 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
it('stores the default tile grid on a projection', function() {
|
||||
const projection = getProjection('EPSG:3857');
|
||||
const grid = _ol_tilegrid_.getForProjection(projection);
|
||||
const gridAgain = _ol_tilegrid_.getForProjection(projection);
|
||||
const grid = getTileGridForProjection(projection);
|
||||
const gridAgain = getTileGridForProjection(projection);
|
||||
|
||||
expect(grid).to.be(gridAgain);
|
||||
});
|
||||
@@ -442,7 +442,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -492,7 +492,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -552,7 +552,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
let tileGrid;
|
||||
beforeEach(function() {
|
||||
tileGrid = _ol_tilegrid_.createForExtent(
|
||||
tileGrid = createForExtent(
|
||||
getProjection('EPSG:3857').getExtent(), 22);
|
||||
});
|
||||
|
||||
@@ -917,7 +917,7 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
|
||||
describe('forEachTileCoord', function() {
|
||||
it('calls the provided function with each tile coordinate', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90]});
|
||||
const tileGrid = createXYZ({extent: [-180, -90, 180, 90]});
|
||||
const tileCoords = [];
|
||||
tileGrid.forEachTileCoord([15, 47, 16, 48], 8, function(tileCoord) {
|
||||
tileCoords.push(tileCoord);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {expandUrl, createFromTemplate, createFromTemplates, createFromTileUrlFunctions} from '../../../src/ol/tileurlfunction.js';
|
||||
import _ol_tilecoord_ from '../../../src/ol/tilecoord.js';
|
||||
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
describe('ol.TileUrlFunction', function() {
|
||||
@@ -49,7 +49,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTemplate', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const tileUrl = createFromTemplate('{z}/{x}/{y}', tileGrid);
|
||||
expect(tileUrl([3, 2, -2])).to.eql('3/2/1');
|
||||
@@ -75,7 +75,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTemplates', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const templates = [
|
||||
'http://tile-1/{z}/{x}/{y}',
|
||||
@@ -108,7 +108,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
});
|
||||
|
||||
describe('createFromTileUrlFunctions', function() {
|
||||
const tileGrid = _ol_tilegrid_.createXYZ();
|
||||
const tileGrid = createXYZ();
|
||||
it('creates expected URL', function() {
|
||||
const tileUrl = createFromTileUrlFunctions([
|
||||
createFromTemplate('a', tileGrid),
|
||||
|
||||
@@ -4,7 +4,7 @@ import VectorTile from '../../../src/ol/VectorTile.js';
|
||||
import {listen, listenOnce} from '../../../src/ol/events.js';
|
||||
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
|
||||
import {get as getProjection} from '../../../src/ol/proj.js';
|
||||
import _ol_tilegrid_ from '../../../src/ol/tilegrid.js';
|
||||
import {createXYZ} from '../../../src/ol/tilegrid.js';
|
||||
import TileGrid from '../../../src/ol/tilegrid/TileGrid.js';
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -40,7 +40,7 @@ describe('ol.VectorImageTile', function() {
|
||||
defaultLoadFunction(tile, url);
|
||||
}, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -64,7 +64,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
}, createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -80,7 +80,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const url = '';
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {},
|
||||
_ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ(), {},
|
||||
createXYZ(), createXYZ(), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -104,7 +104,7 @@ describe('ol.VectorImageTile', function() {
|
||||
defaultLoadFunction, [1, 0, -1], function(zxy) {
|
||||
return url;
|
||||
}, tileGrid,
|
||||
_ol_tilegrid_.createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
||||
createXYZ({extent: [-180, -90, 180, 90], tileSize: 512}),
|
||||
sourceTiles, 1, getProjection('EPSG:4326'), VectorTile, function() {});
|
||||
tile.load();
|
||||
expect(tile.tileKeys.length).to.be(1);
|
||||
@@ -117,7 +117,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, 0] /* one world away */, 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||
}, createXYZ(), createXYZ({tileSize: 512}), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
@@ -137,7 +137,7 @@ describe('ol.VectorImageTile', function() {
|
||||
const tile = new VectorImageTile([0, 0, -1], 0, url, format,
|
||||
defaultLoadFunction, [0, 0, -1], function() {
|
||||
return url;
|
||||
}, _ol_tilegrid_.createXYZ(), _ol_tilegrid_.createXYZ({tileSize: 512}), {},
|
||||
}, createXYZ(), createXYZ({tileSize: 512}), {},
|
||||
1, getProjection('EPSG:3857'), VectorTile, function() {});
|
||||
|
||||
tile.load();
|
||||
|
||||
Reference in New Issue
Block a user