Autofix indentation issues (eslint --fix)

This commit is contained in:
Marc Jansen
2017-06-19 11:58:00 +02:00
parent a17db4f45c
commit d0ef05977b
196 changed files with 1574 additions and 1574 deletions

View File

@@ -97,7 +97,7 @@ function rgb2xyz(x) {
function xyz2rgb(x) { function xyz2rgb(x) {
return 255 * (x <= 0.0031308 ? return 255 * (x <= 0.0031308 ?
12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055); 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
} }
var raster = new ol.source.Raster({ var raster = new ol.source.Raster({

View File

@@ -142,7 +142,7 @@ var lineFeature = new ol.Feature(
var polygonFeature = new ol.Feature( var polygonFeature = new ol.Feature(
new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6], new ol.geom.Polygon([[[-3e6, -1e6], [-3e6, 1e6],
[-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]])); [-1e6, 1e6], [-1e6, -1e6], [-3e6, -1e6]]]));
var map = new ol.Map({ var map = new ol.Map({

View File

@@ -198,7 +198,7 @@ function stopAnimation(ended) {
// if animation cancelled set the marker at the beginning // if animation cancelled set the marker at the beginning
var coord = ended ? routeCoords[routeLength - 1] : routeCoords[0]; var coord = ended ? routeCoords[routeLength - 1] : routeCoords[0];
/** @type {ol.geom.Point} */ (geoMarker.getGeometry()) /** @type {ol.geom.Point} */ (geoMarker.getGeometry())
.setCoordinates(coord); .setCoordinates(coord);
//remove listener //remove listener
map.un('postcompose', moveFeature); map.un('postcompose', moveFeature);
} }

View File

@@ -85,10 +85,10 @@ fetch(url).then(function(response) {
var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1); var data = tileIndex.getTile(tileCoord[0], tileCoord[1], -tileCoord[2] - 1);
var features = format.readFeatures( var features = format.readFeatures(
JSON.stringify({ JSON.stringify({
type: 'FeatureCollection', type: 'FeatureCollection',
features: data ? data.features : [] features: data ? data.features : []
}, replacer)); }, replacer));
tile.setLoader(function() { tile.setLoader(function() {
tile.setFeatures(features); tile.setFeatures(features);
tile.setProjection(tilePixels); tile.setProjection(tilePixels);

View File

@@ -83,7 +83,7 @@ positionFeature.setStyle(new ol.style.Style({
geolocation.on('change:position', function() { geolocation.on('change:position', function() {
var coordinates = geolocation.getPosition(); var coordinates = geolocation.getPosition();
positionFeature.setGeometry(coordinates ? positionFeature.setGeometry(coordinates ?
new ol.geom.Point(coordinates) : null); new ol.geom.Point(coordinates) : null);
}); });
new ol.layer.Vector({ new ol.layer.Vector({

View File

@@ -81,11 +81,11 @@ var map = new ol.Map({
function createUrl(tpl, layerDesc) { function createUrl(tpl, layerDesc) {
return tpl return tpl
.replace('{base}', layerDesc.base) .replace('{base}', layerDesc.base)
.replace('{type}', layerDesc.type) .replace('{type}', layerDesc.type)
.replace('{scheme}', layerDesc.scheme) .replace('{scheme}', layerDesc.scheme)
.replace('{app_id}', layerDesc.app_id) .replace('{app_id}', layerDesc.app_id)
.replace('{app_code}', layerDesc.app_code); .replace('{app_code}', layerDesc.app_code);
} }
var select = document.getElementById('layer-select'); var select = document.getElementById('layer-select');

View File

@@ -96,8 +96,8 @@ var geojsonObject = {
'geometry': { 'geometry': {
'type': 'Polygon', 'type': 'Polygon',
'coordinates': [[[-5e6, -1e6], [-4e6, 1e6], 'coordinates': [[[-5e6, -1e6], [-4e6, 1e6],
[-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6], [-3e6, -1e6], [-5e6, -1e6]], [[-4.5e6, -0.5e6],
[-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]] [-3.5e6, -0.5e6], [-4e6, 0.5e6], [-4.5e6, -0.5e6]]]
} }
}, { }, {
'type': 'Feature', 'type': 'Feature',
@@ -117,11 +117,11 @@ var geojsonObject = {
'type': 'MultiPolygon', 'type': 'MultiPolygon',
'coordinates': [ 'coordinates': [
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]], [-3e6, 6e6], [-5e6, 6e6]]],
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6], [[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-3e6, 6e6]]], [0, 6e6], [-3e6, 6e6]]],
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]] [3e6, 6e6], [1e6, 6e6]]]
] ]
} }
}, { }, {

View File

@@ -54,28 +54,28 @@ var geojsonObject = {
'geometry': { 'geometry': {
'type': 'Polygon', 'type': 'Polygon',
'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6], 'coordinates': [[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
[-3e6, 6e6], [-5e6, 6e6]]] [-3e6, 6e6], [-5e6, 6e6]]]
} }
}, { }, {
'type': 'Feature', 'type': 'Feature',
'geometry': { 'geometry': {
'type': 'Polygon', 'type': 'Polygon',
'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6], 'coordinates': [[[-2e6, 6e6], [-2e6, 8e6], [0, 8e6],
[0, 6e6], [-2e6, 6e6]]] [0, 6e6], [-2e6, 6e6]]]
} }
}, { }, {
'type': 'Feature', 'type': 'Feature',
'geometry': { 'geometry': {
'type': 'Polygon', 'type': 'Polygon',
'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6], 'coordinates': [[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
[3e6, 6e6], [1e6, 6e6]]] [3e6, 6e6], [1e6, 6e6]]]
} }
}, { }, {
'type': 'Feature', 'type': 'Feature',
'geometry': { 'geometry': {
'type': 'Polygon', 'type': 'Polygon',
'coordinates': [[[-2e6, -1e6], [-1e6, 1e6], 'coordinates': [[[-2e6, -1e6], [-1e6, 1e6],
[0, -1e6], [-2e6, -1e6]]] [0, -1e6], [-2e6, -1e6]]]
} }
}] }]
}; };

View File

@@ -162,13 +162,13 @@ function plot(resolution, counts, threshold) {
var value = counts.min + (index * counts.delta); var value = counts.min + (index * counts.delta);
return 'bar' + (value >= threshold ? ' selected' : ''); return 'bar' + (value >= threshold ? ' selected' : '');
}) })
.attr('width', barWidth - 2); .attr('width', barWidth - 2);
bar.transition().attr('transform', function(value, index) { bar.transition().attr('transform', function(value, index) {
return 'translate(' + (index * barWidth) + ', ' + return 'translate(' + (index * barWidth) + ', ' +
(plotHeight - yScale(value)) + ')'; (plotHeight - yScale(value)) + ')';
}) })
.attr('height', yScale); .attr('height', yScale);
bar.on('mousemove', function(count, index) { bar.on('mousemove', function(count, index) {
var threshold = counts.min + (index * counts.delta); var threshold = counts.min + (index * counts.delta);

View File

@@ -47,8 +47,8 @@ var featureRequest = new ol.format.WFS().writeGetFeature({
featureTypes: ['water_areas'], featureTypes: ['water_areas'],
outputFormat: 'application/json', outputFormat: 'application/json',
filter: ol.format.filter.and( filter: ol.format.filter.and(
ol.format.filter.like('name', 'Mississippi*'), ol.format.filter.like('name', 'Mississippi*'),
ol.format.filter.equalTo('waterway', 'riverbank') ol.format.filter.equalTo('waterway', 'riverbank')
) )
}); });

View File

@@ -28,8 +28,8 @@ var map = new ol.Map({
tileSize: tileSize, tileSize: tileSize,
tileUrlFunction: function(tileCoord) { tileUrlFunction: function(tileCoord) {
return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString()) return urlTemplate.replace('{z}', (tileCoord[0] - 1).toString())
.replace('{x}', tileCoord[1].toString()) .replace('{x}', tileCoord[1].toString())
.replace('{y}', (-tileCoord[2] - 1).toString()); .replace('{y}', (-tileCoord[2] - 1).toString());
}, },
wrapX: true wrapX: true
}) })

View File

@@ -9,20 +9,20 @@ goog.require('ol.math');
*/ */
ol.CenterConstraint.createExtent = function(extent) { ol.CenterConstraint.createExtent = function(extent) {
return ( return (
/** /**
* @param {ol.Coordinate|undefined} center Center. * @param {ol.Coordinate|undefined} center Center.
* @return {ol.Coordinate|undefined} Center. * @return {ol.Coordinate|undefined} Center.
*/ */
function(center) { function(center) {
if (center) { if (center) {
return [ return [
ol.math.clamp(center[0], extent[0], extent[2]), ol.math.clamp(center[0], extent[0], extent[2]),
ol.math.clamp(center[1], extent[1], extent[3]) ol.math.clamp(center[1], extent[1], extent[3])
]; ];
} else { } else {
return undefined; return undefined;
} }
}); });
}; };

View File

