+9
-18
@@ -192,8 +192,7 @@ const Graticule = function(opt_options) {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.targetSize_ = options.targetSize !== undefined ?
|
this.targetSize_ = options.targetSize !== undefined ? options.targetSize : 100;
|
||||||
options.targetSize : 100;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
@@ -337,8 +336,7 @@ const Graticule = function(opt_options) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) {
|
Graticule.prototype.addMeridian_ = function(lon, minLat, maxLat, squaredTolerance, extent, index) {
|
||||||
const lineString = this.getMeridian_(lon, minLat, maxLat,
|
const lineString = this.getMeridian_(lon, minLat, maxLat, squaredTolerance, index);
|
||||||
squaredTolerance, index);
|
|
||||||
if (intersects(lineString.getExtent(), extent)) {
|
if (intersects(lineString.getExtent(), extent)) {
|
||||||
if (this.meridiansLabels_) {
|
if (this.meridiansLabels_) {
|
||||||
const textPoint = this.getMeridianPoint_(lineString, extent, index);
|
const textPoint = this.getMeridianPoint_(lineString, extent, index);
|
||||||
@@ -385,8 +383,7 @@ Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) {
|
Graticule.prototype.addParallel_ = function(lat, minLon, maxLon, squaredTolerance, extent, index) {
|
||||||
const lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance,
|
const lineString = this.getParallel_(lat, minLon, maxLon, squaredTolerance, index);
|
||||||
index);
|
|
||||||
if (intersects(lineString.getExtent(), extent)) {
|
if (intersects(lineString.getExtent(), extent)) {
|
||||||
if (this.parallelsLabels_) {
|
if (this.parallelsLabels_) {
|
||||||
const textPoint = this.getParallelPoint_(lineString, extent, index);
|
const textPoint = this.getParallelPoint_(lineString, extent, index);
|
||||||
@@ -457,8 +454,7 @@ Graticule.prototype.createGraticule_ = function(extent, center, resolution, squa
|
|||||||
Math.min(extent[3], this.maxLatP_)
|
Math.min(extent[3], this.maxLatP_)
|
||||||
];
|
];
|
||||||
|
|
||||||
validExtent = transformExtent(validExtent, this.projection_,
|
validExtent = transformExtent(validExtent, this.projection_, 'EPSG:4326');
|
||||||
'EPSG:4326');
|
|
||||||
const maxLat = validExtent[3];
|
const maxLat = validExtent[3];
|
||||||
const maxLon = validExtent[2];
|
const maxLon = validExtent[2];
|
||||||
const minLat = validExtent[1];
|
const minLat = validExtent[1];
|
||||||
@@ -572,10 +568,8 @@ Graticule.prototype.getMap = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat, squaredTolerance, index) {
|
Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat, squaredTolerance, index) {
|
||||||
const flatCoordinates = meridian(lon,
|
const flatCoordinates = meridian(lon, minLat, maxLat, this.projection_, squaredTolerance);
|
||||||
minLat, maxLat, this.projection_, squaredTolerance);
|
const lineString = this.meridians_[index] !== undefined ? this.meridians_[index] : new LineString(null);
|
||||||
const lineString = this.meridians_[index] !== undefined ?
|
|
||||||
this.meridians_[index] : new LineString(null);
|
|
||||||
lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
||||||
return lineString;
|
return lineString;
|
||||||
};
|
};
|
||||||
@@ -601,10 +595,8 @@ Graticule.prototype.getMeridians = function() {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
Graticule.prototype.getParallel_ = function(lat, minLon, maxLon, squaredTolerance, index) {
|
Graticule.prototype.getParallel_ = function(lat, minLon, maxLon, squaredTolerance, index) {
|
||||||
const flatCoordinates = parallel(lat,
|
const flatCoordinates = parallel(lat, minLon, maxLon, this.projection_, squaredTolerance);
|
||||||
minLon, maxLon, this.projection_, squaredTolerance);
|
const lineString = this.parallels_[index] !== undefined ? this.parallels_[index] : new LineString(null);
|
||||||
const lineString = this.parallels_[index] !== undefined ?
|
|
||||||
this.parallels_[index] : new LineString(null);
|
|
||||||
lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
lineString.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
||||||
return lineString;
|
return lineString;
|
||||||
};
|
};
|
||||||
@@ -685,8 +677,7 @@ Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
|||||||
|
|
||||||
const extent = projection.getExtent();
|
const extent = projection.getExtent();
|
||||||
const worldExtent = projection.getWorldExtent();
|
const worldExtent = projection.getWorldExtent();
|
||||||
const worldExtentP = transformExtent(worldExtent,
|
const worldExtentP = transformExtent(worldExtent, epsg4326Projection, projection);
|
||||||
epsg4326Projection, projection);
|
|
||||||
|
|
||||||
const maxLat = worldExtent[3];
|
const maxLat = worldExtent[3];
|
||||||
const maxLon = worldExtent[2];
|
const maxLon = worldExtent[2];
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ import MapEvent from './MapEvent.js';
|
|||||||
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
* @param {boolean=} opt_dragging Is the map currently being dragged?
|
||||||
* @param {?olx.FrameState=} opt_frameState Frame state.
|
* @param {?olx.FrameState=} opt_frameState Frame state.
|
||||||
*/
|
*/
|
||||||
const MapBrowserEvent = function(type, map, browserEvent, opt_dragging,
|
const MapBrowserEvent = function(type, map, browserEvent, opt_dragging, opt_frameState) {
|
||||||
opt_frameState) {
|
|
||||||
|
|
||||||
MapEvent.call(this, type, map, opt_frameState);
|
MapEvent.call(this, type, map, opt_frameState);
|
||||||
|
|
||||||
|
|||||||
+12
-24
@@ -500,15 +500,11 @@ PluggableMap.prototype.addOverlayInternal_ = function(overlay) {
|
|||||||
*/
|
*/
|
||||||
PluggableMap.prototype.disposeInternal = function() {
|
PluggableMap.prototype.disposeInternal = function() {
|
||||||
this.mapBrowserEventHandler_.dispose();
|
this.mapBrowserEventHandler_.dispose();
|
||||||
unlisten(this.viewport_, EventType.CONTEXTMENU,
|
unlisten(this.viewport_, EventType.CONTEXTMENU, this.handleBrowserEvent, this);
|
||||||
this.handleBrowserEvent, this);
|
unlisten(this.viewport_, EventType.WHEEL, this.handleBrowserEvent, this);
|
||||||
unlisten(this.viewport_, EventType.WHEEL,
|
unlisten(this.viewport_, EventType.MOUSEWHEEL, this.handleBrowserEvent, this);
|
||||||
this.handleBrowserEvent, this);
|
|
||||||
unlisten(this.viewport_, EventType.MOUSEWHEEL,
|
|
||||||
this.handleBrowserEvent, this);
|
|
||||||
if (this.handleResize_ !== undefined) {
|
if (this.handleResize_ !== undefined) {
|
||||||
removeEventListener(EventType.RESIZE,
|
removeEventListener(EventType.RESIZE, this.handleResize_, false);
|
||||||
this.handleResize_, false);
|
|
||||||
this.handleResize_ = undefined;
|
this.handleResize_ = undefined;
|
||||||
}
|
}
|
||||||
if (this.animationDelayKey_) {
|
if (this.animationDelayKey_) {
|
||||||
@@ -792,8 +788,7 @@ PluggableMap.prototype.getPixelFromCoordinate = function(coordinate) {
|
|||||||
if (!frameState) {
|
if (!frameState) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return applyTransform(frameState.coordinateToPixelTransform,
|
return applyTransform(frameState.coordinateToPixelTransform, coordinate.slice(0, 2));
|
||||||
coordinate.slice(0, 2));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1010,8 +1005,7 @@ PluggableMap.prototype.handleTargetChanged_ = function() {
|
|||||||
this.renderer_.removeLayerRenderers();
|
this.renderer_.removeLayerRenderers();
|
||||||
removeNode(this.viewport_);
|
removeNode(this.viewport_);
|
||||||
if (this.handleResize_ !== undefined) {
|
if (this.handleResize_ !== undefined) {
|
||||||
removeEventListener(EventType.RESIZE,
|
removeEventListener(EventType.RESIZE, this.handleResize_, false);
|
||||||
this.handleResize_, false);
|
|
||||||
this.handleResize_ = undefined;
|
this.handleResize_ = undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1020,16 +1014,13 @@ PluggableMap.prototype.handleTargetChanged_ = function() {
|
|||||||
const keyboardEventTarget = !this.keyboardEventTarget_ ?
|
const keyboardEventTarget = !this.keyboardEventTarget_ ?
|
||||||
targetElement : this.keyboardEventTarget_;
|
targetElement : this.keyboardEventTarget_;
|
||||||
this.keyHandlerKeys_ = [
|
this.keyHandlerKeys_ = [
|
||||||
listen(keyboardEventTarget, EventType.KEYDOWN,
|
listen(keyboardEventTarget, EventType.KEYDOWN, this.handleBrowserEvent, this),
|
||||||
this.handleBrowserEvent, this),
|
listen(keyboardEventTarget, EventType.KEYPRESS, this.handleBrowserEvent, this)
|
||||||
listen(keyboardEventTarget, EventType.KEYPRESS,
|
|
||||||
this.handleBrowserEvent, this)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!this.handleResize_) {
|
if (!this.handleResize_) {
|
||||||
this.handleResize_ = this.updateSize.bind(this);
|
this.handleResize_ = this.updateSize.bind(this);
|
||||||
addEventListener(EventType.RESIZE,
|
addEventListener(EventType.RESIZE, this.handleResize_, false);
|
||||||
this.handleResize_, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,8 +1121,7 @@ PluggableMap.prototype.renderSync = function() {
|
|||||||
*/
|
*/
|
||||||
PluggableMap.prototype.render = function() {
|
PluggableMap.prototype.render = function() {
|
||||||
if (this.animationDelayKey_ === undefined) {
|
if (this.animationDelayKey_ === undefined) {
|
||||||
this.animationDelayKey_ = requestAnimationFrame(
|
this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);
|
||||||
this.animationDelay_);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1267,14 +1257,12 @@ PluggableMap.prototype.renderFrame_ = function(time) {
|
|||||||
!equals(frameState.extent, this.previousExtent_);
|
!equals(frameState.extent, this.previousExtent_);
|
||||||
|
|
||||||
if (idle) {
|
if (idle) {
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(new MapEvent(MapEventType.MOVEEND, this, frameState));
|
||||||
new MapEvent(MapEventType.MOVEEND, this, frameState));
|
|
||||||
clone(frameState.extent, this.previousExtent_);
|
clone(frameState.extent, this.previousExtent_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dispatchEvent(
|
this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));
|
||||||
new MapEvent(MapEventType.POSTRENDER, this, frameState));
|
|
||||||
|
|
||||||
setTimeout(this.handlePostRender.bind(this), 0);
|
setTimeout(this.handlePostRender.bind(this), 0);
|
||||||
|
|
||||||
|
|||||||
+1
-2
@@ -543,8 +543,7 @@ View.prototype.constrainCenter = function(center) {
|
|||||||
* @return {number|undefined} Constrained resolution.
|
* @return {number|undefined} Constrained resolution.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
View.prototype.constrainResolution = function(
|
View.prototype.constrainResolution = function(resolution, opt_delta, opt_direction) {
|
||||||
resolution, opt_delta, opt_direction) {
|
|
||||||
const delta = opt_delta || 0;
|
const delta = opt_delta || 0;
|
||||||
const direction = opt_direction || 0;
|
const direction = opt_direction || 0;
|
||||||
return this.constraints_.resolution(resolution, delta, direction);
|
return this.constraints_.resolution(resolution, delta, direction);
|
||||||
|
|||||||
+16
-31
@@ -109,9 +109,8 @@ function readGeometry(object, opt_options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const geometryReader = GEOMETRY_READERS[type];
|
const geometryReader = GEOMETRY_READERS[type];
|
||||||
return (
|
return /** @type {ol.geom.Geometry} */ (transformWithOptions(
|
||||||
/** @type {ol.geom.Geometry} */ transformWithOptions(
|
geometryReader(object), false, opt_options)
|
||||||
geometryReader(object), false, opt_options)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,11 +428,9 @@ EsriJSON.prototype.readFeatures;
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
EsriJSON.prototype.readFeatureFromObject = function(
|
EsriJSON.prototype.readFeatureFromObject = function(object, opt_options) {
|
||||||
object, opt_options) {
|
|
||||||
const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
|
const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
|
||||||
const geometry = readGeometry(esriJSONFeature.geometry,
|
const geometry = readGeometry(esriJSONFeature.geometry, opt_options);
|
||||||
opt_options);
|
|
||||||
const feature = new Feature();
|
const feature = new Feature();
|
||||||
if (this.geometryName_) {
|
if (this.geometryName_) {
|
||||||
feature.setGeometryName(this.geometryName_);
|
feature.setGeometryName(this.geometryName_);
|
||||||
@@ -441,8 +438,7 @@ EsriJSON.prototype.readFeatureFromObject = function(
|
|||||||
feature.setGeometry(geometry);
|
feature.setGeometry(geometry);
|
||||||
if (opt_options && opt_options.idField &&
|
if (opt_options && opt_options.idField &&
|
||||||
esriJSONFeature.attributes[opt_options.idField]) {
|
esriJSONFeature.attributes[opt_options.idField]) {
|
||||||
feature.setId(/** @type {number} */(
|
feature.setId(/** @type {number} */(esriJSONFeature.attributes[opt_options.idField]));
|
||||||
esriJSONFeature.attributes[opt_options.idField]));
|
|
||||||
}
|
}
|
||||||
if (esriJSONFeature.attributes) {
|
if (esriJSONFeature.attributes) {
|
||||||
feature.setProperties(esriJSONFeature.attributes);
|
feature.setProperties(esriJSONFeature.attributes);
|
||||||
@@ -454,21 +450,17 @@ EsriJSON.prototype.readFeatureFromObject = function(
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
EsriJSON.prototype.readFeaturesFromObject = function(
|
EsriJSON.prototype.readFeaturesFromObject = function(object, opt_options) {
|
||||||
object, opt_options) {
|
|
||||||
const esriJSONObject = /** @type {EsriJSONObject} */ (object);
|
const esriJSONObject = /** @type {EsriJSONObject} */ (object);
|
||||||
const options = opt_options ? opt_options : {};
|
const options = opt_options ? opt_options : {};
|
||||||
if (esriJSONObject.features) {
|
if (esriJSONObject.features) {
|
||||||
const esriJSONFeatureCollection = /** @type {EsriJSONFeatureCollection} */
|
const esriJSONFeatureCollection = /** @type {EsriJSONFeatureCollection} */ (object);
|
||||||
(object);
|
|
||||||
/** @type {Array.<ol.Feature>} */
|
/** @type {Array.<ol.Feature>} */
|
||||||
const features = [];
|
const features = [];
|
||||||
const esriJSONFeatures = esriJSONFeatureCollection.features;
|
const esriJSONFeatures = esriJSONFeatureCollection.features;
|
||||||
let i, ii;
|
|
||||||
options.idField = object.objectIdFieldName;
|
options.idField = object.objectIdFieldName;
|
||||||
for (i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {
|
for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {
|
||||||
features.push(this.readFeatureFromObject(esriJSONFeatures[i],
|
features.push(this.readFeatureFromObject(esriJSONFeatures[i], options));
|
||||||
options));
|
|
||||||
}
|
}
|
||||||
return features;
|
return features;
|
||||||
} else {
|
} else {
|
||||||
@@ -492,10 +484,8 @@ EsriJSON.prototype.readGeometry;
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
EsriJSON.prototype.readGeometryFromObject = function(
|
EsriJSON.prototype.readGeometryFromObject = function(object, opt_options) {
|
||||||
object, opt_options) {
|
return readGeometry(/** @type {EsriJSONGeometry} */(object), opt_options);
|
||||||
return readGeometry(
|
|
||||||
/** @type {EsriJSONGeometry} */(object), opt_options);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -557,10 +547,8 @@ EsriJSON.prototype.writeGeometry;
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
EsriJSON.prototype.writeGeometryObject = function(geometry,
|
EsriJSON.prototype.writeGeometryObject = function(geometry, opt_options) {
|
||||||
opt_options) {
|
return writeGeometry(geometry, this.adaptOptions(opt_options));
|
||||||
return writeGeometry(geometry,
|
|
||||||
this.adaptOptions(opt_options));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -585,14 +573,12 @@ EsriJSON.prototype.writeFeature;
|
|||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
EsriJSON.prototype.writeFeatureObject = function(
|
EsriJSON.prototype.writeFeatureObject = function(feature, opt_options) {
|
||||||
feature, opt_options) {
|
|
||||||
opt_options = this.adaptOptions(opt_options);
|
opt_options = this.adaptOptions(opt_options);
|
||||||
const object = {};
|
const object = {};
|
||||||
const geometry = feature.getGeometry();
|
const geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
object['geometry'] =
|
object['geometry'] = writeGeometry(geometry, opt_options);
|
||||||
writeGeometry(geometry, opt_options);
|
|
||||||
if (opt_options && opt_options.featureProjection) {
|
if (opt_options && opt_options.featureProjection) {
|
||||||
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
|
object['geometry']['spatialReference'] = /** @type {EsriJSONCRS} */({
|
||||||
wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop()
|
wkid: getProjection(opt_options.featureProjection).getCode().split(':').pop()
|
||||||
@@ -634,8 +620,7 @@ EsriJSON.prototype.writeFeatures;
|
|||||||
EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
EsriJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
||||||
opt_options = this.adaptOptions(opt_options);
|
opt_options = this.adaptOptions(opt_options);
|
||||||
const objects = [];
|
const objects = [];
|
||||||
let i, ii;
|
for (let i = 0, ii = features.length; i < ii; ++i) {
|
||||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
|
||||||
objects.push(this.writeFeatureObject(features[i], opt_options));
|
objects.push(this.writeFeatureObject(features[i], opt_options));
|
||||||
}
|
}
|
||||||
return /** @type {EsriJSONFeatureCollection} */ ({
|
return /** @type {EsriJSONFeatureCollection} */ ({
|
||||||
|
|||||||
@@ -479,8 +479,7 @@ GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
|
|||||||
* @param {Array.<*>} objectStack Node stack.
|
* @param {Array.<*>} objectStack Node stack.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
GML2.prototype.writeMultiPoint_ = function(node, geometry,
|
GML2.prototype.writeMultiPoint_ = function(node, geometry, objectStack) {
|
||||||
objectStack) {
|
|
||||||
const context = objectStack[objectStack.length - 1];
|
const context = objectStack[objectStack.length - 1];
|
||||||
const hasZ = context['hasZ'];
|
const hasZ = context['hasZ'];
|
||||||
const srsName = context['srsName'];
|
const srsName = context['srsName'];
|
||||||
|
|||||||
@@ -813,8 +813,7 @@ GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStac
|
|||||||
* @param {Array.<*>} objectStack Node stack.
|
* @param {Array.<*>} objectStack Node stack.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
GML3.prototype.writeMultiPoint_ = function(node, geometry, objectStack) {
|
||||||
objectStack) {
|
|
||||||
const context = objectStack[objectStack.length - 1];
|
const context = objectStack[objectStack.length - 1];
|
||||||
const srsName = context['srsName'];
|
const srsName = context['srsName'];
|
||||||
const hasZ = context['hasZ'];
|
const hasZ = context['hasZ'];
|
||||||
|
|||||||
@@ -106,9 +106,8 @@ function readGeometry(object, opt_options) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const geometryReader = GEOMETRY_READERS[object.type];
|
const geometryReader = GEOMETRY_READERS[object.type];
|
||||||
return (
|
return /** @type {ol.geom.Geometry} */ (transformWithOptions(
|
||||||
/** @type {ol.geom.Geometry} */ transformWithOptions(
|
geometryReader(object), false, opt_options)
|
||||||
geometryReader(object), false, opt_options)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,9 +120,9 @@ function readGeometry(object, opt_options) {
|
|||||||
function readGeometryCollectionGeometry(object, opt_options) {
|
function readGeometryCollectionGeometry(object, opt_options) {
|
||||||
const geometries = object.geometries.map(
|
const geometries = object.geometries.map(
|
||||||
/**
|
/**
|
||||||
* @param {GeoJSONGeometry} geometry Geometry.
|
* @param {GeoJSONGeometry} geometry Geometry.
|
||||||
* @return {ol.geom.Geometry} geometry Geometry.
|
* @return {ol.geom.Geometry} geometry Geometry.
|
||||||
*/
|
*/
|
||||||
function(geometry) {
|
function(geometry) {
|
||||||
return readGeometry(geometry, opt_options);
|
return readGeometry(geometry, opt_options);
|
||||||
});
|
});
|
||||||
@@ -388,8 +387,7 @@ GeoJSON.prototype.readFeaturesFromObject = function(object, opt_options) {
|
|||||||
const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (object);
|
const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (object);
|
||||||
features = [];
|
features = [];
|
||||||
const geoJSONFeatures = geoJSONFeatureCollection.features;
|
const geoJSONFeatures = geoJSONFeatureCollection.features;
|
||||||
let i, ii;
|
for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {
|
||||||
for (i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {
|
|
||||||
features.push(this.readFeatureFromObject(geoJSONFeatures[i], opt_options));
|
features.push(this.readFeatureFromObject(geoJSONFeatures[i], opt_options));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -523,8 +521,7 @@ GeoJSON.prototype.writeFeatures;
|
|||||||
GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
GeoJSON.prototype.writeFeaturesObject = function(features, opt_options) {
|
||||||
opt_options = this.adaptOptions(opt_options);
|
opt_options = this.adaptOptions(opt_options);
|
||||||
const objects = [];
|
const objects = [];
|
||||||
let i, ii;
|
for (let i = 0, ii = features.length; i < ii; ++i) {
|
||||||
for (i = 0, ii = features.length; i < ii; ++i) {
|
|
||||||
objects.push(this.writeFeatureObject(features[i], opt_options));
|
objects.push(this.writeFeatureObject(features[i], opt_options));
|
||||||
}
|
}
|
||||||
return /** @type {GeoJSONFeatureCollection} */ ({
|
return /** @type {GeoJSONFeatureCollection} */ ({
|
||||||
|
|||||||
@@ -2192,8 +2192,7 @@ const DOCUMENT_SERIALIZERS = makeStructureNS(
|
|||||||
* @param {string=} opt_nodeName Node name.
|
* @param {string=} opt_nodeName Node name.
|
||||||
* @return {Node|undefined} Node.
|
* @return {Node|undefined} Node.
|
||||||
*/
|
*/
|
||||||
const DOCUMENT_NODE_FACTORY = function(value, objectStack,
|
const DOCUMENT_NODE_FACTORY = function(value, objectStack, opt_nodeName) {
|
||||||
opt_nodeName) {
|
|
||||||
const parentNode = objectStack[objectStack.length - 1].node;
|
const parentNode = objectStack[objectStack.length - 1].node;
|
||||||
return createElementNS(parentNode.namespaceURI, 'Placemark');
|
return createElementNS(parentNode.namespaceURI, 'Placemark');
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -319,13 +319,11 @@ Polyline.prototype.readGeometryFromText = function(text, opt_options) {
|
|||||||
const stride = getStrideForLayout(this.geometryLayout_);
|
const stride = getStrideForLayout(this.geometryLayout_);
|
||||||
const flatCoordinates = decodeDeltas(text, stride, this.factor_);
|
const flatCoordinates = decodeDeltas(text, stride, this.factor_);
|
||||||
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
|
||||||
const coordinates = inflateCoordinates(
|
const coordinates = inflateCoordinates(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||||
flatCoordinates, 0, flatCoordinates.length, stride);
|
|
||||||
|
|
||||||
return (
|
return /** @type {ol.geom.Geometry} */ (transformWithOptions(
|
||||||
/** @type {ol.geom.Geometry} */ transformWithOptions(
|
new LineString(coordinates, this.geometryLayout_), false,
|
||||||
new LineString(coordinates, this.geometryLayout_), false,
|
this.adaptOptions(opt_options))
|
||||||
this.adaptOptions(opt_options))
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ XMLFeature.prototype.readFeature = function(source, opt_options) {
|
|||||||
* @param {olx.format.ReadOptions=} opt_options Options.
|
* @param {olx.format.ReadOptions=} opt_options Options.
|
||||||
* @return {ol.Feature} Feature.
|
* @return {ol.Feature} Feature.
|
||||||
*/
|
*/
|
||||||
XMLFeature.prototype.readFeatureFromDocument = function(
|
XMLFeature.prototype.readFeatureFromDocument = function(doc, opt_options) {
|
||||||
doc, opt_options) {
|
|
||||||
const features = this.readFeaturesFromDocument(doc, opt_options);
|
const features = this.readFeaturesFromDocument(doc, opt_options);
|
||||||
if (features.length > 0) {
|
if (features.length > 0) {
|
||||||
return features[0];
|
return features[0];
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import {transform2D} from '../../geom/flat/transform.js';
|
|||||||
import {CANVAS_LINE_DASH} from '../../has.js';
|
import {CANVAS_LINE_DASH} from '../../has.js';
|
||||||
import {isEmpty} from '../../obj.js';
|
import {isEmpty} from '../../obj.js';
|
||||||
import VectorContext from '../VectorContext.js';
|
import VectorContext from '../VectorContext.js';
|
||||||
import {drawImage, resetTransform, defaultPadding, defaultFillStyle, defaultStrokeStyle, defaultMiterLimit, defaultLineWidth, defaultLineJoin, defaultLineDashOffset, defaultLineDash, defaultLineCap} from '../canvas.js';
|
import {drawImage, resetTransform, defaultPadding, defaultFillStyle, defaultStrokeStyle,
|
||||||
|
defaultMiterLimit, defaultLineWidth, defaultLineJoin, defaultLineDashOffset,
|
||||||
|
defaultLineDash, defaultLineCap} from '../canvas.js';
|
||||||
import CanvasInstruction from '../canvas/Instruction.js';
|
import CanvasInstruction from '../canvas/Instruction.js';
|
||||||
import {TEXT_ALIGN} from '../replay.js';
|
import {TEXT_ALIGN} from '../replay.js';
|
||||||
import {
|
import {
|
||||||
@@ -581,8 +583,7 @@ CanvasReplay.prototype.replay_ = function(
|
|||||||
|
|
||||||
// When the batch size gets too big, performance decreases. 200 is a good
|
// When the batch size gets too big, performance decreases. 200 is a good
|
||||||
// balance between batch size and number of fill/stroke instructions.
|
// balance between batch size and number of fill/stroke instructions.
|
||||||
const batchSize =
|
const batchSize = this.instructions != instructions || this.overlaps ? 0 : 200;
|
||||||
this.instructions != instructions || this.overlaps ? 0 : 200;
|
|
||||||
let /** @type {ol.Feature|ol.render.Feature} */ feature;
|
let /** @type {ol.Feature|ol.render.Feature} */ feature;
|
||||||
let x, y;
|
let x, y;
|
||||||
while (i < ii) {
|
while (i < ii) {
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ Cluster.prototype.getSource = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
Cluster.prototype.loadFeatures = function(extent, resolution,
|
Cluster.prototype.loadFeatures = function(extent, resolution, projection) {
|
||||||
projection) {
|
|
||||||
this.source.loadFeatures(extent, resolution, projection);
|
this.source.loadFeatures(extent, resolution, projection);
|
||||||
if (resolution !== this.resolution) {
|
if (resolution !== this.resolution) {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|||||||
@@ -233,8 +233,7 @@ ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, size, project
|
|||||||
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ImageMapGuide.prototype.setImageLoadFunction = function(
|
ImageMapGuide.prototype.setImageLoadFunction = function(imageLoadFunction) {
|
||||||
imageLoadFunction) {
|
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.imageLoadFunction_ = imageLoadFunction;
|
this.imageLoadFunction_ = imageLoadFunction;
|
||||||
this.changed();
|
this.changed();
|
||||||
|
|||||||
@@ -326,8 +326,7 @@ ImageWMS.prototype.getUrl = function() {
|
|||||||
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ImageWMS.prototype.setImageLoadFunction = function(
|
ImageWMS.prototype.setImageLoadFunction = function(imageLoadFunction) {
|
||||||
imageLoadFunction) {
|
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.imageLoadFunction_ = imageLoadFunction;
|
this.imageLoadFunction_ = imageLoadFunction;
|
||||||
this.changed();
|
this.changed();
|
||||||
|
|||||||
@@ -490,10 +490,10 @@ VectorSource.prototype.forEachFeatureInExtent = function(extent, callback) {
|
|||||||
VectorSource.prototype.forEachFeatureIntersectingExtent = function(extent, callback) {
|
VectorSource.prototype.forEachFeatureIntersectingExtent = function(extent, callback) {
|
||||||
return this.forEachFeatureInExtent(extent,
|
return this.forEachFeatureInExtent(extent,
|
||||||
/**
|
/**
|
||||||
* @param {ol.Feature} feature Feature.
|
* @param {ol.Feature} feature Feature.
|
||||||
* @return {T|undefined} The return value from the last call to the callback.
|
* @return {T|undefined} The return value from the last call to the callback.
|
||||||
* @template T
|
* @template T
|
||||||
*/
|
*/
|
||||||
function(feature) {
|
function(feature) {
|
||||||
const geometry = feature.getGeometry();
|
const geometry = feature.getGeometry();
|
||||||
if (geometry.intersectsExtent(extent)) {
|
if (geometry.intersectsExtent(extent)) {
|
||||||
@@ -754,17 +754,16 @@ VectorSource.prototype.isEmpty = function() {
|
|||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @param {ol.proj.Projection} projection Projection.
|
* @param {ol.proj.Projection} projection Projection.
|
||||||
*/
|
*/
|
||||||
VectorSource.prototype.loadFeatures = function(
|
VectorSource.prototype.loadFeatures = function(extent, resolution, projection) {
|
||||||
extent, resolution, projection) {
|
|
||||||
const loadedExtentsRtree = this.loadedExtentsRtree_;
|
const loadedExtentsRtree = this.loadedExtentsRtree_;
|
||||||
const extentsToLoad = this.strategy_(extent, resolution);
|
const extentsToLoad = this.strategy_(extent, resolution);
|
||||||
for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {
|
for (let i = 0, ii = extentsToLoad.length; i < ii; ++i) {
|
||||||
const extentToLoad = extentsToLoad[i];
|
const extentToLoad = extentsToLoad[i];
|
||||||
const alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad,
|
const alreadyLoaded = loadedExtentsRtree.forEachInExtent(extentToLoad,
|
||||||
/**
|
/**
|
||||||
* @param {{extent: ol.Extent}} object Object.
|
* @param {{extent: ol.Extent}} object Object.
|
||||||
* @return {boolean} Contains.
|
* @return {boolean} Contains.
|
||||||
*/
|
*/
|
||||||
function(object) {
|
function(object) {
|
||||||
return containsExtent(object.extent, extentToLoad);
|
return containsExtent(object.extent, extentToLoad);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -224,10 +224,8 @@ WebGLContext.prototype.getShader = function(shaderObject) {
|
|||||||
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
|
* @param {ol.webgl.Vertex} vertexShaderObject Vertex shader.
|
||||||
* @return {WebGLProgram} Program.
|
* @return {WebGLProgram} Program.
|
||||||
*/
|
*/
|
||||||
WebGLContext.prototype.getProgram = function(
|
WebGLContext.prototype.getProgram = function(fragmentShaderObject, vertexShaderObject) {
|
||||||
fragmentShaderObject, vertexShaderObject) {
|
const programKey = getUid(fragmentShaderObject) + '/' + getUid(vertexShaderObject);
|
||||||
const programKey =
|
|
||||||
getUid(fragmentShaderObject) + '/' + getUid(vertexShaderObject);
|
|
||||||
if (programKey in this.programCache_) {
|
if (programKey in this.programCache_) {
|
||||||
return this.programCache_[programKey];
|
return this.programCache_[programKey];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user