@@ -72,56 +72,56 @@ ol.color.fromNamed = function(color) {
* @return {ol.Color} Color. * @return {ol.Color} Color.
*/ */
ol.color.fromString = ( ol.color.fromString = (
function() { function() {
// We maintain a small cache of parsed strings. To provide cheap LRU-like // We maintain a small cache of parsed strings. To provide cheap LRU-like
// semantics, whenever the cache grows too large we simply delete an // semantics, whenever the cache grows too large we simply delete an
// arbitrary 25% of the entries. // arbitrary 25% of the entries.
/** /**
* @const * @const
* @type {number} * @type {number}
*/ */
var MAX_CACHE_SIZE = 1024; var MAX_CACHE_SIZE = 1024;
/** /**
* @type {Object.<string, ol.Color>} * @type {Object.<string, ol.Color>}
*/ */
var cache = {}; var cache = {};
/** /**
* @type {number} * @type {number}
*/ */
var cacheSize = 0; var cacheSize = 0;
return ( return (
/** /**
* @param {string} s String. * @param {string} s String.
* @return {ol.Color} Color. * @return {ol.Color} Color.
*/ */
function(s) { function(s) {
var color; var color;
if (cache.hasOwnProperty(s)) { if (cache.hasOwnProperty(s)) {
color = cache[s]; color = cache[s];
} else { } else {
if (cacheSize >= MAX_CACHE_SIZE) { if (cacheSize >= MAX_CACHE_SIZE) {
var i = 0; var i = 0;
var key; var key;
for (key in cache) { for (key in cache) {
if ((i++ & 3) === 0) { if ((i++ & 3) === 0) {
delete cache[key]; delete cache[key];
--cacheSize; --cacheSize;
}
}
} }
color = ol.color.fromStringInternal_(s);
cache[s] = color;
++cacheSize;
} }
return color; }
}); color = ol.color.fromStringInternal_(s);
cache[s] = color;
++cacheSize;
}
return color;
});
})(); })();
/** /**

View File

@@ -23,7 +23,7 @@ ol.colorlike.asColorLike = function(color) {
*/ */
ol.colorlike.isColorLike = function(color) { ol.colorlike.isColorLike = function(color) {
return ( return (
typeof color === 'string' || typeof color === 'string' ||
color instanceof CanvasPattern || color instanceof CanvasPattern ||
color instanceof CanvasGradient color instanceof CanvasGradient
); );

View File

@@ -35,7 +35,7 @@ ol.control.defaults = function(opt_options) {
} }
var attributionControl = options.attribution !== undefined ? var attributionControl = options.attribution !== undefined ?
options.attribution : true; options.attribution : true;
if (attributionControl) { if (attributionControl) {
controls.push(new ol.control.Attribution(options.attributionOptions)); controls.push(new ol.control.Attribution(options.attributionOptions));
} }

View File

@@ -53,7 +53,7 @@ ol.control.Attribution = function(opt_options) {
* @type {boolean} * @type {boolean}
*/ */
this.collapsible_ = options.collapsible !== undefined ? this.collapsible_ = options.collapsible !== undefined ?
options.collapsible : true; options.collapsible : true;
if (!this.collapsible_) { if (!this.collapsible_) {
this.collapsed_ = false; this.collapsed_ = false;
@@ -91,7 +91,7 @@ ol.control.Attribution = function(opt_options) {
var activeLabel = (this.collapsible_ && !this.collapsed_) ? var activeLabel = (this.collapsible_ && !this.collapsed_) ?
this.collapseLabel_ : this.label_; this.collapseLabel_ : this.label_;
var button = document.createElement('button'); var button = document.createElement('button');
button.setAttribute('type', 'button'); button.setAttribute('type', 'button');
button.title = tipLabel; button.title = tipLabel;

View File

@@ -115,7 +115,7 @@ ol.control.Control.prototype.setMap = function(map) {
this.map_ = map; this.map_ = map;
if (this.map_) { if (this.map_) {
var target = this.target_ ? var target = this.target_ ?
this.target_ : map.getOverlayContainerStopEvent(); this.target_ : map.getOverlayContainerStopEvent();
target.appendChild(this.element); target.appendChild(this.element);
if (this.render !== ol.nullFunction) { if (this.render !== ol.nullFunction) {
this.listenerKeys.push(ol.events.listen(map, this.listenerKeys.push(ol.events.listen(map,

View File

@@ -34,7 +34,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {string} * @type {string}
*/ */
this.cssClassName_ = options.className !== undefined ? options.className : this.cssClassName_ = options.className !== undefined ? options.className :
'ol-full-screen'; 'ol-full-screen';
var label = options.label !== undefined ? options.label : '\u2922'; var label = options.label !== undefined ? options.label : '\u2922';
@@ -43,7 +43,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node} * @type {Node}
*/ */
this.labelNode_ = typeof label === 'string' ? this.labelNode_ = typeof label === 'string' ?
document.createTextNode(label) : label; document.createTextNode(label) : label;
var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7'; var labelActive = options.labelActive !== undefined ? options.labelActive : '\u00d7';
@@ -52,7 +52,7 @@ ol.control.FullScreen = function(opt_options) {
* @type {Node} * @type {Node}
*/ */
this.labelActiveNode_ = typeof labelActive === 'string' ? this.labelActiveNode_ = typeof labelActive === 'string' ?
document.createTextNode(labelActive) : labelActive; document.createTextNode(labelActive) : labelActive;
var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen'; var tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';
var button = document.createElement('button'); var button = document.createElement('button');

View File

@@ -31,7 +31,7 @@ ol.control.MousePosition = function(opt_options) {
element.className = options.className !== undefined ? options.className : 'ol-mouse-position'; element.className = options.className !== undefined ? options.className : 'ol-mouse-position';
var render = options.render ? var render = options.render ?
options.render : ol.control.MousePosition.render; options.render : ol.control.MousePosition.render;
ol.control.Control.call(this, { ol.control.Control.call(this, {
element: element, element: element,
@@ -122,7 +122,7 @@ ol.control.MousePosition.prototype.handleProjectionChanged_ = function() {
*/ */
ol.control.MousePosition.prototype.getCoordinateFormat = function() { ol.control.MousePosition.prototype.getCoordinateFormat = function() {
return /** @type {ol.CoordinateFormatType|undefined} */ ( return /** @type {ol.CoordinateFormatType|undefined} */ (
this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT)); this.get(ol.control.MousePosition.Property_.COORDINATE_FORMAT));
}; };
@@ -135,7 +135,7 @@ ol.control.MousePosition.prototype.getCoordinateFormat = function() {
*/ */
ol.control.MousePosition.prototype.getProjection = function() { ol.control.MousePosition.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.control.MousePosition.Property_.PROJECTION)); this.get(ol.control.MousePosition.Property_.PROJECTION));
}; };

View File

@@ -42,7 +42,7 @@ ol.control.OverviewMap = function(opt_options) {
* @type {boolean} * @type {boolean}
*/ */
this.collapsible_ = options.collapsible !== undefined ? this.collapsible_ = options.collapsible !== undefined ?
options.collapsible : true; options.collapsible : true;
if (!this.collapsible_) { if (!this.collapsible_) {
this.collapsed_ = false; this.collapsed_ = false;
@@ -80,7 +80,7 @@ ol.control.OverviewMap = function(opt_options) {
} }
var activeLabel = (this.collapsible_ && !this.collapsed_) ? var activeLabel = (this.collapsible_ && !this.collapsed_) ?
this.collapseLabel_ : this.label_; this.collapseLabel_ : this.label_;
var button = document.createElement('button'); var button = document.createElement('button');
button.setAttribute('type', 'button'); button.setAttribute('type', 'button');
button.title = tipLabel; button.title = tipLabel;

View File

@@ -112,7 +112,7 @@ ol.control.ScaleLine.LEADING_DIGITS = [1, 2, 5];
*/ */
ol.control.ScaleLine.prototype.getUnits = function() { ol.control.ScaleLine.prototype.getUnits = function() {
return /** @type {ol.control.ScaleLineUnits|undefined} */ ( return /** @type {ol.control.ScaleLineUnits|undefined} */ (
this.get(ol.control.ScaleLine.Property_.UNITS)); this.get(ol.control.ScaleLine.Property_.UNITS));
}; };

View File

@@ -31,16 +31,16 @@ ol.control.Zoom = function(opt_options) {
var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212'; var zoomOutLabel = options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\u2212';
var zoomInTipLabel = options.zoomInTipLabel !== undefined ? var zoomInTipLabel = options.zoomInTipLabel !== undefined ?
options.zoomInTipLabel : 'Zoom in'; options.zoomInTipLabel : 'Zoom in';
var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ? var zoomOutTipLabel = options.zoomOutTipLabel !== undefined ?
options.zoomOutTipLabel : 'Zoom out'; options.zoomOutTipLabel : 'Zoom out';
var inElement = document.createElement('button'); var inElement = document.createElement('button');
inElement.className = className + '-in'; inElement.className = className + '-in';
inElement.setAttribute('type', 'button'); inElement.setAttribute('type', 'button');
inElement.title = zoomInTipLabel; inElement.title = zoomInTipLabel;
inElement.appendChild( inElement.appendChild(
typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel typeof zoomInLabel === 'string' ? document.createTextNode(zoomInLabel) : zoomInLabel
); );
ol.events.listen(inElement, ol.events.EventType.CLICK, ol.events.listen(inElement, ol.events.EventType.CLICK,
@@ -51,7 +51,7 @@ ol.control.Zoom = function(opt_options) {
outElement.setAttribute('type', 'button'); outElement.setAttribute('type', 'button');
outElement.title = zoomOutTipLabel; outElement.title = zoomOutTipLabel;
outElement.appendChild( outElement.appendChild(
typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel typeof zoomOutLabel === 'string' ? document.createTextNode(zoomOutLabel) : zoomOutLabel
); );
ol.events.listen(outElement, ol.events.EventType.CLICK, ol.events.listen(outElement, ol.events.EventType.CLICK,

View File

@@ -27,16 +27,16 @@ ol.control.ZoomToExtent = function(opt_options) {
this.extent_ = options.extent ? options.extent : null; this.extent_ = options.extent ? options.extent : null;
var className = options.className !== undefined ? options.className : var className = options.className !== undefined ? options.className :
'ol-zoom-extent'; 'ol-zoom-extent';
var label = options.label !== undefined ? options.label : 'E'; var label = options.label !== undefined ? options.label : 'E';
var tipLabel = options.tipLabel !== undefined ? var tipLabel = options.tipLabel !== undefined ?
options.tipLabel : 'Fit to extent'; options.tipLabel : 'Fit to extent';
var button = document.createElement('button'); var button = document.createElement('button');
button.setAttribute('type', 'button'); button.setAttribute('type', 'button');
button.title = tipLabel; button.title = tipLabel;
button.appendChild( button.appendChild(
typeof label === 'string' ? document.createTextNode(label) : label typeof label === 'string' ? document.createTextNode(label) : label
); );
ol.events.listen(button, ol.events.EventType.CLICK, ol.events.listen(button, ol.events.EventType.CLICK,

View File

@@ -80,7 +80,7 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
var dx = x2 - x1; var dx = x2 - x1;
var dy = y2 - y1; var dy = y2 - y1;
var along = (dx === 0 && dy === 0) ? 0 : var along = (dx === 0 && dy === 0) ? 0 :
((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0); ((dx * (x0 - x1)) + (dy * (y0 - y1))) / ((dx * dx + dy * dy) || 0);
var x, y; var x, y;
if (along <= 0) { if (along <= 0) {
x = x1; x = x1;
@@ -121,13 +121,13 @@ ol.coordinate.closestOnSegment = function(coordinate, segment) {
*/ */
ol.coordinate.createStringXY = function(opt_fractionDigits) { ol.coordinate.createStringXY = function(opt_fractionDigits) {
return ( return (
/** /**
* @param {ol.Coordinate|undefined} coordinate Coordinate. * @param {ol.Coordinate|undefined} coordinate Coordinate.
* @return {string} String XY. * @return {string} String XY.
*/ */
function(coordinate) { function(coordinate) {
return ol.coordinate.toStringXY(coordinate, opt_fractionDigits); return ol.coordinate.toStringXY(coordinate, opt_fractionDigits);
}); });
}; };
@@ -195,8 +195,8 @@ ol.coordinate.degreesToStringHDMS = function(hemispheres, degrees, opt_fractionD
ol.coordinate.format = function(coordinate, template, opt_fractionDigits) { ol.coordinate.format = function(coordinate, template, opt_fractionDigits) {
if (coordinate) { if (coordinate) {
return template return template
.replace('{x}', coordinate[0].toFixed(opt_fractionDigits)) .replace('{x}', coordinate[0].toFixed(opt_fractionDigits))
.replace('{y}', coordinate[1].toFixed(opt_fractionDigits)); .replace('{y}', coordinate[1].toFixed(opt_fractionDigits));
} else { } else {
return ''; return '';
} }

View File

@@ -132,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
*/ */
ol.DeviceOrientation.prototype.getAlpha = function() { ol.DeviceOrientation.prototype.getAlpha = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.ALPHA)); this.get(ol.DeviceOrientation.Property_.ALPHA));
}; };
@@ -145,7 +145,7 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
*/ */
ol.DeviceOrientation.prototype.getBeta = function() { ol.DeviceOrientation.prototype.getBeta = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.BETA)); this.get(ol.DeviceOrientation.Property_.BETA));
}; };
@@ -158,7 +158,7 @@ ol.DeviceOrientation.prototype.getBeta = function() {
*/ */
ol.DeviceOrientation.prototype.getGamma = function() { ol.DeviceOrientation.prototype.getGamma = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.GAMMA)); this.get(ol.DeviceOrientation.Property_.GAMMA));
}; };
@@ -171,7 +171,7 @@ ol.DeviceOrientation.prototype.getGamma = function() {
*/ */
ol.DeviceOrientation.prototype.getHeading = function() { ol.DeviceOrientation.prototype.getHeading = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientation.Property_.HEADING)); this.get(ol.DeviceOrientation.Property_.HEADING));
}; };
@@ -183,7 +183,7 @@ ol.DeviceOrientation.prototype.getHeading = function() {
*/ */
ol.DeviceOrientation.prototype.getTracking = function() { ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (
this.get(ol.DeviceOrientation.Property_.TRACKING)); this.get(ol.DeviceOrientation.Property_.TRACKING));
}; };

View File

@@ -17,7 +17,7 @@ goog.require('ol.has');
ol.events.condition.altKeyOnly = function(mapBrowserEvent) { ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
return ( return (
originalEvent.altKey && originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) && !(originalEvent.metaKey || originalEvent.ctrlKey) &&
!originalEvent.shiftKey); !originalEvent.shiftKey);
}; };
@@ -34,7 +34,7 @@ ol.events.condition.altKeyOnly = function(mapBrowserEvent) {
ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) { ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
return ( return (
originalEvent.altKey && originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) && !(originalEvent.metaKey || originalEvent.ctrlKey) &&
originalEvent.shiftKey); originalEvent.shiftKey);
}; };
@@ -138,7 +138,7 @@ ol.events.condition.doubleClick = function(mapBrowserEvent) {
ol.events.condition.noModifierKeys = function(mapBrowserEvent) { ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
return ( return (
!originalEvent.altKey && !originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) && !(originalEvent.metaKey || originalEvent.ctrlKey) &&
!originalEvent.shiftKey); !originalEvent.shiftKey);
}; };
@@ -156,7 +156,7 @@ ol.events.condition.noModifierKeys = function(mapBrowserEvent) {
ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) { ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
return ( return (
!originalEvent.altKey && !originalEvent.altKey &&
(ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) && (ol.has.MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&
!originalEvent.shiftKey); !originalEvent.shiftKey);
}; };
@@ -173,7 +173,7 @@ ol.events.condition.platformModifierKeyOnly = function(mapBrowserEvent) {
ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) { ol.events.condition.shiftKeyOnly = function(mapBrowserEvent) {
var originalEvent = mapBrowserEvent.originalEvent; var originalEvent = mapBrowserEvent.originalEvent;
return ( return (
!originalEvent.altKey && !originalEvent.altKey &&
!(originalEvent.metaKey || originalEvent.ctrlKey) && !(originalEvent.metaKey || originalEvent.ctrlKey) &&
originalEvent.shiftKey); originalEvent.shiftKey);
}; };
@@ -191,7 +191,7 @@ ol.events.condition.targetNotEditable = function(mapBrowserEvent) {
var target = mapBrowserEvent.originalEvent.target; var target = mapBrowserEvent.originalEvent.target;
var tagName = target.tagName; var tagName = target.tagName;
return ( return (
tagName !== 'INPUT' && tagName !== 'INPUT' &&
tagName !== 'SELECT' && tagName !== 'SELECT' &&
tagName !== 'TEXTAREA'); tagName !== 'TEXTAREA');
}; };

View File

@@ -53,9 +53,9 @@ ol.events.Event.prototype.preventDefault =
* @override * @override
* @api * @api
*/ */
ol.events.Event.prototype.stopPropagation = function() { ol.events.Event.prototype.stopPropagation = function() {
this.propagationStopped = true; this.propagationStopped = true;
}; };
/** /**

View File

@@ -131,8 +131,8 @@ ol.events.EventTarget.prototype.getListeners = function(type) {
*/ */
ol.events.EventTarget.prototype.hasListener = function(opt_type) { ol.events.EventTarget.prototype.hasListener = function(opt_type) {
return opt_type ? return opt_type ?
opt_type in this.listeners_ : opt_type in this.listeners_ :
Object.keys(this.listeners_).length > 0; Object.keys(this.listeners_).length > 0;
}; };

View File

@@ -140,7 +140,7 @@ ol.Feature.prototype.clone = function() {
*/ */
ol.Feature.prototype.getGeometry = function() { ol.Feature.prototype.getGeometry = function() {
return /** @type {ol.geom.Geometry|undefined} */ ( return /** @type {ol.geom.Geometry|undefined} */ (
this.get(this.geometryName_)); this.get(this.geometryName_));
}; };
@@ -240,7 +240,7 @@ ol.Feature.prototype.setGeometry = function(geometry) {
ol.Feature.prototype.setStyle = function(style) { ol.Feature.prototype.setStyle = function(style) {
this.style_ = style; this.style_ = style;
this.styleFunction_ = !style ? this.styleFunction_ = !style ?
undefined : ol.Feature.createStyleFunction(style); undefined : ol.Feature.createStyleFunction(style);
this.changed(); this.changed();
}; };

View File

@@ -18,60 +18,60 @@ goog.require('ol.xml');
*/ */
ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) { ol.featureloader.loadFeaturesXhr = function(url, format, success, failure) {
return ( return (
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @param {ol.proj.Projection} projection Projection. * @param {ol.proj.Projection} projection Projection.
* @this {ol.source.Vector|ol.VectorTile} * @this {ol.source.Vector|ol.VectorTile}
*/ */
function(extent, resolution, projection) { function(extent, resolution, projection) {
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('GET', xhr.open('GET',
typeof url === 'function' ? url(extent, resolution, projection) : url, typeof url === 'function' ? url(extent, resolution, projection) : url,
true); true);
if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) { if (format.getType() == ol.format.FormatType.ARRAY_BUFFER) {
xhr.responseType = 'arraybuffer'; xhr.responseType = 'arraybuffer';
} }
/** /**
* @param {Event} event Event. * @param {Event} event Event.
* @private * @private
*/ */
xhr.onload = function(event) { xhr.onload = function(event) {
// status will be 0 for file:// urls // status will be 0 for file:// urls
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) { if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
var type = format.getType(); var type = format.getType();
/** @type {Document|Node|Object|string|undefined} */ /** @type {Document|Node|Object|string|undefined} */
var source; var source;
if (type == ol.format.FormatType.JSON || if (type == ol.format.FormatType.JSON ||
type == ol.format.FormatType.TEXT) { type == ol.format.FormatType.TEXT) {
source = xhr.responseText; source = xhr.responseText;
} else if (type == ol.format.FormatType.XML) { } else if (type == ol.format.FormatType.XML) {
source = xhr.responseXML; source = xhr.responseXML;
if (!source) { if (!source) {
source = ol.xml.parse(xhr.responseText); source = ol.xml.parse(xhr.responseText);
}
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
source = /** @type {ArrayBuffer} */ (xhr.response);
}
if (source) {
success.call(this, format.readFeatures(source,
{featureProjection: projection}),
format.readProjection(source));
} else {
failure.call(this);
} }
} else if (type == ol.format.FormatType.ARRAY_BUFFER) {
source = /** @type {ArrayBuffer} */ (xhr.response);
}
if (source) {
success.call(this, format.readFeatures(source,
{featureProjection: projection}),
format.readProjection(source));
} else { } else {
failure.call(this); failure.call(this);
} }
}.bind(this); } else {
/** failure.call(this);
}
}.bind(this);
/**
* @private * @private
*/ */
xhr.onerror = function() { xhr.onerror = function() {
failure.call(this); failure.call(this);
}.bind(this); }.bind(this);
xhr.send(); xhr.send();
}); });
}; };

View File

@@ -83,8 +83,8 @@ ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
} }
var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type]; var geometryReader = ol.format.EsriJSON.GEOMETRY_READERS_[type];
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions( ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options)); geometryReader(object), false, opt_options));
}; };
@@ -123,7 +123,7 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
var outerRing = outerRings[i][0]; var outerRing = outerRings[i][0];
if (ol.extent.containsExtent(new ol.geom.LinearRing( if (ol.extent.containsExtent(new ol.geom.LinearRing(
outerRing).getExtent(), outerRing).getExtent(),
new ol.geom.LinearRing(hole).getExtent())) { new ol.geom.LinearRing(hole).getExtent())) {
// the hole is contained push it into our polygon // the hole is contained push it into our polygon
outerRings[i].push(hole); outerRings[i].push(hole);
matched = true; matched = true;
@@ -468,7 +468,7 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
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);
@@ -559,8 +559,8 @@ ol.format.EsriJSON.prototype.readProjectionFromObject = function(object) {
ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) { ol.format.EsriJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()]; var geometryWriter = ol.format.EsriJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ ( return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)), ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options); opt_options);
}; };

View File

@@ -47,7 +47,7 @@ ol.format.Feature.prototype.getReadOptions = function(source, opt_options) {
if (opt_options) { if (opt_options) {
options = { options = {
dataProjection: opt_options.dataProjection ? dataProjection: opt_options.dataProjection ?
opt_options.dataProjection : this.readProjection(source), opt_options.dataProjection : this.readProjection(source),
featureProjection: opt_options.featureProjection featureProjection: opt_options.featureProjection
}; };
} }
@@ -166,9 +166,9 @@ ol.format.Feature.prototype.writeGeometry = function(geometry, opt_options) {};
ol.format.Feature.transformWithOptions = function( ol.format.Feature.transformWithOptions = function(
geometry, write, opt_options) { geometry, write, opt_options) {
var featureProjection = opt_options ? var featureProjection = opt_options ?
ol.proj.get(opt_options.featureProjection) : null; ol.proj.get(opt_options.featureProjection) : null;
var dataProjection = opt_options ? var dataProjection = opt_options ?
ol.proj.get(opt_options.dataProjection) : null; ol.proj.get(opt_options.dataProjection) : null;
/** /**
* @type {ol.geom.Geometry|ol.Extent} * @type {ol.geom.Geometry|ol.Extent}
*/ */

View File

@@ -229,7 +229,7 @@ ol.format.filter.between = function(propertyName, lowerBoundary, upperBoundary)
ol.format.filter.like = function(propertyName, pattern, ol.format.filter.like = function(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
return new ol.format.filter.IsLike(propertyName, pattern, return new ol.format.filter.IsLike(propertyName, pattern,
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase); opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
}; };

View File

@@ -39,7 +39,7 @@ ol.format.GeoJSON = function(opt_options) {
*/ */
this.defaultDataProjection = ol.proj.get( this.defaultDataProjection = ol.proj.get(
options.defaultDataProjection ? options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326'); options.defaultDataProjection : 'EPSG:4326');
if (options.featureProjection) { if (options.featureProjection) {
@@ -69,8 +69,8 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
} }
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type]; var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions( ol.format.Feature.transformWithOptions(
geometryReader(object), false, opt_options)); geometryReader(object), false, opt_options));
}; };
@@ -163,8 +163,8 @@ ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) { ol.format.GeoJSON.writeGeometry_ = function(geometry, opt_options) {
var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()]; var geometryWriter = ol.format.GeoJSON.GEOMETRY_WRITERS_[geometry.getType()];
return geometryWriter(/** @type {ol.geom.Geometry} */ ( return geometryWriter(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options)), ol.format.Feature.transformWithOptions(geometry, true, opt_options)),
opt_options); opt_options);
}; };

View File

@@ -35,7 +35,7 @@ ol.format.GML2 = function(opt_options) {
* @inheritDoc * @inheritDoc
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML2.schemaLocation_; options.schemaLocation : ol.format.GML2.schemaLocation_;
}; };
ol.inherits(ol.format.GML2, ol.format.GMLBase); ol.inherits(ol.format.GML2, ol.format.GMLBase);
@@ -469,8 +469,8 @@ ol.format.GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation(); axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
} }
var coords = ((axisOrientation.substr(0, 2) === 'en') ? var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ',' + point[1] : point[0] + ',' + point[1] :
point[1] + ',' + point[0]); point[1] + ',' + point[0]);
if (opt_hasZ) { if (opt_hasZ) {
// For newly created points, Z can be undefined. // For newly created points, Z can be undefined.
var z = point[2] || 0; var z = point[2] || 0;

View File

@@ -52,20 +52,20 @@ ol.format.GML3 = function(opt_options) {
* @type {boolean} * @type {boolean}
*/ */
this.multiCurve_ = options.multiCurve !== undefined ? this.multiCurve_ = options.multiCurve !== undefined ?
options.multiCurve : true; options.multiCurve : true;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.multiSurface_ = options.multiSurface !== undefined ? this.multiSurface_ = options.multiSurface !== undefined ?
options.multiSurface : true; options.multiSurface : true;
/** /**
* @inheritDoc * @inheritDoc
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : ol.format.GML3.schemaLocation_; options.schemaLocation : ol.format.GML3.schemaLocation_;
}; };
ol.inherits(ol.format.GML3, ol.format.GMLBase); ol.inherits(ol.format.GML3, ol.format.GMLBase);
@@ -601,8 +601,8 @@ ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation(); axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
} }
var coords = ((axisOrientation.substr(0, 2) === 'en') ? var coords = ((axisOrientation.substr(0, 2) === 'en') ?
point[0] + ' ' + point[1] : point[0] + ' ' + point[1] :
point[1] + ' ' + point[0]); point[1] + ' ' + point[0]);
if (opt_hasZ) { if (opt_hasZ) {
// For newly created points, Z can be undefined. // For newly created points, Z can be undefined.
var z = point[2] || 0; var z = point[2] || 0;

View File

@@ -167,12 +167,12 @@ ol.format.GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
var parsers = {}; var parsers = {};
for (i = 0, ii = featureTypes.length; i < ii; ++i) { for (i = 0, ii = featureTypes.length; i < ii; ++i) {
var featurePrefix = featureTypes[i].indexOf(':') === -1 ? var featurePrefix = featureTypes[i].indexOf(':') === -1 ?
defaultPrefix : featureTypes[i].split(':')[0]; defaultPrefix : featureTypes[i].split(':')[0];
if (featurePrefix === p) { if (featurePrefix === p) {
parsers[featureTypes[i].split(':').pop()] = parsers[featureTypes[i].split(':').pop()] =
(localName == 'featureMembers') ? (localName == 'featureMembers') ?
ol.xml.makeArrayPusher(this.readFeatureElement, this) : ol.xml.makeArrayPusher(this.readFeatureElement, this) :
ol.xml.makeReplacer(this.readFeatureElement, this); ol.xml.makeReplacer(this.readFeatureElement, this);
} }
} }
parsersNS[featureNS[p]] = parsers; parsersNS[featureNS[p]] = parsers;
@@ -203,7 +203,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
this.GEOMETRY_PARSERS_, node, objectStack, this); this.GEOMETRY_PARSERS_, node, objectStack, this);
if (geometry) { if (geometry) {
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context)); ol.format.Feature.transformWithOptions(geometry, false, context));
} else { } else {
return undefined; return undefined;
} }
@@ -590,5 +590,5 @@ ol.format.GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
*/ */
ol.format.GMLBase.prototype.readProjectionFromNode = function(node) { ol.format.GMLBase.prototype.readProjectionFromNode = function(node) {
return ol.proj.get(this.srsName ? this.srsName : return ol.proj.get(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName')); node.firstElementChild.getAttribute('srsName'));
}; };

View File

@@ -606,8 +606,8 @@ ol.format.GPX.writeWptType_ = function(node, coordinate, objectStack) {
// pass // pass
} }
var orderedKeys = (node.nodeName == 'rtept') ? var orderedKeys = (node.nodeName == 'rtept') ?
ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] : ol.format.GPX.RTEPT_TYPE_SEQUENCE_[namespaceURI] :
ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI]; ol.format.GPX.WPT_TYPE_SEQUENCE_[namespaceURI];
var values = ol.xml.makeSequence(properties, orderedKeys); var values = ol.xml.makeSequence(properties, orderedKeys);
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node, 'properties': properties}), ({node: node, 'properties': properties}),
@@ -629,7 +629,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.LineString} */ geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options)); (ol.format.Feature.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout(); context['geometryLayout'] = geometry.getLayout();
properties['rtept'] = geometry.getCoordinates(); properties['rtept'] = geometry.getCoordinates();
} }
@@ -656,7 +656,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.MultiLineString} */ geometry = /** @type {ol.geom.MultiLineString} */
(ol.format.Feature.transformWithOptions(geometry, true, options)); (ol.format.Feature.transformWithOptions(geometry, true, options));
properties['trkseg'] = geometry.getLineStrings(); properties['trkseg'] = geometry.getLineStrings();
} }
var parentNode = objectStack[objectStack.length - 1].node; var parentNode = objectStack[objectStack.length - 1].node;
@@ -697,7 +697,7 @@ ol.format.GPX.writeWpt_ = function(node, feature, objectStack) {
var geometry = feature.getGeometry(); var geometry = feature.getGeometry();
if (geometry) { if (geometry) {
geometry = /** @type {ol.geom.Point} */ geometry = /** @type {ol.geom.Point} */
(ol.format.Feature.transformWithOptions(geometry, true, options)); (ol.format.Feature.transformWithOptions(geometry, true, options));
context['geometryLayout'] = geometry.getLayout(); context['geometryLayout'] = geometry.getLayout();
ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack); ol.format.GPX.writeWptType_(node, geometry.getCoordinates(), objectStack);
} }

View File

@@ -35,7 +35,7 @@ ol.format.IGC = function(opt_options) {
* @type {ol.format.IGCZ} * @type {ol.format.IGCZ}
*/ */
this.altitudeMode_ = options.altitudeMode ? this.altitudeMode_ = options.altitudeMode ?
options.altitudeMode : ol.format.IGCZ.NONE; options.altitudeMode : ol.format.IGCZ.NONE;
}; };
ol.inherits(ol.format.IGC, ol.format.TextFeature); ol.inherits(ol.format.IGC, ol.format.TextFeature);
@@ -158,7 +158,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
} }
var lineString = new ol.geom.LineString(null); var lineString = new ol.geom.LineString(null);
var layout = altitudeMode == ol.format.IGCZ.NONE ? var layout = altitudeMode == ol.format.IGCZ.NONE ?
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM; ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
lineString.setFlatCoordinates(layout, flatCoordinates); lineString.setFlatCoordinates(layout, flatCoordinates);
var feature = new ol.Feature(ol.format.Feature.transformWithOptions( var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
lineString, false, opt_options)); lineString, false, opt_options));

View File

@@ -66,21 +66,21 @@ ol.format.KML = function(opt_options) {
* @type {Array.<ol.style.Style>} * @type {Array.<ol.style.Style>}
*/ */
this.defaultStyle_ = options.defaultStyle ? this.defaultStyle_ = options.defaultStyle ?
options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_; options.defaultStyle : ol.format.KML.DEFAULT_STYLE_ARRAY_;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.extractStyles_ = options.extractStyles !== undefined ? this.extractStyles_ = options.extractStyles !== undefined ?
options.extractStyles : true; options.extractStyles : true;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.writeStyles_ = options.writeStyles !== undefined ? this.writeStyles_ = options.writeStyles !== undefined ?
options.writeStyles : true; options.writeStyles : true;
/** /**
* @private * @private
@@ -93,7 +93,7 @@ ol.format.KML = function(opt_options) {
* @type {boolean} * @type {boolean}
*/ */
this.showPointNames_ = options.showPointNames !== undefined ? this.showPointNames_ = options.showPointNames !== undefined ?
options.showPointNames : true; options.showPointNames : true;
}; };
ol.inherits(ol.format.KML, ol.format.XMLFeature); ol.inherits(ol.format.KML, ol.format.XMLFeature);
@@ -353,53 +353,53 @@ ol.format.KML.createFeatureStyleFunction_ = function(style, styleUrl,
defaultStyle, sharedStyles, showPointNames) { defaultStyle, sharedStyles, showPointNames) {
return ( return (
/** /**
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @return {Array.<ol.style.Style>} Style. * @return {Array.<ol.style.Style>} Style.
* @this {ol.Feature} * @this {ol.Feature}
*/ */
function(resolution) { function(resolution) {
var drawName = showPointNames; var drawName = showPointNames;
/** @type {ol.style.Style|undefined} */ /** @type {ol.style.Style|undefined} */
var nameStyle; var nameStyle;
var name = ''; var name = '';
if (drawName) { if (drawName) {
if (this.getGeometry()) { if (this.getGeometry()) {
drawName = (this.getGeometry().getType() === drawName = (this.getGeometry().getType() ===
ol.geom.GeometryType.POINT); ol.geom.GeometryType.POINT);
}
} }
}
if (drawName) { if (drawName) {
name = /** @type {string} */ (this.get('name')); name = /** @type {string} */ (this.get('name'));
drawName = drawName && name; drawName = drawName && name;
} }
if (style) { if (style) {
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
name);
return style.concat(nameStyle);
}
return style;
}
if (styleUrl) {
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
sharedStyles);
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
name);
return foundStyle.concat(nameStyle);
}
return foundStyle;
}
if (drawName) { if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0], nameStyle = ol.format.KML.createNameStyleFunction_(style[0],
name); name);
return defaultStyle.concat(nameStyle); return style.concat(nameStyle);
} }
return defaultStyle; return style;
}); }
if (styleUrl) {
var foundStyle = ol.format.KML.findStyle_(styleUrl, defaultStyle,
sharedStyles);
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(foundStyle[0],
name);
return foundStyle.concat(nameStyle);
}
return foundStyle;
}
if (drawName) {
nameStyle = ol.format.KML.createNameStyleFunction_(defaultStyle[0],
name);
return defaultStyle.concat(nameStyle);
}
return defaultStyle;
});
}; };
@@ -549,7 +549,7 @@ ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
return ol.xml.pushParseAndPop(undefined, return ol.xml.pushParseAndPop(undefined,
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack); ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
}; };
/** /**
* @param {Node} node Node. * @param {Node} node Node.
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
@@ -807,7 +807,7 @@ ol.format.KML.readGxTrack_ = function(node, objectStack) {
var whens = gxTrackObject.whens; var whens = gxTrackObject.whens;
var i, ii; var i, ii;
for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii; for (i = 0, ii = Math.min(flatCoordinates.length, whens.length); i < ii;
++i) { ++i) {
flatCoordinates[4 * i + 3] = whens[i]; flatCoordinates[4 * i + 3] = whens[i];
} }
var lineString = new ol.geom.LineString(null); var lineString = new ol.geom.LineString(null);
@@ -1021,23 +1021,23 @@ ol.format.KML.readStyle_ = function(node, objectStack) {
} }
var fillStyle = /** @type {ol.style.Fill} */ var fillStyle = /** @type {ol.style.Fill} */
('fillStyle' in styleObject ? ('fillStyle' in styleObject ?
styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_); styleObject['fillStyle'] : ol.format.KML.DEFAULT_FILL_STYLE_);
var fill = /** @type {boolean|undefined} */ (styleObject['fill']); var fill = /** @type {boolean|undefined} */ (styleObject['fill']);
if (fill !== undefined && !fill) { if (fill !== undefined && !fill) {
fillStyle = null; fillStyle = null;
} }
var imageStyle = /** @type {ol.style.Image} */ var imageStyle = /** @type {ol.style.Image} */
('imageStyle' in styleObject ? ('imageStyle' in styleObject ?
styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_); styleObject['imageStyle'] : ol.format.KML.DEFAULT_IMAGE_STYLE_);
if (imageStyle == ol.format.KML.DEFAULT_NO_IMAGE_STYLE_) { if (imageStyle == ol.format.KML.DEFAULT_NO_IMAGE_STYLE_) {
imageStyle = undefined; imageStyle = undefined;
} }
var textStyle = /** @type {ol.style.Text} */ var textStyle = /** @type {ol.style.Text} */
('textStyle' in styleObject ? ('textStyle' in styleObject ?
styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_); styleObject['textStyle'] : ol.format.KML.DEFAULT_TEXT_STYLE_);
var strokeStyle = /** @type {ol.style.Stroke} */ var strokeStyle = /** @type {ol.style.Stroke} */
('strokeStyle' in styleObject ? ('strokeStyle' in styleObject ?
styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_); styleObject['strokeStyle'] : ol.format.KML.DEFAULT_STROKE_STYLE_);
var outline = /** @type {boolean|undefined} */ var outline = /** @type {boolean|undefined} */
(styleObject['outline']); (styleObject['outline']);
if (outline !== undefined && !outline) { if (outline !== undefined && !outline) {
@@ -1093,7 +1093,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
var name = node.getAttribute('name'); var name = node.getAttribute('name');
ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack); ol.xml.parseNode(ol.format.KML.DATA_PARSERS_, node, objectStack);
var featureObject = var featureObject =
/** @type {Object} */ (objectStack[objectStack.length - 1]); /** @type {Object} */ (objectStack[objectStack.length - 1]);
if (name !== null) { if (name !== null) {
featureObject[name] = featureObject.value; featureObject[name] = featureObject.value;
} else if (featureObject.displayName !== null) { } else if (featureObject.displayName !== null) {
@@ -2144,16 +2144,16 @@ ol.format.KML.writeDataNode_ = function(node, pair, objectStack) {
if (typeof value == 'object') { if (typeof value == 'object') {
if (value !== null && value.displayName) { if (value !== null && value.displayName) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_, ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']); ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.displayName], objectStack, ['displayName']);
} }
if (value !== null && value.value) { if (value !== null && value.value) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_, ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']); ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value.value], objectStack, ['value']);
} }
} else { } else {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_, ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']); ol.xml.OBJECT_PROPERTY_NODE_FACTORY, [value], objectStack, ['value']);
} }
}; };
@@ -2206,7 +2206,7 @@ ol.format.KML.writeExtendedData_ = function(node, namesAndValues, objectStack) {
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_, ol.xml.pushSerializeAndPop(context, ol.format.KML.EXTENDEDDATA_NODE_SERIALIZERS_,
ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack); ol.format.KML.DATA_NODE_FACTORY_, [{name: names[i], value: values[i]}], objectStack);
} }
}; };
@@ -2420,7 +2420,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
var sequence = ol.xml.makeSequence(properties, keys); var sequence = ol.xml.makeSequence(properties, keys);
var namesAndValues = {names: keys, values: sequence}; var namesAndValues = {names: keys, values: sequence};
ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_, ol.xml.pushSerializeAndPop(context, ol.format.KML.PLACEMARK_SERIALIZERS_,
ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack); ol.format.KML.EXTENDEDDATA_NODE_FACTORY_, [namesAndValues], objectStack);
} }
var styleFunction = feature.getStyleFunction(); var styleFunction = feature.getStyleFunction();

View File

@@ -49,7 +49,7 @@ ol.format.MVT = function(opt_options) {
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} * (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
*/ */
this.featureClass_ = options.featureClass ? this.featureClass_ = options.featureClass ?
options.featureClass : ol.render.Feature; options.featureClass : ol.render.Feature;
/** /**
* @private * @private
@@ -124,7 +124,7 @@ ol.format.MVT.prototype.readRenderFeature_ = function(rawFeature, layer) {
var geometryType; var geometryType;
if (type === 1) { if (type === 1) {
geometryType = coords.length === 1 ? geometryType = coords.length === 1 ?
ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT; ol.geom.GeometryType.POINT : ol.geom.GeometryType.MULTI_POINT;
} else if (type === 2) { } else if (type === 2) {
if (coords.length === 1) { if (coords.length === 1) {
geometryType = ol.geom.GeometryType.LINE_STRING; geometryType = ol.geom.GeometryType.LINE_STRING;
@@ -238,7 +238,7 @@ ol.format.MVT.readGeometry_ = function(rawFeature) {
var geom; var geom;
if (type === 1) { if (type === 1) {
geom = coords.length === 1 ? geom = coords.length === 1 ?
new ol.geom.Point(null) : new ol.geom.MultiPoint(null); new ol.geom.Point(null) : new ol.geom.MultiPoint(null);
} else if (type === 2) { } else if (type === 2) {
if (coords.length === 1) { if (coords.length === 1) {
geom = new ol.geom.LineString(null); geom = new ol.geom.LineString(null);

View File

@@ -386,13 +386,13 @@ ol.format.OWS.REQUEST_METHOD_PARSERS_ = ol.xml.makeStructureNS(
*/ */
ol.format.OWS.SERVICE_CONTACT_PARSERS_ = ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
ol.xml.makeStructureNS( ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, { ol.format.OWS.NAMESPACE_URIS_, {
'IndividualName': ol.xml.makeObjectPropertySetter( 'IndividualName': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString), ol.format.XSD.readString),
'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'PositionName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ContactInfo': ol.xml.makeObjectPropertySetter( 'ContactInfo': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readContactInfo_) ol.format.OWS.readContactInfo_)
}); });
/** /**
@@ -402,12 +402,12 @@ ol.format.OWS.SERVICE_CONTACT_PARSERS_ =
*/ */
ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ = ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
ol.xml.makeStructureNS( ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, { ol.format.OWS.NAMESPACE_URIS_, {
'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'Title': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ServiceTypeVersion': ol.xml.makeObjectPropertySetter( 'ServiceTypeVersion': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString), ol.format.XSD.readString),
'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString) 'ServiceType': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString)
}); });
/** /**
@@ -417,9 +417,9 @@ ol.format.OWS.SERVICE_IDENTIFICATION_PARSERS_ =
*/ */
ol.format.OWS.SERVICE_PROVIDER_PARSERS_ = ol.format.OWS.SERVICE_PROVIDER_PARSERS_ =
ol.xml.makeStructureNS( ol.xml.makeStructureNS(
ol.format.OWS.NAMESPACE_URIS_, { ol.format.OWS.NAMESPACE_URIS_, {
'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString), 'ProviderName': ol.xml.makeObjectPropertySetter(ol.format.XSD.readString),
'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref), 'ProviderSite': ol.xml.makeObjectPropertySetter(ol.format.XLink.readHref),
'ServiceContact': ol.xml.makeObjectPropertySetter( 'ServiceContact': ol.xml.makeObjectPropertySetter(
ol.format.OWS.readServiceContact_) ol.format.OWS.readServiceContact_)
}); });

View File

@@ -46,7 +46,7 @@ ol.format.Polyline = function(opt_options) {
* @type {ol.geom.GeometryLayout} * @type {ol.geom.GeometryLayout}
*/ */
this.geometryLayout_ = options.geometryLayout ? this.geometryLayout_ = options.geometryLayout ?
options.geometryLayout : ol.geom.GeometryLayout.XY; options.geometryLayout : ol.geom.GeometryLayout.XY;
}; };
ol.inherits(ol.format.Polyline, ol.format.TextFeature); ol.inherits(ol.format.Polyline, ol.format.TextFeature);
@@ -332,9 +332,9 @@ ol.format.Polyline.prototype.readGeometryFromText = function(text, opt_options)
flatCoordinates, 0, flatCoordinates.length, stride); flatCoordinates, 0, flatCoordinates.length, stride);
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions( ol.format.Feature.transformWithOptions(
new ol.geom.LineString(coordinates, this.geometryLayout_), false, new ol.geom.LineString(coordinates, this.geometryLayout_), false,
this.adaptOptions(opt_options))); this.adaptOptions(opt_options)));
}; };
@@ -388,8 +388,8 @@ ol.format.Polyline.prototype.writeGeometry;
*/ */
ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) { ol.format.Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
geometry = /** @type {ol.geom.LineString} */ geometry = /** @type {ol.geom.LineString} */
(ol.format.Feature.transformWithOptions( (ol.format.Feature.transformWithOptions(
geometry, true, this.adaptOptions(opt_options))); geometry, true, this.adaptOptions(opt_options)));
var flatCoordinates = geometry.getFlatCoordinates(); var flatCoordinates = geometry.getFlatCoordinates();
var stride = geometry.getStride(); var stride = geometry.getStride();
ol.geom.flat.flip.flipXY( ol.geom.flat.flip.flipXY(

View File

@@ -45,7 +45,7 @@ ol.format.TopoJSON = function(opt_options) {
*/ */
this.defaultDataProjection = ol.proj.get( this.defaultDataProjection = ol.proj.get(
options.defaultDataProjection ? options.defaultDataProjection ?
options.defaultDataProjection : 'EPSG:4326'); options.defaultDataProjection : 'EPSG:4326');
}; };
ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature); ol.inherits(ol.format.TopoJSON, ol.format.JSONFeature);
@@ -259,7 +259,7 @@ ol.format.TopoJSON.readFeatureFromGeometry_ = function(object, arcs,
} }
var feature = new ol.Feature(); var feature = new ol.Feature();
feature.setGeometry(/** @type {ol.geom.Geometry} */ ( feature.setGeometry(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options))); ol.format.Feature.transformWithOptions(geometry, false, opt_options)));
if (object.id !== undefined) { if (object.id !== undefined) {
feature.setId(object.id); feature.setId(object.id);
} }
@@ -316,13 +316,13 @@ ol.format.TopoJSON.prototype.readFeaturesFromObject = function(
} }
if (topoJSONFeatures[objectName].type === 'GeometryCollection') { if (topoJSONFeatures[objectName].type === 'GeometryCollection') {
feature = /** @type {TopoJSONGeometryCollection} */ feature = /** @type {TopoJSONGeometryCollection} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[objectName]);
features.push.apply(features, features.push.apply(features,
ol.format.TopoJSON.readFeaturesFromGeometryCollection_( ol.format.TopoJSON.readFeaturesFromGeometryCollection_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, property, objectName, opt_options));
} else { } else {
feature = /** @type {TopoJSONGeometry} */ feature = /** @type {TopoJSONGeometry} */
(topoJSONFeatures[objectName]); (topoJSONFeatures[objectName]);
features.push(ol.format.TopoJSON.readFeatureFromGeometry_( features.push(ol.format.TopoJSON.readFeatureFromGeometry_(
feature, arcs, scale, translate, property, objectName, opt_options)); feature, arcs, scale, translate, property, objectName, opt_options));
} }

View File

@@ -47,15 +47,15 @@ ol.format.WFS = function(opt_options) {
* @type {ol.format.GMLBase} * @type {ol.format.GMLBase}
*/ */
this.gmlFormat_ = options.gmlFormat ? this.gmlFormat_ = options.gmlFormat ?
options.gmlFormat : new ol.format.GML3(); options.gmlFormat : new ol.format.GML3();
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.schemaLocation_ = options.schemaLocation ? this.schemaLocation_ = options.schemaLocation ?
options.schemaLocation : options.schemaLocation :
ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION]; ol.format.WFS.SCHEMA_LOCATIONS[ol.format.WFS.DEFAULT_VERSION];
ol.format.XMLFeature.call(this); ol.format.XMLFeature.call(this);
}; };
@@ -414,7 +414,7 @@ ol.format.WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
*/ */
ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) { ol.format.WFS.getTypeName_ = function(featurePrefix, featureType) {
featurePrefix = featurePrefix ? featurePrefix : featurePrefix = featurePrefix ? featurePrefix :
ol.format.WFS.FEATURE_PREFIX; ol.format.WFS.FEATURE_PREFIX;
var prefix = featurePrefix + ':'; var prefix = featurePrefix + ':';
// The featureType already contains the prefix. // The featureType already contains the prefix.
if (featureType.indexOf(prefix) === 0) { if (featureType.indexOf(prefix) === 0) {
@@ -477,9 +477,9 @@ ol.format.WFS.writeUpdate_ = function(node, feature, objectStack) {
ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ( ol.xml.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
{'gmlVersion': context['gmlVersion'], node: node, {'gmlVersion': context['gmlVersion'], node: node,
'hasZ': context['hasZ'], 'srsName': context['srsName']}), 'hasZ': context['hasZ'], 'srsName': context['srsName']}),
ol.format.WFS.TRANSACTION_SERIALIZERS_, ol.format.WFS.TRANSACTION_SERIALIZERS_,
ol.xml.makeSimpleNodeFactory('Property'), values, ol.xml.makeSimpleNodeFactory('Property'), values,
objectStack); objectStack);
ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack); ol.format.WFS.writeOgcFidFilter_(node, fid, objectStack);
} }
}; };
@@ -964,7 +964,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
var objectStack = []; var objectStack = [];
var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction'); var node = ol.xml.createElementNS(ol.format.WFS.WFSNS, 'Transaction');
var version = options.version ? var version = options.version ?
options.version : ol.format.WFS.DEFAULT_VERSION; options.version : ol.format.WFS.DEFAULT_VERSION;
var gmlVersion = version === '1.0.0' ? 2 : 3; var gmlVersion = version === '1.0.0' ? 2 : 3;
node.setAttribute('service', 'WFS'); node.setAttribute('service', 'WFS');
node.setAttribute('version', version); node.setAttribute('version', version);

View File

@@ -38,7 +38,7 @@ ol.format.WKT = function(opt_options) {
* @private * @private
*/ */
this.splitCollection_ = options.splitCollection !== undefined ? this.splitCollection_ = options.splitCollection !== undefined ?
options.splitCollection : false; options.splitCollection : false;
}; };
ol.inherits(ol.format.WKT, ol.format.TextFeature); ol.inherits(ol.format.WKT, ol.format.TextFeature);
@@ -330,7 +330,7 @@ ol.format.WKT.prototype.readGeometryFromText = function(text, opt_options) {
var geometry = this.parse_(text); var geometry = this.parse_(text);
if (geometry) { if (geometry) {
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, opt_options)); ol.format.Feature.transformWithOptions(geometry, false, opt_options));
} else { } else {
return null; return null;
} }
@@ -405,7 +405,7 @@ ol.format.WKT.prototype.writeGeometry;
*/ */
ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) { ol.format.WKT.prototype.writeGeometryText = function(geometry, opt_options) {
return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ ( return ol.format.WKT.encode_(/** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, true, opt_options))); ol.format.Feature.transformWithOptions(geometry, true, opt_options)));
}; };
@@ -535,7 +535,7 @@ ol.format.WKT.Lexer.prototype.readNumber_ = function() {
} }
c = this.nextChar_(); c = this.nextChar_();
} while ( } while (
this.isNumeric_(c, decimal) || this.isNumeric_(c, decimal) ||
// if we haven't detected a scientific number before, 'e' or 'E' // if we haven't detected a scientific number before, 'e' or 'E'
// hint that we should continue to read // hint that we should continue to read
!scientificNotation && (c == 'e' || c == 'E') || !scientificNotation && (c == 'e' || c == 'E') ||

View File

@@ -71,7 +71,7 @@ ol.format.WMSCapabilities.prototype.readFromNode = function(node) {
*/ */
ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) { ol.format.WMSCapabilities.readAttribution_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
}; };
@@ -110,9 +110,9 @@ ol.format.WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) { ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
var geographicBoundingBox = ol.xml.pushParseAndPop( var geographicBoundingBox = ol.xml.pushParseAndPop(
{}, {},
ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_, ol.format.WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
node, objectStack); node, objectStack);
if (!geographicBoundingBox) { if (!geographicBoundingBox) {
return undefined; return undefined;
} }
@@ -143,7 +143,7 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
*/ */
ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) { ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
}; };
@@ -155,7 +155,7 @@ ol.format.WMSCapabilities.readCapability_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readService_ = function(node, objectStack) { ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
}; };
@@ -167,8 +167,8 @@ ol.format.WMSCapabilities.readService_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) { ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_, {}, ol.format.WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -180,8 +180,8 @@ ol.format.WMSCapabilities.readContactInformation_ = function(node, objectStack)
*/ */
ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) { ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_, {}, ol.format.WMSCapabilities.CONTACT_PERSON_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -193,8 +193,8 @@ ol.format.WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack
*/ */
ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) { ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_, {}, ol.format.WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -206,7 +206,7 @@ ol.format.WMSCapabilities.readContactAddress_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readException_ = function(node, objectStack) { ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack); [], ol.format.WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
}; };
@@ -218,7 +218,7 @@ ol.format.WMSCapabilities.readException_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) { ol.format.WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
}; };
@@ -233,7 +233,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
var layerObject = ol.xml.pushParseAndPop( var layerObject = ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
if (!layerObject) { if (!layerObject) {
return undefined; return undefined;
@@ -246,7 +246,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
layerObject['queryable'] = queryable !== undefined ? queryable : false; layerObject['queryable'] = queryable !== undefined ? queryable : false;
var cascaded = ol.format.XSD.readNonNegativeIntegerString( var cascaded = ol.format.XSD.readNonNegativeIntegerString(
node.getAttribute('cascaded')); node.getAttribute('cascaded'));
if (cascaded === undefined) { if (cascaded === undefined) {
cascaded = parentLayerObject['cascaded']; cascaded = parentLayerObject['cascaded'];
} }
@@ -279,7 +279,7 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
} }
layerObject['fixedHeight'] = fixedHeight; layerObject['fixedHeight'] = fixedHeight;
// See 7.2.4.8 // See 7.2.4.8
var addKeys = ['Style', 'CRS', 'AuthorityURL']; var addKeys = ['Style', 'CRS', 'AuthorityURL'];
addKeys.forEach(function(key) { addKeys.forEach(function(key) {
if (key in parentLayerObject) { if (key in parentLayerObject) {
@@ -314,9 +314,9 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
'unitSymbol': node.getAttribute('unitSymbol'), 'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'), 'default': node.getAttribute('default'),
'multipleValues': ol.format.XSD.readBooleanString( 'multipleValues': ol.format.XSD.readBooleanString(
node.getAttribute('multipleValues')), node.getAttribute('multipleValues')),
'nearestValue': ol.format.XSD.readBooleanString( 'nearestValue': ol.format.XSD.readBooleanString(
node.getAttribute('nearestValue')), node.getAttribute('nearestValue')),
'current': ol.format.XSD.readBooleanString(node.getAttribute('current')), 'current': ol.format.XSD.readBooleanString(node.getAttribute('current')),
'values': ol.format.XSD.readString(node) 'values': ol.format.XSD.readString(node)
}; };
@@ -332,8 +332,8 @@ ol.format.WMSCapabilities.readDimension_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) { ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_, {}, ol.format.WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
node, objectStack); node, objectStack);
}; };
@@ -345,7 +345,7 @@ ol.format.WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack
*/ */
ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) { ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
}; };
@@ -357,7 +357,7 @@ ol.format.WMSCapabilities.readRequest_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) { ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
}; };
@@ -369,7 +369,7 @@ ol.format.WMSCapabilities.readDCPType_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) { ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.HTTP_PARSERS_, node, objectStack);
}; };
@@ -381,7 +381,7 @@ ol.format.WMSCapabilities.readHTTP_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) { ol.format.WMSCapabilities.readOperationType_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
}; };
@@ -448,7 +448,7 @@ ol.format.WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) { ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
{}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack); {}, ol.format.WMSCapabilities.STYLE_PARSERS_, node, objectStack);
}; };
@@ -460,7 +460,7 @@ ol.format.WMSCapabilities.readStyle_ = function(node, objectStack) {
*/ */
ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) { ol.format.WMSCapabilities.readKeywordList_ = function(node, objectStack) {
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
[], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack); [], ol.format.WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
}; };

View File

@@ -64,7 +64,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
} }
WMTSCapabilityObject['version'] = version; WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject, WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,
ol.format.WMTSCapabilities.PARSERS_, node, []); ol.format.WMTSCapabilities.PARSERS_, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null; return WMTSCapabilityObject ? WMTSCapabilityObject : null;
}; };
@@ -77,7 +77,7 @@ ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {
*/ */
ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) { ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({}, return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack); ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
}; };
@@ -89,7 +89,7 @@ ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {
*/ */
ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) { ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {
return ol.xml.pushParseAndPop({}, return ol.xml.pushParseAndPop({},
ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack); ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
}; };

View File

@@ -140,9 +140,9 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
coords.altitude === null ? undefined : coords.altitude); coords.altitude === null ? undefined : coords.altitude);
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY, this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
coords.altitudeAccuracy === null ? coords.altitudeAccuracy === null ?
undefined : coords.altitudeAccuracy); undefined : coords.altitudeAccuracy);
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ? this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
undefined : ol.math.toRadians(coords.heading)); undefined : ol.math.toRadians(coords.heading));
if (!this.position_) { if (!this.position_) {
this.position_ = [coords.longitude, coords.latitude]; this.position_ = [coords.longitude, coords.latitude];
} else { } else {
@@ -186,7 +186,7 @@ ol.Geolocation.prototype.positionError_ = function(error) {
*/ */
ol.Geolocation.prototype.getAccuracy = function() { ol.Geolocation.prototype.getAccuracy = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ACCURACY)); this.get(ol.GeolocationProperty.ACCURACY));
}; };
@@ -198,7 +198,7 @@ ol.Geolocation.prototype.getAccuracy = function() {
*/ */
ol.Geolocation.prototype.getAccuracyGeometry = function() { ol.Geolocation.prototype.getAccuracyGeometry = function() {
return /** @type {?ol.geom.Polygon} */ ( return /** @type {?ol.geom.Polygon} */ (
this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null); this.get(ol.GeolocationProperty.ACCURACY_GEOMETRY) || null);
}; };
@@ -211,7 +211,7 @@ ol.Geolocation.prototype.getAccuracyGeometry = function() {
*/ */
ol.Geolocation.prototype.getAltitude = function() { ol.Geolocation.prototype.getAltitude = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE)); this.get(ol.GeolocationProperty.ALTITUDE));
}; };
@@ -224,7 +224,7 @@ ol.Geolocation.prototype.getAltitude = function() {
*/ */
ol.Geolocation.prototype.getAltitudeAccuracy = function() { ol.Geolocation.prototype.getAltitudeAccuracy = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY)); this.get(ol.GeolocationProperty.ALTITUDE_ACCURACY));
}; };
@@ -236,7 +236,7 @@ ol.Geolocation.prototype.getAltitudeAccuracy = function() {
*/ */
ol.Geolocation.prototype.getHeading = function() { ol.Geolocation.prototype.getHeading = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.HEADING)); this.get(ol.GeolocationProperty.HEADING));
}; };
@@ -249,7 +249,7 @@ ol.Geolocation.prototype.getHeading = function() {
*/ */
ol.Geolocation.prototype.getPosition = function() { ol.Geolocation.prototype.getPosition = function() {
return /** @type {ol.Coordinate|undefined} */ ( return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.GeolocationProperty.POSITION)); this.get(ol.GeolocationProperty.POSITION));
}; };
@@ -262,7 +262,7 @@ ol.Geolocation.prototype.getPosition = function() {
*/ */
ol.Geolocation.prototype.getProjection = function() { ol.Geolocation.prototype.getProjection = function() {
return /** @type {ol.proj.Projection|undefined} */ ( return /** @type {ol.proj.Projection|undefined} */ (
this.get(ol.GeolocationProperty.PROJECTION)); this.get(ol.GeolocationProperty.PROJECTION));
}; };
@@ -275,7 +275,7 @@ ol.Geolocation.prototype.getProjection = function() {
*/ */
ol.Geolocation.prototype.getSpeed = function() { ol.Geolocation.prototype.getSpeed = function() {
return /** @type {number|undefined} */ ( return /** @type {number|undefined} */ (
this.get(ol.GeolocationProperty.SPEED)); this.get(ol.GeolocationProperty.SPEED));
}; };
@@ -287,7 +287,7 @@ ol.Geolocation.prototype.getSpeed = function() {
*/ */
ol.Geolocation.prototype.getTracking = function() { ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (
this.get(ol.GeolocationProperty.TRACKING)); this.get(ol.GeolocationProperty.TRACKING));
}; };
@@ -302,7 +302,7 @@ ol.Geolocation.prototype.getTracking = function() {
*/ */
ol.Geolocation.prototype.getTrackingOptions = function() { ol.Geolocation.prototype.getTrackingOptions = function() {
return /** @type {GeolocationPositionOptions|undefined} */ ( return /** @type {GeolocationPositionOptions|undefined} */ (
this.get(ol.GeolocationProperty.TRACKING_OPTIONS)); this.get(ol.GeolocationProperty.TRACKING_OPTIONS));
}; };

View File

@@ -119,7 +119,7 @@ ol.geom.flat.geodesic.greatCircleArc = function(
var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta)); var lat = Math.asin(sinLat1 * cosD + cosLat1 * sinD * Math.cos(theta));
var lon = ol.math.toRadians(lon1) + var lon = ol.math.toRadians(lon1) +
Math.atan2(Math.sin(theta) * sinD * cosLat1, Math.atan2(Math.sin(theta) * sinD * cosLat1,
cosD - sinLat1 * Math.sin(lat)); cosD - sinLat1 * Math.sin(lat));
return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)]; return [ol.math.toDegrees(lon), ol.math.toDegrees(lat)];
}, ol.proj.getTransform(geoProjection, projection), squaredTolerance); }, ol.proj.getTransform(geoProjection, projection), squaredTolerance);
}; };

View File

@@ -108,8 +108,8 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise( var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
flatCoordinates, offset, end, stride); flatCoordinates, offset, end, stride);
var reverse = i === 0 ? var reverse = i === 0 ?
(right && isClockwise) || (!right && !isClockwise) : (right && isClockwise) || (!right && !isClockwise) :
(right && !isClockwise) || (!right && isClockwise); (right && !isClockwise) || (!right && isClockwise);
if (reverse) { if (reverse) {
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride); ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
} }

View File

@@ -43,7 +43,7 @@ goog.require('ol.math');
ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end, ol.geom.flat.simplify.lineString = function(flatCoordinates, offset, end,
stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) { stride, squaredTolerance, highQuality, opt_simplifiedFlatCoordinates) {
var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ? var simplifiedFlatCoordinates = opt_simplifiedFlatCoordinates !== undefined ?
opt_simplifiedFlatCoordinates : []; opt_simplifiedFlatCoordinates : [];
if (!highQuality) { if (!highQuality) {
end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end, end = ol.geom.flat.simplify.radialDistance(flatCoordinates, offset, end,
stride, squaredTolerance, stride, squaredTolerance,

View File

@@ -103,7 +103,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
*/ */
ol.geom.MultiPoint.prototype.getPoint = function(index) { ol.geom.MultiPoint.prototype.getPoint = function(index) {
var n = !this.flatCoordinates ? var n = !this.flatCoordinates ?
0 : this.flatCoordinates.length / this.stride; 0 : this.flatCoordinates.length / this.stride;
if (index < 0 || n <= index) { if (index < 0 || n <= index) {
return null; return null;
} }

View File

@@ -375,7 +375,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates = function(coordinates, opt_layout
} else { } else {
var lastEnds = endss[endss.length - 1]; var lastEnds = endss[endss.length - 1];
this.flatCoordinates.length = lastEnds.length === 0 ? this.flatCoordinates.length = lastEnds.length === 0 ?
0 : lastEnds[lastEnds.length - 1]; 0 : lastEnds[lastEnds.length - 1];
} }
this.changed(); this.changed();
} }

View File

@@ -23,86 +23,86 @@ goog.require('ol.style.Text');
ol.Graticule = function(opt_options) { ol.Graticule = function(opt_options) {
var options = opt_options || {}; var options = opt_options || {};
/** /**
* @type {ol.Map} * @type {ol.Map}
* @private * @private
*/ */
this.map_ = null; this.map_ = null;
/** /**
* @type {ol.proj.Projection} * @type {ol.proj.Projection}
* @private * @private
*/ */
this.projection_ = null; this.projection_ = null;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.maxLat_ = Infinity; this.maxLat_ = Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.maxLon_ = Infinity; this.maxLon_ = Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.minLat_ = -Infinity; this.minLat_ = -Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.minLon_ = -Infinity; this.minLon_ = -Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.maxLatP_ = Infinity; this.maxLatP_ = Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.maxLonP_ = Infinity; this.maxLonP_ = Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.minLatP_ = -Infinity; this.minLatP_ = -Infinity;
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.minLonP_ = -Infinity; this.minLonP_ = -Infinity;
/** /**
* @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}
* @private * @private
*/ */
this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100; this.maxLines_ = options.maxLines !== undefined ? options.maxLines : 100;
/** /**
* @type {Array.<ol.geom.LineString>} * @type {Array.<ol.geom.LineString>}
* @private * @private
*/ */
this.meridians_ = []; this.meridians_ = [];
/** /**
* @type {Array.<ol.geom.LineString>} * @type {Array.<ol.geom.LineString>}
* @private * @private
*/ */
@@ -113,7 +113,7 @@ ol.Graticule = function(opt_options) {
* @private * @private
*/ */
this.strokeStyle_ = options.strokeStyle !== undefined ? this.strokeStyle_ = options.strokeStyle !== undefined ?
options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_; options.strokeStyle : ol.Graticule.DEFAULT_STROKE_STYLE_;
/** /**
* @type {ol.TransformFunction|undefined} * @type {ol.TransformFunction|undefined}
@@ -153,14 +153,14 @@ ol.Graticule = function(opt_options) {
* @private * @private
*/ */
this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ? this.lonLabelFormatter_ = options.lonLabelFormatter == undefined ?
degreesToString.bind(this, 'EW') : options.lonLabelFormatter; degreesToString.bind(this, 'EW') : options.lonLabelFormatter;
/** /**
* @type {function(number):string} * @type {function(number):string}
* @private * @private
*/ */
this.latLabelFormatter_ = options.latLabelFormatter == undefined ? this.latLabelFormatter_ = options.latLabelFormatter == undefined ?
degreesToString.bind(this, 'NS') : options.latLabelFormatter; degreesToString.bind(this, 'NS') : options.latLabelFormatter;
/** /**
* Longitude label position in fractions (0..1) of view extent. 0 means * Longitude label position in fractions (0..1) of view extent. 0 means
@@ -169,7 +169,7 @@ ol.Graticule = function(opt_options) {
* @private * @private
*/ */
this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 : this.lonLabelPosition_ = options.lonLabelPosition == undefined ? 0 :
options.lonLabelPosition; options.lonLabelPosition;
/** /**
* Latitude Label position in fractions (0..1) of view extent. 0 means left, 1 * Latitude Label position in fractions (0..1) of view extent. 0 means left, 1
@@ -178,41 +178,41 @@ ol.Graticule = function(opt_options) {
* @private * @private
*/ */
this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 : this.latLabelPosition_ = options.latLabelPosition == undefined ? 1 :
options.latLabelPosition; options.latLabelPosition;
/** /**
* @type {ol.style.Text} * @type {ol.style.Text}
* @private * @private
*/ */
this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle : this.lonLabelStyle_ = options.lonLabelStyle !== undefined ? options.lonLabelStyle :
new ol.style.Text({ new ol.style.Text({
font: '12px Calibri,sans-serif', font: '12px Calibri,sans-serif',
textBaseline: 'bottom', textBaseline: 'bottom',
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,0,0,1)' color: 'rgba(0,0,0,1)'
}), }),
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: 'rgba(255,255,255,1)', color: 'rgba(255,255,255,1)',
width: 3 width: 3
}) })
}); });
/** /**
* @type {ol.style.Text} * @type {ol.style.Text}
* @private * @private
*/ */
this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle : this.latLabelStyle_ = options.latLabelStyle !== undefined ? options.latLabelStyle :
new ol.style.Text({ new ol.style.Text({
font: '12px Calibri,sans-serif', font: '12px Calibri,sans-serif',
textAlign: 'end', textAlign: 'end',
fill: new ol.style.Fill({ fill: new ol.style.Fill({
color: 'rgba(0,0,0,1)' color: 'rgba(0,0,0,1)'
}), }),
stroke: new ol.style.Stroke({ stroke: new ol.style.Stroke({
color: 'rgba(255,255,255,1)', color: 'rgba(255,255,255,1)',
width: 3 width: 3
}) })
}); });
this.meridiansLabels_ = []; this.meridiansLabels_ = [];
this.parallelsLabels_ = []; this.parallelsLabels_ = [];
@@ -283,7 +283,7 @@ ol.Graticule.prototype.getMeridianPoint_ = function(lineString, extent, index) {
clampedBottom, clampedTop); clampedBottom, clampedTop);
var coordinate = [flatCoordinates[0], lat]; var coordinate = [flatCoordinates[0], lat];
var point = this.meridiansLabels_[index] !== undefined ? var point = this.meridiansLabels_[index] !== undefined ?
this.meridiansLabels_[index].geom : new ol.geom.Point(null); this.meridiansLabels_[index].geom : new ol.geom.Point(null);
point.setCoordinates(coordinate); point.setCoordinates(coordinate);
return point; return point;
}; };
@@ -332,7 +332,7 @@ ol.Graticule.prototype.getParallelPoint_ = function(lineString, extent, index) {
clampedLeft, clampedRight); clampedLeft, clampedRight);
var coordinate = [lon, flatCoordinates[1]]; var coordinate = [lon, flatCoordinates[1]];
var point = this.parallelsLabels_[index] !== undefined ? var point = this.parallelsLabels_[index] !== undefined ?
this.parallelsLabels_[index].geom : new ol.geom.Point(null); this.parallelsLabels_[index].geom : new ol.geom.Point(null);
point.setCoordinates(coordinate); point.setCoordinates(coordinate);
return point; return point;
}; };
@@ -487,11 +487,11 @@ ol.Graticule.prototype.getMap = function() {
* @private * @private
*/ */
ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat, ol.Graticule.prototype.getMeridian_ = function(lon, minLat, maxLat,
squaredTolerance, index) { squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.meridian(lon, var flatCoordinates = ol.geom.flat.geodesic.meridian(lon,
minLat, maxLat, this.projection_, squaredTolerance); minLat, maxLat, this.projection_, squaredTolerance);
var lineString = this.meridians_[index] !== undefined ? var lineString = this.meridians_[index] !== undefined ?
this.meridians_[index] : new ol.geom.LineString(null); this.meridians_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
return lineString; return lineString;
}; };
@@ -517,11 +517,11 @@ ol.Graticule.prototype.getMeridians = function() {
* @private * @private
*/ */
ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon, ol.Graticule.prototype.getParallel_ = function(lat, minLon, maxLon,
squaredTolerance, index) { squaredTolerance, index) {
var flatCoordinates = ol.geom.flat.geodesic.parallel(lat, var flatCoordinates = ol.geom.flat.geodesic.parallel(lat,
this.minLon_, this.maxLon_, this.projection_, squaredTolerance); this.minLon_, this.maxLon_, this.projection_, squaredTolerance);
var lineString = this.parallels_[index] !== undefined ? var lineString = this.parallels_[index] !== undefined ?
this.parallels_[index] : new ol.geom.LineString(null); this.parallels_[index] : new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates); lineString.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates);
return lineString; return lineString;
}; };
@@ -620,7 +620,7 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
var extent = projection.getExtent(); var extent = projection.getExtent();
var worldExtent = projection.getWorldExtent(); var worldExtent = projection.getWorldExtent();
var worldExtentP = ol.proj.transformExtent(worldExtent, var worldExtentP = ol.proj.transformExtent(worldExtent,
epsg4326Projection, projection); epsg4326Projection, projection);
var maxLat = worldExtent[3]; var maxLat = worldExtent[3];
var maxLon = worldExtent[2]; var maxLon = worldExtent[2];
@@ -644,13 +644,13 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
this.fromLonLatTransform_ = ol.proj.getTransform( this.fromLonLatTransform_ = ol.proj.getTransform(
epsg4326Projection, projection); epsg4326Projection, projection);
this.toLonLatTransform_ = ol.proj.getTransform( this.toLonLatTransform_ = ol.proj.getTransform(
projection, epsg4326Projection); projection, epsg4326Projection);
this.projectionCenterLonLat_ = this.toLonLatTransform_( this.projectionCenterLonLat_ = this.toLonLatTransform_(
ol.extent.getCenter(extent)); ol.extent.getCenter(extent));
this.projection_ = projection; this.projection_ = projection;
}; };

View File

@@ -4,7 +4,7 @@ goog.require('ol');
goog.require('ol.webgl'); goog.require('ol.webgl');
var ua = typeof navigator !== 'undefined' ? var ua = typeof navigator !== 'undefined' ?
navigator.userAgent.toLowerCase() : ''; navigator.userAgent.toLowerCase() : '';
/** /**
* User agent string says we are dealing with Firefox as browser. * User agent string says we are dealing with Firefox as browser.
@@ -56,27 +56,27 @@ ol.has.CANVAS_LINE_DASH = false;
* @api * @api
*/ */
ol.has.CANVAS = ol.ENABLE_CANVAS && ( ol.has.CANVAS = ol.ENABLE_CANVAS && (
/** /**
* @return {boolean} Canvas supported. * @return {boolean} Canvas supported.
*/ */
function() { function() {
if (!('HTMLCanvasElement' in window)) { if (!('HTMLCanvasElement' in window)) {
return false;
}
try {
var context = document.createElement('CANVAS').getContext('2d');
if (!context) {
return false; return false;
} } else {
try { if (context.setLineDash !== undefined) {
var context = document.createElement('CANVAS').getContext('2d'); ol.has.CANVAS_LINE_DASH = true;
if (!context) {
return false;
} else {
if (context.setLineDash !== undefined) {
ol.has.CANVAS_LINE_DASH = true;
}
return true;
} }
} catch (e) { return true;
return false;
} }
})(); } catch (e) {
return false;
}
})();
/** /**
@@ -148,7 +148,7 @@ ol.has.WEBGL;
if (gl) { if (gl) {
hasWebGL = true; hasWebGL = true;
textureSize = /** @type {number} */ textureSize = /** @type {number} */
(gl.getParameter(gl.MAX_TEXTURE_SIZE)); (gl.getParameter(gl.MAX_TEXTURE_SIZE));
extensions = gl.getSupportedExtensions(); extensions = gl.getSupportedExtensions();
} }
} catch (e) { } catch (e) {

View File

@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
this.loader_ = opt_loader !== undefined ? opt_loader : null; this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ? var state = opt_loader !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED; ol.ImageState.IDLE : ol.ImageState.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions); ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);

View File

@@ -45,13 +45,13 @@ ol.interaction.defaults = function(opt_options) {
var kinetic = new ol.Kinetic(-0.005, 0.05, 100); var kinetic = new ol.Kinetic(-0.005, 0.05, 100);
var altShiftDragRotate = options.altShiftDragRotate !== undefined ? var altShiftDragRotate = options.altShiftDragRotate !== undefined ?
options.altShiftDragRotate : true; options.altShiftDragRotate : true;
if (altShiftDragRotate) { if (altShiftDragRotate) {
interactions.push(new ol.interaction.DragRotate()); interactions.push(new ol.interaction.DragRotate());
} }
var doubleClickZoom = options.doubleClickZoom !== undefined ? var doubleClickZoom = options.doubleClickZoom !== undefined ?
options.doubleClickZoom : true; options.doubleClickZoom : true;
if (doubleClickZoom) { if (doubleClickZoom) {
interactions.push(new ol.interaction.DoubleClickZoom({ interactions.push(new ol.interaction.DoubleClickZoom({
delta: options.zoomDelta, delta: options.zoomDelta,
@@ -67,7 +67,7 @@ ol.interaction.defaults = function(opt_options) {
} }
var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate : var pinchRotate = options.pinchRotate !== undefined ? options.pinchRotate :
true; true;
if (pinchRotate) { if (pinchRotate) {
interactions.push(new ol.interaction.PinchRotate()); interactions.push(new ol.interaction.PinchRotate());
} }
@@ -90,7 +90,7 @@ ol.interaction.defaults = function(opt_options) {
} }
var mouseWheelZoom = options.mouseWheelZoom !== undefined ? var mouseWheelZoom = options.mouseWheelZoom !== undefined ?
options.mouseWheelZoom : true; options.mouseWheelZoom : true;
if (mouseWheelZoom) { if (mouseWheelZoom) {
interactions.push(new ol.interaction.MouseWheelZoom({ interactions.push(new ol.interaction.MouseWheelZoom({
constrainResolution: options.constrainResolution, constrainResolution: options.constrainResolution,
@@ -99,7 +99,7 @@ ol.interaction.defaults = function(opt_options) {
} }
var shiftDragZoom = options.shiftDragZoom !== undefined ? var shiftDragZoom = options.shiftDragZoom !== undefined ?
options.shiftDragZoom : true; options.shiftDragZoom : true;
if (shiftDragZoom) { if (shiftDragZoom) {
interactions.push(new ol.interaction.DragZoom({ interactions.push(new ol.interaction.DragZoom({
duration: options.zoomDuration duration: options.zoomDuration

View File

@@ -34,14 +34,14 @@ ol.interaction.DragAndDrop = function(opt_options) {
* @type {Array.<function(new: ol.format.Feature)>} * @type {Array.<function(new: ol.format.Feature)>}
*/ */
this.formatConstructors_ = options.formatConstructors ? this.formatConstructors_ = options.formatConstructors ?
options.formatConstructors : []; options.formatConstructors : [];
/** /**
* @private * @private
* @type {ol.proj.Projection} * @type {ol.proj.Projection}
*/ */
this.projection_ = options.projection ? this.projection_ = options.projection ?
ol.proj.get(options.projection) : null; ol.proj.get(options.projection) : null;
/** /**
* @private * @private

View File

@@ -58,14 +58,14 @@ ol.interaction.DragBox = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.always; options.condition : ol.events.condition.always;
/** /**
* @private * @private
* @type {ol.DragBoxEndConditionType} * @type {ol.DragBoxEndConditionType}
*/ */
this.boxEndCondition_ = options.boxEndCondition ? this.boxEndCondition_ = options.boxEndCondition ?
options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition; options.boxEndCondition : ol.interaction.DragBox.defaultBoxEndCondition;
}; };
ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer); ol.inherits(ol.interaction.DragBox, ol.interaction.Pointer);
@@ -100,7 +100,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) {
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType_.BOXDRAG, this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType_.BOXDRAG,
mapBrowserEvent.coordinate, mapBrowserEvent)); mapBrowserEvent.coordinate, mapBrowserEvent));
}; };

View File

@@ -49,7 +49,7 @@ ol.interaction.DragPan = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.noModifierKeys; options.condition : ol.events.condition.noModifierKeys;
/** /**
* @private * @private

View File

@@ -37,7 +37,7 @@ ol.interaction.DragRotate = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.altShiftKeysOnly; options.condition : ol.events.condition.altShiftKeysOnly;
/** /**
* @private * @private

View File

@@ -38,7 +38,7 @@ ol.interaction.DragRotateAndZoom = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.shiftKeyOnly; options.condition : ol.events.condition.shiftKeyOnly;
/** /**
* @private * @private

View File

@@ -25,7 +25,7 @@ ol.interaction.DragZoom = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
var condition = options.condition ? var condition = options.condition ?
options.condition : ol.events.condition.shiftKeyOnly; options.condition : ol.events.condition.shiftKeyOnly;
/** /**
* @private * @private

View File

@@ -105,8 +105,8 @@ ol.interaction.Draw = function(options) {
* @private * @private
*/ */
this.minPoints_ = options.minPoints ? this.minPoints_ = options.minPoints ?
options.minPoints : options.minPoints :
(this.mode_ === ol.interaction.Draw.Mode_.POLYGON ? 3 : 2); (this.mode_ === ol.interaction.Draw.Mode_.POLYGON ? 3 : 2);
/** /**
* The number of points that can be drawn before a polygon ring or line string * The number of points that can be drawn before a polygon ring or line string
@@ -134,7 +134,7 @@ ol.interaction.Draw = function(options) {
*/ */
geometryFunction = function(coordinates, opt_geometry) { geometryFunction = function(coordinates, opt_geometry) {
var circle = opt_geometry ? /** @type {ol.geom.Circle} */ (opt_geometry) : var circle = opt_geometry ? /** @type {ol.geom.Circle} */ (opt_geometry) :
new ol.geom.Circle([NaN, NaN]); new ol.geom.Circle([NaN, NaN]);
var squaredLength = ol.coordinate.squaredDistance( var squaredLength = ol.coordinate.squaredDistance(
coordinates[0], coordinates[1]); coordinates[0], coordinates[1]);
circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength)); circle.setCenterAndRadius(coordinates[0], Math.sqrt(squaredLength));
@@ -229,7 +229,7 @@ ol.interaction.Draw = function(options) {
* @private * @private
*/ */
this.squaredClickTolerance_ = options.clickTolerance ? this.squaredClickTolerance_ = options.clickTolerance ?
options.clickTolerance * options.clickTolerance : 36; options.clickTolerance * options.clickTolerance : 36;
/** /**
* Draw overlay where our sketch features are drawn. * Draw overlay where our sketch features are drawn.
@@ -242,7 +242,7 @@ ol.interaction.Draw = function(options) {
wrapX: options.wrapX ? options.wrapX : false wrapX: options.wrapX ? options.wrapX : false
}), }),
style: options.style ? options.style : style: options.style ? options.style :
ol.interaction.Draw.getDefaultStyleFunction() ol.interaction.Draw.getDefaultStyleFunction()
}); });
/** /**
@@ -257,7 +257,7 @@ ol.interaction.Draw = function(options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.noModifierKeys; options.condition : ol.events.condition.noModifierKeys;
/** /**
* @private * @private
@@ -268,7 +268,7 @@ ol.interaction.Draw = function(options) {
this.freehandCondition_ = ol.events.condition.always; this.freehandCondition_ = ol.events.condition.always;
} else { } else {
this.freehandCondition_ = options.freehandCondition ? this.freehandCondition_ = options.freehandCondition ?
options.freehandCondition : ol.events.condition.shiftKeyOnly; options.freehandCondition : ol.events.condition.shiftKeyOnly;
} }
ol.events.listen(this, ol.events.listen(this,
@@ -401,8 +401,8 @@ ol.interaction.Draw.prototype.handlePointerMove_ = function(event) {
var dy = downPx[1] - clickPx[1]; var dy = downPx[1] - clickPx[1];
var squaredDistance = dx * dx + dy * dy; var squaredDistance = dx * dx + dy * dy;
this.shouldHandle_ = this.freehand_ ? this.shouldHandle_ = this.freehand_ ?
squaredDistance > this.squaredClickTolerance_ : squaredDistance > this.squaredClickTolerance_ :
squaredDistance <= this.squaredClickTolerance_; squaredDistance <= this.squaredClickTolerance_;
} }
if (this.finishCoordinate_) { if (this.finishCoordinate_) {
@@ -767,23 +767,23 @@ ol.interaction.Draw.prototype.updateState_ = function() {
*/ */
ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) { ol.interaction.Draw.createRegularPolygon = function(opt_sides, opt_angle) {
return ( return (
/** /**
* @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates * @param {ol.Coordinate|Array.<ol.Coordinate>|Array.<Array.<ol.Coordinate>>} coordinates
* @param {ol.geom.SimpleGeometry=} opt_geometry * @param {ol.geom.SimpleGeometry=} opt_geometry
* @return {ol.geom.SimpleGeometry} * @return {ol.geom.SimpleGeometry}
*/ */
function(coordinates, opt_geometry) { function(coordinates, opt_geometry) {
var center = coordinates[0]; var center = coordinates[0];
var end = coordinates[1]; var end = coordinates[1];
var radius = Math.sqrt( var radius = Math.sqrt(
ol.coordinate.squaredDistance(center, end)); ol.coordinate.squaredDistance(center, end));
var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) : var geometry = opt_geometry ? /** @type {ol.geom.Polygon} */ (opt_geometry) :
ol.geom.Polygon.fromCircle(new ol.geom.Circle(center), opt_sides); ol.geom.Polygon.fromCircle(new ol.geom.Circle(center), opt_sides);
var angle = opt_angle ? opt_angle : var angle = opt_angle ? opt_angle :
Math.atan((end[1] - center[1]) / (end[0] - center[0])); Math.atan((end[1] - center[1]) / (end[0] - center[0]));
ol.geom.Polygon.makeRegular(geometry, center, radius, angle); ol.geom.Polygon.makeRegular(geometry, center, radius, angle);
return geometry; return geometry;
} }
); );
}; };

View File

@@ -183,13 +183,13 @@ ol.interaction.Extent.handleDownEvent_ = function(mapBrowserEvent) {
//snap to edge //snap to edge
} else if (x !== null) { } else if (x !== null) {
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_( this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
getOpposingPoint([x, extent[1]]), getOpposingPoint([x, extent[1]]),
getOpposingPoint([x, extent[3]]) getOpposingPoint([x, extent[3]])
); );
} else if (y !== null) { } else if (y !== null) {
this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_( this.pointerHandler_ = ol.interaction.Extent.getEdgeHandler_(
getOpposingPoint([extent[0], y]), getOpposingPoint([extent[0], y]),
getOpposingPoint([extent[2], y]) getOpposingPoint([extent[2], y])
); );
} }
//no snap - new bbox //no snap - new bbox
@@ -337,7 +337,7 @@ ol.interaction.Extent.prototype.snapToVertex_ = function(pixel, map) {
this.snappedToVertex_ = dist <= this.pixelTolerance_; this.snappedToVertex_ = dist <= this.pixelTolerance_;
if (this.snappedToVertex_) { if (this.snappedToVertex_) {
vertex = squaredDist1 > squaredDist2 ? vertex = squaredDist1 > squaredDist2 ?
closestSegment[1] : closestSegment[0]; closestSegment[1] : closestSegment[0];
} }
return vertex; return vertex;
} }

View File

@@ -54,7 +54,7 @@ ol.inherits(ol.interaction.Interaction, ol.Object);
*/ */
ol.interaction.Interaction.prototype.getActive = function() { ol.interaction.Interaction.prototype.getActive = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (
this.get(ol.interaction.Property.ACTIVE)); this.get(ol.interaction.Property.ACTIVE));
}; };

View File

@@ -48,7 +48,7 @@ ol.interaction.KeyboardPan = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition !== undefined ? this.condition_ = options.condition !== undefined ?
options.condition : this.defaultCondition_; options.condition : this.defaultCondition_;
/** /**
* @private * @private
@@ -61,7 +61,7 @@ ol.interaction.KeyboardPan = function(opt_options) {
* @type {number} * @type {number}
*/ */
this.pixelDelta_ = options.pixelDelta !== undefined ? this.pixelDelta_ = options.pixelDelta !== undefined ?
options.pixelDelta : 128; options.pixelDelta : 128;
}; };
ol.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction); ol.inherits(ol.interaction.KeyboardPan, ol.interaction.Interaction);

View File

@@ -36,7 +36,7 @@ ol.interaction.KeyboardZoom = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? options.condition : this.condition_ = options.condition ? options.condition :
ol.events.condition.targetNotEditable; ol.events.condition.targetNotEditable;
/** /**
* @private * @private

View File

@@ -47,7 +47,7 @@ ol.interaction.Modify = function(options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.primaryAction; options.condition : ol.events.condition.primaryAction;
/** /**
@@ -65,14 +65,14 @@ ol.interaction.Modify = function(options) {
* @private * @private
*/ */
this.deleteCondition_ = options.deleteCondition ? this.deleteCondition_ = options.deleteCondition ?
options.deleteCondition : this.defaultDeleteCondition_; options.deleteCondition : this.defaultDeleteCondition_;
/** /**
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
* @private * @private
*/ */
this.insertVertexCondition_ = options.insertVertexCondition ? this.insertVertexCondition_ = options.insertVertexCondition ?
options.insertVertexCondition : ol.events.condition.always; options.insertVertexCondition : ol.events.condition.always;
/** /**
* Editing vertex. * Editing vertex.
@@ -120,7 +120,7 @@ ol.interaction.Modify = function(options) {
* @private * @private
*/ */
this.pixelTolerance_ = options.pixelTolerance !== undefined ? this.pixelTolerance_ = options.pixelTolerance !== undefined ?
options.pixelTolerance : 10; options.pixelTolerance : 10;
/** /**
* @type {boolean} * @type {boolean}
@@ -153,7 +153,7 @@ ol.interaction.Modify = function(options) {
wrapX: !!options.wrapX wrapX: !!options.wrapX
}), }),
style: options.style ? options.style : style: options.style ? options.style :
ol.interaction.Modify.getDefaultStyleFunction(), ol.interaction.Modify.getDefaultStyleFunction(),
updateWhileAnimating: true, updateWhileAnimating: true,
updateWhileInteracting: true updateWhileInteracting: true
}); });
@@ -825,7 +825,7 @@ ol.interaction.Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
this.snappedToVertex_ = dist <= this.pixelTolerance_; this.snappedToVertex_ = dist <= this.pixelTolerance_;
if (this.snappedToVertex_) { if (this.snappedToVertex_) {
vertex = squaredDist1 > squaredDist2 ? vertex = squaredDist1 > squaredDist2 ?
closestSegment[1] : closestSegment[0]; closestSegment[1] : closestSegment[0];
} }
this.createOrUpdateVertexFeature_(vertex); this.createOrUpdateVertexFeature_(vertex);
var segment; var segment;

View File

@@ -164,8 +164,8 @@ ol.interaction.MouseWheelZoom.handleEvent = function(mapBrowserEvent) {
if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) { if (!this.mode_ || now - this.startTime_ > this.trackpadEventGap_) {
this.mode_ = Math.abs(delta) < 4 ? this.mode_ = Math.abs(delta) < 4 ?
ol.interaction.MouseWheelZoom.Mode_.TRACKPAD : ol.interaction.MouseWheelZoom.Mode_.TRACKPAD :
ol.interaction.MouseWheelZoom.Mode_.WHEEL; ol.interaction.MouseWheelZoom.Mode_.WHEEL;
} }
if (this.mode_ === ol.interaction.MouseWheelZoom.Mode_.TRACKPAD) { if (this.mode_ === ol.interaction.MouseWheelZoom.Mode_.TRACKPAD) {

View File

@@ -28,7 +28,7 @@ ol.interaction.Pointer = function(opt_options) {
var options = opt_options ? opt_options : {}; var options = opt_options ? opt_options : {};
var handleEvent = options.handleEvent ? var handleEvent = options.handleEvent ?
options.handleEvent : ol.interaction.Pointer.handleEvent; options.handleEvent : ol.interaction.Pointer.handleEvent;
ol.interaction.Interaction.call(this, { ol.interaction.Interaction.call(this, {
handleEvent: handleEvent handleEvent: handleEvent
@@ -39,28 +39,28 @@ ol.interaction.Pointer = function(opt_options) {
* @private * @private
*/ */
this.handleDownEvent_ = options.handleDownEvent ? this.handleDownEvent_ = options.handleDownEvent ?
options.handleDownEvent : ol.interaction.Pointer.handleDownEvent; options.handleDownEvent : ol.interaction.Pointer.handleDownEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent)} * @type {function(ol.MapBrowserPointerEvent)}
* @private * @private
*/ */
this.handleDragEvent_ = options.handleDragEvent ? this.handleDragEvent_ = options.handleDragEvent ?
options.handleDragEvent : ol.interaction.Pointer.handleDragEvent; options.handleDragEvent : ol.interaction.Pointer.handleDragEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent)} * @type {function(ol.MapBrowserPointerEvent)}
* @private * @private
*/ */
this.handleMoveEvent_ = options.handleMoveEvent ? this.handleMoveEvent_ = options.handleMoveEvent ?
options.handleMoveEvent : ol.interaction.Pointer.handleMoveEvent; options.handleMoveEvent : ol.interaction.Pointer.handleMoveEvent;
/** /**
* @type {function(ol.MapBrowserPointerEvent):boolean} * @type {function(ol.MapBrowserPointerEvent):boolean}
* @private * @private
*/ */
this.handleUpEvent_ = options.handleUpEvent ? this.handleUpEvent_ = options.handleUpEvent ?
options.handleUpEvent : ol.interaction.Pointer.handleUpEvent; options.handleUpEvent : ol.interaction.Pointer.handleUpEvent;
/** /**
* @type {boolean} * @type {boolean}
@@ -109,7 +109,7 @@ ol.interaction.Pointer.centroid = function(pointerEvents) {
ol.interaction.Pointer.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) { ol.interaction.Pointer.prototype.isPointerDraggingEvent_ = function(mapBrowserEvent) {
var type = mapBrowserEvent.type; var type = mapBrowserEvent.type;
return ( return (
type === ol.MapBrowserEventType.POINTERDOWN || type === ol.MapBrowserEventType.POINTERDOWN ||
type === ol.MapBrowserEventType.POINTERDRAG || type === ol.MapBrowserEventType.POINTERDRAG ||
type === ol.MapBrowserEventType.POINTERUP); type === ol.MapBrowserEventType.POINTERUP);
}; };

View File

@@ -46,28 +46,28 @@ ol.interaction.Select = function(opt_options) {
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.condition_ = options.condition ? this.condition_ = options.condition ?
options.condition : ol.events.condition.singleClick; options.condition : ol.events.condition.singleClick;
/** /**
* @private * @private
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.addCondition_ = options.addCondition ? this.addCondition_ = options.addCondition ?
options.addCondition : ol.events.condition.never; options.addCondition : ol.events.condition.never;
/** /**
* @private * @private
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.removeCondition_ = options.removeCondition ? this.removeCondition_ = options.removeCondition ?
options.removeCondition : ol.events.condition.never; options.removeCondition : ol.events.condition.never;
/** /**
* @private * @private
* @type {ol.EventsConditionType} * @type {ol.EventsConditionType}
*/ */
this.toggleCondition_ = options.toggleCondition ? this.toggleCondition_ = options.toggleCondition ?
options.toggleCondition : ol.events.condition.shiftKeyOnly; options.toggleCondition : ol.events.condition.shiftKeyOnly;
/** /**
* @private * @private
@@ -80,7 +80,7 @@ ol.interaction.Select = function(opt_options) {
* @type {ol.SelectFilterFunction} * @type {ol.SelectFilterFunction}
*/ */
this.filter_ = options.filter ? options.filter : this.filter_ = options.filter ? options.filter :
ol.functions.TRUE; ol.functions.TRUE;
/** /**
* @private * @private
@@ -95,7 +95,7 @@ ol.interaction.Select = function(opt_options) {
wrapX: options.wrapX wrapX: options.wrapX
}), }),
style: options.style ? options.style : style: options.style ? options.style :
ol.interaction.Select.getDefaultStyleFunction(), ol.interaction.Select.getDefaultStyleFunction(),
updateWhileAnimating: true, updateWhileAnimating: true,
updateWhileInteracting: true updateWhileInteracting: true
}); });
@@ -217,18 +217,18 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
// the pixel. // the pixel.
ol.obj.clear(this.featureLayerAssociation_); ol.obj.clear(this.featureLayerAssociation_);
map.forEachFeatureAtPixel(mapBrowserEvent.pixel, map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(/** (/**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @param {ol.layer.Layer} layer Layer. * @param {ol.layer.Layer} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features. * @return {boolean|undefined} Continue to iterate over the features.
*/ */
function(feature, layer) { function(feature, layer) {
if (this.filter_(feature, layer)) { if (this.filter_(feature, layer)) {
selected.push(feature); selected.push(feature);
this.addFeatureLayerAssociation_(feature, layer); this.addFeatureLayerAssociation_(feature, layer);
return !this.multi_; return !this.multi_;
} }
}).bind(this), { }).bind(this), {
layerFilter: this.layerFilter_, layerFilter: this.layerFilter_,
hitTolerance: this.hitTolerance_ hitTolerance: this.hitTolerance_
}); });
@@ -250,25 +250,25 @@ ol.interaction.Select.handleEvent = function(mapBrowserEvent) {
} else { } else {
// Modify the currently selected feature(s). // Modify the currently selected feature(s).
map.forEachFeatureAtPixel(mapBrowserEvent.pixel, map.forEachFeatureAtPixel(mapBrowserEvent.pixel,
(/** (/**
* @param {ol.Feature|ol.render.Feature} feature Feature. * @param {ol.Feature|ol.render.Feature} feature Feature.
* @param {ol.layer.Layer} layer Layer. * @param {ol.layer.Layer} layer Layer.
* @return {boolean|undefined} Continue to iterate over the features. * @return {boolean|undefined} Continue to iterate over the features.
*/ */
function(feature, layer) { function(feature, layer) {
if (this.filter_(feature, layer)) { if (this.filter_(feature, layer)) {
if ((add || toggle) && if ((add || toggle) &&
!ol.array.includes(features.getArray(), feature)) { !ol.array.includes(features.getArray(), feature)) {
selected.push(feature); selected.push(feature);
this.addFeatureLayerAssociation_(feature, layer); this.addFeatureLayerAssociation_(feature, layer);
} else if ((remove || toggle) && } else if ((remove || toggle) &&
ol.array.includes(features.getArray(), feature)) { ol.array.includes(features.getArray(), feature)) {
deselected.push(feature); deselected.push(feature);
this.removeFeatureLayerAssociation_(feature); this.removeFeatureLayerAssociation_(feature);
}
return !this.multi_;
} }
return !this.multi_; }).bind(this), {
}
}).bind(this), {
layerFilter: this.layerFilter_, layerFilter: this.layerFilter_,
hitTolerance: this.hitTolerance_ hitTolerance: this.hitTolerance_
}); });

View File

@@ -114,7 +114,7 @@ ol.interaction.Snap = function(opt_options) {
* @private * @private
*/ */
this.pixelTolerance_ = options.pixelTolerance !== undefined ? this.pixelTolerance_ = options.pixelTolerance !== undefined ?
options.pixelTolerance : 10; options.pixelTolerance : 10;
/** /**
* @type {function(ol.SnapSegmentDataType, ol.SnapSegmentDataType): number} * @type {function(ol.SnapSegmentDataType, ol.SnapSegmentDataType): number}
@@ -309,17 +309,17 @@ ol.interaction.Snap.prototype.setMap = function(map) {
if (map) { if (map) {
if (this.features_) { if (this.features_) {
keys.push( keys.push(
ol.events.listen(this.features_, ol.CollectionEventType.ADD, ol.events.listen(this.features_, ol.CollectionEventType.ADD,
this.handleFeatureAdd_, this), this.handleFeatureAdd_, this),
ol.events.listen(this.features_, ol.CollectionEventType.REMOVE, ol.events.listen(this.features_, ol.CollectionEventType.REMOVE,
this.handleFeatureRemove_, this) this.handleFeatureRemove_, this)
); );
} else if (this.source_) { } else if (this.source_) {
keys.push( keys.push(
ol.events.listen(this.source_, ol.source.VectorEventType.ADDFEATURE, ol.events.listen(this.source_, ol.source.VectorEventType.ADDFEATURE,
this.handleFeatureAdd_, this), this.handleFeatureAdd_, this),
ol.events.listen(this.source_, ol.source.VectorEventType.REMOVEFEATURE, ol.events.listen(this.source_, ol.source.VectorEventType.REMOVEFEATURE,
this.handleFeatureRemove_, this) this.handleFeatureRemove_, this)
); );
} }
features.forEach(this.forEachFeatureAdd_, this); features.forEach(this.forEachFeatureAdd_, this);
@@ -378,7 +378,7 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
if (snappedToVertex) { if (snappedToVertex) {
snapped = true; snapped = true;
vertex = squaredDist1 > squaredDist2 ? vertex = squaredDist1 > squaredDist2 ?
closestSegment[1] : closestSegment[0]; closestSegment[1] : closestSegment[0];
vertexPixel = map.getPixelFromCoordinate(vertex); vertexPixel = map.getPixelFromCoordinate(vertex);
} }
} else if (this.edge_) { } else if (this.edge_) {
@@ -401,7 +401,7 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) {
snappedToVertex = dist <= this.pixelTolerance_; snappedToVertex = dist <= this.pixelTolerance_;
if (snappedToVertex) { if (snappedToVertex) {
vertex = squaredDist1 > squaredDist2 ? vertex = squaredDist1 > squaredDist2 ?
closestSegment[1] : closestSegment[0]; closestSegment[1] : closestSegment[0];
vertexPixel = map.getPixelFromCoordinate(vertex); vertexPixel = map.getPixelFromCoordinate(vertex);
} }
} }
@@ -631,5 +631,5 @@ ol.interaction.Snap.sortByDistance = function(a, b) {
return ol.coordinate.squaredDistanceToSegment( return ol.coordinate.squaredDistanceToSegment(
this.pixelCoordinate_, a.segment) - this.pixelCoordinate_, a.segment) -
ol.coordinate.squaredDistanceToSegment( ol.coordinate.squaredDistanceToSegment(
this.pixelCoordinate_, b.segment); this.pixelCoordinate_, b.segment);
}; };

View File

@@ -107,7 +107,7 @@ ol.layer.Base.prototype.getLayerStatesArray = function(opt_states) {};
*/ */
ol.layer.Base.prototype.getExtent = function() { ol.layer.Base.prototype.getExtent = function() {
return /** @type {ol.Extent|undefined} */ ( return /** @type {ol.Extent|undefined} */ (
this.get(ol.layer.Property.EXTENT)); this.get(ol.layer.Property.EXTENT));
}; };
@@ -119,7 +119,7 @@ ol.layer.Base.prototype.getExtent = function() {
*/ */
ol.layer.Base.prototype.getMaxResolution = function() { ol.layer.Base.prototype.getMaxResolution = function() {
return /** @type {number} */ ( return /** @type {number} */ (
this.get(ol.layer.Property.MAX_RESOLUTION)); this.get(ol.layer.Property.MAX_RESOLUTION));
}; };
@@ -131,7 +131,7 @@ ol.layer.Base.prototype.getMaxResolution = function() {
*/ */
ol.layer.Base.prototype.getMinResolution = function() { ol.layer.Base.prototype.getMinResolution = function() {
return /** @type {number} */ ( return /** @type {number} */ (
this.get(ol.layer.Property.MIN_RESOLUTION)); this.get(ol.layer.Property.MIN_RESOLUTION));
}; };

View File

@@ -66,7 +66,7 @@ ol.layer.Heatmap = function(opt_options) {
this.handleGradientChanged_, this); this.handleGradientChanged_, this);
this.setGradient(options.gradient ? this.setGradient(options.gradient ?
options.gradient : ol.layer.Heatmap.DEFAULT_GRADIENT); options.gradient : ol.layer.Heatmap.DEFAULT_GRADIENT);
this.setBlur(options.blur !== undefined ? options.blur : 15); this.setBlur(options.blur !== undefined ? options.blur : 15);
@@ -190,7 +190,7 @@ ol.layer.Heatmap.prototype.getBlur = function() {
*/ */
ol.layer.Heatmap.prototype.getGradient = function() { ol.layer.Heatmap.prototype.getGradient = function() {
return /** @type {Array.<string>} */ ( return /** @type {Array.<string>} */ (
this.get(ol.layer.Heatmap.Property_.GRADIENT)); this.get(ol.layer.Heatmap.Property_.GRADIENT));
}; };

View File

@@ -34,7 +34,7 @@ ol.layer.Tile = function(opt_options) {
this.setPreload(options.preload !== undefined ? options.preload : 0); this.setPreload(options.preload !== undefined ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ? this.setUseInterimTilesOnError(options.useInterimTilesOnError !== undefined ?
options.useInterimTilesOnError : true); options.useInterimTilesOnError : true);
}; };
ol.inherits(ol.layer.Tile, ol.layer.Layer); ol.inherits(ol.layer.Tile, ol.layer.Layer);
@@ -93,7 +93,7 @@ ol.layer.Tile.prototype.setPreload = function(preload) {
*/ */
ol.layer.Tile.prototype.getUseInterimTilesOnError = function() { ol.layer.Tile.prototype.getUseInterimTilesOnError = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (
this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR)); this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR));
}; };

View File

@@ -24,7 +24,7 @@ goog.require('ol.style.Style');
*/ */
ol.layer.Vector = function(opt_options) { ol.layer.Vector = function(opt_options) {
var options = opt_options ? var options = opt_options ?
opt_options : /** @type {olx.layer.VectorOptions} */ ({}); opt_options : /** @type {olx.layer.VectorOptions} */ ({});
var baseOptions = ol.obj.assign({}, options); var baseOptions = ol.obj.assign({}, options);
@@ -34,21 +34,21 @@ ol.layer.Vector = function(opt_options) {
delete baseOptions.updateWhileInteracting; delete baseOptions.updateWhileInteracting;
ol.layer.Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions)); ol.layer.Layer.call(this, /** @type {olx.layer.LayerOptions} */ (baseOptions));
/** /**
* @type {number} * @type {number}
* @private * @private
*/ */
this.renderBuffer_ = options.renderBuffer !== undefined ? this.renderBuffer_ = options.renderBuffer !== undefined ?
options.renderBuffer : 100; options.renderBuffer : 100;
/** /**
* User provided style. * User provided style.
* @type {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction} * @type {ol.style.Style|Array.<ol.style.Style>|ol.StyleFunction}
* @private * @private
*/ */
this.style_ = null; this.style_ = null;
/** /**
* Style function for use within the library. * Style function for use within the library.
* @type {ol.StyleFunction|undefined} * @type {ol.StyleFunction|undefined}
* @private * @private
@@ -57,19 +57,19 @@ ol.layer.Vector = function(opt_options) {
this.setStyle(options.style); this.setStyle(options.style);
/** /**
* @type {boolean} * @type {boolean}
* @private * @private
*/ */
this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ? this.updateWhileAnimating_ = options.updateWhileAnimating !== undefined ?
options.updateWhileAnimating : false; options.updateWhileAnimating : false;
/** /**
* @type {boolean} * @type {boolean}
* @private * @private
*/ */
this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ? this.updateWhileInteracting_ = options.updateWhileInteracting !== undefined ?
options.updateWhileInteracting : false; options.updateWhileInteracting : false;
}; };
ol.inherits(ol.layer.Vector, ol.layer.Layer); ol.inherits(ol.layer.Vector, ol.layer.Layer);
@@ -103,7 +103,7 @@ ol.layer.Vector.prototype.getRenderBuffer = function() {
*/ */
ol.layer.Vector.prototype.getRenderOrder = function() { ol.layer.Vector.prototype.getRenderOrder = function() {
return /** @type {ol.RenderOrderFunction|null|undefined} */ ( return /** @type {ol.RenderOrderFunction|null|undefined} */ (
this.get(ol.layer.Vector.Property_.RENDER_ORDER)); this.get(ol.layer.Vector.Property_.RENDER_ORDER));
}; };
@@ -179,7 +179,7 @@ ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
ol.layer.Vector.prototype.setStyle = function(style) { ol.layer.Vector.prototype.setStyle = function(style) {
this.style_ = style !== undefined ? style : ol.style.Style.defaultFunction; this.style_ = style !== undefined ? style : ol.style.Style.defaultFunction;
this.styleFunction_ = style === null ? this.styleFunction_ = style === null ?
undefined : ol.style.Style.createFunction(this.style_); undefined : ol.style.Style.createFunction(this.style_);
this.changed(); this.changed();
}; };

View File

@@ -33,13 +33,13 @@ ol.layer.VectorTile = function(opt_options) {
this.setPreload(options.preload ? options.preload : 0); this.setPreload(options.preload ? options.preload : 0);
this.setUseInterimTilesOnError(options.useInterimTilesOnError ? this.setUseInterimTilesOnError(options.useInterimTilesOnError ?
options.useInterimTilesOnError : true); options.useInterimTilesOnError : true);
ol.asserts.assert(options.renderMode == undefined || ol.asserts.assert(options.renderMode == undefined ||
options.renderMode == ol.layer.VectorTileRenderType.IMAGE || options.renderMode == ol.layer.VectorTileRenderType.IMAGE ||
options.renderMode == ol.layer.VectorTileRenderType.HYBRID || options.renderMode == ol.layer.VectorTileRenderType.HYBRID ||
options.renderMode == ol.layer.VectorTileRenderType.VECTOR, options.renderMode == ol.layer.VectorTileRenderType.VECTOR,
28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'` 28); // `renderMode` must be `'image'`, `'hybrid'` or `'vector'`
/** /**
* @private * @private
@@ -91,7 +91,7 @@ ol.layer.VectorTile.prototype.getRenderMode = function() {
*/ */
ol.layer.VectorTile.prototype.getUseInterimTilesOnError = function() { ol.layer.VectorTile.prototype.getUseInterimTilesOnError = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (
this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR)); this.get(ol.layer.TileProperty.USE_INTERIM_TILES_ON_ERROR));
}; };

View File

@@ -34,25 +34,25 @@ ol.loadingstrategy.bbox = function(extent, resolution) {
*/ */
ol.loadingstrategy.tile = function(tileGrid) { ol.loadingstrategy.tile = function(tileGrid) {
return ( return (
/** /**
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution. * @param {number} resolution Resolution.
* @return {Array.<ol.Extent>} Extents. * @return {Array.<ol.Extent>} Extents.
*/ */
function(extent, resolution) { function(extent, resolution) {
var z = tileGrid.getZForResolution(resolution); var z = tileGrid.getZForResolution(resolution);
var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z); var tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
/** @type {Array.<ol.Extent>} */ /** @type {Array.<ol.Extent>} */
var extents = []; var extents = [];
/** @type {ol.TileCoord} */ /** @type {ol.TileCoord} */
var tileCoord = [z, 0, 0]; var tileCoord = [z, 0, 0];
for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX; for (tileCoord[1] = tileRange.minX; tileCoord[1] <= tileRange.maxX;
++tileCoord[1]) { ++tileCoord[1]) {
for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY; for (tileCoord[2] = tileRange.minY; tileCoord[2] <= tileRange.maxY;
++tileCoord[2]) { ++tileCoord[2]) {
extents.push(tileGrid.getTileCoordExtent(tileCoord)); extents.push(tileGrid.getTileCoordExtent(tileCoord));
}
} }
return extents; }
}); return extents;
});
}; };

View File

@@ -144,7 +144,7 @@ ol.Map = function(options) {
*/ */
this.loadTilesWhileAnimating_ = this.loadTilesWhileAnimating_ =
options.loadTilesWhileAnimating !== undefined ? options.loadTilesWhileAnimating !== undefined ?
options.loadTilesWhileAnimating : false; options.loadTilesWhileAnimating : false;
/** /**
* @type {boolean} * @type {boolean}
@@ -152,14 +152,14 @@ ol.Map = function(options) {
*/ */
this.loadTilesWhileInteracting_ = this.loadTilesWhileInteracting_ =
options.loadTilesWhileInteracting !== undefined ? options.loadTilesWhileInteracting !== undefined ?
options.loadTilesWhileInteracting : false; options.loadTilesWhileInteracting : false;
/** /**
* @private * @private
* @type {number} * @type {number}
*/ */
this.pixelRatio_ = options.pixelRatio !== undefined ? this.pixelRatio_ = options.pixelRatio !== undefined ?
options.pixelRatio : ol.has.DEVICE_PIXEL_RATIO; options.pixelRatio : ol.has.DEVICE_PIXEL_RATIO;
/** /**
* @private * @private
@@ -603,7 +603,7 @@ ol.Map.prototype.forEachLayerAtPixel = function(pixel, callback, opt_this, opt_l
} }
var thisArg = opt_this !== undefined ? opt_this : null; var thisArg = opt_this !== undefined ? opt_this : null;
var layerFilter = opt_layerFilter !== undefined ? var layerFilter = opt_layerFilter !== undefined ?
opt_layerFilter : ol.functions.TRUE; opt_layerFilter : ol.functions.TRUE;
var thisArg2 = opt_this2 !== undefined ? opt_this2 : null; var thisArg2 = opt_this2 !== undefined ? opt_this2 : null;
return this.renderer_.forEachLayerAtPixel( return this.renderer_.forEachLayerAtPixel(
pixel, this.frameState_, callback, thisArg, pixel, this.frameState_, callback, thisArg,
@@ -627,7 +627,7 @@ ol.Map.prototype.hasFeatureAtPixel = function(pixel, opt_options) {
var coordinate = this.getCoordinateFromPixel(pixel); var coordinate = this.getCoordinateFromPixel(pixel);
opt_options = opt_options !== undefined ? opt_options : {}; opt_options = opt_options !== undefined ? opt_options : {};
var layerFilter = opt_options.layerFilter !== undefined ? var layerFilter = opt_options.layerFilter !== undefined ?
opt_options.layerFilter : ol.functions.TRUE; opt_options.layerFilter : ol.functions.TRUE;
var hitTolerance = opt_options.hitTolerance !== undefined ? var hitTolerance = opt_options.hitTolerance !== undefined ?
opt_options.hitTolerance * this.frameState_.pixelRatio : 0; opt_options.hitTolerance * this.frameState_.pixelRatio : 0;
return this.renderer_.hasFeatureAtCoordinate( return this.renderer_.hasFeatureAtCoordinate(
@@ -673,7 +673,7 @@ ol.Map.prototype.getEventPixel = function(event) {
*/ */
ol.Map.prototype.getTarget = function() { ol.Map.prototype.getTarget = function() {
return /** @type {Element|string|undefined} */ ( return /** @type {Element|string|undefined} */ (
this.get(ol.MapProperty.TARGET)); this.get(ol.MapProperty.TARGET));
}; };
@@ -1023,7 +1023,7 @@ ol.Map.prototype.handleTargetChanged_ = function() {
targetElement.appendChild(this.viewport_); targetElement.appendChild(this.viewport_);
var keyboardEventTarget = !this.keyboardEventTarget_ ? var keyboardEventTarget = !this.keyboardEventTarget_ ?
targetElement : this.keyboardEventTarget_; targetElement : this.keyboardEventTarget_;
this.keyHandlerKeys_ = [ this.keyHandlerKeys_ = [
ol.events.listen(keyboardEventTarget, ol.events.EventType.KEYDOWN, ol.events.listen(keyboardEventTarget, ol.events.EventType.KEYDOWN,
this.handleBrowserEvent, this), this.handleBrowserEvent, this),
@@ -1387,8 +1387,8 @@ ol.Map.createOptionsInternal = function(options) {
var keyboardEventTarget = null; var keyboardEventTarget = null;
if (options.keyboardEventTarget !== undefined) { if (options.keyboardEventTarget !== undefined) {
keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ? keyboardEventTarget = typeof options.keyboardEventTarget === 'string' ?
document.getElementById(options.keyboardEventTarget) : document.getElementById(options.keyboardEventTarget) :
options.keyboardEventTarget; options.keyboardEventTarget;
} }
/** /**
@@ -1414,13 +1414,13 @@ ol.Map.createOptionsInternal = function(options) {
} }
var layerGroup = (options.layers instanceof ol.layer.Group) ? var layerGroup = (options.layers instanceof ol.layer.Group) ?
options.layers : new ol.layer.Group({layers: options.layers}); options.layers : new ol.layer.Group({layers: options.layers});
values[ol.MapProperty.LAYERGROUP] = layerGroup; values[ol.MapProperty.LAYERGROUP] = layerGroup;
values[ol.MapProperty.TARGET] = options.target; values[ol.MapProperty.TARGET] = options.target;
values[ol.MapProperty.VIEW] = options.view !== undefined ? values[ol.MapProperty.VIEW] = options.view !== undefined ?
options.view : new ol.View(); options.view : new ol.View();
/** /**
* @type {function(new: ol.renderer.Map, Element, ol.Map)} * @type {function(new: ol.renderer.Map, Element, ol.Map)}

View File

@@ -50,7 +50,7 @@ ol.MapBrowserEventHandler = function(map, moveTolerance) {
* @private * @private
*/ */
this.moveTolerance_ = moveTolerance ? this.moveTolerance_ = moveTolerance ?
moveTolerance * ol.has.DEVICE_PIXEL_RATIO : ol.has.DEVICE_PIXEL_RATIO; moveTolerance * ol.has.DEVICE_PIXEL_RATIO : ol.has.DEVICE_PIXEL_RATIO;
/** /**
* The most recent "down" type event (or null if none have occurred). * The most recent "down" type event (or null if none have occurred).
@@ -165,13 +165,13 @@ ol.MapBrowserEventHandler.prototype.updateActivePointers_ = function(pointerEven
ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) { ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
this.updateActivePointers_(pointerEvent); this.updateActivePointers_(pointerEvent);
var newEvent = new ol.MapBrowserPointerEvent( var newEvent = new ol.MapBrowserPointerEvent(
ol.MapBrowserEventType.POINTERUP, this.map_, pointerEvent); ol.MapBrowserEventType.POINTERUP, this.map_, pointerEvent);
this.dispatchEvent(newEvent); this.dispatchEvent(newEvent);
// We emulate click events on left mouse button click, touch contact, and pen // We emulate click events on left mouse button click, touch contact, and pen
// contact. isMouseActionButton returns true in these cases (evt.button is set // contact. isMouseActionButton returns true in these cases (evt.button is set
// to 0). // to 0).
// See http://www.w3.org/TR/pointerevents/#button-states // See http://www.w3.org/TR/pointerevents/#button-states
if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) { if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) {
this.emulateClick_(this.down_); this.emulateClick_(this.down_);
} }
@@ -218,13 +218,13 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent)
new ol.pointer.PointerEventHandler(document); new ol.pointer.PointerEventHandler(document);
this.dragListenerKeys_.push( this.dragListenerKeys_.push(
ol.events.listen(this.documentPointerEventHandler_, ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEventType.POINTERMOVE, ol.MapBrowserEventType.POINTERMOVE,
this.handlePointerMove_, this), this.handlePointerMove_, this),
ol.events.listen(this.documentPointerEventHandler_, ol.events.listen(this.documentPointerEventHandler_,
ol.MapBrowserEventType.POINTERUP, ol.MapBrowserEventType.POINTERUP,
this.handlePointerUp_, this), this.handlePointerUp_, this),
/* Note that the listener for `pointercancel is set up on /* Note that the listener for `pointercancel is set up on
* `pointerEventHandler_` and not `documentPointerEventHandler_` like * `pointerEventHandler_` and not `documentPointerEventHandler_` like
* the `pointerup` and `pointermove` listeners. * the `pointerup` and `pointermove` listeners.
* *
@@ -237,9 +237,9 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ = function(pointerEvent)
* only receive a `touchcancel` from `pointerEventHandler_`, because it is * only receive a `touchcancel` from `pointerEventHandler_`, because it is
* only registered there. * only registered there.
*/ */
ol.events.listen(this.pointerEventHandler_, ol.events.listen(this.pointerEventHandler_,
ol.MapBrowserEventType.POINTERCANCEL, ol.MapBrowserEventType.POINTERCANCEL,
this.handlePointerUp_, this) this.handlePointerUp_, this)
); );
} }
}; };

View File

@@ -87,8 +87,8 @@ ol.Object.changeEventTypeCache_ = {};
*/ */
ol.Object.getChangeEventType = function(key) { ol.Object.getChangeEventType = function(key) {
return ol.Object.changeEventTypeCache_.hasOwnProperty(key) ? return ol.Object.changeEventTypeCache_.hasOwnProperty(key) ?
ol.Object.changeEventTypeCache_[key] : ol.Object.changeEventTypeCache_[key] :
(ol.Object.changeEventTypeCache_[key] = 'change:' + key); (ol.Object.changeEventTypeCache_[key] = 'change:' + key);
}; };

View File

@@ -46,7 +46,7 @@ ol.Overlay = function(options) {
* @type {boolean} * @type {boolean}
*/ */
this.insertFirst_ = options.insertFirst !== undefined ? this.insertFirst_ = options.insertFirst !== undefined ?
options.insertFirst : true; options.insertFirst : true;
/** /**
* @private * @private
@@ -73,14 +73,14 @@ ol.Overlay = function(options) {
* @type {olx.OverlayPanOptions} * @type {olx.OverlayPanOptions}
*/ */
this.autoPanAnimation_ = options.autoPanAnimation || this.autoPanAnimation_ = options.autoPanAnimation ||
/** @type {olx.OverlayPanOptions} */ ({}); /** @type {olx.OverlayPanOptions} */ ({});
/** /**
* @private * @private
* @type {number} * @type {number}
*/ */
this.autoPanMargin_ = options.autoPanMargin !== undefined ? this.autoPanMargin_ = options.autoPanMargin !== undefined ?
options.autoPanMargin : 20; options.autoPanMargin : 20;
/** /**
* @private * @private
@@ -131,8 +131,8 @@ ol.Overlay = function(options) {
this.setOffset(options.offset !== undefined ? options.offset : [0, 0]); this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);
this.setPositioning(options.positioning !== undefined ? this.setPositioning(options.positioning !== undefined ?
/** @type {ol.OverlayPositioning} */ (options.positioning) : /** @type {ol.OverlayPositioning} */ (options.positioning) :
ol.OverlayPositioning.TOP_LEFT); ol.OverlayPositioning.TOP_LEFT);
if (options.position !== undefined) { if (options.position !== undefined) {
this.setPosition(options.position); this.setPosition(options.position);
@@ -150,7 +150,7 @@ ol.inherits(ol.Overlay, ol.Object);
*/ */
ol.Overlay.prototype.getElement = function() { ol.Overlay.prototype.getElement = function() {
return /** @type {Element|undefined} */ ( return /** @type {Element|undefined} */ (
this.get(ol.Overlay.Property_.ELEMENT)); this.get(ol.Overlay.Property_.ELEMENT));
}; };
@@ -172,7 +172,7 @@ ol.Overlay.prototype.getId = function() {
*/ */
ol.Overlay.prototype.getMap = function() { ol.Overlay.prototype.getMap = function() {
return /** @type {ol.Map|undefined} */ ( return /** @type {ol.Map|undefined} */ (
this.get(ol.Overlay.Property_.MAP)); this.get(ol.Overlay.Property_.MAP));
}; };
@@ -184,7 +184,7 @@ ol.Overlay.prototype.getMap = function() {
*/ */
ol.Overlay.prototype.getOffset = function() { ol.Overlay.prototype.getOffset = function() {
return /** @type {Array.<number>} */ ( return /** @type {Array.<number>} */ (
this.get(ol.Overlay.Property_.OFFSET)); this.get(ol.Overlay.Property_.OFFSET));
}; };
@@ -197,7 +197,7 @@ ol.Overlay.prototype.getOffset = function() {
*/ */
ol.Overlay.prototype.getPosition = function() { ol.Overlay.prototype.getPosition = function() {
return /** @type {ol.Coordinate|undefined} */ ( return /** @type {ol.Coordinate|undefined} */ (
this.get(ol.Overlay.Property_.POSITION)); this.get(ol.Overlay.Property_.POSITION));
}; };
@@ -210,7 +210,7 @@ ol.Overlay.prototype.getPosition = function() {
*/ */
ol.Overlay.prototype.getPositioning = function() { ol.Overlay.prototype.getPositioning = function() {
return /** @type {ol.OverlayPositioning} */ ( return /** @type {ol.OverlayPositioning} */ (
this.get(ol.Overlay.Property_.POSITIONING)); this.get(ol.Overlay.Property_.POSITIONING));
}; };
@@ -241,7 +241,7 @@ ol.Overlay.prototype.handleMapChanged = function() {
ol.MapEventType.POSTRENDER, this.render, this); ol.MapEventType.POSTRENDER, this.render, this);
this.updatePixelPosition(); this.updatePixelPosition();
var container = this.stopEvent_ ? var container = this.stopEvent_ ?
map.getOverlayContainerStopEvent() : map.getOverlayContainer(); map.getOverlayContainerStopEvent() : map.getOverlayContainer();
if (this.insertFirst_) { if (this.insertFirst_) {
container.insertBefore(this.element_, container.childNodes[0] || null); container.insertBefore(this.element_, container.childNodes[0] || null);
} else { } else {

View File

@@ -140,7 +140,7 @@ ol.pointer.PointerEvent = function(type, originalEvent, opt_eventDict) {
* @type {Node} * @type {Node}
*/ */
this.relatedTarget = 'relatedTarget' in eventDict ? this.relatedTarget = 'relatedTarget' in eventDict ?
eventDict['relatedTarget'] : null; eventDict['relatedTarget'] : null;
// PointerEvent related properties // PointerEvent related properties

View File

@@ -221,27 +221,27 @@ ol.proj.addCoordinateTransforms = function(source, destination, forward, inverse
*/ */
ol.proj.createTransformFromCoordinateTransform = function(transform) { ol.proj.createTransformFromCoordinateTransform = function(transform) {
return ( return (
/** /**
* @param {Array.<number>} input Input. * @param {Array.<number>} input Input.
* @param {Array.<number>=} opt_output Output. * @param {Array.<number>=} opt_output Output.
* @param {number=} opt_dimension Dimension. * @param {number=} opt_dimension Dimension.
* @return {Array.<number>} Output. * @return {Array.<number>} Output.
*/ */
function(input, opt_output, opt_dimension) { function(input, opt_output, opt_dimension) {
var length = input.length; var length = input.length;
var dimension = opt_dimension !== undefined ? opt_dimension : 2; var dimension = opt_dimension !== undefined ? opt_dimension : 2;
var output = opt_output !== undefined ? opt_output : new Array(length); var output = opt_output !== undefined ? opt_output : new Array(length);
var point, i, j; var point, i, j;
for (i = 0; i < length; i += dimension) { for (i = 0; i < length; i += dimension) {
point = transform([input[i], input[i + 1]]); point = transform([input[i], input[i + 1]]);
output[i] = point[0]; output[i] = point[0];
output[i + 1] = point[1]; output[i + 1] = point[1];
for (j = dimension - 1; j >= 2; --j) { for (j = dimension - 1; j >= 2; --j) {
output[i + j] = input[i + j]; output[i + j] = input[i + j];
}
} }
return output; }
}); return output;
});
}; };

View File

@@ -36,63 +36,63 @@ goog.require('ol.proj.proj4');
* @api * @api
*/ */
ol.proj.Projection = function(options) { ol.proj.Projection = function(options) {
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.code_ = options.code; this.code_ = options.code;
/** /**
* @private * @private
* @type {ol.proj.Units} * @type {ol.proj.Units}
*/ */
this.units_ = /** @type {ol.proj.Units} */ (options.units); this.units_ = /** @type {ol.proj.Units} */ (options.units);
/** /**
* @private * @private
* @type {ol.Extent} * @type {ol.Extent}
*/ */
this.extent_ = options.extent !== undefined ? options.extent : null; this.extent_ = options.extent !== undefined ? options.extent : null;
/** /**
* @private * @private
* @type {ol.Extent} * @type {ol.Extent}
*/ */
this.worldExtent_ = options.worldExtent !== undefined ? this.worldExtent_ = options.worldExtent !== undefined ?
options.worldExtent : null; options.worldExtent : null;
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
this.axisOrientation_ = options.axisOrientation !== undefined ? this.axisOrientation_ = options.axisOrientation !== undefined ?
options.axisOrientation : 'enu'; options.axisOrientation : 'enu';
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.global_ = options.global !== undefined ? options.global : false; this.global_ = options.global !== undefined ? options.global : false;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
*/ */
this.canWrapX_ = !!(this.global_ && this.extent_); this.canWrapX_ = !!(this.global_ && this.extent_);
/** /**
* @private * @private
* @type {function(number, ol.Coordinate):number|undefined} * @type {function(number, ol.Coordinate):number|undefined}
*/ */
this.getPointResolutionFunc_ = options.getPointResolution; this.getPointResolutionFunc_ = options.getPointResolution;
/** /**
* @private * @private
* @type {ol.tilegrid.TileGrid} * @type {ol.tilegrid.TileGrid}
*/ */
this.defaultTileGrid_ = null; this.defaultTileGrid_ = null;
/** /**
* @private * @private
* @type {number|undefined} * @type {number|undefined}
*/ */

View File

@@ -125,10 +125,10 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu
var stride = pointGeometry.getStride(); var stride = pointGeometry.getStride();
var myBegin = this.coordinates.length; var myBegin = this.coordinates.length;
var myEnd = this.drawCoordinates_( var myEnd = this.drawCoordinates_(
flatCoordinates, 0, flatCoordinates.length, stride); flatCoordinates, 0, flatCoordinates.length, stride);
this.instructions.push([ this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_ this.scale_, this.snapToPixel_, this.width_
@@ -136,7 +136,7 @@ ol.render.canvas.ImageReplay.prototype.drawPoint = function(pointGeometry, featu
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_, this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_ this.scale_, this.snapToPixel_, this.width_
@@ -157,10 +157,10 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome
var stride = multiPointGeometry.getStride(); var stride = multiPointGeometry.getStride();
var myBegin = this.coordinates.length; var myBegin = this.coordinates.length;
var myEnd = this.drawCoordinates_( var myEnd = this.drawCoordinates_(
flatCoordinates, 0, flatCoordinates.length, stride); flatCoordinates, 0, flatCoordinates.length, stride);
this.instructions.push([ this.instructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, this.image_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_ this.scale_, this.snapToPixel_, this.width_
@@ -168,7 +168,7 @@ ol.render.canvas.ImageReplay.prototype.drawMultiPoint = function(multiPointGeome
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd, ol.render.canvas.Instruction.DRAW_IMAGE, myBegin, myEnd,
this.hitDetectionImage_, this.hitDetectionImage_,
// Remaining arguments to DRAW_IMAGE are in alphabetical order // Remaining arguments to DRAW_IMAGE are in alphabetical order
this.anchorX_, this.anchorY_, this.height_, this.opacity_, this.anchorX_, this.anchorY_, this.height_, this.opacity_,
this.originX_, this.originY_, this.rotateWithView_, this.rotation_, this.originX_, this.originY_, this.rotateWithView_, this.rotation_,
this.scale_, this.snapToPixel_, this.width_ this.scale_, this.snapToPixel_, this.width_

View File

@@ -822,7 +822,7 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle = function(fillStyle, st
var fillStyleColor = fillStyle.getColor(); var fillStyleColor = fillStyle.getColor();
this.fillState_ = { this.fillState_ = {
fillStyle: ol.colorlike.asColorLike(fillStyleColor ? fillStyle: ol.colorlike.asColorLike(fillStyleColor ?
fillStyleColor : ol.render.canvas.defaultFillStyle) fillStyleColor : ol.render.canvas.defaultFillStyle)
}; };
} }
if (!strokeStyle) { if (!strokeStyle) {
@@ -837,19 +837,19 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle = function(fillStyle, st
var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
this.strokeState_ = { this.strokeState_ = {
lineCap: strokeStyleLineCap !== undefined ? lineCap: strokeStyleLineCap !== undefined ?
strokeStyleLineCap : ol.render.canvas.defaultLineCap, strokeStyleLineCap : ol.render.canvas.defaultLineCap,
lineDash: strokeStyleLineDash ? lineDash: strokeStyleLineDash ?
strokeStyleLineDash : ol.render.canvas.defaultLineDash, strokeStyleLineDash : ol.render.canvas.defaultLineDash,
lineDashOffset: strokeStyleLineDashOffset ? lineDashOffset: strokeStyleLineDashOffset ?
strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset, strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset,
lineJoin: strokeStyleLineJoin !== undefined ? lineJoin: strokeStyleLineJoin !== undefined ?
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin, strokeStyleLineJoin : ol.render.canvas.defaultLineJoin,
lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ? lineWidth: this.pixelRatio_ * (strokeStyleWidth !== undefined ?
strokeStyleWidth : ol.render.canvas.defaultLineWidth), strokeStyleWidth : ol.render.canvas.defaultLineWidth),
miterLimit: strokeStyleMiterLimit !== undefined ? miterLimit: strokeStyleMiterLimit !== undefined ?
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit, strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
strokeStyle: ol.colorlike.asColorLike(strokeStyleColor ? strokeStyle: ol.colorlike.asColorLike(strokeStyleColor ?
strokeStyleColor : ol.render.canvas.defaultStrokeStyle) strokeStyleColor : ol.render.canvas.defaultStrokeStyle)
}; };
} }
}; };
@@ -905,7 +905,7 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
var textFillStyleColor = textFillStyle.getColor(); var textFillStyleColor = textFillStyle.getColor();
this.textFillState_ = { this.textFillState_ = {
fillStyle: ol.colorlike.asColorLike(textFillStyleColor ? fillStyle: ol.colorlike.asColorLike(textFillStyleColor ?
textFillStyleColor : ol.render.canvas.defaultFillStyle) textFillStyleColor : ol.render.canvas.defaultFillStyle)
}; };
} }
var textStrokeStyle = textStyle.getStroke(); var textStrokeStyle = textStyle.getStroke();
@@ -921,19 +921,19 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit(); var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
this.textStrokeState_ = { this.textStrokeState_ = {
lineCap: textStrokeStyleLineCap !== undefined ? lineCap: textStrokeStyleLineCap !== undefined ?
textStrokeStyleLineCap : ol.render.canvas.defaultLineCap, textStrokeStyleLineCap : ol.render.canvas.defaultLineCap,
lineDash: textStrokeStyleLineDash ? lineDash: textStrokeStyleLineDash ?
textStrokeStyleLineDash : ol.render.canvas.defaultLineDash, textStrokeStyleLineDash : ol.render.canvas.defaultLineDash,
lineDashOffset: textStrokeStyleLineDashOffset ? lineDashOffset: textStrokeStyleLineDashOffset ?
textStrokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset, textStrokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset,
lineJoin: textStrokeStyleLineJoin !== undefined ? lineJoin: textStrokeStyleLineJoin !== undefined ?
textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin, textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin,
lineWidth: textStrokeStyleWidth !== undefined ? lineWidth: textStrokeStyleWidth !== undefined ?
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth, textStrokeStyleWidth : ol.render.canvas.defaultLineWidth,
miterLimit: textStrokeStyleMiterLimit !== undefined ? miterLimit: textStrokeStyleMiterLimit !== undefined ?
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit, textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
strokeStyle: ol.colorlike.asColorLike(textStrokeStyleColor ? strokeStyle: ol.colorlike.asColorLike(textStrokeStyleColor ?
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle) textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle)
}; };
} }
var textFont = textStyle.getFont(); var textFont = textStyle.getFont();
@@ -947,11 +947,11 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
var textTextBaseline = textStyle.getTextBaseline(); var textTextBaseline = textStyle.getTextBaseline();
this.textState_ = { this.textState_ = {
font: textFont !== undefined ? font: textFont !== undefined ?
textFont : ol.render.canvas.defaultFont, textFont : ol.render.canvas.defaultFont,
textAlign: textTextAlign !== undefined ? textAlign: textTextAlign !== undefined ?
textTextAlign : ol.render.canvas.defaultTextAlign, textTextAlign : ol.render.canvas.defaultTextAlign,
textBaseline: textTextBaseline !== undefined ? textBaseline: textTextBaseline !== undefined ?
textTextBaseline : ol.render.canvas.defaultTextBaseline textTextBaseline : ol.render.canvas.defaultTextBaseline
}; };
this.text_ = textText !== undefined ? textText : ''; this.text_ = textText !== undefined ? textText : '';
this.textOffsetX_ = this.textOffsetX_ =
@@ -961,6 +961,6 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
this.textRotateWithView_ = textRotateWithView !== undefined ? textRotateWithView : false; this.textRotateWithView_ = textRotateWithView !== undefined ? textRotateWithView : false;
this.textRotation_ = textRotation !== undefined ? textRotation : 0; this.textRotation_ = textRotation !== undefined ? textRotation : 0;
this.textScale_ = this.pixelRatio_ * (textScale !== undefined ? this.textScale_ = this.pixelRatio_ * (textScale !== undefined ?
textScale : 1); textScale : 1);
} }
}; };

View File

@@ -222,25 +222,25 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() {
ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) { ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle = function(fillStyle, strokeStyle) {
var strokeStyleColor = strokeStyle.getColor(); var strokeStyleColor = strokeStyle.getColor();
this.state_.strokeStyle = ol.colorlike.asColorLike(strokeStyleColor ? this.state_.strokeStyle = ol.colorlike.asColorLike(strokeStyleColor ?
strokeStyleColor : ol.render.canvas.defaultStrokeStyle); strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
var strokeStyleLineCap = strokeStyle.getLineCap(); var strokeStyleLineCap = strokeStyle.getLineCap();
this.state_.lineCap = strokeStyleLineCap !== undefined ? this.state_.lineCap = strokeStyleLineCap !== undefined ?
strokeStyleLineCap : ol.render.canvas.defaultLineCap; strokeStyleLineCap : ol.render.canvas.defaultLineCap;
var strokeStyleLineDash = strokeStyle.getLineDash(); var strokeStyleLineDash = strokeStyle.getLineDash();
this.state_.lineDash = strokeStyleLineDash ? this.state_.lineDash = strokeStyleLineDash ?
strokeStyleLineDash : ol.render.canvas.defaultLineDash; strokeStyleLineDash : ol.render.canvas.defaultLineDash;
var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset(); var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
this.state_.lineDashOffset = strokeStyleLineDashOffset ? this.state_.lineDashOffset = strokeStyleLineDashOffset ?
strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset; strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset;
var strokeStyleLineJoin = strokeStyle.getLineJoin(); var strokeStyleLineJoin = strokeStyle.getLineJoin();
this.state_.lineJoin = strokeStyleLineJoin !== undefined ? this.state_.lineJoin = strokeStyleLineJoin !== undefined ?
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin; strokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
var strokeStyleWidth = strokeStyle.getWidth(); var strokeStyleWidth = strokeStyle.getWidth();
this.state_.lineWidth = strokeStyleWidth !== undefined ? this.state_.lineWidth = strokeStyleWidth !== undefined ?
strokeStyleWidth : ol.render.canvas.defaultLineWidth; strokeStyleWidth : ol.render.canvas.defaultLineWidth;
var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
this.state_.miterLimit = strokeStyleMiterLimit !== undefined ? this.state_.miterLimit = strokeStyleMiterLimit !== undefined ?
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
if (this.state_.lineWidth > this.maxLineWidth) { if (this.state_.lineWidth > this.maxLineWidth) {
this.maxLineWidth = this.state_.lineWidth; this.maxLineWidth = this.state_.lineWidth;

View File

@@ -178,7 +178,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygon = function(polygonGeometry,
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.SET_FILL_STYLE, ol.render.canvas.Instruction.SET_FILL_STYLE,
ol.color.asString(ol.render.canvas.defaultFillStyle)] ol.color.asString(ol.render.canvas.defaultFillStyle)]
); );
if (state.strokeStyle !== undefined) { if (state.strokeStyle !== undefined) {
this.hitDetectionInstructions.push([ this.hitDetectionInstructions.push([
ol.render.canvas.Instruction.SET_STROKE_STYLE, ol.render.canvas.Instruction.SET_STROKE_STYLE,
@@ -275,32 +275,32 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle = function(fillStyle
if (fillStyle) { if (fillStyle) {
var fillStyleColor = fillStyle.getColor(); var fillStyleColor = fillStyle.getColor();
state.fillStyle = ol.colorlike.asColorLike(fillStyleColor ? state.fillStyle = ol.colorlike.asColorLike(fillStyleColor ?
fillStyleColor : ol.render.canvas.defaultFillStyle); fillStyleColor : ol.render.canvas.defaultFillStyle);
} else { } else {
state.fillStyle = undefined; state.fillStyle = undefined;
} }
if (strokeStyle) { if (strokeStyle) {
var strokeStyleColor = strokeStyle.getColor(); var strokeStyleColor = strokeStyle.getColor();
state.strokeStyle = ol.colorlike.asColorLike(strokeStyleColor ? state.strokeStyle = ol.colorlike.asColorLike(strokeStyleColor ?
strokeStyleColor : ol.render.canvas.defaultStrokeStyle); strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
var strokeStyleLineCap = strokeStyle.getLineCap(); var strokeStyleLineCap = strokeStyle.getLineCap();
state.lineCap = strokeStyleLineCap !== undefined ? state.lineCap = strokeStyleLineCap !== undefined ?
strokeStyleLineCap : ol.render.canvas.defaultLineCap; strokeStyleLineCap : ol.render.canvas.defaultLineCap;
var strokeStyleLineDash = strokeStyle.getLineDash(); var strokeStyleLineDash = strokeStyle.getLineDash();
state.lineDash = strokeStyleLineDash ? state.lineDash = strokeStyleLineDash ?
strokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash; strokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash;
var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset(); var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
state.lineDashOffset = strokeStyleLineDashOffset ? state.lineDashOffset = strokeStyleLineDashOffset ?
strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset; strokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset;
var strokeStyleLineJoin = strokeStyle.getLineJoin(); var strokeStyleLineJoin = strokeStyle.getLineJoin();
state.lineJoin = strokeStyleLineJoin !== undefined ? state.lineJoin = strokeStyleLineJoin !== undefined ?
strokeStyleLineJoin : ol.render.canvas.defaultLineJoin; strokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
var strokeStyleWidth = strokeStyle.getWidth(); var strokeStyleWidth = strokeStyle.getWidth();
state.lineWidth = strokeStyleWidth !== undefined ? state.lineWidth = strokeStyleWidth !== undefined ?
strokeStyleWidth : ol.render.canvas.defaultLineWidth; strokeStyleWidth : ol.render.canvas.defaultLineWidth;
var strokeStyleMiterLimit = strokeStyle.getMiterLimit(); var strokeStyleMiterLimit = strokeStyle.getMiterLimit();
state.miterLimit = strokeStyleMiterLimit !== undefined ? state.miterLimit = strokeStyleMiterLimit !== undefined ?
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
if (state.lineWidth > this.maxLineWidth) { if (state.lineWidth > this.maxLineWidth) {
this.maxLineWidth = state.lineWidth; this.maxLineWidth = state.lineWidth;

View File

@@ -473,7 +473,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
break; break;
case ol.render.canvas.Instruction.SET_STROKE_STYLE: case ol.render.canvas.Instruction.SET_STROKE_STYLE:
var usePixelRatio = instruction[8] !== undefined ? var usePixelRatio = instruction[8] !== undefined ?
instruction[8] : true; instruction[8] : true;
var renderedPixelRatio = instruction[9]; var renderedPixelRatio = instruction[9];
var lineWidth = /** @type {number} */ (instruction[2]); var lineWidth = /** @type {number} */ (instruction[2]);

View File

@@ -239,7 +239,7 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
} else { } else {
var textFillStyleColor = textFillStyle.getColor(); var textFillStyleColor = textFillStyle.getColor();
var fillStyle = ol.colorlike.asColorLike(textFillStyleColor ? var fillStyle = ol.colorlike.asColorLike(textFillStyleColor ?
textFillStyleColor : ol.render.canvas.defaultFillStyle); textFillStyleColor : ol.render.canvas.defaultFillStyle);
if (!this.textFillState_) { if (!this.textFillState_) {
this.textFillState_ = { this.textFillState_ = {
fillStyle: fillStyle fillStyle: fillStyle
@@ -261,19 +261,19 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
var textStrokeStyleWidth = textStrokeStyle.getWidth(); var textStrokeStyleWidth = textStrokeStyle.getWidth();
var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit(); var textStrokeStyleMiterLimit = textStrokeStyle.getMiterLimit();
var lineCap = textStrokeStyleLineCap !== undefined ? var lineCap = textStrokeStyleLineCap !== undefined ?
textStrokeStyleLineCap : ol.render.canvas.defaultLineCap; textStrokeStyleLineCap : ol.render.canvas.defaultLineCap;
var lineDash = textStrokeStyleLineDash ? var lineDash = textStrokeStyleLineDash ?
textStrokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash; textStrokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash;
var lineDashOffset = textStrokeStyleLineDashOffset !== undefined ? var lineDashOffset = textStrokeStyleLineDashOffset !== undefined ?
textStrokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset; textStrokeStyleLineDashOffset : ol.render.canvas.defaultLineDashOffset;
var lineJoin = textStrokeStyleLineJoin !== undefined ? var lineJoin = textStrokeStyleLineJoin !== undefined ?
textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin; textStrokeStyleLineJoin : ol.render.canvas.defaultLineJoin;
var lineWidth = textStrokeStyleWidth !== undefined ? var lineWidth = textStrokeStyleWidth !== undefined ?
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth; textStrokeStyleWidth : ol.render.canvas.defaultLineWidth;
var miterLimit = textStrokeStyleMiterLimit !== undefined ? var miterLimit = textStrokeStyleMiterLimit !== undefined ?
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit; textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
var strokeStyle = ol.colorlike.asColorLike(textStrokeStyleColor ? var strokeStyle = ol.colorlike.asColorLike(textStrokeStyleColor ?
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle); textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle);
if (!this.textStrokeState_) { if (!this.textStrokeState_) {
this.textStrokeState_ = { this.textStrokeState_ = {
lineCap: lineCap, lineCap: lineCap,
@@ -305,11 +305,11 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
var textTextAlign = textStyle.getTextAlign(); var textTextAlign = textStyle.getTextAlign();
var textTextBaseline = textStyle.getTextBaseline(); var textTextBaseline = textStyle.getTextBaseline();
var font = textFont !== undefined ? var font = textFont !== undefined ?
textFont : ol.render.canvas.defaultFont; textFont : ol.render.canvas.defaultFont;
var textAlign = textTextAlign !== undefined ? var textAlign = textTextAlign !== undefined ?
textTextAlign : ol.render.canvas.defaultTextAlign; textTextAlign : ol.render.canvas.defaultTextAlign;
var textBaseline = textTextBaseline !== undefined ? var textBaseline = textTextBaseline !== undefined ?
textTextBaseline : ol.render.canvas.defaultTextBaseline; textTextBaseline : ol.render.canvas.defaultTextBaseline;
if (!this.textState_) { if (!this.textState_) {
this.textState_ = { this.textState_ = {
font: font, font: font,

View File

@@ -84,9 +84,9 @@ ol.render.Feature.prototype.getEnds = function() {
ol.render.Feature.prototype.getExtent = function() { ol.render.Feature.prototype.getExtent = function() {
if (!this.extent_) { if (!this.extent_) {
this.extent_ = this.type_ === ol.geom.GeometryType.POINT ? this.extent_ = this.type_ === ol.geom.GeometryType.POINT ?
ol.extent.createOrUpdateFromCoordinate(this.flatCoordinates_) : ol.extent.createOrUpdateFromCoordinate(this.flatCoordinates_) :
ol.extent.createOrUpdateFromFlatCoordinates( ol.extent.createOrUpdateFromFlatCoordinates(
this.flatCoordinates_, 0, this.flatCoordinates_.length, 2); this.flatCoordinates_, 0, this.flatCoordinates_.length, 2);
} }
return this.extent_; return this.extent_;

View File

@@ -70,7 +70,7 @@ if (ol.ENABLE_WEBGL) {
ol.render.webgl.triangleIsCounterClockwise = function(x1, y1, x2, y2, x3, y3) { ol.render.webgl.triangleIsCounterClockwise = function(x1, y1, x2, y2, x3, y3) {
var area = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1); var area = (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
return (area <= ol.render.webgl.EPSILON && area >= -ol.render.webgl.EPSILON) ? return (area <= ol.render.webgl.EPSILON && area >= -ol.render.webgl.EPSILON) ?
undefined : area > 0; undefined : area > 0;
}; };
/** /**

View File

@@ -381,10 +381,10 @@ if (ol.ENABLE_WEBGL) {
if (strokeStyle) { if (strokeStyle) {
var strokeStyleLineDash = strokeStyle.getLineDash(); var strokeStyleLineDash = strokeStyle.getLineDash();
this.state_.lineDash = strokeStyleLineDash ? this.state_.lineDash = strokeStyleLineDash ?
strokeStyleLineDash : ol.render.webgl.defaultLineDash; strokeStyleLineDash : ol.render.webgl.defaultLineDash;
var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset(); var strokeStyleLineDashOffset = strokeStyle.getLineDashOffset();
this.state_.lineDashOffset = strokeStyleLineDashOffset ? this.state_.lineDashOffset = strokeStyleLineDashOffset ?
strokeStyleLineDashOffset : ol.render.webgl.defaultLineDashOffset; strokeStyleLineDashOffset : ol.render.webgl.defaultLineDashOffset;
strokeStyleColor = strokeStyle.getColor(); strokeStyleColor = strokeStyle.getColor();
if (!(strokeStyleColor instanceof CanvasGradient) && if (!(strokeStyleColor instanceof CanvasGradient) &&
!(strokeStyleColor instanceof CanvasPattern)) { !(strokeStyleColor instanceof CanvasPattern)) {
@@ -396,7 +396,7 @@ if (ol.ENABLE_WEBGL) {
} }
strokeStyleWidth = strokeStyle.getWidth(); strokeStyleWidth = strokeStyle.getWidth();
strokeStyleWidth = strokeStyleWidth !== undefined ? strokeStyleWidth = strokeStyleWidth !== undefined ?
strokeStyleWidth : ol.render.webgl.defaultLineWidth; strokeStyleWidth : ol.render.webgl.defaultLineWidth;
} else { } else {
strokeStyleColor = [0, 0, 0, 0]; strokeStyleColor = [0, 0, 0, 0];
strokeStyleWidth = 0; strokeStyleWidth = 0;

View File

@@ -38,8 +38,8 @@ if (ol.ENABLE_WEBGL) {
* @type {string} * @type {string}
*/ */
ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ? ol.render.webgl.circlereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.circlereplay.defaultshader.Fragment.DEBUG_SOURCE : ol.render.webgl.circlereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.circlereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment(); ol.render.webgl.circlereplay.defaultshader.fragment = new ol.render.webgl.circlereplay.defaultshader.Fragment();
@@ -75,8 +75,8 @@ if (ol.ENABLE_WEBGL) {
* @type {string} * @type {string}
*/ */
ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ? ol.render.webgl.circlereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.circlereplay.defaultshader.Vertex.DEBUG_SOURCE : ol.render.webgl.circlereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.circlereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex(); ol.render.webgl.circlereplay.defaultshader.vertex = new ol.render.webgl.circlereplay.defaultshader.Vertex();

View File

@@ -497,12 +497,12 @@ if (ol.ENABLE_WEBGL) {
} }
// continue with the next feature // continue with the next feature
start = (featureIndex === this.startIndices.length - 1) ? start = (featureIndex === this.startIndices.length - 1) ?
groupEnd : this.startIndices[featureIndex + 1]; groupEnd : this.startIndices[featureIndex + 1];
end = start; end = start;
} else { } else {
// the feature is not skipped, augment the end index // the feature is not skipped, augment the end index
end = (featureIndex === this.startIndices.length - 1) ? end = (featureIndex === this.startIndices.length - 1) ?
groupEnd : this.startIndices[featureIndex + 1]; groupEnd : this.startIndices[featureIndex + 1];
} }
featureIndex++; featureIndex++;
} }

View File

@@ -38,8 +38,8 @@ if (ol.ENABLE_WEBGL) {
* @type {string} * @type {string}
*/ */
ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ? ol.render.webgl.imagereplay.defaultshader.Fragment.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.imagereplay.defaultshader.Fragment.DEBUG_SOURCE : ol.render.webgl.imagereplay.defaultshader.Fragment.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE; ol.render.webgl.imagereplay.defaultshader.Fragment.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment(); ol.render.webgl.imagereplay.defaultshader.fragment = new ol.render.webgl.imagereplay.defaultshader.Fragment();
@@ -75,8 +75,8 @@ if (ol.ENABLE_WEBGL) {
* @type {string} * @type {string}
*/ */
ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ? ol.render.webgl.imagereplay.defaultshader.Vertex.SOURCE = ol.DEBUG_WEBGL ?
ol.render.webgl.imagereplay.defaultshader.Vertex.DEBUG_SOURCE : ol.render.webgl.imagereplay.defaultshader.Vertex.DEBUG_SOURCE :
ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE; ol.render.webgl.imagereplay.defaultshader.Vertex.OPTIMIZED_SOURCE;
ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex(); ol.render.webgl.imagereplay.defaultshader.vertex = new ol.render.webgl.imagereplay.defaultshader.Vertex();

View File

@@ -171,7 +171,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.ImageReplay} */ ( var replay = /** @type {ol.render.webgl.ImageReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.IMAGE)); replayGroup.getReplay(0, ol.render.ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
replay.drawPoint(geometry, data); replay.drawPoint(geometry, data);
replay.finish(context); replay.finish(context);
@@ -194,7 +194,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.ImageReplay} */ ( var replay = /** @type {ol.render.webgl.ImageReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.IMAGE)); replayGroup.getReplay(0, ol.render.ReplayType.IMAGE));
replay.setImageStyle(this.imageStyle_); replay.setImageStyle(this.imageStyle_);
replay.drawMultiPoint(geometry, data); replay.drawMultiPoint(geometry, data);
replay.finish(context); replay.finish(context);
@@ -216,7 +216,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.LineStringReplay} */ ( var replay = /** @type {ol.render.webgl.LineStringReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.LINE_STRING)); replayGroup.getReplay(0, ol.render.ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
replay.drawLineString(geometry, data); replay.drawLineString(geometry, data);
replay.finish(context); replay.finish(context);
@@ -238,7 +238,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.LineStringReplay} */ ( var replay = /** @type {ol.render.webgl.LineStringReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.LINE_STRING)); replayGroup.getReplay(0, ol.render.ReplayType.LINE_STRING));
replay.setFillStrokeStyle(null, this.strokeStyle_); replay.setFillStrokeStyle(null, this.strokeStyle_);
replay.drawMultiLineString(geometry, data); replay.drawMultiLineString(geometry, data);
replay.finish(context); replay.finish(context);
@@ -260,7 +260,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.PolygonReplay} */ ( var replay = /** @type {ol.render.webgl.PolygonReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.POLYGON)); replayGroup.getReplay(0, ol.render.ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawPolygon(geometry, data); replay.drawPolygon(geometry, data);
replay.finish(context); replay.finish(context);
@@ -282,7 +282,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.PolygonReplay} */ ( var replay = /** @type {ol.render.webgl.PolygonReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.POLYGON)); replayGroup.getReplay(0, ol.render.ReplayType.POLYGON));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawMultiPolygon(geometry, data); replay.drawMultiPolygon(geometry, data);
replay.finish(context); replay.finish(context);
@@ -304,7 +304,7 @@ if (ol.ENABLE_WEBGL) {
var context = this.context_; var context = this.context_;
var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_); var replayGroup = new ol.render.webgl.ReplayGroup(1, this.extent_);
var replay = /** @type {ol.render.webgl.CircleReplay} */ ( var replay = /** @type {ol.render.webgl.CircleReplay} */ (
replayGroup.getReplay(0, ol.render.ReplayType.CIRCLE)); replayGroup.getReplay(0, ol.render.ReplayType.CIRCLE));
replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_); replay.setFillStrokeStyle(this.fillStyle_, this.strokeStyle_);
replay.drawCircle(geometry, data); replay.drawCircle(geometry, data);
replay.finish(context); replay.finish(context);

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