Merge pull request #4192 from marcjansen/simpler-no-is-null
Remove use of goog.isNull in favor of simple truthy checks
This commit is contained in:
@@ -115,7 +115,7 @@ ol.animation.rotate = function(options) {
|
||||
(sourceRotation - frameState.viewState.rotation) * delta;
|
||||
frameState.animate = true;
|
||||
frameState.viewState.rotation += deltaRotation;
|
||||
if (!goog.isNull(anchor)) {
|
||||
if (anchor) {
|
||||
var center = frameState.viewState.center;
|
||||
ol.coordinate.sub(center, anchor);
|
||||
ol.coordinate.rotate(center, deltaRotation);
|
||||
|
||||
@@ -61,7 +61,7 @@ ol.Attribution.prototype.getHTML = function() {
|
||||
*/
|
||||
ol.Attribution.prototype.intersectsAnyTileRange =
|
||||
function(tileRanges, tileGrid, projection) {
|
||||
if (goog.isNull(this.tileRanges_)) {
|
||||
if (!this.tileRanges_) {
|
||||
return true;
|
||||
}
|
||||
var i, ii, tileRange, zKey;
|
||||
|
||||
@@ -164,15 +164,15 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
|
||||
/** @type {Object.<string, ol.Attribution>} */
|
||||
var hiddenAttributions = {};
|
||||
var projection = frameState.viewState.projection;
|
||||
goog.asserts.assert(!goog.isNull(projection), 'projection cannot be null');
|
||||
goog.asserts.assert(projection, 'projection of viewState required');
|
||||
for (i = 0, ii = layerStatesArray.length; i < ii; i++) {
|
||||
source = layerStatesArray[i].layer.getSource();
|
||||
if (goog.isNull(source)) {
|
||||
if (!source) {
|
||||
continue;
|
||||
}
|
||||
sourceKey = goog.getUid(source).toString();
|
||||
sourceAttributions = source.getAttributions();
|
||||
if (goog.isNull(sourceAttributions)) {
|
||||
if (!sourceAttributions) {
|
||||
continue;
|
||||
}
|
||||
for (j = 0, jj = sourceAttributions.length; j < jj; j++) {
|
||||
@@ -186,7 +186,7 @@ ol.control.Attribution.prototype.getSourceAttributions = function(frameState) {
|
||||
goog.asserts.assertInstanceof(source, ol.source.Tile,
|
||||
'source should be an ol.source.Tile');
|
||||
var tileGrid = source.getTileGridForProjection(projection);
|
||||
goog.asserts.assert(!goog.isNull(tileGrid), 'tileGrid cannot be null');
|
||||
goog.asserts.assert(tileGrid, 'tileGrid required for projection');
|
||||
intersectsTileRange = sourceAttribution.intersectsAnyTileRange(
|
||||
tileRanges, tileGrid, projection);
|
||||
} else {
|
||||
@@ -223,7 +223,7 @@ ol.control.Attribution.render = function(mapEvent) {
|
||||
*/
|
||||
ol.control.Attribution.prototype.updateElement_ = function(frameState) {
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.element, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -105,7 +105,7 @@ ol.control.Control.prototype.getMap = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.control.Control.prototype.setMap = function(map) {
|
||||
if (!goog.isNull(this.map_)) {
|
||||
if (this.map_) {
|
||||
goog.dom.removeNode(this.element);
|
||||
}
|
||||
if (this.listenerKeys.length > 0) {
|
||||
@@ -113,8 +113,8 @@ ol.control.Control.prototype.setMap = function(map) {
|
||||
this.listenerKeys.length = 0;
|
||||
}
|
||||
this.map_ = map;
|
||||
if (!goog.isNull(this.map_)) {
|
||||
var target = !goog.isNull(this.target_) ?
|
||||
if (this.map_) {
|
||||
var target = this.target_ ?
|
||||
this.target_ : map.getOverlayContainerStopEvent();
|
||||
goog.dom.appendChild(target, this.element);
|
||||
if (this.render !== ol.nullFunction) {
|
||||
|
||||
@@ -107,7 +107,7 @@ ol.control.FullScreen.prototype.handleFullScreen_ = function() {
|
||||
return;
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (goog.isNull(map)) {
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
if (goog.dom.fullscreen.isFullScreen()) {
|
||||
@@ -141,7 +141,7 @@ ol.control.FullScreen.prototype.handleFullScreenChange_ = function() {
|
||||
goog.dom.classlist.swap(button, opened, closed);
|
||||
goog.dom.replaceNode(this.labelNode_, this.labelActiveNode_);
|
||||
}
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
map.updateSize();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ goog.inherits(ol.control.MousePosition, ol.control.Control);
|
||||
*/
|
||||
ol.control.MousePosition.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
this.mapProjection_ = null;
|
||||
} else {
|
||||
if (this.mapProjection_ != frameState.viewState.projection) {
|
||||
@@ -182,7 +182,7 @@ ol.control.MousePosition.prototype.handleMouseOut = function(browserEvent) {
|
||||
*/
|
||||
ol.control.MousePosition.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
var viewport = map.getViewport();
|
||||
this.listenerKeys.push(
|
||||
goog.events.listen(viewport, goog.events.EventType.MOUSEMOVE,
|
||||
@@ -224,8 +224,8 @@ ol.control.MousePosition.prototype.setProjection = function(projection) {
|
||||
*/
|
||||
ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
var html = this.undefinedHTML_;
|
||||
if (!goog.isNull(pixel) && !goog.isNull(this.mapProjection_)) {
|
||||
if (goog.isNull(this.transform_)) {
|
||||
if (pixel && this.mapProjection_) {
|
||||
if (!this.transform_) {
|
||||
var projection = this.getProjection();
|
||||
if (projection) {
|
||||
this.transform_ = ol.proj.getTransformFromProjections(
|
||||
@@ -236,7 +236,7 @@ ol.control.MousePosition.prototype.updateHTML_ = function(pixel) {
|
||||
}
|
||||
var map = this.getMap();
|
||||
var coordinate = map.getCoordinateFromPixel(pixel);
|
||||
if (!goog.isNull(coordinate)) {
|
||||
if (coordinate) {
|
||||
this.transform_(coordinate, coordinate);
|
||||
var coordinateFormat = this.getCoordinateFormat();
|
||||
if (coordinateFormat) {
|
||||
|
||||
@@ -113,7 +113,7 @@ ol.control.Rotate.prototype.handleClick_ = function(event) {
|
||||
ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (goog.isNull(view)) {
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
@@ -147,7 +147,7 @@ ol.control.Rotate.prototype.resetNorth_ = function() {
|
||||
*/
|
||||
ol.control.Rotate.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return;
|
||||
}
|
||||
var rotation = frameState.viewState.rotation;
|
||||
|
||||
@@ -160,7 +160,7 @@ ol.control.ScaleLine.prototype.getUnits = function() {
|
||||
*/
|
||||
ol.control.ScaleLine.render = function(mapEvent) {
|
||||
var frameState = mapEvent.frameState;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
this.viewState_ = null;
|
||||
} else {
|
||||
this.viewState_ = frameState.viewState;
|
||||
@@ -194,7 +194,7 @@ ol.control.ScaleLine.prototype.setUnits = function(units) {
|
||||
ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
var viewState = this.viewState_;
|
||||
|
||||
if (goog.isNull(viewState)) {
|
||||
if (!viewState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.element_, false);
|
||||
this.renderedVisible_ = false;
|
||||
@@ -226,7 +226,7 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
|
||||
units == ol.control.ScaleLineUnits.DEGREES) {
|
||||
|
||||
// Convert pointResolution from other units to degrees
|
||||
if (goog.isNull(this.toEPSG4326_)) {
|
||||
if (!this.toEPSG4326_) {
|
||||
this.toEPSG4326_ = ol.proj.getTransformFromProjections(
|
||||
projection, ol.proj.get('EPSG:4326'));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ ol.control.Zoom.prototype.handleClick_ = function(delta, event) {
|
||||
ol.control.Zoom.prototype.zoomByDelta_ = function(delta) {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
if (goog.isNull(view)) {
|
||||
if (!view) {
|
||||
// the map does not have a view, so we can't act
|
||||
// upon it
|
||||
return;
|
||||
|
||||
@@ -130,7 +130,7 @@ ol.control.ZoomSlider.direction = {
|
||||
*/
|
||||
ol.control.ZoomSlider.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
map.render();
|
||||
}
|
||||
};
|
||||
@@ -179,7 +179,7 @@ ol.control.ZoomSlider.prototype.initSlider_ = function() {
|
||||
* @api
|
||||
*/
|
||||
ol.control.ZoomSlider.render = function(mapEvent) {
|
||||
if (goog.isNull(mapEvent.frameState)) {
|
||||
if (!mapEvent.frameState) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(mapEvent.frameState.viewState,
|
||||
|
||||
@@ -71,7 +71,7 @@ ol.control.ZoomToExtent.prototype.handleClick_ = function(event) {
|
||||
ol.control.ZoomToExtent.prototype.handleZoomToExtent_ = function() {
|
||||
var map = this.getMap();
|
||||
var view = map.getView();
|
||||
var extent = goog.isNull(this.extent_) ?
|
||||
var extent = !this.extent_ ?
|
||||
view.getProjection().getExtent() : this.extent_;
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(size, 'size should be defined');
|
||||
|
||||
@@ -208,10 +208,10 @@ ol.DeviceOrientation.prototype.getTracking = function() {
|
||||
ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
|
||||
if (ol.has.DEVICE_ORIENTATION) {
|
||||
var tracking = this.getTracking();
|
||||
if (tracking && goog.isNull(this.listenerKey_)) {
|
||||
if (tracking && !this.listenerKey_) {
|
||||
this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation',
|
||||
this.orientationChange_, false, this);
|
||||
} else if (!tracking && !goog.isNull(this.listenerKey_)) {
|
||||
} else if (!tracking && this.listenerKey_) {
|
||||
goog.events.unlistenByKey(this.listenerKey_);
|
||||
this.listenerKey_ = null;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ ol.dom.canUseCssTransform = (function() {
|
||||
var canUseCssTransform;
|
||||
return function() {
|
||||
if (canUseCssTransform === undefined) {
|
||||
goog.asserts.assert(!goog.isNull(document.body),
|
||||
goog.asserts.assert(document.body,
|
||||
'document.body should not be null');
|
||||
if (!goog.global.getComputedStyle) {
|
||||
// this browser is ancient
|
||||
@@ -82,7 +82,7 @@ ol.dom.canUseCssTransform3D = (function() {
|
||||
var canUseCssTransform3D;
|
||||
return function() {
|
||||
if (canUseCssTransform3D === undefined) {
|
||||
goog.asserts.assert(!goog.isNull(document.body),
|
||||
goog.asserts.assert(document.body,
|
||||
'document.body should not be null');
|
||||
if (!goog.global.getComputedStyle) {
|
||||
// this browser is ancient
|
||||
|
||||
@@ -98,7 +98,7 @@ ol.Feature = function(opt_geometryOrProperties) {
|
||||
|
||||
if (opt_geometryOrProperties !== undefined) {
|
||||
if (opt_geometryOrProperties instanceof ol.geom.Geometry ||
|
||||
goog.isNull(opt_geometryOrProperties)) {
|
||||
!opt_geometryOrProperties) {
|
||||
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrProperties);
|
||||
this.setGeometry(geometry);
|
||||
} else {
|
||||
@@ -127,7 +127,7 @@ ol.Feature.prototype.clone = function() {
|
||||
clone.setGeometry(geometry.clone());
|
||||
}
|
||||
var style = this.getStyle();
|
||||
if (!goog.isNull(style)) {
|
||||
if (style) {
|
||||
clone.setStyle(style);
|
||||
}
|
||||
return clone;
|
||||
@@ -209,7 +209,7 @@ ol.Feature.prototype.handleGeometryChange_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.Feature.prototype.handleGeometryChanged_ = function() {
|
||||
if (!goog.isNull(this.geometryChangeKey_)) {
|
||||
if (this.geometryChangeKey_) {
|
||||
goog.events.unlistenByKey(this.geometryChangeKey_);
|
||||
this.geometryChangeKey_ = null;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ ol.Feature.prototype.setGeometry = function(geometry) {
|
||||
*/
|
||||
ol.Feature.prototype.setStyle = function(style) {
|
||||
this.style_ = style;
|
||||
this.styleFunction_ = goog.isNull(style) ?
|
||||
this.styleFunction_ = !style ?
|
||||
undefined : ol.Feature.createStyleFunction(style);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ goog.inherits(ol.format.EsriJSON, ol.format.JSONFeature);
|
||||
* @return {ol.geom.Geometry} Geometry.
|
||||
*/
|
||||
ol.format.EsriJSON.readGeometry_ = function(object, opt_options) {
|
||||
if (goog.isNull(object)) {
|
||||
if (!object) {
|
||||
return null;
|
||||
}
|
||||
var type;
|
||||
|
||||
@@ -165,7 +165,7 @@ ol.format.Feature.transformWithOptions = function(
|
||||
ol.proj.get(opt_options.featureProjection) : null;
|
||||
var dataProjection = opt_options ?
|
||||
ol.proj.get(opt_options.dataProjection) : null;
|
||||
if (!goog.isNull(featureProjection) && !goog.isNull(dataProjection) &&
|
||||
if (featureProjection && dataProjection &&
|
||||
!ol.proj.equivalent(featureProjection, dataProjection)) {
|
||||
if (geometry instanceof ol.geom.Geometry) {
|
||||
return (write ? geometry.clone() : geometry).transform(
|
||||
|
||||
@@ -68,7 +68,7 @@ ol.format.GeoJSON.EXTENSIONS_ = ['.geojson'];
|
||||
* @return {ol.geom.Geometry} Geometry.
|
||||
*/
|
||||
ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
|
||||
if (goog.isNull(object)) {
|
||||
if (!object) {
|
||||
return null;
|
||||
}
|
||||
var geometryReader = ol.format.GeoJSON.GEOMETRY_READERS_[object.type];
|
||||
|
||||
@@ -62,20 +62,20 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
|
||||
var containerSrs = context['srsName'];
|
||||
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
||||
var axisOrientation = 'enu';
|
||||
if (!goog.isNull(containerSrs)) {
|
||||
if (containerSrs) {
|
||||
var proj = ol.proj.get(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
var coords = s.split(/[\s,]+/);
|
||||
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||
var dim = 2;
|
||||
if (!goog.isNull(node.getAttribute('srsDimension'))) {
|
||||
if (node.getAttribute('srsDimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('srsDimension'));
|
||||
} else if (!goog.isNull(node.getAttribute('dimension'))) {
|
||||
} else if (node.getAttribute('dimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('dimension'));
|
||||
} else if (!goog.isNull(containerDimension)) {
|
||||
} else if (containerDimension) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
||||
}
|
||||
var x, y, z;
|
||||
|
||||
@@ -301,7 +301,7 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && !goog.isNull(flatLinearRings[0])) {
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
@@ -385,7 +385,7 @@ ol.format.GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||
var containerSrs = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
if (!goog.isNull(containerSrs)) {
|
||||
if (containerSrs) {
|
||||
var proj = ol.proj.get(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
@@ -422,20 +422,20 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
var containerSrs = context['srsName'];
|
||||
var containerDimension = node.parentNode.getAttribute('srsDimension');
|
||||
var axisOrientation = 'enu';
|
||||
if (!goog.isNull(containerSrs)) {
|
||||
if (containerSrs) {
|
||||
var proj = ol.proj.get(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
var coords = s.split(/\s+/);
|
||||
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||
var dim = 2;
|
||||
if (!goog.isNull(node.getAttribute('srsDimension'))) {
|
||||
if (node.getAttribute('srsDimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('srsDimension'));
|
||||
} else if (!goog.isNull(node.getAttribute('dimension'))) {
|
||||
} else if (node.getAttribute('dimension')) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('dimension'));
|
||||
} else if (!goog.isNull(containerDimension)) {
|
||||
} else if (containerDimension) {
|
||||
dim = ol.format.XSD.readNonNegativeIntegerString(containerDimension);
|
||||
}
|
||||
var x, y, z;
|
||||
@@ -1067,7 +1067,7 @@ ol.format.GML3.prototype.writeFeatureElement =
|
||||
var keys = [], values = [];
|
||||
for (var key in properties) {
|
||||
var value = properties[key];
|
||||
if (!goog.isNull(value)) {
|
||||
if (value !== null) {
|
||||
keys.push(key);
|
||||
values.push(value);
|
||||
if (key == geometryName) {
|
||||
|
||||
@@ -199,8 +199,7 @@ ol.format.GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
var fid = node.getAttribute('fid') ||
|
||||
ol.xml.getAttributeNS(node, ol.format.GMLBase.GMLNS, 'id');
|
||||
var values = {}, geometryName;
|
||||
for (n = node.firstElementChild; !goog.isNull(n);
|
||||
n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
var localName = ol.xml.getLocalName(n);
|
||||
// Assume attribute elements have one child node and that the child
|
||||
// is a text or CDATA node (to be treated as text).
|
||||
@@ -449,8 +448,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings &&
|
||||
!goog.isNull(flatLinearRings[0])) {
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
|
||||
@@ -97,7 +97,7 @@ ol.format.GPX.parseLink_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.localName == 'link', 'localName should be link');
|
||||
var values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var href = node.getAttribute('href');
|
||||
if (!goog.isNull(href)) {
|
||||
if (href !== null) {
|
||||
values['link'] = href;
|
||||
}
|
||||
ol.xml.parseNode(ol.format.GPX.LINK_PARSERS_, node, objectStack);
|
||||
@@ -417,7 +417,7 @@ ol.format.GPX.WPT_PARSERS_ = ol.xml.makeStructureNS(
|
||||
* @private
|
||||
*/
|
||||
ol.format.GPX.prototype.handleReadExtensions_ = function(features) {
|
||||
if (goog.isNull(features)) {
|
||||
if (!features) {
|
||||
features = [];
|
||||
}
|
||||
for (var i = 0, ii = features.length; i < ii; ++i) {
|
||||
|
||||
@@ -202,7 +202,7 @@ ol.format.IGC.prototype.readFeatures;
|
||||
*/
|
||||
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
|
||||
var feature = this.readFeatureFromText(text, opt_options);
|
||||
if (!goog.isNull(feature)) {
|
||||
if (feature) {
|
||||
return [feature];
|
||||
} else {
|
||||
return [];
|
||||
|
||||
@@ -979,7 +979,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
|
||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
||||
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||
if (flatLinearRings && !goog.isNull(flatLinearRings[0])) {
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new ol.geom.Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
@@ -1085,7 +1085,7 @@ ol.format.KML.DataParser_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Data', 'localName should be Data');
|
||||
var name = node.getAttribute('name');
|
||||
if (!goog.isNull(name)) {
|
||||
if (name !== null) {
|
||||
var data = ol.xml.pushParseAndPop(
|
||||
undefined, ol.format.KML.DATA_PARSERS_, node, objectStack);
|
||||
if (data) {
|
||||
@@ -1196,7 +1196,7 @@ ol.format.KML.SimpleDataParser_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.localName == 'SimpleData',
|
||||
'localName should be SimpleData');
|
||||
var name = node.getAttribute('name');
|
||||
if (!goog.isNull(name)) {
|
||||
if (name !== null) {
|
||||
var data = ol.format.XSD.readString(node);
|
||||
var featureObject =
|
||||
/** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
@@ -1679,7 +1679,7 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) {
|
||||
}
|
||||
var feature = new ol.Feature();
|
||||
var id = node.getAttribute('id');
|
||||
if (!goog.isNull(id)) {
|
||||
if (id !== null) {
|
||||
feature.setId(id);
|
||||
}
|
||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
@@ -1718,7 +1718,7 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
|
||||
'node.nodeType should be ELEMENT');
|
||||
goog.asserts.assert(node.localName == 'Style', 'localName should be Style');
|
||||
var id = node.getAttribute('id');
|
||||
if (!goog.isNull(id)) {
|
||||
if (id !== null) {
|
||||
var style = ol.format.KML.readStyle_(node, objectStack);
|
||||
if (style) {
|
||||
var styleUri;
|
||||
@@ -1744,7 +1744,7 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
|
||||
goog.asserts.assert(node.localName == 'StyleMap',
|
||||
'localName should be StyleMap');
|
||||
var id = node.getAttribute('id');
|
||||
if (goog.isNull(id)) {
|
||||
if (id === null) {
|
||||
return;
|
||||
}
|
||||
var styleMapValue = ol.format.KML.readStyleMapValue_(node, objectStack);
|
||||
@@ -1836,8 +1836,7 @@ ol.format.KML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
} else if (localName == 'kml') {
|
||||
features = [];
|
||||
var n;
|
||||
for (n = node.firstElementChild; !goog.isNull(n);
|
||||
n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
var fs = this.readFeaturesFromNode(n, opt_options);
|
||||
if (fs) {
|
||||
goog.array.extend(features, fs);
|
||||
@@ -1878,7 +1877,7 @@ ol.format.KML.prototype.readName = function(source) {
|
||||
*/
|
||||
ol.format.KML.prototype.readNameFromDocument = function(doc) {
|
||||
var n;
|
||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
var name = this.readNameFromNode(n);
|
||||
if (name) {
|
||||
@@ -1896,13 +1895,13 @@ ol.format.KML.prototype.readNameFromDocument = function(doc) {
|
||||
*/
|
||||
ol.format.KML.prototype.readNameFromNode = function(node) {
|
||||
var n;
|
||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||
n.localName == 'name') {
|
||||
return ol.format.XSD.readString(n);
|
||||
}
|
||||
}
|
||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
var localName = ol.xml.getLocalName(n);
|
||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||
(localName == 'Document' ||
|
||||
@@ -1950,7 +1949,7 @@ ol.format.KML.prototype.readNetworkLinks = function(source) {
|
||||
*/
|
||||
ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
||||
var n, networkLinks = [];
|
||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
goog.array.extend(networkLinks, this.readNetworkLinksFromNode(n));
|
||||
}
|
||||
@@ -1965,7 +1964,7 @@ ol.format.KML.prototype.readNetworkLinksFromDocument = function(doc) {
|
||||
*/
|
||||
ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
||||
var n, networkLinks = [];
|
||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||
n.localName == 'NetworkLink') {
|
||||
var obj = ol.xml.pushParseAndPop({}, ol.format.KML.NETWORK_LINK_PARSERS_,
|
||||
@@ -1973,7 +1972,7 @@ ol.format.KML.prototype.readNetworkLinksFromNode = function(node) {
|
||||
networkLinks.push(obj);
|
||||
}
|
||||
}
|
||||
for (n = node.firstElementChild; !goog.isNull(n); n = n.nextElementSibling) {
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
var localName = ol.xml.getLocalName(n);
|
||||
if (ol.array.includes(ol.format.KML.NAMESPACE_URIS_, n.namespaceURI) &&
|
||||
(localName == 'Document' ||
|
||||
@@ -2110,20 +2109,18 @@ ol.format.KML.writeIconStyle_ = function(node, style, objectStack) {
|
||||
'href': src
|
||||
};
|
||||
|
||||
if (!goog.isNull(size)) {
|
||||
if (size) {
|
||||
iconProperties['w'] = size[0];
|
||||
iconProperties['h'] = size[1];
|
||||
var anchor = style.getAnchor(); // top-left
|
||||
var origin = style.getOrigin(); // top-left
|
||||
|
||||
if (!goog.isNull(origin) && !goog.isNull(iconImageSize) &&
|
||||
origin[0] !== 0 && origin[1] !== size[1]) {
|
||||
if (origin && iconImageSize && origin[0] !== 0 && origin[1] !== size[1]) {
|
||||
iconProperties['x'] = origin[0];
|
||||
iconProperties['y'] = iconImageSize[1] - (origin[1] + size[1]);
|
||||
}
|
||||
|
||||
if (!goog.isNull(anchor) &&
|
||||
anchor[0] !== 0 && anchor[1] !== size[1]) {
|
||||
if (anchor && anchor[0] !== 0 && anchor[1] !== size[1]) {
|
||||
var /** @type {ol.format.KMLVec2_} */ hotSpot = {
|
||||
x: anchor[0],
|
||||
xunits: ol.style.IconAnchorUnits.PIXELS,
|
||||
@@ -2164,7 +2161,7 @@ ol.format.KML.writeLabelStyle_ = function(node, style, objectStack) {
|
||||
var /** @type {ol.xml.NodeStackItem} */ context = {node: node};
|
||||
var properties = {};
|
||||
var fill = style.getFill();
|
||||
if (!goog.isNull(fill)) {
|
||||
if (fill) {
|
||||
properties['color'] = fill.getColor();
|
||||
}
|
||||
var scale = style.getScale();
|
||||
@@ -2279,10 +2276,10 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
||||
// FIXME the styles returned by the style function are supposed to be
|
||||
// resolution-independent here
|
||||
var styles = styleFunction.call(feature, 0);
|
||||
if (!goog.isNull(styles) && styles.length > 0) {
|
||||
if (styles && styles.length > 0) {
|
||||
properties['Style'] = styles[0];
|
||||
var textStyle = styles[0].getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
properties['name'] = textStyle.getText();
|
||||
}
|
||||
}
|
||||
@@ -2392,16 +2389,16 @@ ol.format.KML.writeStyle_ = function(node, style, objectStack) {
|
||||
var strokeStyle = style.getStroke();
|
||||
var imageStyle = style.getImage();
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(imageStyle)) {
|
||||
if (imageStyle) {
|
||||
properties['IconStyle'] = imageStyle;
|
||||
}
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
properties['LabelStyle'] = textStyle;
|
||||
}
|
||||
if (!goog.isNull(strokeStyle)) {
|
||||
if (strokeStyle) {
|
||||
properties['LineStyle'] = strokeStyle;
|
||||
}
|
||||
if (!goog.isNull(fillStyle)) {
|
||||
if (fillStyle) {
|
||||
properties['PolyStyle'] = fillStyle;
|
||||
}
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
|
||||
@@ -26,7 +26,7 @@ goog.inherits(ol.format.OWS, ol.format.XML);
|
||||
ol.format.OWS.prototype.readFromDocument = function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readFromNode(n);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ ol.format.TopoJSON.concatenateArcs_ = function(indices, arcs) {
|
||||
*/
|
||||
ol.format.TopoJSON.readPointGeometry_ = function(object, scale, translate) {
|
||||
var coordinates = object.coordinates;
|
||||
if (!goog.isNull(scale) && !goog.isNull(translate)) {
|
||||
if (scale && translate) {
|
||||
ol.format.TopoJSON.transformVertex_(coordinates, scale, translate);
|
||||
}
|
||||
return new ol.geom.Point(coordinates);
|
||||
@@ -117,7 +117,7 @@ ol.format.TopoJSON.readMultiPointGeometry_ = function(object, scale,
|
||||
translate) {
|
||||
var coordinates = object.coordinates;
|
||||
var i, ii;
|
||||
if (!goog.isNull(scale) && !goog.isNull(translate)) {
|
||||
if (scale && translate) {
|
||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||
ol.format.TopoJSON.transformVertex_(coordinates[i], scale, translate);
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ ol.format.WFS.prototype.readFeatureCollectionMetadataFromDocument =
|
||||
function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readFeatureCollectionMetadataFromNode(n);
|
||||
}
|
||||
@@ -337,7 +337,7 @@ ol.format.WFS.TRANSACTION_RESPONSE_PARSERS_ = {
|
||||
ol.format.WFS.prototype.readTransactionResponseFromDocument = function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readTransactionResponseFromNode(n);
|
||||
}
|
||||
@@ -750,7 +750,7 @@ ol.format.WFS.prototype.readProjection;
|
||||
ol.format.WFS.prototype.readProjectionFromDocument = function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be a DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readProjectionFromNode(n);
|
||||
}
|
||||
@@ -771,8 +771,7 @@ ol.format.WFS.prototype.readProjectionFromNode = function(node) {
|
||||
if (node.firstElementChild &&
|
||||
node.firstElementChild.firstElementChild) {
|
||||
node = node.firstElementChild.firstElementChild;
|
||||
for (var n = node.firstElementChild; !goog.isNull(n);
|
||||
n = n.nextElementSibling) {
|
||||
for (var n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
if (!(n.childNodes.length === 0 ||
|
||||
(n.childNodes.length === 1 &&
|
||||
n.firstChild.nodeType === 3))) {
|
||||
|
||||
@@ -50,7 +50,7 @@ ol.format.WMSCapabilities.prototype.read;
|
||||
ol.format.WMSCapabilities.prototype.readFromDocument = function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readFromNode(n);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ ol.format.WMTSCapabilities.prototype.read;
|
||||
ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {
|
||||
goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT,
|
||||
'doc.nodeType should be DOCUMENT');
|
||||
for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (var n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
return this.readFromNode(n);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ ol.format.XMLFeature.prototype.readFeaturesFromDocument = function(
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
var n;
|
||||
for (n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {
|
||||
for (n = doc.firstChild; n; n = n.nextSibling) {
|
||||
if (n.nodeType == goog.dom.NodeType.ELEMENT) {
|
||||
goog.array.extend(features, this.readFeaturesFromNode(n, opt_options));
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
if (projection) {
|
||||
this.transform_ = ol.proj.getTransformFromProjections(
|
||||
ol.proj.get('EPSG:4326'), projection);
|
||||
if (!goog.isNull(this.position_)) {
|
||||
if (this.position_) {
|
||||
this.set(
|
||||
ol.GeolocationProperty.POSITION, this.transform_(this.position_));
|
||||
}
|
||||
@@ -155,13 +155,13 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
var coords = position.coords;
|
||||
this.set(ol.GeolocationProperty.ACCURACY, coords.accuracy);
|
||||
this.set(ol.GeolocationProperty.ALTITUDE,
|
||||
goog.isNull(coords.altitude) ? undefined : coords.altitude);
|
||||
coords.altitude === null ? undefined : coords.altitude);
|
||||
this.set(ol.GeolocationProperty.ALTITUDE_ACCURACY,
|
||||
goog.isNull(coords.altitudeAccuracy) ?
|
||||
coords.altitudeAccuracy === null ?
|
||||
undefined : coords.altitudeAccuracy);
|
||||
this.set(ol.GeolocationProperty.HEADING, goog.isNull(coords.heading) ?
|
||||
this.set(ol.GeolocationProperty.HEADING, coords.heading === null ?
|
||||
undefined : goog.math.toRadians(coords.heading));
|
||||
if (goog.isNull(this.position_)) {
|
||||
if (!this.position_) {
|
||||
this.position_ = [coords.longitude, coords.latitude];
|
||||
} else {
|
||||
this.position_[0] = coords.longitude;
|
||||
@@ -170,7 +170,7 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
var projectedPosition = this.transform_(this.position_);
|
||||
this.set(ol.GeolocationProperty.POSITION, projectedPosition);
|
||||
this.set(ol.GeolocationProperty.SPEED,
|
||||
goog.isNull(coords.speed) ? undefined : coords.speed);
|
||||
coords.speed === null ? undefined : coords.speed);
|
||||
var geometry = ol.geom.Polygon.circular(
|
||||
ol.sphere.WGS84, this.position_, coords.accuracy);
|
||||
geometry.applyTransform(this.transform_);
|
||||
|
||||
@@ -189,11 +189,11 @@ ol.geom.Circle.prototype.setCenter = function(center) {
|
||||
*/
|
||||
ol.geom.Circle.prototype.setCenterAndRadius =
|
||||
function(center, radius, opt_layout) {
|
||||
if (goog.isNull(center)) {
|
||||
if (!center) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, center, 0);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
/** @type {Array.<number>} */
|
||||
@@ -228,8 +228,8 @@ ol.geom.Circle.prototype.setFlatCoordinates =
|
||||
* @api
|
||||
*/
|
||||
ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||
goog.asserts.assert(!goog.isNull(this.flatCoordinates),
|
||||
'this.flatCoordinates cannot be null');
|
||||
goog.asserts.assert(this.flatCoordinates,
|
||||
'truthy this.flatCoordinates expected');
|
||||
this.flatCoordinates[this.stride] = this.flatCoordinates[0] + radius;
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ ol.geom.GeometryCollection.cloneGeometries_ = function(geometries) {
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
||||
var i, ii;
|
||||
if (goog.isNull(this.geometries_)) {
|
||||
if (!this.geometries_) {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
@@ -69,7 +69,7 @@ ol.geom.GeometryCollection.prototype.unlistenGeometriesChange_ = function() {
|
||||
*/
|
||||
ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
|
||||
var i, ii;
|
||||
if (goog.isNull(this.geometries_)) {
|
||||
if (!this.geometries_) {
|
||||
return;
|
||||
}
|
||||
for (i = 0, ii = this.geometries_.length; i < ii; ++i) {
|
||||
|
||||
@@ -132,11 +132,11 @@ ol.geom.LinearRing.prototype.getType = function() {
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
|
||||
@@ -70,7 +70,7 @@ goog.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
|
||||
ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
|
||||
goog.asserts.assert(coordinate.length == this.stride,
|
||||
'length of coordinate array should match stride');
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = coordinate.slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, coordinate);
|
||||
@@ -235,11 +235,11 @@ ol.geom.LineString.prototype.intersectsExtent = function(extent) {
|
||||
*/
|
||||
ol.geom.LineString.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
|
||||
@@ -63,7 +63,7 @@ goog.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
|
||||
ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
|
||||
goog.asserts.assert(lineString.getLayout() == this.layout,
|
||||
'layout of lineString should match the layout');
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = lineString.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(
|
||||
@@ -270,11 +270,11 @@ ol.geom.MultiLineString.prototype.intersectsExtent = function(extent) {
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 2);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
@@ -292,9 +292,9 @@ ol.geom.MultiLineString.prototype.setCoordinates =
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.setFlatCoordinates =
|
||||
function(layout, flatCoordinates, ends) {
|
||||
if (goog.isNull(flatCoordinates)) {
|
||||
goog.asserts.assert(!goog.isNull(ends) && ends.length === 0,
|
||||
'ends cannot be null and ends.length should be 0');
|
||||
if (!flatCoordinates) {
|
||||
goog.asserts.assert(ends && ends.length === 0,
|
||||
'ends must be truthy and ends.length should be 0');
|
||||
} else if (ends.length === 0) {
|
||||
goog.asserts.assert(flatCoordinates.length === 0,
|
||||
'flatCoordinates should be an empty array');
|
||||
|
||||
@@ -38,7 +38,7 @@ goog.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry);
|
||||
ol.geom.MultiPoint.prototype.appendPoint = function(point) {
|
||||
goog.asserts.assert(point.getLayout() == this.layout,
|
||||
'the layout of point should match layout');
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = point.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, point.getFlatCoordinates());
|
||||
@@ -104,7 +104,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getPoint = function(index) {
|
||||
var n = goog.isNull(this.flatCoordinates) ?
|
||||
var n = !this.flatCoordinates ?
|
||||
0 : this.flatCoordinates.length / this.stride;
|
||||
goog.asserts.assert(0 <= index && index < n,
|
||||
'index should be in between 0 and n');
|
||||
@@ -175,11 +175,11 @@ ol.geom.MultiPoint.prototype.intersectsExtent = function(extent) {
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||
|
||||
@@ -95,7 +95,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
|
||||
'layout of polygon should match layout');
|
||||
/** @type {Array.<number>} */
|
||||
var ends;
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = polygon.getFlatCoordinates().slice();
|
||||
ends = polygon.getEnds().slice();
|
||||
this.endss_.push();
|
||||
@@ -363,11 +363,11 @@ ol.geom.MultiPolygon.prototype.intersectsExtent = function(extent) {
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.endss_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 3);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var endss = ol.geom.flat.deflate.coordinatesss(
|
||||
@@ -391,8 +391,8 @@ ol.geom.MultiPolygon.prototype.setCoordinates =
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.setFlatCoordinates =
|
||||
function(layout, flatCoordinates, endss) {
|
||||
goog.asserts.assert(!goog.isNull(endss), 'endss cannot be null');
|
||||
if (goog.isNull(flatCoordinates) || flatCoordinates.length === 0) {
|
||||
goog.asserts.assert(endss, 'endss must be truthy');
|
||||
if (!flatCoordinates || flatCoordinates.length === 0) {
|
||||
goog.asserts.assert(endss.length === 0, 'the length of endss should be 0');
|
||||
} else {
|
||||
goog.asserts.assert(endss.length > 0, 'endss cannot be an empty array');
|
||||
|
||||
@@ -66,7 +66,7 @@ ol.geom.Point.prototype.closestPointXY =
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.Point.prototype.getCoordinates = function() {
|
||||
return goog.isNull(this.flatCoordinates) ? [] : this.flatCoordinates.slice();
|
||||
return !this.flatCoordinates ? [] : this.flatCoordinates.slice();
|
||||
};
|
||||
|
||||
|
||||
@@ -104,11 +104,11 @@ ol.geom.Point.prototype.intersectsExtent = function(extent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 0);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
this.flatCoordinates.length = ol.geom.flat.deflate.coordinate(
|
||||
|
||||
@@ -92,7 +92,7 @@ goog.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
|
||||
ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
|
||||
goog.asserts.assert(linearRing.getLayout() == this.layout,
|
||||
'layout of linearRing should match layout');
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
|
||||
} else {
|
||||
goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
|
||||
@@ -339,11 +339,11 @@ ol.geom.Polygon.prototype.intersectsExtent = function(extent) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
if (goog.isNull(coordinates)) {
|
||||
if (!coordinates) {
|
||||
this.setFlatCoordinates(ol.geom.GeometryLayout.XY, null, this.ends_);
|
||||
} else {
|
||||
this.setLayout(opt_layout, coordinates, 2);
|
||||
if (goog.isNull(this.flatCoordinates)) {
|
||||
if (!this.flatCoordinates) {
|
||||
this.flatCoordinates = [];
|
||||
}
|
||||
var ends = ol.geom.flat.deflate.coordinatess(
|
||||
@@ -361,9 +361,9 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||
*/
|
||||
ol.geom.Polygon.prototype.setFlatCoordinates =
|
||||
function(layout, flatCoordinates, ends) {
|
||||
if (goog.isNull(flatCoordinates)) {
|
||||
goog.asserts.assert(!goog.isNull(ends) && ends.length === 0,
|
||||
'ends cannot be null and should be an empty array');
|
||||
if (!flatCoordinates) {
|
||||
goog.asserts.assert(ends && ends.length === 0,
|
||||
'ends must be an empty array');
|
||||
} else if (ends.length === 0) {
|
||||
goog.asserts.assert(flatCoordinates.length === 0,
|
||||
'flatCoordinates should be an empty array');
|
||||
|
||||
@@ -258,7 +258,7 @@ ol.geom.SimpleGeometry.prototype.setLayout =
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
||||
if (!goog.isNull(this.flatCoordinates)) {
|
||||
if (this.flatCoordinates) {
|
||||
transformFn(this.flatCoordinates, this.flatCoordinates, this.stride);
|
||||
this.changed();
|
||||
}
|
||||
@@ -271,7 +271,7 @@ ol.geom.SimpleGeometry.prototype.applyTransform = function(transformFn) {
|
||||
*/
|
||||
ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) {
|
||||
var flatCoordinates = this.getFlatCoordinates();
|
||||
if (!goog.isNull(flatCoordinates)) {
|
||||
if (flatCoordinates) {
|
||||
var stride = this.getStride();
|
||||
ol.geom.flat.transform.translate(
|
||||
flatCoordinates, 0, flatCoordinates.length, stride,
|
||||
@@ -290,7 +290,7 @@ ol.geom.SimpleGeometry.prototype.translate = function(deltaX, deltaY) {
|
||||
ol.geom.transformSimpleGeometry2D =
|
||||
function(simpleGeometry, transform, opt_dest) {
|
||||
var flatCoordinates = simpleGeometry.getFlatCoordinates();
|
||||
if (goog.isNull(flatCoordinates)) {
|
||||
if (!flatCoordinates) {
|
||||
return null;
|
||||
} else {
|
||||
var stride = simpleGeometry.getStride();
|
||||
|
||||
@@ -415,7 +415,7 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) {
|
||||
var squaredTolerance =
|
||||
resolution * resolution / (4 * pixelRatio * pixelRatio);
|
||||
|
||||
var updateProjectionInfo = goog.isNull(this.projection_) ||
|
||||
var updateProjectionInfo = !this.projection_ ||
|
||||
!ol.proj.equivalent(this.projection_, projection);
|
||||
|
||||
if (updateProjectionInfo) {
|
||||
@@ -443,7 +443,7 @@ ol.Graticule.prototype.handlePostCompose_ = function(e) {
|
||||
* @private
|
||||
*/
|
||||
ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
||||
goog.asserts.assert(!goog.isNull(projection), 'projection cannot be null');
|
||||
goog.asserts.assert(projection, 'projection cannot be null');
|
||||
|
||||
var epsg4326Projection = ol.proj.get('EPSG:4326');
|
||||
|
||||
@@ -462,7 +462,7 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
||||
var minLatP = worldExtentP[1];
|
||||
var minLonP = worldExtentP[0];
|
||||
|
||||
goog.asserts.assert(!goog.isNull(extent), 'extent cannot be null');
|
||||
goog.asserts.assert(extent, 'extent cannot be null');
|
||||
goog.asserts.assert(maxLat !== undefined, 'maxLat should be defined');
|
||||
goog.asserts.assert(maxLon !== undefined, 'maxLon should be defined');
|
||||
goog.asserts.assert(minLat !== undefined, 'minLat should be defined');
|
||||
@@ -508,12 +508,12 @@ ol.Graticule.prototype.updateProjectionInfo_ = function(projection) {
|
||||
* @api
|
||||
*/
|
||||
ol.Graticule.prototype.setMap = function(map) {
|
||||
if (!goog.isNull(this.map_)) {
|
||||
if (this.map_) {
|
||||
this.map_.un(ol.render.EventType.POSTCOMPOSE,
|
||||
this.handlePostCompose_, this);
|
||||
this.map_.render();
|
||||
}
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
map.on(ol.render.EventType.POSTCOMPOSE,
|
||||
this.handlePostCompose_, this);
|
||||
map.render();
|
||||
|
||||
@@ -41,7 +41,7 @@ ol.has.CANVAS = ol.ENABLE_CANVAS && (
|
||||
}
|
||||
try {
|
||||
var context = ol.dom.createCanvasContext2D();
|
||||
if (goog.isNull(context)) {
|
||||
if (!context) {
|
||||
return false;
|
||||
} else {
|
||||
if (context.setLineDash !== undefined) {
|
||||
@@ -129,7 +129,7 @@ ol.has.WEBGL;
|
||||
var gl = ol.webgl.getContext(canvas, {
|
||||
failIfMajorPerformanceCaveat: true
|
||||
});
|
||||
if (!goog.isNull(gl)) {
|
||||
if (gl) {
|
||||
hasWebGL = true;
|
||||
textureSize = /** @type {number} */
|
||||
(gl.getParameter(gl.MAX_TEXTURE_SIZE));
|
||||
|
||||
@@ -38,7 +38,7 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
|
||||
* @type {Image}
|
||||
*/
|
||||
this.image_ = new Image();
|
||||
if (!goog.isNull(crossOrigin)) {
|
||||
if (crossOrigin) {
|
||||
this.image_.crossOrigin = crossOrigin;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ ol.Image.prototype.load = function() {
|
||||
if (this.state == ol.ImageState.IDLE) {
|
||||
this.state = ol.ImageState.LOADING;
|
||||
this.changed();
|
||||
goog.asserts.assert(goog.isNull(this.imageListenerKeys_),
|
||||
goog.asserts.assert(!this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should be null');
|
||||
this.imageListenerKeys_ = [
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.ERROR,
|
||||
@@ -148,7 +148,7 @@ ol.Image.prototype.load = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.Image.prototype.unlistenImage_ = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.imageListenerKeys_),
|
||||
goog.asserts.assert(this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should not be null');
|
||||
this.imageListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.imageListenerKeys_ = null;
|
||||
|
||||
@@ -78,7 +78,7 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
|
||||
*/
|
||||
ol.ImageCanvas.prototype.load = function() {
|
||||
if (this.state == ol.ImageState.IDLE) {
|
||||
goog.asserts.assert(!goog.isNull(this.loader_));
|
||||
goog.asserts.assert(this.loader_, 'this.loader_ must be set');
|
||||
this.state = ol.ImageState.LOADING;
|
||||
this.changed();
|
||||
this.loader_(goog.bind(this.handleLoad_, this));
|
||||
|
||||
@@ -37,7 +37,7 @@ ol.ImageTile = function(tileCoord, state, src, crossOrigin, tileLoadFunction) {
|
||||
* @type {Image}
|
||||
*/
|
||||
this.image_ = new Image();
|
||||
if (!goog.isNull(crossOrigin)) {
|
||||
if (crossOrigin) {
|
||||
this.image_.crossOrigin = crossOrigin;
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ ol.ImageTile.prototype.load = function() {
|
||||
if (this.state == ol.TileState.IDLE) {
|
||||
this.state = ol.TileState.LOADING;
|
||||
this.changed();
|
||||
goog.asserts.assert(goog.isNull(this.imageListenerKeys_),
|
||||
goog.asserts.assert(!this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should be null');
|
||||
this.imageListenerKeys_ = [
|
||||
goog.events.listenOnce(this.image_, goog.events.EventType.ERROR,
|
||||
@@ -160,7 +160,7 @@ ol.ImageTile.prototype.load = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.ImageTile.prototype.unlistenImage_ = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.imageListenerKeys_),
|
||||
goog.asserts.assert(this.imageListenerKeys_,
|
||||
'this.imageListenerKeys_ should not be null');
|
||||
this.imageListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.imageListenerKeys_ = null;
|
||||
|
||||
@@ -56,7 +56,7 @@ ol.interaction.DoubleClickZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var anchor = mapBrowserEvent.coordinate;
|
||||
var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have a view');
|
||||
ol.interaction.Interaction.zoomByDelta(
|
||||
map, view, delta, anchor, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
|
||||
@@ -98,11 +98,11 @@ ol.interaction.DragAndDrop.prototype.handleDrop_ = function(event) {
|
||||
*/
|
||||
ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
||||
var map = this.getMap();
|
||||
goog.asserts.assert(!goog.isNull(map), 'map should not be null');
|
||||
goog.asserts.assert(map, 'map must be set');
|
||||
var projection = this.projection_;
|
||||
if (goog.isNull(projection)) {
|
||||
if (!projection) {
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
projection = view.getProjection();
|
||||
goog.asserts.assert(projection !== undefined,
|
||||
'projection should be defined');
|
||||
@@ -114,7 +114,7 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
||||
var formatConstructor = formatConstructors[i];
|
||||
var format = new formatConstructor();
|
||||
var readFeatures = this.tryReadFeatures_(format, result);
|
||||
if (!goog.isNull(readFeatures)) {
|
||||
if (readFeatures) {
|
||||
var featureProjection = format.readProjection(result);
|
||||
var transform = ol.proj.getTransform(featureProjection, projection);
|
||||
var j, jj;
|
||||
@@ -154,14 +154,14 @@ ol.interaction.DragAndDrop.prototype.setMap = function(map) {
|
||||
goog.events.unlistenByKey(this.dropListenKey_);
|
||||
this.dropListenKey_ = undefined;
|
||||
}
|
||||
if (!goog.isNull(this.fileDropHandler_)) {
|
||||
if (this.fileDropHandler_) {
|
||||
goog.dispose(this.fileDropHandler_);
|
||||
this.fileDropHandler_ = null;
|
||||
}
|
||||
goog.asserts.assert(this.dropListenKey_ === undefined,
|
||||
'this.dropListenKey_ should be undefined');
|
||||
goog.base(this, 'setMap', map);
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
this.fileDropHandler_ = new goog.events.FileDropHandler(map.getViewport());
|
||||
this.dropListenKey_ = goog.events.listen(
|
||||
this.fileDropHandler_, goog.events.FileDropHandler.EventType.DROP,
|
||||
|
||||
@@ -77,7 +77,7 @@ ol.interaction.DragPan.handleDragEvent_ = function(mapBrowserEvent) {
|
||||
if (this.kinetic_) {
|
||||
this.kinetic_.update(centroid[0], centroid[1]);
|
||||
}
|
||||
if (!goog.isNull(this.lastCentroid)) {
|
||||
if (this.lastCentroid) {
|
||||
var deltaX = this.lastCentroid[0] - centroid[0];
|
||||
var deltaY = centroid[1] - this.lastCentroid[1];
|
||||
var map = mapBrowserEvent.map;
|
||||
@@ -145,7 +145,7 @@ ol.interaction.DragPan.handleDownEvent_ = function(mapBrowserEvent) {
|
||||
view.setHint(ol.ViewHint.INTERACTING, 1);
|
||||
}
|
||||
map.render();
|
||||
if (!goog.isNull(this.kineticPreRenderFn_) &&
|
||||
if (this.kineticPreRenderFn_ &&
|
||||
map.removePreRenderFunction(this.kineticPreRenderFn_)) {
|
||||
view.setCenter(mapBrowserEvent.frameState.viewState.center);
|
||||
this.kineticPreRenderFn_ = null;
|
||||
|
||||
@@ -61,7 +61,7 @@ ol.interaction.DragZoom.prototype.onBoxEnd = function() {
|
||||
var map = this.getMap();
|
||||
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
|
||||
var size = map.getSize();
|
||||
goog.asserts.assert(size !== undefined, 'size should be defined');
|
||||
|
||||
@@ -367,7 +367,7 @@ ol.interaction.Draw.handleDownEvent_ = function(event) {
|
||||
this.freehandCondition_(event)) {
|
||||
this.downPx_ = event.pixel;
|
||||
this.freehand_ = true;
|
||||
if (goog.isNull(this.finishCoordinate_)) {
|
||||
if (!this.finishCoordinate_) {
|
||||
this.startDrawing_(event);
|
||||
}
|
||||
return true;
|
||||
@@ -393,7 +393,7 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
|
||||
var pass = true;
|
||||
if (squaredDistance <= this.squaredClickTolerance_) {
|
||||
this.handlePointerMove_(event);
|
||||
if (goog.isNull(this.finishCoordinate_)) {
|
||||
if (!this.finishCoordinate_) {
|
||||
this.startDrawing_(event);
|
||||
if (this.mode_ === ol.interaction.DrawMode.POINT) {
|
||||
this.finishDrawing();
|
||||
@@ -418,7 +418,7 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.Draw.prototype.handlePointerMove_ = function(event) {
|
||||
if (!goog.isNull(this.finishCoordinate_)) {
|
||||
if (this.finishCoordinate_) {
|
||||
this.modifyDrawing_(event);
|
||||
} else {
|
||||
this.createOrUpdateSketchPoint_(event);
|
||||
@@ -435,7 +435,7 @@ ol.interaction.Draw.prototype.handlePointerMove_ = function(event) {
|
||||
*/
|
||||
ol.interaction.Draw.prototype.atFinish_ = function(event) {
|
||||
var at = false;
|
||||
if (!goog.isNull(this.sketchFeature_)) {
|
||||
if (this.sketchFeature_) {
|
||||
var potentiallyDone = false;
|
||||
var potentiallyFinishCoordinates = [this.finishCoordinate_];
|
||||
if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) {
|
||||
@@ -474,7 +474,7 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) {
|
||||
*/
|
||||
ol.interaction.Draw.prototype.createOrUpdateSketchPoint_ = function(event) {
|
||||
var coordinates = event.coordinate.slice();
|
||||
if (goog.isNull(this.sketchPoint_)) {
|
||||
if (!this.sketchPoint_) {
|
||||
this.sketchPoint_ = new ol.Feature(new ol.geom.Point(coordinates));
|
||||
this.updateSketchFeatures_();
|
||||
} else {
|
||||
@@ -505,7 +505,7 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
||||
this.sketchLineCoords_ = this.sketchCoords_;
|
||||
}
|
||||
}
|
||||
if (!goog.isNull(this.sketchLineCoords_)) {
|
||||
if (this.sketchLineCoords_) {
|
||||
this.sketchLine_ = new ol.Feature(
|
||||
new ol.geom.LineString(this.sketchLineCoords_));
|
||||
}
|
||||
@@ -548,10 +548,9 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
||||
}
|
||||
last[0] = coordinate[0];
|
||||
last[1] = coordinate[1];
|
||||
goog.asserts.assert(!goog.isNull(this.sketchCoords_),
|
||||
'sketchCoords_ must not be null');
|
||||
goog.asserts.assert(this.sketchCoords_, 'sketchCoords_ expected');
|
||||
this.geometryFunction_(this.sketchCoords_, geometry);
|
||||
if (!goog.isNull(this.sketchPoint_)) {
|
||||
if (this.sketchPoint_) {
|
||||
var sketchPointGeom = this.sketchPoint_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchPointGeom, ol.geom.Point,
|
||||
'sketchPointGeom should be an ol.geom.Point');
|
||||
@@ -560,7 +559,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
||||
var sketchLineGeom;
|
||||
if (geometry instanceof ol.geom.Polygon &&
|
||||
this.mode_ !== ol.interaction.DrawMode.POLYGON) {
|
||||
if (goog.isNull(this.sketchLine_)) {
|
||||
if (!this.sketchLine_) {
|
||||
this.sketchLine_ = new ol.Feature(new ol.geom.LineString(null));
|
||||
}
|
||||
var ring = geometry.getLinearRing(0);
|
||||
@@ -569,7 +568,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
||||
'sketchLineGeom must be an ol.geom.LineString');
|
||||
sketchLineGeom.setFlatCoordinates(
|
||||
ring.getLayout(), ring.getFlatCoordinates());
|
||||
} else if (!goog.isNull(this.sketchLineCoords_)) {
|
||||
} else if (this.sketchLineCoords_) {
|
||||
sketchLineGeom = this.sketchLine_.getGeometry();
|
||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString,
|
||||
'sketchLineGeom must be an ol.geom.LineString');
|
||||
@@ -652,8 +651,7 @@ ol.interaction.Draw.prototype.removeLastPoint = function() {
|
||||
*/
|
||||
ol.interaction.Draw.prototype.finishDrawing = function() {
|
||||
var sketchFeature = this.abortDrawing_();
|
||||
goog.asserts.assert(!goog.isNull(sketchFeature),
|
||||
'sketchFeature should not be null');
|
||||
goog.asserts.assert(sketchFeature, 'sketchFeature expected to be truthy');
|
||||
var coordinates = this.sketchCoords_;
|
||||
var geometry = sketchFeature.getGeometry();
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.SimpleGeometry,
|
||||
@@ -685,10 +683,10 @@ ol.interaction.Draw.prototype.finishDrawing = function() {
|
||||
ol.interaction.DrawEventType.DRAWEND, sketchFeature));
|
||||
|
||||
// Then insert feature
|
||||
if (!goog.isNull(this.features_)) {
|
||||
if (this.features_) {
|
||||
this.features_.push(sketchFeature);
|
||||
}
|
||||
if (!goog.isNull(this.source_)) {
|
||||
if (this.source_) {
|
||||
this.source_.addFeature(sketchFeature);
|
||||
}
|
||||
};
|
||||
@@ -702,7 +700,7 @@ ol.interaction.Draw.prototype.finishDrawing = function() {
|
||||
ol.interaction.Draw.prototype.abortDrawing_ = function() {
|
||||
this.finishCoordinate_ = null;
|
||||
var sketchFeature = this.sketchFeature_;
|
||||
if (!goog.isNull(sketchFeature)) {
|
||||
if (sketchFeature) {
|
||||
this.sketchFeature_ = null;
|
||||
this.sketchPoint_ = null;
|
||||
this.sketchLine_ = null;
|
||||
@@ -750,13 +748,13 @@ ol.interaction.Draw.prototype.shouldStopEvent = goog.functions.FALSE;
|
||||
*/
|
||||
ol.interaction.Draw.prototype.updateSketchFeatures_ = function() {
|
||||
var sketchFeatures = [];
|
||||
if (!goog.isNull(this.sketchFeature_)) {
|
||||
if (this.sketchFeature_) {
|
||||
sketchFeatures.push(this.sketchFeature_);
|
||||
}
|
||||
if (!goog.isNull(this.sketchLine_)) {
|
||||
if (this.sketchLine_) {
|
||||
sketchFeatures.push(this.sketchLine_);
|
||||
}
|
||||
if (!goog.isNull(this.sketchPoint_)) {
|
||||
if (this.sketchPoint_) {
|
||||
sketchFeatures.push(this.sketchPoint_);
|
||||
}
|
||||
var overlaySource = this.overlay_.getSource();
|
||||
@@ -771,7 +769,7 @@ ol.interaction.Draw.prototype.updateSketchFeatures_ = function() {
|
||||
ol.interaction.Draw.prototype.updateState_ = function() {
|
||||
var map = this.getMap();
|
||||
var active = this.getActive();
|
||||
if (goog.isNull(map) || !active) {
|
||||
if (!map || !active) {
|
||||
this.abortDrawing_();
|
||||
}
|
||||
this.overlay_.setMap(active ? map : null);
|
||||
|
||||
@@ -85,7 +85,7 @@ ol.interaction.KeyboardPan.handleEvent = function(mapBrowserEvent) {
|
||||
keyCode == goog.events.KeyCodes.UP)) {
|
||||
var map = mapBrowserEvent.map;
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
var mapUnitsDelta = view.getResolution() * this.pixelDelta_;
|
||||
var deltaX = 0, deltaY = 0;
|
||||
if (keyCode == goog.events.KeyCodes.DOWN) {
|
||||
|
||||
@@ -77,7 +77,7 @@ ol.interaction.KeyboardZoom.handleEvent = function(mapBrowserEvent) {
|
||||
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
|
||||
map.render();
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
ol.interaction.Interaction.zoomByDelta(
|
||||
map, view, delta, undefined, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
|
||||
@@ -243,7 +243,7 @@ ol.interaction.Modify.prototype.addFeature_ = function(feature) {
|
||||
this.SEGMENT_WRITERS_[geometry.getType()].call(this, feature, geometry);
|
||||
}
|
||||
var map = this.getMap();
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
this.handlePointerAtPixel_(this.lastPixel_, map);
|
||||
}
|
||||
goog.events.listen(feature, goog.events.EventType.CHANGE,
|
||||
@@ -259,8 +259,7 @@ ol.interaction.Modify.prototype.removeFeature_ = function(feature) {
|
||||
this.removeFeatureSegmentData_(feature);
|
||||
// Remove the vertex feature if the collection of canditate features
|
||||
// is empty.
|
||||
if (!goog.isNull(this.vertexFeature_) &&
|
||||
this.features_.getLength() === 0) {
|
||||
if (this.vertexFeature_ && this.features_.getLength() === 0) {
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
@@ -501,7 +500,7 @@ ol.interaction.Modify.prototype.writeGeometryCollectionGeometry_ =
|
||||
ol.interaction.Modify.prototype.createOrUpdateVertexFeature_ =
|
||||
function(coordinates) {
|
||||
var vertexFeature = this.vertexFeature_;
|
||||
if (goog.isNull(vertexFeature)) {
|
||||
if (!vertexFeature) {
|
||||
vertexFeature = new ol.Feature(new ol.geom.Point(coordinates));
|
||||
this.vertexFeature_ = vertexFeature;
|
||||
this.overlay_.getSource().addFeature(vertexFeature);
|
||||
@@ -534,7 +533,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
|
||||
this.handlePointerAtPixel_(evt.pixel, evt.map);
|
||||
this.dragSegments_ = [];
|
||||
var vertexFeature = this.vertexFeature_;
|
||||
if (!goog.isNull(vertexFeature)) {
|
||||
if (vertexFeature) {
|
||||
var insertVertices = [];
|
||||
var geometry = /** @type {ol.geom.Point} */ (vertexFeature.getGeometry());
|
||||
var vertex = geometry.getCoordinates();
|
||||
@@ -584,7 +583,7 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
|
||||
new ol.interaction.ModifyEvent(ol.ModifyEventType.MODIFYSTART,
|
||||
this.features_, evt));
|
||||
}
|
||||
return !goog.isNull(this.vertexFeature_);
|
||||
return !!this.vertexFeature_;
|
||||
};
|
||||
|
||||
|
||||
@@ -678,8 +677,7 @@ ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||
!this.handlingDownUpSequence) {
|
||||
this.handlePointerMove_(mapBrowserEvent);
|
||||
}
|
||||
if (!goog.isNull(this.vertexFeature_) &&
|
||||
this.deleteCondition_(mapBrowserEvent)) {
|
||||
if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {
|
||||
if (mapBrowserEvent.type != ol.MapBrowserEvent.EventType.SINGLECLICK ||
|
||||
!this.ignoreNextSingleClick_) {
|
||||
var geometry = this.vertexFeature_.getGeometry();
|
||||
@@ -768,7 +766,7 @@ ol.interaction.Modify.prototype.handlePointerAtPixel_ = function(pixel, map) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!goog.isNull(this.vertexFeature_)) {
|
||||
if (this.vertexFeature_) {
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
@@ -940,7 +938,7 @@ ol.interaction.Modify.prototype.removeVertex_ = function() {
|
||||
newSegmentData);
|
||||
this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);
|
||||
|
||||
if (!goog.isNull(this.vertexFeature_)) {
|
||||
if (this.vertexFeature_) {
|
||||
this.overlay_.getSource().removeFeature(this.vertexFeature_);
|
||||
this.vertexFeature_ = null;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ ol.interaction.MouseWheelZoom.prototype.doZoom_ = function(map) {
|
||||
var delta = ol.math.clamp(this.delta_, -maxDelta, maxDelta);
|
||||
|
||||
var view = map.getView();
|
||||
goog.asserts.assert(!goog.isNull(view), 'view should not be null');
|
||||
goog.asserts.assert(view, 'map must have view');
|
||||
|
||||
map.render();
|
||||
ol.interaction.Interaction.zoomByDelta(map, view, -delta, this.lastAnchor_,
|
||||
|
||||
@@ -205,9 +205,9 @@ ol.interaction.Snap.prototype.forEachFeatureRemove_ = function(feature) {
|
||||
*/
|
||||
ol.interaction.Snap.prototype.getFeatures_ = function() {
|
||||
var features;
|
||||
if (!goog.isNull(this.features_)) {
|
||||
if (this.features_) {
|
||||
features = this.features_;
|
||||
} else if (!goog.isNull(this.source_)) {
|
||||
} else if (this.source_) {
|
||||
features = this.source_.getFeatures();
|
||||
}
|
||||
goog.asserts.assert(features !== undefined, 'features should be defined');
|
||||
@@ -328,12 +328,12 @@ ol.interaction.Snap.prototype.setMap = function(map) {
|
||||
goog.base(this, 'setMap', map);
|
||||
|
||||
if (map) {
|
||||
if (!goog.isNull(this.features_)) {
|
||||
if (this.features_) {
|
||||
keys.push(this.features_.on(ol.CollectionEventType.ADD,
|
||||
this.handleFeatureAdd_, this));
|
||||
keys.push(this.features_.on(ol.CollectionEventType.REMOVE,
|
||||
this.handleFeatureRemove_, this));
|
||||
} else if (!goog.isNull(this.source_)) {
|
||||
} else if (this.source_) {
|
||||
keys.push(this.source_.on(ol.source.VectorEventType.ADDFEATURE,
|
||||
this.handleFeatureAdd_, this));
|
||||
keys.push(this.source_.on(ol.source.VectorEventType.REMOVEFEATURE,
|
||||
|
||||
@@ -61,7 +61,7 @@ goog.inherits(ol.interaction.Translate, ol.interaction.Pointer);
|
||||
*/
|
||||
ol.interaction.Translate.handleDownEvent_ = function(event) {
|
||||
this.lastFeature_ = this.featuresAtPixel_(event.pixel, event.map);
|
||||
if (goog.isNull(this.lastCoordinate_) && !goog.isNull(this.lastFeature_)) {
|
||||
if (!this.lastCoordinate_ && this.lastFeature_) {
|
||||
this.lastCoordinate_ = event.coordinate;
|
||||
ol.interaction.Translate.handleMoveEvent_.call(this, event);
|
||||
return true;
|
||||
@@ -77,7 +77,7 @@ ol.interaction.Translate.handleDownEvent_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.Translate.handleUpEvent_ = function(event) {
|
||||
if (!goog.isNull(this.lastCoordinate_)) {
|
||||
if (this.lastCoordinate_) {
|
||||
this.lastCoordinate_ = null;
|
||||
ol.interaction.Translate.handleMoveEvent_.call(this, event);
|
||||
return true;
|
||||
@@ -92,18 +92,18 @@ ol.interaction.Translate.handleUpEvent_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.interaction.Translate.handleDragEvent_ = function(event) {
|
||||
if (!goog.isNull(this.lastCoordinate_)) {
|
||||
if (this.lastCoordinate_) {
|
||||
var newCoordinate = event.coordinate;
|
||||
var deltaX = newCoordinate[0] - this.lastCoordinate_[0];
|
||||
var deltaY = newCoordinate[1] - this.lastCoordinate_[1];
|
||||
|
||||
if (!goog.isNull(this.features_)) {
|
||||
if (this.features_) {
|
||||
this.features_.forEach(function(feature) {
|
||||
var geom = feature.getGeometry();
|
||||
geom.translate(deltaX, deltaY);
|
||||
feature.setGeometry(geom);
|
||||
});
|
||||
} else if (goog.isNull(this.lastFeature_)) {
|
||||
} else if (this.lastFeature_) {
|
||||
var geom = this.lastFeature_.getGeometry();
|
||||
geom.translate(deltaX, deltaY);
|
||||
this.lastFeature_.setGeometry(geom);
|
||||
@@ -130,7 +130,7 @@ ol.interaction.Translate.handleMoveEvent_ = function(event)
|
||||
if (intersectingFeature) {
|
||||
var isSelected = false;
|
||||
|
||||
if (!goog.isNull(this.features_) &&
|
||||
if (this.features_ &&
|
||||
ol.array.includes(this.features_.getArray(), intersectingFeature)) {
|
||||
isSelected = true;
|
||||
}
|
||||
@@ -138,12 +138,12 @@ ol.interaction.Translate.handleMoveEvent_ = function(event)
|
||||
this.previousCursor_ = elem.style.cursor;
|
||||
|
||||
// WebKit browsers don't support the grab icons without a prefix
|
||||
elem.style.cursor = !goog.isNull(this.lastCoordinate_) ?
|
||||
elem.style.cursor = this.lastCoordinate_ ?
|
||||
'-webkit-grabbing' : (isSelected ? '-webkit-grab' : 'pointer');
|
||||
|
||||
// Thankfully, attempting to set the standard ones will silently fail,
|
||||
// keeping the prefixed icons
|
||||
elem.style.cursor = goog.isNull(this.lastCoordinate_) ?
|
||||
elem.style.cursor = !this.lastCoordinate_ ?
|
||||
'grabbing' : (isSelected ? 'grab' : 'pointer');
|
||||
|
||||
} else {
|
||||
@@ -171,7 +171,7 @@ ol.interaction.Translate.prototype.featuresAtPixel_ = function(pixel, map) {
|
||||
return feature;
|
||||
});
|
||||
|
||||
if (!goog.isNull(this.features_) &&
|
||||
if (this.features_ &&
|
||||
ol.array.includes(this.features_.getArray(), intersectingFeature)) {
|
||||
found = intersectingFeature;
|
||||
}
|
||||
|
||||
@@ -106,8 +106,7 @@ ol.layer.Heatmap = function(opt_options) {
|
||||
'weightFunction should be a function');
|
||||
|
||||
this.setStyle(goog.bind(function(feature, resolution) {
|
||||
goog.asserts.assert(!goog.isNull(this.styleCache_),
|
||||
'this.styleCache_ should not be null');
|
||||
goog.asserts.assert(this.styleCache_, 'this.styleCache_ expected');
|
||||
goog.asserts.assert(this.circleImage_ !== undefined,
|
||||
'this.circleImage_ should be defined');
|
||||
var weight = weightFunction(feature);
|
||||
@@ -252,8 +251,7 @@ ol.layer.Heatmap.prototype.handleStyleChanged_ = function() {
|
||||
ol.layer.Heatmap.prototype.handleRender_ = function(event) {
|
||||
goog.asserts.assert(event.type == ol.render.EventType.RENDER,
|
||||
'event.type should be RENDER');
|
||||
goog.asserts.assert(!goog.isNull(this.gradient_),
|
||||
'this.gradient_ should not be null');
|
||||
goog.asserts.assert(this.gradient_, 'this.gradient_ expected');
|
||||
var context = event.context;
|
||||
var canvas = context.canvas;
|
||||
var image = context.getImageData(0, 0, canvas.width, canvas.height);
|
||||
|
||||
@@ -118,7 +118,7 @@ ol.layer.Layer.prototype.getSource = function() {
|
||||
*/
|
||||
ol.layer.Layer.prototype.getSourceState = function() {
|
||||
var source = this.getSource();
|
||||
return goog.isNull(source) ? ol.source.State.UNDEFINED : source.getState();
|
||||
return !source ? ol.source.State.UNDEFINED : source.getState();
|
||||
};
|
||||
|
||||
|
||||
@@ -134,12 +134,12 @@ ol.layer.Layer.prototype.handleSourceChange_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
||||
if (!goog.isNull(this.sourceChangeKey_)) {
|
||||
if (this.sourceChangeKey_) {
|
||||
goog.events.unlistenByKey(this.sourceChangeKey_);
|
||||
this.sourceChangeKey_ = null;
|
||||
}
|
||||
var source = this.getSource();
|
||||
if (!goog.isNull(source)) {
|
||||
if (source) {
|
||||
this.sourceChangeKey_ = goog.events.listen(source,
|
||||
goog.events.EventType.CHANGE, this.handleSourceChange_, false, this);
|
||||
}
|
||||
@@ -162,12 +162,12 @@ ol.layer.Layer.prototype.handleSourcePropertyChange_ = function() {
|
||||
ol.layer.Layer.prototype.setMap = function(map) {
|
||||
goog.events.unlistenByKey(this.mapPrecomposeKey_);
|
||||
this.mapPrecomposeKey_ = null;
|
||||
if (goog.isNull(map)) {
|
||||
if (!map) {
|
||||
this.changed();
|
||||
}
|
||||
goog.events.unlistenByKey(this.mapRenderKey_);
|
||||
this.mapRenderKey_ = null;
|
||||
if (!goog.isNull(map)) {
|
||||
if (map) {
|
||||
this.mapPrecomposeKey_ = goog.events.listen(
|
||||
map, ol.render.EventType.PRECOMPOSE, function(evt) {
|
||||
var layerState = this.getLayerState();
|
||||
|
||||
@@ -35,7 +35,7 @@ ol.layer.Vector = function(opt_options) {
|
||||
opt_options : /** @type {olx.layer.VectorOptions} */ ({});
|
||||
|
||||
goog.asserts.assert(
|
||||
options.renderOrder === undefined || goog.isNull(options.renderOrder) ||
|
||||
options.renderOrder === undefined || !options.renderOrder ||
|
||||
goog.isFunction(options.renderOrder),
|
||||
'renderOrder must be a comparator function');
|
||||
|
||||
@@ -161,7 +161,7 @@ ol.layer.Vector.prototype.getUpdateWhileInteracting = function() {
|
||||
*/
|
||||
ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
||||
goog.asserts.assert(
|
||||
renderOrder === undefined || goog.isNull(renderOrder) ||
|
||||
renderOrder === undefined || !renderOrder ||
|
||||
goog.isFunction(renderOrder),
|
||||
'renderOrder must be a comparator function');
|
||||
this.set(ol.layer.VectorProperty.RENDER_ORDER, renderOrder);
|
||||
@@ -181,7 +181,7 @@ ol.layer.Vector.prototype.setRenderOrder = function(renderOrder) {
|
||||
*/
|
||||
ol.layer.Vector.prototype.setStyle = function(style) {
|
||||
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
||||
this.styleFunction_ = goog.isNull(style) ?
|
||||
this.styleFunction_ = style === null ?
|
||||
undefined : ol.style.createStyleFunction(this.style_);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -597,7 +597,7 @@ ol.Map.prototype.disposeInternal = function() {
|
||||
*/
|
||||
ol.Map.prototype.forEachFeatureAtPixel =
|
||||
function(pixel, callback, opt_this, opt_layerFilter, opt_this2) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
@@ -635,7 +635,7 @@ ol.Map.prototype.forEachFeatureAtPixel =
|
||||
*/
|
||||
ol.Map.prototype.forEachLayerAtPixel =
|
||||
function(pixel, callback, opt_this, opt_layerFilter, opt_this2) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return;
|
||||
}
|
||||
var thisArg = opt_this !== undefined ? opt_this : null;
|
||||
@@ -665,7 +665,7 @@ ol.Map.prototype.forEachLayerAtPixel =
|
||||
*/
|
||||
ol.Map.prototype.hasFeatureAtPixel =
|
||||
function(pixel, opt_layerFilter, opt_this) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
return false;
|
||||
}
|
||||
var coordinate = this.getCoordinateFromPixel(pixel);
|
||||
@@ -737,7 +737,7 @@ ol.Map.prototype.getTargetElement = function() {
|
||||
*/
|
||||
ol.Map.prototype.getCoordinateFromPixel = function(pixel) {
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return null;
|
||||
} else {
|
||||
var vec2 = pixel.slice();
|
||||
@@ -812,7 +812,7 @@ ol.Map.prototype.getLayers = function() {
|
||||
*/
|
||||
ol.Map.prototype.getPixelFromCoordinate = function(coordinate) {
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
return null;
|
||||
} else {
|
||||
var vec2 = coordinate.slice(0, 2);
|
||||
@@ -899,7 +899,7 @@ ol.Map.prototype.getTilePriority =
|
||||
// Filter out tiles at higher zoom levels than the current zoom level, or that
|
||||
// are outside the visible extent.
|
||||
var frameState = this.frameState_;
|
||||
if (goog.isNull(frameState) || !(tileSourceKey in frameState.wantedTiles)) {
|
||||
if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {
|
||||
return ol.structs.PriorityQueue.DROP;
|
||||
}
|
||||
var coordKey = ol.tilecoord.toString(tile.tileCoord);
|
||||
@@ -934,7 +934,7 @@ ol.Map.prototype.handleBrowserEvent = function(browserEvent, opt_type) {
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent The event to handle.
|
||||
*/
|
||||
ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
if (goog.isNull(this.frameState_)) {
|
||||
if (!this.frameState_) {
|
||||
// With no view defined, we cannot translate pixels into geographical
|
||||
// coordinates so interactions cannot be used.
|
||||
return;
|
||||
@@ -982,7 +982,7 @@ ol.Map.prototype.handlePostRender = function() {
|
||||
var maxTotalLoading = 16;
|
||||
var maxNewLoads = maxTotalLoading;
|
||||
var tileSourceCount = 0;
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
var hints = frameState.viewHints;
|
||||
if (hints[ol.ViewHint.ANIMATING]) {
|
||||
maxTotalLoading = this.loadTilesWhileAnimating_ ? 8 : 0;
|
||||
@@ -1032,20 +1032,20 @@ ol.Map.prototype.handleTargetChanged_ = function() {
|
||||
|
||||
this.keyHandler_.detach();
|
||||
|
||||
if (goog.isNull(targetElement)) {
|
||||
if (!targetElement) {
|
||||
goog.dom.removeNode(this.viewport_);
|
||||
if (!goog.isNull(this.viewportResizeListenerKey_)) {
|
||||
if (this.viewportResizeListenerKey_) {
|
||||
goog.events.unlistenByKey(this.viewportResizeListenerKey_);
|
||||
this.viewportResizeListenerKey_ = null;
|
||||
}
|
||||
} else {
|
||||
goog.dom.appendChild(targetElement, this.viewport_);
|
||||
|
||||
var keyboardEventTarget = goog.isNull(this.keyboardEventTarget_) ?
|
||||
var keyboardEventTarget = !this.keyboardEventTarget_ ?
|
||||
targetElement : this.keyboardEventTarget_;
|
||||
this.keyHandler_.attach(keyboardEventTarget);
|
||||
|
||||
if (goog.isNull(this.viewportResizeListenerKey_)) {
|
||||
if (!this.viewportResizeListenerKey_) {
|
||||
this.viewportResizeListenerKey_ = goog.events.listen(
|
||||
this.viewportSizeMonitor_, goog.events.EventType.RESIZE,
|
||||
this.updateSize, false, this);
|
||||
@@ -1078,12 +1078,12 @@ ol.Map.prototype.handleViewPropertyChanged_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.Map.prototype.handleViewChanged_ = function() {
|
||||
if (!goog.isNull(this.viewPropertyListenerKey_)) {
|
||||
if (this.viewPropertyListenerKey_) {
|
||||
goog.events.unlistenByKey(this.viewPropertyListenerKey_);
|
||||
this.viewPropertyListenerKey_ = null;
|
||||
}
|
||||
var view = this.getView();
|
||||
if (!goog.isNull(view)) {
|
||||
if (view) {
|
||||
this.viewPropertyListenerKey_ = goog.events.listen(
|
||||
view, ol.ObjectEventType.PROPERTYCHANGE,
|
||||
this.handleViewPropertyChanged_, false, this);
|
||||
@@ -1118,7 +1118,7 @@ ol.Map.prototype.handleLayerGroupPropertyChanged_ = function(event) {
|
||||
* @private
|
||||
*/
|
||||
ol.Map.prototype.handleLayerGroupChanged_ = function() {
|
||||
if (!goog.isNull(this.layerGroupPropertyListenerKeys_)) {
|
||||
if (this.layerGroupPropertyListenerKeys_) {
|
||||
this.layerGroupPropertyListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.layerGroupPropertyListenerKeys_ = null;
|
||||
}
|
||||
@@ -1155,7 +1155,7 @@ ol.Map.prototype.isDef = function() {
|
||||
return false;
|
||||
}
|
||||
var view = this.getView();
|
||||
if (goog.isNull(view) || !view.isDef()) {
|
||||
if (!view || !view.isDef()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1166,7 +1166,7 @@ ol.Map.prototype.isDef = function() {
|
||||
* @return {boolean} Is rendered.
|
||||
*/
|
||||
ol.Map.prototype.isRendered = function() {
|
||||
return !goog.isNull(this.frameState_);
|
||||
return !!this.frameState_;
|
||||
};
|
||||
|
||||
|
||||
@@ -1259,7 +1259,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
/** @type {?olx.FrameState} */
|
||||
var frameState = null;
|
||||
if (size !== undefined && ol.size.hasArea(size) &&
|
||||
!goog.isNull(view) && view.isDef()) {
|
||||
view && view.isDef()) {
|
||||
var viewHints = view.getHints();
|
||||
var layerStatesArray = this.getLayerGroup().getLayerStatesArray();
|
||||
var layerStates = {};
|
||||
@@ -1272,7 +1272,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
attributions: {},
|
||||
coordinateToPixelMatrix: this.coordinateToPixelMatrix_,
|
||||
extent: null,
|
||||
focus: goog.isNull(this.focus_) ? viewState.center : this.focus_,
|
||||
focus: !this.focus_ ? viewState.center : this.focus_,
|
||||
index: this.frameIndex_++,
|
||||
layerStates: layerStates,
|
||||
layerStatesArray: layerStatesArray,
|
||||
@@ -1291,7 +1291,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
var preRenderFunctions = this.preRenderFunctions_;
|
||||
var n = 0, preRenderFunction;
|
||||
for (i = 0, ii = preRenderFunctions.length; i < ii; ++i) {
|
||||
@@ -1309,7 +1309,7 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
||||
this.frameState_ = frameState;
|
||||
this.renderer_.renderFrame(frameState);
|
||||
|
||||
if (!goog.isNull(frameState)) {
|
||||
if (frameState) {
|
||||
if (frameState.animate) {
|
||||
this.render();
|
||||
}
|
||||
@@ -1400,7 +1400,7 @@ ol.Map.prototype.skipFeature = function(feature) {
|
||||
ol.Map.prototype.updateSize = function() {
|
||||
var targetElement = this.getTargetElement();
|
||||
|
||||
if (goog.isNull(targetElement)) {
|
||||
if (!targetElement) {
|
||||
this.setSize(undefined);
|
||||
} else {
|
||||
var size = goog.style.getContentBoxSize(targetElement);
|
||||
|
||||
@@ -284,8 +284,7 @@ ol.MapBrowserEventHandler.prototype.handlePointerUp_ = function(pointerEvent) {
|
||||
// to 0).
|
||||
// See http://www.w3.org/TR/pointerevents/#button-states
|
||||
if (!this.dragging_ && this.isMouseActionButton_(pointerEvent)) {
|
||||
goog.asserts.assert(!goog.isNull(this.down_),
|
||||
'this.down_ should not be null');
|
||||
goog.asserts.assert(this.down_, 'this.down_ must be truthy');
|
||||
this.emulateClick_(this.down_);
|
||||
}
|
||||
|
||||
@@ -326,7 +325,7 @@ ol.MapBrowserEventHandler.prototype.handlePointerDown_ =
|
||||
|
||||
this.down_ = pointerEvent;
|
||||
|
||||
if (goog.isNull(this.dragListenerKeys_)) {
|
||||
if (!this.dragListenerKeys_) {
|
||||
/* Set up a pointer event handler on the `document`,
|
||||
* which is required when the pointer is moved outside
|
||||
* the viewport when dragging.
|
||||
@@ -396,7 +395,7 @@ ol.MapBrowserEventHandler.prototype.handlePointerMove_ =
|
||||
* @private
|
||||
*/
|
||||
ol.MapBrowserEventHandler.prototype.relayEvent_ = function(pointerEvent) {
|
||||
var dragging = !goog.isNull(this.down_) && this.isMoving_(pointerEvent);
|
||||
var dragging = !!(this.down_ && this.isMoving_(pointerEvent));
|
||||
this.dispatchEvent(new ol.MapBrowserPointerEvent(
|
||||
pointerEvent.type, this.map_, pointerEvent, dragging));
|
||||
};
|
||||
@@ -417,23 +416,23 @@ ol.MapBrowserEventHandler.prototype.isMoving_ = function(pointerEvent) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.MapBrowserEventHandler.prototype.disposeInternal = function() {
|
||||
if (!goog.isNull(this.relayedListenerKey_)) {
|
||||
if (this.relayedListenerKey_) {
|
||||
goog.events.unlistenByKey(this.relayedListenerKey_);
|
||||
this.relayedListenerKey_ = null;
|
||||
}
|
||||
if (!goog.isNull(this.pointerdownListenerKey_)) {
|
||||
if (this.pointerdownListenerKey_) {
|
||||
goog.events.unlistenByKey(this.pointerdownListenerKey_);
|
||||
this.pointerdownListenerKey_ = null;
|
||||
}
|
||||
if (!goog.isNull(this.dragListenerKeys_)) {
|
||||
if (this.dragListenerKeys_) {
|
||||
this.dragListenerKeys_.forEach(goog.events.unlistenByKey);
|
||||
this.dragListenerKeys_ = null;
|
||||
}
|
||||
if (!goog.isNull(this.documentPointerEventHandler_)) {
|
||||
if (this.documentPointerEventHandler_) {
|
||||
goog.dispose(this.documentPointerEventHandler_);
|
||||
this.documentPointerEventHandler_ = null;
|
||||
}
|
||||
if (!goog.isNull(this.pointerEventHandler_)) {
|
||||
if (this.pointerEventHandler_) {
|
||||
goog.dispose(this.pointerEventHandler_);
|
||||
this.pointerEventHandler_ = null;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ ol.Overlay.prototype.handleElementChanged = function() {
|
||||
* @protected
|
||||
*/
|
||||
ol.Overlay.prototype.handleMapChanged = function() {
|
||||
if (!goog.isNull(this.mapPostrenderListenerKey_)) {
|
||||
if (this.mapPostrenderListenerKey_) {
|
||||
goog.dom.removeNode(this.element_);
|
||||
goog.events.unlistenByKey(this.mapPostrenderListenerKey_);
|
||||
this.mapPostrenderListenerKey_ = null;
|
||||
@@ -366,7 +366,7 @@ ol.Overlay.prototype.panIntoView_ = function() {
|
||||
goog.asserts.assert(this.autoPan, 'this.autoPan should be true');
|
||||
var map = this.getMap();
|
||||
|
||||
if (map === undefined || goog.isNull(map.getTargetElement())) {
|
||||
if (map === undefined || !map.getTargetElement()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ ol.Overlay.prototype.panIntoView_ = function() {
|
||||
centerPx[1] + delta[1]
|
||||
];
|
||||
|
||||
if (!goog.isNull(this.autoPanAnimation_)) {
|
||||
if (this.autoPanAnimation_) {
|
||||
this.autoPanAnimation_.source = center;
|
||||
map.beforeRender(ol.animation.pan(this.autoPanAnimation_));
|
||||
}
|
||||
@@ -489,7 +489,7 @@ ol.Overlay.prototype.updatePixelPosition = function() {
|
||||
* @protected
|
||||
*/
|
||||
ol.Overlay.prototype.updateRenderedPosition = function(pixel, mapSize) {
|
||||
goog.asserts.assert(!goog.isNull(pixel), 'pixel should not be null');
|
||||
goog.asserts.assert(pixel, 'pixel should not be null');
|
||||
goog.asserts.assert(mapSize !== undefined, 'mapSize should be defined');
|
||||
var style = this.element_.style;
|
||||
var offset = this.getOffset();
|
||||
|
||||
@@ -366,7 +366,7 @@ ol.pointer.PointerEventHandler.prototype.enterOver =
|
||||
*/
|
||||
ol.pointer.PointerEventHandler.prototype.contains_ =
|
||||
function(container, contained) {
|
||||
if (goog.isNull(contained)) {
|
||||
if (!contained) {
|
||||
return false;
|
||||
}
|
||||
return goog.dom.contains(container, contained);
|
||||
|
||||
@@ -125,7 +125,7 @@ ol.proj.Projection = function(options) {
|
||||
* @private
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.canWrapX_ = this.global_ && !goog.isNull(this.extent_);
|
||||
this.canWrapX_ = !!(this.global_ && this.extent_);
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -272,7 +272,7 @@ ol.proj.Projection.prototype.isGlobal = function() {
|
||||
*/
|
||||
ol.proj.Projection.prototype.setGlobal = function(global) {
|
||||
this.global_ = global;
|
||||
this.canWrapX_ = global && !goog.isNull(this.extent_);
|
||||
this.canWrapX_ = !!(global && this.extent_);
|
||||
};
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ ol.proj.Projection.prototype.setDefaultTileGrid = function(tileGrid) {
|
||||
*/
|
||||
ol.proj.Projection.prototype.setExtent = function(extent) {
|
||||
this.extent_ = extent;
|
||||
this.canWrapX_ = this.global_ && !goog.isNull(extent);
|
||||
this.canWrapX_ = !!(this.global_ && extent);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ goog.inherits(ol.render.Box, goog.Disposable);
|
||||
* @return {ol.geom.Polygon} Geometry.
|
||||
*/
|
||||
ol.render.Box.prototype.createGeometry_ = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.startPixel_),
|
||||
'this.startPixel_ should not be null');
|
||||
goog.asserts.assert(!goog.isNull(this.endPixel_),
|
||||
'this.endPixel_ should not be null');
|
||||
goog.asserts.assert(!goog.isNull(this.map_), 'this.map_ should not be null');
|
||||
goog.asserts.assert(this.startPixel_,
|
||||
'this.startPixel_ must be truthy');
|
||||
goog.asserts.assert(this.endPixel_,
|
||||
'this.endPixel_ must be truthy');
|
||||
goog.asserts.assert(this.map_, 'this.map_ must be truthy');
|
||||
var startPixel = this.startPixel_;
|
||||
var endPixel = this.endPixel_;
|
||||
var pixels = [
|
||||
@@ -98,7 +98,7 @@ ol.render.Box.prototype.handleMapPostCompose_ = function(event) {
|
||||
var geometry = this.geometry_;
|
||||
goog.asserts.assert(geometry, 'geometry should be defined');
|
||||
var style = this.style_;
|
||||
goog.asserts.assert(!goog.isNull(style), 'style should not be null');
|
||||
goog.asserts.assert(style, 'style must be truthy');
|
||||
// use drawAsync(Infinity) to draw above everything
|
||||
event.vectorContext.drawAsync(Infinity, function(render) {
|
||||
render.setFillStrokeStyle(style.getFill(), style.getStroke());
|
||||
@@ -120,9 +120,7 @@ ol.render.Box.prototype.getGeometry = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.render.Box.prototype.requestMapRenderFrame_ = function() {
|
||||
if (!goog.isNull(this.map_) &&
|
||||
!goog.isNull(this.startPixel_) &&
|
||||
!goog.isNull(this.endPixel_)) {
|
||||
if (this.map_ && this.startPixel_ && this.endPixel_) {
|
||||
this.map_.render();
|
||||
}
|
||||
};
|
||||
@@ -132,14 +130,14 @@ ol.render.Box.prototype.requestMapRenderFrame_ = function() {
|
||||
* @param {ol.Map} map Map.
|
||||
*/
|
||||
ol.render.Box.prototype.setMap = function(map) {
|
||||
if (!goog.isNull(this.postComposeListenerKey_)) {
|
||||
if (this.postComposeListenerKey_) {
|
||||
goog.events.unlistenByKey(this.postComposeListenerKey_);
|
||||
this.postComposeListenerKey_ = null;
|
||||
this.map_.render();
|
||||
this.map_ = null;
|
||||
}
|
||||
this.map_ = map;
|
||||
if (!goog.isNull(this.map_)) {
|
||||
if (this.map_) {
|
||||
this.postComposeListenerKey_ = goog.events.listen(
|
||||
map, ol.render.EventType.POSTCOMPOSE, this.handleMapPostCompose_, false,
|
||||
this);
|
||||
|
||||
@@ -249,7 +249,7 @@ ol.render.canvas.Immediate =
|
||||
*/
|
||||
ol.render.canvas.Immediate.prototype.drawImages_ =
|
||||
function(flatCoordinates, offset, end, stride) {
|
||||
if (goog.isNull(this.image_)) {
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(offset === 0, 'offset should be 0');
|
||||
@@ -312,13 +312,13 @@ ol.render.canvas.Immediate.prototype.drawImages_ =
|
||||
*/
|
||||
ol.render.canvas.Immediate.prototype.drawText_ =
|
||||
function(flatCoordinates, offset, end, stride) {
|
||||
if (goog.isNull(this.textState_) || this.text_ === '') {
|
||||
if (!this.textState_ || this.text_ === '') {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.textFillState_)) {
|
||||
if (this.textFillState_) {
|
||||
this.setContextFillState_(this.textFillState_);
|
||||
}
|
||||
if (!goog.isNull(this.textStrokeState_)) {
|
||||
if (this.textStrokeState_) {
|
||||
this.setContextStrokeState_(this.textStrokeState_);
|
||||
}
|
||||
this.setContextTextState_(this.textState_);
|
||||
@@ -343,10 +343,10 @@ ol.render.canvas.Immediate.prototype.drawText_ =
|
||||
goog.vec.Mat4.getElement(localTransform, 0, 3),
|
||||
goog.vec.Mat4.getElement(localTransform, 1, 3));
|
||||
}
|
||||
if (!goog.isNull(this.textStrokeState_)) {
|
||||
if (this.textStrokeState_) {
|
||||
context.strokeText(this.text_, x, y);
|
||||
}
|
||||
if (!goog.isNull(this.textFillState_)) {
|
||||
if (this.textFillState_) {
|
||||
context.fillText(this.text_, x, y);
|
||||
}
|
||||
}
|
||||
@@ -437,11 +437,11 @@ ol.render.canvas.Immediate.prototype.drawCircleGeometry =
|
||||
if (!ol.extent.intersects(this.extent_, circleGeometry.getExtent())) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.fillState_) || !goog.isNull(this.strokeState_)) {
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.fillState_ || this.strokeState_) {
|
||||
if (this.fillState_) {
|
||||
this.setContextFillState_(this.fillState_);
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
this.setContextStrokeState_(this.strokeState_);
|
||||
}
|
||||
var pixelCoordinates = ol.geom.transformSimpleGeometry2D(
|
||||
@@ -453,10 +453,10 @@ ol.render.canvas.Immediate.prototype.drawCircleGeometry =
|
||||
context.beginPath();
|
||||
context.arc(
|
||||
pixelCoordinates[0], pixelCoordinates[1], radius, 0, 2 * Math.PI);
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.fillState_) {
|
||||
context.fill();
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,7 @@ ol.render.canvas.Immediate.prototype.drawPointGeometry =
|
||||
function(pointGeometry, feature) {
|
||||
var flatCoordinates = pointGeometry.getFlatCoordinates();
|
||||
var stride = pointGeometry.getStride();
|
||||
if (!goog.isNull(this.image_)) {
|
||||
if (this.image_) {
|
||||
this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
}
|
||||
if (this.text_ !== '') {
|
||||
@@ -556,7 +556,7 @@ ol.render.canvas.Immediate.prototype.drawMultiPointGeometry =
|
||||
function(multiPointGeometry, feature) {
|
||||
var flatCoordinates = multiPointGeometry.getFlatCoordinates();
|
||||
var stride = multiPointGeometry.getStride();
|
||||
if (!goog.isNull(this.image_)) {
|
||||
if (this.image_) {
|
||||
this.drawImages_(flatCoordinates, 0, flatCoordinates.length, stride);
|
||||
}
|
||||
if (this.text_ !== '') {
|
||||
@@ -578,7 +578,7 @@ ol.render.canvas.Immediate.prototype.drawLineStringGeometry =
|
||||
if (!ol.extent.intersects(this.extent_, lineStringGeometry.getExtent())) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
this.setContextStrokeState_(this.strokeState_);
|
||||
var context = this.context_;
|
||||
var flatCoordinates = lineStringGeometry.getFlatCoordinates();
|
||||
@@ -609,7 +609,7 @@ ol.render.canvas.Immediate.prototype.drawMultiLineStringGeometry =
|
||||
if (!ol.extent.intersects(this.extent_, geometryExtent)) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
this.setContextStrokeState_(this.strokeState_);
|
||||
var context = this.context_;
|
||||
var flatCoordinates = multiLineStringGeometry.getFlatCoordinates();
|
||||
@@ -644,21 +644,21 @@ ol.render.canvas.Immediate.prototype.drawPolygonGeometry =
|
||||
if (!ol.extent.intersects(this.extent_, polygonGeometry.getExtent())) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_) || !goog.isNull(this.fillState_)) {
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.strokeState_ || this.fillState_) {
|
||||
if (this.fillState_) {
|
||||
this.setContextFillState_(this.fillState_);
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
this.setContextStrokeState_(this.strokeState_);
|
||||
}
|
||||
var context = this.context_;
|
||||
context.beginPath();
|
||||
this.drawRings_(polygonGeometry.getOrientedFlatCoordinates(),
|
||||
0, polygonGeometry.getEnds(), polygonGeometry.getStride());
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.fillState_) {
|
||||
context.fill();
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
@@ -681,11 +681,11 @@ ol.render.canvas.Immediate.prototype.drawMultiPolygonGeometry =
|
||||
if (!ol.extent.intersects(this.extent_, multiPolygonGeometry.getExtent())) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_) || !goog.isNull(this.fillState_)) {
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.strokeState_ || this.fillState_) {
|
||||
if (this.fillState_) {
|
||||
this.setContextFillState_(this.fillState_);
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
this.setContextStrokeState_(this.strokeState_);
|
||||
}
|
||||
var context = this.context_;
|
||||
@@ -698,10 +698,10 @@ ol.render.canvas.Immediate.prototype.drawMultiPolygonGeometry =
|
||||
var ends = endss[i];
|
||||
context.beginPath();
|
||||
offset = this.drawRings_(flatCoordinates, offset, ends, stride);
|
||||
if (!goog.isNull(this.fillState_)) {
|
||||
if (this.fillState_) {
|
||||
context.fill();
|
||||
}
|
||||
if (!goog.isNull(this.strokeState_)) {
|
||||
if (this.strokeState_) {
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
@@ -744,7 +744,7 @@ ol.render.canvas.Immediate.prototype.setContextFillState_ =
|
||||
function(fillState) {
|
||||
var context = this.context_;
|
||||
var contextFillState = this.contextFillState_;
|
||||
if (goog.isNull(contextFillState)) {
|
||||
if (!contextFillState) {
|
||||
context.fillStyle = fillState.fillStyle;
|
||||
this.contextFillState_ = {
|
||||
fillStyle: fillState.fillStyle
|
||||
@@ -765,7 +765,7 @@ ol.render.canvas.Immediate.prototype.setContextStrokeState_ =
|
||||
function(strokeState) {
|
||||
var context = this.context_;
|
||||
var contextStrokeState = this.contextStrokeState_;
|
||||
if (goog.isNull(contextStrokeState)) {
|
||||
if (!contextStrokeState) {
|
||||
context.lineCap = strokeState.lineCap;
|
||||
if (ol.has.CANVAS_LINE_DASH) {
|
||||
context.setLineDash(strokeState.lineDash);
|
||||
@@ -818,7 +818,7 @@ ol.render.canvas.Immediate.prototype.setContextTextState_ =
|
||||
function(textState) {
|
||||
var context = this.context_;
|
||||
var contextTextState = this.contextTextState_;
|
||||
if (goog.isNull(contextTextState)) {
|
||||
if (!contextTextState) {
|
||||
context.font = textState.font;
|
||||
context.textAlign = textState.textAlign;
|
||||
context.textBaseline = textState.textBaseline;
|
||||
@@ -852,16 +852,16 @@ ol.render.canvas.Immediate.prototype.setContextTextState_ =
|
||||
*/
|
||||
ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
if (goog.isNull(fillStyle)) {
|
||||
if (!fillStyle) {
|
||||
this.fillState_ = null;
|
||||
} else {
|
||||
var fillStyleColor = fillStyle.getColor();
|
||||
this.fillState_ = {
|
||||
fillStyle: ol.color.asString(!goog.isNull(fillStyleColor) ?
|
||||
fillStyle: ol.color.asString(fillStyleColor ?
|
||||
fillStyleColor : ol.render.canvas.defaultFillStyle)
|
||||
};
|
||||
}
|
||||
if (goog.isNull(strokeStyle)) {
|
||||
if (!strokeStyle) {
|
||||
this.strokeState_ = null;
|
||||
} else {
|
||||
var strokeStyleColor = strokeStyle.getColor();
|
||||
@@ -881,7 +881,7 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
|
||||
strokeStyleWidth : ol.render.canvas.defaultLineWidth),
|
||||
miterLimit: strokeStyleMiterLimit !== undefined ?
|
||||
strokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
|
||||
strokeStyle: ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
strokeStyle: ol.color.asString(strokeStyleColor ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle)
|
||||
};
|
||||
}
|
||||
@@ -896,7 +896,7 @@ ol.render.canvas.Immediate.prototype.setFillStrokeStyle =
|
||||
* @api
|
||||
*/
|
||||
ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
if (goog.isNull(imageStyle)) {
|
||||
if (!imageStyle) {
|
||||
this.image_ = null;
|
||||
} else {
|
||||
var imageAnchor = imageStyle.getAnchor();
|
||||
@@ -904,14 +904,10 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
var imageImage = imageStyle.getImage(1);
|
||||
var imageOrigin = imageStyle.getOrigin();
|
||||
var imageSize = imageStyle.getSize();
|
||||
goog.asserts.assert(!goog.isNull(imageAnchor),
|
||||
'imageAnchor should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageImage),
|
||||
'imageImage should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageOrigin),
|
||||
'imageOrigin should not be null');
|
||||
goog.asserts.assert(!goog.isNull(imageSize),
|
||||
'imageSize should not be null');
|
||||
goog.asserts.assert(imageAnchor, 'imageAnchor must be truthy');
|
||||
goog.asserts.assert(imageImage, 'imageImage must be truthy');
|
||||
goog.asserts.assert(imageOrigin, 'imageOrigin must be truthy');
|
||||
goog.asserts.assert(imageSize, 'imageSize must be truthy');
|
||||
this.imageAnchorX_ = imageAnchor[0];
|
||||
this.imageAnchorY_ = imageAnchor[1];
|
||||
this.imageHeight_ = imageSize[1];
|
||||
@@ -936,21 +932,21 @@ ol.render.canvas.Immediate.prototype.setImageStyle = function(imageStyle) {
|
||||
* @api
|
||||
*/
|
||||
ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
||||
if (goog.isNull(textStyle)) {
|
||||
if (!textStyle) {
|
||||
this.text_ = '';
|
||||
} else {
|
||||
var textFillStyle = textStyle.getFill();
|
||||
if (goog.isNull(textFillStyle)) {
|
||||
if (!textFillStyle) {
|
||||
this.textFillState_ = null;
|
||||
} else {
|
||||
var textFillStyleColor = textFillStyle.getColor();
|
||||
this.textFillState_ = {
|
||||
fillStyle: ol.color.asString(!goog.isNull(textFillStyleColor) ?
|
||||
fillStyle: ol.color.asString(textFillStyleColor ?
|
||||
textFillStyleColor : ol.render.canvas.defaultFillStyle)
|
||||
};
|
||||
}
|
||||
var textStrokeStyle = textStyle.getStroke();
|
||||
if (goog.isNull(textStrokeStyle)) {
|
||||
if (!textStrokeStyle) {
|
||||
this.textStrokeState_ = null;
|
||||
} else {
|
||||
var textStrokeStyleColor = textStrokeStyle.getColor();
|
||||
@@ -970,7 +966,7 @@ ol.render.canvas.Immediate.prototype.setTextStyle = function(textStyle) {
|
||||
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth,
|
||||
miterLimit: textStrokeStyleMiterLimit !== undefined ?
|
||||
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit,
|
||||
strokeStyle: ol.color.asString(!goog.isNull(textStrokeStyleColor) ?
|
||||
strokeStyle: ol.color.asString(textStrokeStyleColor ?
|
||||
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
||||
'5th instruction should be a string');
|
||||
goog.asserts.assert(goog.isNumber(instruction[5]),
|
||||
'6th instruction should be a number');
|
||||
goog.asserts.assert(!goog.isNull(instruction[6]),
|
||||
goog.asserts.assert(instruction[6],
|
||||
'7th instruction should not be null');
|
||||
var usePixelRatio = instruction[7] !== undefined ?
|
||||
instruction[7] : true;
|
||||
@@ -568,11 +568,11 @@ ol.render.canvas.Replay.prototype.reverseHitDetectionInstructions_ =
|
||||
* @param {ol.Feature} feature Feature.
|
||||
*/
|
||||
ol.render.canvas.Replay.prototype.endGeometry = function(geometry, feature) {
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction1_),
|
||||
goog.asserts.assert(this.beginGeometryInstruction1_,
|
||||
'this.beginGeometryInstruction1_ should not be null');
|
||||
this.beginGeometryInstruction1_[2] = this.instructions.length;
|
||||
this.beginGeometryInstruction1_ = null;
|
||||
goog.asserts.assert(!goog.isNull(this.beginGeometryInstruction2_),
|
||||
goog.asserts.assert(this.beginGeometryInstruction2_,
|
||||
'this.beginGeometryInstruction2_ should not be null');
|
||||
this.beginGeometryInstruction2_[2] = this.hitDetectionInstructions.length;
|
||||
this.beginGeometryInstruction2_ = null;
|
||||
@@ -716,7 +716,7 @@ ol.render.canvas.ImageReplay.prototype.drawCoordinates_ =
|
||||
*/
|
||||
ol.render.canvas.ImageReplay.prototype.drawPointGeometry =
|
||||
function(pointGeometry, feature) {
|
||||
if (goog.isNull(this.image_)) {
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(this.anchorX_ !== undefined,
|
||||
@@ -769,7 +769,7 @@ ol.render.canvas.ImageReplay.prototype.drawPointGeometry =
|
||||
*/
|
||||
ol.render.canvas.ImageReplay.prototype.drawMultiPointGeometry =
|
||||
function(multiPointGeometry, feature) {
|
||||
if (goog.isNull(this.image_)) {
|
||||
if (!this.image_) {
|
||||
return;
|
||||
}
|
||||
goog.asserts.assert(this.anchorX_ !== undefined,
|
||||
@@ -843,19 +843,18 @@ ol.render.canvas.ImageReplay.prototype.finish = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
goog.asserts.assert(!goog.isNull(imageStyle),
|
||||
'imageStyle should not be null');
|
||||
goog.asserts.assert(imageStyle, 'imageStyle should not be null');
|
||||
var anchor = imageStyle.getAnchor();
|
||||
goog.asserts.assert(!goog.isNull(anchor), 'anchor should not be null');
|
||||
goog.asserts.assert(anchor, 'anchor should not be null');
|
||||
var size = imageStyle.getSize();
|
||||
goog.asserts.assert(!goog.isNull(size), 'size should not be null');
|
||||
goog.asserts.assert(size, 'size should not be null');
|
||||
var hitDetectionImage = imageStyle.getHitDetectionImage(1);
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImage),
|
||||
goog.asserts.assert(hitDetectionImage,
|
||||
'hitDetectionImage should not be null');
|
||||
var image = imageStyle.getImage(1);
|
||||
goog.asserts.assert(!goog.isNull(image), 'image should not be null');
|
||||
goog.asserts.assert(image, 'image should not be null');
|
||||
var origin = imageStyle.getOrigin();
|
||||
goog.asserts.assert(!goog.isNull(origin), 'origin should not be null');
|
||||
goog.asserts.assert(origin, 'origin should not be null');
|
||||
this.anchorX_ = anchor[0];
|
||||
this.anchorY_ = anchor[1];
|
||||
this.hitDetectionImage_ = hitDetectionImage;
|
||||
@@ -947,7 +946,7 @@ ol.render.canvas.LineStringReplay.prototype.drawFlatCoordinates_ =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.getBufferedMaxExtent = function() {
|
||||
if (goog.isNull(this.bufferedMaxExtent_)) {
|
||||
if (!this.bufferedMaxExtent_) {
|
||||
this.bufferedMaxExtent_ = ol.extent.clone(this.maxExtent);
|
||||
if (this.maxLineWidth > 0) {
|
||||
var width = this.resolution * (this.maxLineWidth + 1) / 2;
|
||||
@@ -972,7 +971,7 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
goog.asserts.assert(strokeStyle !== undefined,
|
||||
'strokeStyle should be defined');
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
|
||||
goog.asserts.assert(lineDash, 'lineDash should not be null');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== undefined, 'miterLimit should be defined');
|
||||
@@ -1007,7 +1006,7 @@ ol.render.canvas.LineStringReplay.prototype.setStrokeStyle_ = function() {
|
||||
ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
|
||||
function(lineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (strokeStyle === undefined || lineWidth === undefined) {
|
||||
@@ -1035,7 +1034,7 @@ ol.render.canvas.LineStringReplay.prototype.drawLineStringGeometry =
|
||||
ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
|
||||
function(multiLineStringGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
var strokeStyle = state.strokeStyle;
|
||||
var lineWidth = state.lineWidth;
|
||||
if (strokeStyle === undefined || lineWidth === undefined) {
|
||||
@@ -1067,7 +1066,7 @@ ol.render.canvas.LineStringReplay.prototype.drawMultiLineStringGeometry =
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
if (state.lastStroke != this.coordinates.length) {
|
||||
this.instructions.push([ol.render.canvas.Instruction.STROKE]);
|
||||
}
|
||||
@@ -1081,19 +1080,17 @@ ol.render.canvas.LineStringReplay.prototype.finish = function() {
|
||||
*/
|
||||
ol.render.canvas.LineStringReplay.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
goog.asserts.assert(goog.isNull(fillStyle), 'fillStyle should be null');
|
||||
goog.asserts.assert(!goog.isNull(strokeStyle),
|
||||
'strokeStyle should not be null');
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
goog.asserts.assert(!fillStyle, 'fillStyle should be null');
|
||||
goog.asserts.assert(strokeStyle, 'strokeStyle should not be null');
|
||||
var strokeStyleColor = strokeStyle.getColor();
|
||||
this.state_.strokeStyle = ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
this.state_.strokeStyle = ol.color.asString(strokeStyleColor ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
var strokeStyleLineCap = strokeStyle.getLineCap();
|
||||
this.state_.lineCap = strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.canvas.defaultLineCap;
|
||||
var strokeStyleLineDash = strokeStyle.getLineDash();
|
||||
this.state_.lineDash = !goog.isNull(strokeStyleLineDash) ?
|
||||
this.state_.lineDash = strokeStyleLineDash ?
|
||||
strokeStyleLineDash : ol.render.canvas.defaultLineDash;
|
||||
var strokeStyleLineJoin = strokeStyle.getLineJoin();
|
||||
this.state_.lineJoin = strokeStyleLineJoin !== undefined ?
|
||||
@@ -1217,7 +1214,7 @@ ol.render.canvas.PolygonReplay.prototype.drawFlatCoordinatess_ =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
function(circleGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
@@ -1270,7 +1267,7 @@ ol.render.canvas.PolygonReplay.prototype.drawCircleGeometry =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
||||
function(polygonGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
@@ -1306,7 +1303,7 @@ ol.render.canvas.PolygonReplay.prototype.drawPolygonGeometry =
|
||||
ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
||||
function(multiPolygonGeometry, feature) {
|
||||
var state = this.state_;
|
||||
goog.asserts.assert(!goog.isNull(state), 'state should not be null');
|
||||
goog.asserts.assert(state, 'state should not be null');
|
||||
var fillStyle = state.fillStyle;
|
||||
var strokeStyle = state.strokeStyle;
|
||||
if (fillStyle === undefined && strokeStyle === undefined) {
|
||||
@@ -1345,8 +1342,7 @@ ol.render.canvas.PolygonReplay.prototype.drawMultiPolygonGeometry =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.finish = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
this.reverseHitDetectionInstructions_();
|
||||
this.state_ = null;
|
||||
// We want to preserve topology when drawing polygons. Polygons are
|
||||
@@ -1368,7 +1364,7 @@ ol.render.canvas.PolygonReplay.prototype.finish = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
|
||||
if (goog.isNull(this.bufferedMaxExtent_)) {
|
||||
if (!this.bufferedMaxExtent_) {
|
||||
this.bufferedMaxExtent_ = ol.extent.clone(this.maxExtent);
|
||||
if (this.maxLineWidth > 0) {
|
||||
var width = this.resolution * (this.maxLineWidth + 1) / 2;
|
||||
@@ -1384,27 +1380,26 @@ ol.render.canvas.PolygonReplay.prototype.getBufferedMaxExtent = function() {
|
||||
*/
|
||||
ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyle =
|
||||
function(fillStyle, strokeStyle) {
|
||||
goog.asserts.assert(!goog.isNull(this.state_),
|
||||
'this.state_ should not be null');
|
||||
goog.asserts.assert(!goog.isNull(fillStyle) || !goog.isNull(strokeStyle),
|
||||
goog.asserts.assert(this.state_, 'this.state_ should not be null');
|
||||
goog.asserts.assert(fillStyle || strokeStyle,
|
||||
'fillStyle or strokeStyle should not be null');
|
||||
var state = this.state_;
|
||||
if (!goog.isNull(fillStyle)) {
|
||||
if (fillStyle) {
|
||||
var fillStyleColor = fillStyle.getColor();
|
||||
state.fillStyle = ol.color.asString(!goog.isNull(fillStyleColor) ?
|
||||
state.fillStyle = ol.color.asString(fillStyleColor ?
|
||||
fillStyleColor : ol.render.canvas.defaultFillStyle);
|
||||
} else {
|
||||
state.fillStyle = undefined;
|
||||
}
|
||||
if (!goog.isNull(strokeStyle)) {
|
||||
if (strokeStyle) {
|
||||
var strokeStyleColor = strokeStyle.getColor();
|
||||
state.strokeStyle = ol.color.asString(!goog.isNull(strokeStyleColor) ?
|
||||
state.strokeStyle = ol.color.asString(strokeStyleColor ?
|
||||
strokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
var strokeStyleLineCap = strokeStyle.getLineCap();
|
||||
state.lineCap = strokeStyleLineCap !== undefined ?
|
||||
strokeStyleLineCap : ol.render.canvas.defaultLineCap;
|
||||
var strokeStyleLineDash = strokeStyle.getLineDash();
|
||||
state.lineDash = !goog.isNull(strokeStyleLineDash) ?
|
||||
state.lineDash = strokeStyleLineDash ?
|
||||
strokeStyleLineDash.slice() : ol.render.canvas.defaultLineDash;
|
||||
var strokeStyleLineJoin = strokeStyle.getLineJoin();
|
||||
state.lineJoin = strokeStyleLineJoin !== undefined ?
|
||||
@@ -1451,7 +1446,7 @@ ol.render.canvas.PolygonReplay.prototype.setFillStrokeStyles_ = function() {
|
||||
}
|
||||
if (strokeStyle !== undefined) {
|
||||
goog.asserts.assert(lineCap !== undefined, 'lineCap should be defined');
|
||||
goog.asserts.assert(!goog.isNull(lineDash), 'lineDash should not be null');
|
||||
goog.asserts.assert(lineDash, 'lineDash should not be null');
|
||||
goog.asserts.assert(lineJoin !== undefined, 'lineJoin should be defined');
|
||||
goog.asserts.assert(lineWidth !== undefined, 'lineWidth should be defined');
|
||||
goog.asserts.assert(miterLimit !== undefined,
|
||||
@@ -1566,15 +1561,15 @@ goog.inherits(ol.render.canvas.TextReplay, ol.render.canvas.Replay);
|
||||
ol.render.canvas.TextReplay.prototype.drawText =
|
||||
function(flatCoordinates, offset, end, stride, geometry, feature) {
|
||||
if (this.text_ === '' ||
|
||||
goog.isNull(this.textState_) ||
|
||||
(goog.isNull(this.textFillState_) &&
|
||||
goog.isNull(this.textStrokeState_))) {
|
||||
!this.textState_ ||
|
||||
(this.textFillState_ &&
|
||||
!this.textStrokeState_)) {
|
||||
return;
|
||||
}
|
||||
if (!goog.isNull(this.textFillState_)) {
|
||||
if (this.textFillState_) {
|
||||
this.setReplayFillState_(this.textFillState_);
|
||||
}
|
||||
if (!goog.isNull(this.textStrokeState_)) {
|
||||
if (this.textStrokeState_) {
|
||||
this.setReplayStrokeState_(this.textStrokeState_);
|
||||
}
|
||||
this.setReplayTextState_(this.textState_);
|
||||
@@ -1582,8 +1577,8 @@ ol.render.canvas.TextReplay.prototype.drawText =
|
||||
var myBegin = this.coordinates.length;
|
||||
var myEnd =
|
||||
this.appendFlatCoordinates(flatCoordinates, offset, end, stride, false);
|
||||
var fill = !goog.isNull(this.textFillState_);
|
||||
var stroke = !goog.isNull(this.textStrokeState_);
|
||||
var fill = this.textFillState_;
|
||||
var stroke = this.textStrokeState_;
|
||||
var drawTextInstruction = [
|
||||
ol.render.canvas.Instruction.DRAW_TEXT, myBegin, myEnd, this.text_,
|
||||
this.textOffsetX_, this.textOffsetY_, this.textRotation_, this.textScale_,
|
||||
@@ -1601,7 +1596,7 @@ ol.render.canvas.TextReplay.prototype.drawText =
|
||||
ol.render.canvas.TextReplay.prototype.setReplayFillState_ =
|
||||
function(fillState) {
|
||||
var replayFillState = this.replayFillState_;
|
||||
if (!goog.isNull(replayFillState) &&
|
||||
if (replayFillState &&
|
||||
replayFillState.fillStyle == fillState.fillStyle) {
|
||||
return;
|
||||
}
|
||||
@@ -1609,7 +1604,7 @@ ol.render.canvas.TextReplay.prototype.setReplayFillState_ =
|
||||
[ol.render.canvas.Instruction.SET_FILL_STYLE, fillState.fillStyle];
|
||||
this.instructions.push(setFillStyleInstruction);
|
||||
this.hitDetectionInstructions.push(setFillStyleInstruction);
|
||||
if (goog.isNull(replayFillState)) {
|
||||
if (!replayFillState) {
|
||||
this.replayFillState_ = {
|
||||
fillStyle: fillState.fillStyle
|
||||
};
|
||||
@@ -1626,7 +1621,7 @@ ol.render.canvas.TextReplay.prototype.setReplayFillState_ =
|
||||
ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ =
|
||||
function(strokeState) {
|
||||
var replayStrokeState = this.replayStrokeState_;
|
||||
if (!goog.isNull(replayStrokeState) &&
|
||||
if (replayStrokeState &&
|
||||
replayStrokeState.lineCap == strokeState.lineCap &&
|
||||
replayStrokeState.lineDash == strokeState.lineDash &&
|
||||
replayStrokeState.lineJoin == strokeState.lineJoin &&
|
||||
@@ -1642,7 +1637,7 @@ ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ =
|
||||
];
|
||||
this.instructions.push(setStrokeStyleInstruction);
|
||||
this.hitDetectionInstructions.push(setStrokeStyleInstruction);
|
||||
if (goog.isNull(replayStrokeState)) {
|
||||
if (!replayStrokeState) {
|
||||
this.replayStrokeState_ = {
|
||||
lineCap: strokeState.lineCap,
|
||||
lineDash: strokeState.lineDash,
|
||||
@@ -1669,7 +1664,7 @@ ol.render.canvas.TextReplay.prototype.setReplayStrokeState_ =
|
||||
ol.render.canvas.TextReplay.prototype.setReplayTextState_ =
|
||||
function(textState) {
|
||||
var replayTextState = this.replayTextState_;
|
||||
if (!goog.isNull(replayTextState) &&
|
||||
if (replayTextState &&
|
||||
replayTextState.font == textState.font &&
|
||||
replayTextState.textAlign == textState.textAlign &&
|
||||
replayTextState.textBaseline == textState.textBaseline) {
|
||||
@@ -1679,7 +1674,7 @@ ol.render.canvas.TextReplay.prototype.setReplayTextState_ =
|
||||
textState.font, textState.textAlign, textState.textBaseline];
|
||||
this.instructions.push(setTextStyleInstruction);
|
||||
this.hitDetectionInstructions.push(setTextStyleInstruction);
|
||||
if (goog.isNull(replayTextState)) {
|
||||
if (!replayTextState) {
|
||||
this.replayTextState_ = {
|
||||
font: textState.font,
|
||||
textAlign: textState.textAlign,
|
||||
@@ -1697,17 +1692,17 @@ ol.render.canvas.TextReplay.prototype.setReplayTextState_ =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
if (goog.isNull(textStyle)) {
|
||||
if (!textStyle) {
|
||||
this.text_ = '';
|
||||
} else {
|
||||
var textFillStyle = textStyle.getFill();
|
||||
if (goog.isNull(textFillStyle)) {
|
||||
if (!textFillStyle) {
|
||||
this.textFillState_ = null;
|
||||
} else {
|
||||
var textFillStyleColor = textFillStyle.getColor();
|
||||
var fillStyle = ol.color.asString(!goog.isNull(textFillStyleColor) ?
|
||||
var fillStyle = ol.color.asString(textFillStyleColor ?
|
||||
textFillStyleColor : ol.render.canvas.defaultFillStyle);
|
||||
if (goog.isNull(this.textFillState_)) {
|
||||
if (!this.textFillState_) {
|
||||
this.textFillState_ = {
|
||||
fillStyle: fillStyle
|
||||
};
|
||||
@@ -1717,7 +1712,7 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
}
|
||||
}
|
||||
var textStrokeStyle = textStyle.getStroke();
|
||||
if (goog.isNull(textStrokeStyle)) {
|
||||
if (!textStrokeStyle) {
|
||||
this.textStrokeState_ = null;
|
||||
} else {
|
||||
var textStrokeStyleColor = textStrokeStyle.getColor();
|
||||
@@ -1736,9 +1731,9 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
textStrokeStyleWidth : ol.render.canvas.defaultLineWidth;
|
||||
var miterLimit = textStrokeStyleMiterLimit !== undefined ?
|
||||
textStrokeStyleMiterLimit : ol.render.canvas.defaultMiterLimit;
|
||||
var strokeStyle = ol.color.asString(!goog.isNull(textStrokeStyleColor) ?
|
||||
var strokeStyle = ol.color.asString(textStrokeStyleColor ?
|
||||
textStrokeStyleColor : ol.render.canvas.defaultStrokeStyle);
|
||||
if (goog.isNull(this.textStrokeState_)) {
|
||||
if (!this.textStrokeState_) {
|
||||
this.textStrokeState_ = {
|
||||
lineCap: lineCap,
|
||||
lineDash: lineDash,
|
||||
@@ -1771,7 +1766,7 @@ ol.render.canvas.TextReplay.prototype.setTextStyle = function(textStyle) {
|
||||
textTextAlign : ol.render.canvas.defaultTextAlign;
|
||||
var textBaseline = textTextBaseline !== undefined ?
|
||||
textTextBaseline : ol.render.canvas.defaultTextBaseline;
|
||||
if (goog.isNull(this.textState_)) {
|
||||
if (!this.textState_) {
|
||||
this.textState_ = {
|
||||
font: font,
|
||||
textAlign: textAlign,
|
||||
|
||||
@@ -58,14 +58,14 @@ ol.renderer.vector.renderCircleGeometry_ =
|
||||
'geometry should be an ol.geom.Circle');
|
||||
var fillStyle = style.getFill();
|
||||
var strokeStyle = style.getStroke();
|
||||
if (!goog.isNull(fillStyle) || !goog.isNull(strokeStyle)) {
|
||||
if (fillStyle || strokeStyle) {
|
||||
var polygonReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.POLYGON);
|
||||
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||
polygonReplay.drawCircleGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -89,7 +89,7 @@ ol.renderer.vector.renderFeature = function(
|
||||
var loading = false;
|
||||
var imageStyle, imageState;
|
||||
imageStyle = style.getImage();
|
||||
if (!goog.isNull(imageStyle)) {
|
||||
if (imageStyle) {
|
||||
imageState = imageStyle.getImageState();
|
||||
if (imageState == ol.style.ImageState.LOADED ||
|
||||
imageState == ol.style.ImageState.ERROR) {
|
||||
@@ -168,14 +168,14 @@ ol.renderer.vector.renderLineStringGeometry_ =
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.LineString,
|
||||
'geometry should be an ol.geom.LineString');
|
||||
var strokeStyle = style.getStroke();
|
||||
if (!goog.isNull(strokeStyle)) {
|
||||
if (strokeStyle) {
|
||||
var lineStringReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
|
||||
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
||||
lineStringReplay.drawLineStringGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -196,14 +196,14 @@ ol.renderer.vector.renderMultiLineStringGeometry_ =
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiLineString,
|
||||
'geometry should be an ol.geom.MultiLineString');
|
||||
var strokeStyle = style.getStroke();
|
||||
if (!goog.isNull(strokeStyle)) {
|
||||
if (strokeStyle) {
|
||||
var lineStringReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
|
||||
lineStringReplay.setFillStrokeStyle(null, strokeStyle);
|
||||
lineStringReplay.drawMultiLineStringGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -227,14 +227,14 @@ ol.renderer.vector.renderMultiPolygonGeometry_ =
|
||||
'geometry should be an ol.geom.MultiPolygon');
|
||||
var fillStyle = style.getFill();
|
||||
var strokeStyle = style.getStroke();
|
||||
if (!goog.isNull(strokeStyle) || !goog.isNull(fillStyle)) {
|
||||
if (strokeStyle || fillStyle) {
|
||||
var polygonReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.POLYGON);
|
||||
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||
polygonReplay.drawMultiPolygonGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -257,7 +257,7 @@ ol.renderer.vector.renderPointGeometry_ =
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.Point,
|
||||
'geometry should be an ol.geom.Point');
|
||||
var imageStyle = style.getImage();
|
||||
if (!goog.isNull(imageStyle)) {
|
||||
if (imageStyle) {
|
||||
if (imageStyle.getImageState() != ol.style.ImageState.LOADED) {
|
||||
return;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ ol.renderer.vector.renderPointGeometry_ =
|
||||
imageReplay.drawPointGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -288,7 +288,7 @@ ol.renderer.vector.renderMultiPointGeometry_ =
|
||||
goog.asserts.assertInstanceof(geometry, ol.geom.MultiPoint,
|
||||
'geometry should be an ol.goem.MultiPoint');
|
||||
var imageStyle = style.getImage();
|
||||
if (!goog.isNull(imageStyle)) {
|
||||
if (imageStyle) {
|
||||
if (imageStyle.getImageState() != ol.style.ImageState.LOADED) {
|
||||
return;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ ol.renderer.vector.renderMultiPointGeometry_ =
|
||||
imageReplay.drawMultiPointGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
@@ -322,14 +322,14 @@ ol.renderer.vector.renderPolygonGeometry_ =
|
||||
'geometry should be an ol.geom.Polygon');
|
||||
var fillStyle = style.getFill();
|
||||
var strokeStyle = style.getStroke();
|
||||
if (!goog.isNull(fillStyle) || !goog.isNull(strokeStyle)) {
|
||||
if (fillStyle || strokeStyle) {
|
||||
var polygonReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.POLYGON);
|
||||
polygonReplay.setFillStrokeStyle(fillStyle, strokeStyle);
|
||||
polygonReplay.drawPolygonGeometry(geometry, feature);
|
||||
}
|
||||
var textStyle = style.getText();
|
||||
if (!goog.isNull(textStyle)) {
|
||||
if (textStyle) {
|
||||
var textReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.TEXT);
|
||||
textReplay.setTextStyle(textStyle);
|
||||
|
||||
@@ -222,9 +222,9 @@ ol.render.webgl.ImageReplay.prototype.getDeleteResourcesFunction =
|
||||
// be used by other ImageReplay instances (for other layers). And
|
||||
// they will be deleted when disposing of the ol.webgl.Context
|
||||
// object.
|
||||
goog.asserts.assert(!goog.isNull(this.verticesBuffer_),
|
||||
goog.asserts.assert(this.verticesBuffer_,
|
||||
'verticesBuffer must not be null');
|
||||
goog.asserts.assert(!goog.isNull(this.indicesBuffer_),
|
||||
goog.asserts.assert(this.indicesBuffer_,
|
||||
'indicesBuffer must not be null');
|
||||
var verticesBuffer = this.verticesBuffer_;
|
||||
var indicesBuffer = this.indicesBuffer_;
|
||||
@@ -514,12 +514,12 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
|
||||
var gl = context.getGL();
|
||||
|
||||
// bind the vertices buffer
|
||||
goog.asserts.assert(!goog.isNull(this.verticesBuffer_),
|
||||
goog.asserts.assert(this.verticesBuffer_,
|
||||
'verticesBuffer must not be null');
|
||||
context.bindBuffer(goog.webgl.ARRAY_BUFFER, this.verticesBuffer_);
|
||||
|
||||
// bind the indices buffer
|
||||
goog.asserts.assert(!goog.isNull(this.indicesBuffer_),
|
||||
goog.asserts.assert(this.indicesBuffer_,
|
||||
'indecesBuffer must not be null');
|
||||
context.bindBuffer(goog.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_);
|
||||
|
||||
@@ -532,7 +532,7 @@ ol.render.webgl.ImageReplay.prototype.replay = function(context,
|
||||
|
||||
// get the locations
|
||||
var locations;
|
||||
if (goog.isNull(this.defaultLocations_)) {
|
||||
if (!this.defaultLocations_) {
|
||||
locations =
|
||||
new ol.render.webgl.imagereplay.shader.Default.Locations(gl, program);
|
||||
this.defaultLocations_ = locations;
|
||||
@@ -863,20 +863,20 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
|
||||
var rotation = imageStyle.getRotation();
|
||||
var size = imageStyle.getSize();
|
||||
var scale = imageStyle.getScale();
|
||||
goog.asserts.assert(!goog.isNull(anchor), 'imageStyle anchor is not null');
|
||||
goog.asserts.assert(!goog.isNull(image), 'imageStyle image is not null');
|
||||
goog.asserts.assert(!goog.isNull(imageSize),
|
||||
goog.asserts.assert(anchor, 'imageStyle anchor is not null');
|
||||
goog.asserts.assert(image, 'imageStyle image is not null');
|
||||
goog.asserts.assert(imageSize,
|
||||
'imageStyle imageSize is not null');
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImage),
|
||||
goog.asserts.assert(hitDetectionImage,
|
||||
'imageStyle hitDetectionImage is not null');
|
||||
goog.asserts.assert(!goog.isNull(hitDetectionImageSize),
|
||||
goog.asserts.assert(hitDetectionImageSize,
|
||||
'imageStyle hitDetectionImageSize is not null');
|
||||
goog.asserts.assert(opacity !== undefined, 'imageStyle opacity is defined');
|
||||
goog.asserts.assert(!goog.isNull(origin), 'imageStyle origin is not null');
|
||||
goog.asserts.assert(origin, 'imageStyle origin is not null');
|
||||
goog.asserts.assert(rotateWithView !== undefined,
|
||||
'imageStyle rotateWithView is defined');
|
||||
goog.asserts.assert(rotation !== undefined, 'imageStyle rotation is defined');
|
||||
goog.asserts.assert(!goog.isNull(size), 'imageStyle size is not null');
|
||||
goog.asserts.assert(size, 'imageStyle size is not null');
|
||||
goog.asserts.assert(scale !== undefined, 'imageStyle scale is defined');
|
||||
|
||||
var currentImage;
|
||||
|
||||
@@ -79,7 +79,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtCoordinate =
|
||||
*/
|
||||
ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.getImage())) {
|
||||
if (!this.getImage()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
}
|
||||
} else {
|
||||
// for all other image sources directly check the image
|
||||
if (goog.isNull(this.imageTransformInv_)) {
|
||||
if (!this.imageTransformInv_) {
|
||||
this.imageTransformInv_ = goog.vec.Mat4.createNumber();
|
||||
goog.vec.Mat4.invert(this.imageTransform_, this.imageTransformInv_);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
var pixelOnCanvas =
|
||||
this.getPixelOnCanvas(pixel, this.imageTransformInv_);
|
||||
|
||||
if (goog.isNull(this.hitCanvasContext_)) {
|
||||
if (!this.hitCanvasContext_) {
|
||||
this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1);
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.renderer.canvas.ImageLayer.prototype.getImage = function() {
|
||||
return goog.isNull(this.image_) ?
|
||||
null : this.image_.getImage();
|
||||
return !this.image_ ? null : this.image_.getImage();
|
||||
};
|
||||
|
||||
|
||||
@@ -172,14 +171,14 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (!goog.isNull(sourceProjection)) {
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
image = imageSource.getImage(
|
||||
renderedExtent, viewResolution, pixelRatio, projection);
|
||||
if (!goog.isNull(image)) {
|
||||
if (image) {
|
||||
var loaded = this.loadImage(image);
|
||||
if (loaded) {
|
||||
this.image_ = image;
|
||||
@@ -187,7 +186,7 @@ ol.renderer.canvas.ImageLayer.prototype.prepareFrame =
|
||||
}
|
||||
}
|
||||
|
||||
if (!goog.isNull(this.image_)) {
|
||||
if (this.image_) {
|
||||
image = this.image_;
|
||||
var imageExtent = image.getExtent();
|
||||
var imageResolution = image.getResolution();
|
||||
|
||||
@@ -44,7 +44,7 @@ ol.renderer.canvas.Layer.prototype.composeFrame =
|
||||
this.dispatchPreComposeEvent(context, frameState);
|
||||
|
||||
var image = this.getImage();
|
||||
if (!goog.isNull(image)) {
|
||||
if (image) {
|
||||
|
||||
// clipped rendering if layer extent is set
|
||||
var extent = layerState.extent;
|
||||
@@ -252,7 +252,7 @@ ol.renderer.canvas.Layer.testCanvasSize = (function() {
|
||||
var imageData = null;
|
||||
|
||||
return function(size) {
|
||||
if (goog.isNull(context)) {
|
||||
if (!context) {
|
||||
context = ol.dom.createCanvasContext2D(1, 1);
|
||||
imageData = context.createImageData(1, 1);
|
||||
var data = imageData.data;
|
||||
|
||||
@@ -146,7 +146,7 @@ ol.renderer.canvas.Map.prototype.getType = function() {
|
||||
*/
|
||||
ol.renderer.canvas.Map.prototype.renderFrame = function(frameState) {
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.canvas_, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -231,12 +231,12 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
|
||||
var canvasHeight = tilePixelSize[1] * tileRange.getHeight();
|
||||
|
||||
var canvas, context;
|
||||
if (goog.isNull(this.canvas_)) {
|
||||
goog.asserts.assert(goog.isNull(this.canvasSize_),
|
||||
if (!this.canvas_) {
|
||||
goog.asserts.assert(!this.canvasSize_,
|
||||
'canvasSize is null (because canvas is null)');
|
||||
goog.asserts.assert(goog.isNull(this.context_),
|
||||
goog.asserts.assert(!this.context_,
|
||||
'context is null (because canvas is null)');
|
||||
goog.asserts.assert(goog.isNull(this.renderedCanvasTileRange_),
|
||||
goog.asserts.assert(!this.renderedCanvasTileRange_,
|
||||
'renderedCanvasTileRange is null (because canvas is null)');
|
||||
context = ol.dom.createCanvasContext2D(canvasWidth, canvasHeight);
|
||||
this.canvas_ = context.canvas;
|
||||
@@ -245,9 +245,9 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
|
||||
this.canvasTooBig_ =
|
||||
!ol.renderer.canvas.Layer.testCanvasSize(this.canvasSize_);
|
||||
} else {
|
||||
goog.asserts.assert(!goog.isNull(this.canvasSize_),
|
||||
goog.asserts.assert(this.canvasSize_,
|
||||
'non-null canvasSize (because canvas is not null)');
|
||||
goog.asserts.assert(!goog.isNull(this.context_),
|
||||
goog.asserts.assert(this.context_,
|
||||
'non-null context (because canvas is not null)');
|
||||
canvas = this.canvas_;
|
||||
context = this.context_;
|
||||
@@ -277,7 +277,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
|
||||
}
|
||||
|
||||
var canvasTileRange, canvasTileRangeWidth, minX, minY;
|
||||
if (goog.isNull(this.renderedCanvasTileRange_)) {
|
||||
if (!this.renderedCanvasTileRange_) {
|
||||
canvasTileRangeWidth = canvasWidth / tilePixelSize[0];
|
||||
var canvasTileRangeHeight = canvasHeight / tilePixelSize[1];
|
||||
minX = tileRange.minX -
|
||||
@@ -336,7 +336,7 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
|
||||
tilesToClear.push(tile);
|
||||
childTileRange = tileGrid.getTileCoordChildTileRange(
|
||||
tile.tileCoord, tmpTileRange, tmpExtent);
|
||||
if (!goog.isNull(childTileRange)) {
|
||||
if (childTileRange) {
|
||||
findLoadedTiles(z + 1, childTileRange);
|
||||
}
|
||||
}
|
||||
@@ -450,11 +450,11 @@ ol.renderer.canvas.TileLayer.prototype.prepareFrame =
|
||||
*/
|
||||
ol.renderer.canvas.TileLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.context_)) {
|
||||
if (!this.context_) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (goog.isNull(this.imageTransformInv_)) {
|
||||
if (!this.imageTransformInv_) {
|
||||
this.imageTransformInv_ = goog.vec.Mat4.createNumber();
|
||||
goog.vec.Mat4.invert(this.imageTransform_, this.imageTransformInv_);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
|
||||
this.dispatchPreComposeEvent(context, frameState, transform);
|
||||
|
||||
var replayGroup = this.replayGroup_;
|
||||
if (!goog.isNull(replayGroup) && !replayGroup.isEmpty()) {
|
||||
if (replayGroup && !replayGroup.isEmpty()) {
|
||||
var layer = this.getLayer();
|
||||
var replayContext;
|
||||
if (layer.hasListener(ol.render.EventType.RENDER)) {
|
||||
@@ -156,7 +156,7 @@ ol.renderer.canvas.VectorLayer.prototype.composeFrame =
|
||||
*/
|
||||
ol.renderer.canvas.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
function(coordinate, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.replayGroup_)) {
|
||||
if (!this.replayGroup_) {
|
||||
return undefined;
|
||||
} else {
|
||||
var resolution = frameState.viewState.resolution;
|
||||
@@ -290,7 +290,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
||||
this.dirty_ = this.dirty_ || dirty;
|
||||
}
|
||||
};
|
||||
if (!goog.isNull(vectorLayerRenderOrder)) {
|
||||
if (vectorLayerRenderOrder) {
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
vectorSource.forEachFeatureInExtentAtResolution(extent, resolution,
|
||||
|
||||
@@ -103,14 +103,14 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame =
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (!goog.isNull(sourceProjection)) {
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
var image_ = imageSource.getImage(renderedExtent, viewResolution,
|
||||
frameState.pixelRatio, projection);
|
||||
if (!goog.isNull(image_)) {
|
||||
if (image_) {
|
||||
var loaded = this.loadImage(image_);
|
||||
if (loaded) {
|
||||
image = image_;
|
||||
@@ -118,7 +118,7 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame =
|
||||
}
|
||||
}
|
||||
|
||||
if (!goog.isNull(image)) {
|
||||
if (image) {
|
||||
var imageExtent = image.getExtent();
|
||||
var imageResolution = image.getResolution();
|
||||
var transform = goog.vec.Mat4.createNumber();
|
||||
|
||||
@@ -159,7 +159,7 @@ ol.renderer.dom.Map.prototype.getType = function() {
|
||||
*/
|
||||
ol.renderer.dom.Map.prototype.renderFrame = function(frameState) {
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.layersPane_, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -148,7 +148,7 @@ ol.renderer.dom.TileLayer.prototype.prepareFrame =
|
||||
if (!fullyLoaded) {
|
||||
childTileRange = tileGrid.getTileCoordChildTileRange(
|
||||
tile.tileCoord, tmpTileRange, tmpExtent);
|
||||
if (!goog.isNull(childTileRange)) {
|
||||
if (childTileRange) {
|
||||
findLoadedTiles(z + 1, childTileRange);
|
||||
}
|
||||
}
|
||||
@@ -376,7 +376,7 @@ ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) {
|
||||
((tileCoordX - this.tileCoordOrigin_[1]) * tileSize[0]) + 'px';
|
||||
tileElementStyle.top =
|
||||
((this.tileCoordOrigin_[2] - tileCoordY) * tileSize[1]) + 'px';
|
||||
if (goog.isNull(this.documentFragment_)) {
|
||||
if (!this.documentFragment_) {
|
||||
this.documentFragment_ = document.createDocumentFragment();
|
||||
}
|
||||
goog.dom.appendChild(this.documentFragment_, tileElement);
|
||||
@@ -388,7 +388,7 @@ ol.renderer.dom.TileLayerZ_.prototype.addTile = function(tile, tileGutter) {
|
||||
* FIXME empty description for jsdoc
|
||||
*/
|
||||
ol.renderer.dom.TileLayerZ_.prototype.finalizeAddTiles = function() {
|
||||
if (!goog.isNull(this.documentFragment_)) {
|
||||
if (this.documentFragment_) {
|
||||
goog.dom.appendChild(this.target, this.documentFragment_);
|
||||
this.documentFragment_ = null;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ ol.renderer.dom.VectorLayer.prototype.composeFrame =
|
||||
|
||||
var replayGroup = this.replayGroup_;
|
||||
|
||||
if (!goog.isNull(replayGroup) && !replayGroup.isEmpty()) {
|
||||
if (replayGroup && !replayGroup.isEmpty()) {
|
||||
|
||||
context.globalAlpha = layerState.opacity;
|
||||
replayGroup.replay(context, pixelRatio, transform, viewRotation,
|
||||
@@ -178,7 +178,7 @@ ol.renderer.dom.VectorLayer.prototype.dispatchEvent_ =
|
||||
*/
|
||||
ol.renderer.dom.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
function(coordinate, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.replayGroup_)) {
|
||||
if (!this.replayGroup_) {
|
||||
return undefined;
|
||||
} else {
|
||||
var resolution = frameState.viewState.resolution;
|
||||
@@ -298,7 +298,7 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
|
||||
this.dirty_ = this.dirty_ || dirty;
|
||||
}
|
||||
};
|
||||
if (!goog.isNull(vectorLayerRenderOrder)) {
|
||||
if (vectorLayerRenderOrder) {
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
vectorSource.forEachFeatureInExtentAtResolution(extent, resolution,
|
||||
|
||||
@@ -71,8 +71,8 @@ goog.inherits(ol.renderer.Map, goog.Disposable);
|
||||
ol.renderer.Map.prototype.calculateMatrices2D = function(frameState) {
|
||||
var viewState = frameState.viewState;
|
||||
var coordinateToPixelMatrix = frameState.coordinateToPixelMatrix;
|
||||
goog.asserts.assert(!goog.isNull(coordinateToPixelMatrix),
|
||||
'frameState has non-null coordinateToPixelMatrix');
|
||||
goog.asserts.assert(coordinateToPixelMatrix,
|
||||
'frameState has a coordinateToPixelMatrix');
|
||||
ol.vec.Mat4.makeTransform2D(coordinateToPixelMatrix,
|
||||
frameState.size[0] / 2, frameState.size[1] / 2,
|
||||
1 / viewState.resolution, -1 / viewState.resolution,
|
||||
@@ -171,7 +171,7 @@ ol.renderer.Map.prototype.forEachFeatureAtCoordinate =
|
||||
(ol.layer.Layer.visibleAtResolution(layerState, viewResolution) &&
|
||||
layerFilter.call(thisArg2, layer))) {
|
||||
var layerRenderer = this.getLayerRenderer(layer);
|
||||
if (!goog.isNull(layer.getSource())) {
|
||||
if (layer.getSource()) {
|
||||
result = layerRenderer.forEachFeatureAtCoordinate(
|
||||
layer.getSource().getWrapX() ? translatedCoordinate : coordinate,
|
||||
frameState, callback, thisArg);
|
||||
@@ -347,7 +347,7 @@ ol.renderer.Map.prototype.removeUnusedLayerRenderers_ =
|
||||
function(map, frameState) {
|
||||
var layerKey;
|
||||
for (layerKey in this.layerRenderers_) {
|
||||
if (goog.isNull(frameState) || !(layerKey in frameState.layerStates)) {
|
||||
if (!frameState || !(layerKey in frameState.layerStates)) {
|
||||
goog.dispose(this.removeLayerRendererByKey_(layerKey));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,19 +126,19 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
|
||||
!ol.extent.isEmpty(renderedExtent)) {
|
||||
var projection = viewState.projection;
|
||||
var sourceProjection = imageSource.getProjection();
|
||||
if (!goog.isNull(sourceProjection)) {
|
||||
if (sourceProjection) {
|
||||
goog.asserts.assert(ol.proj.equivalent(projection, sourceProjection),
|
||||
'projection and sourceProjection are equivalent');
|
||||
projection = sourceProjection;
|
||||
}
|
||||
var image_ = imageSource.getImage(renderedExtent, viewResolution,
|
||||
pixelRatio, projection);
|
||||
if (!goog.isNull(image_)) {
|
||||
if (image_) {
|
||||
var loaded = this.loadImage(image_);
|
||||
if (loaded) {
|
||||
image = image_;
|
||||
texture = this.createTexture_(image_);
|
||||
if (!goog.isNull(this.texture)) {
|
||||
if (this.texture) {
|
||||
frameState.postRenderFunctions.push(
|
||||
goog.partial(
|
||||
/**
|
||||
@@ -155,8 +155,8 @@ ol.renderer.webgl.ImageLayer.prototype.prepareFrame =
|
||||
}
|
||||
}
|
||||
|
||||
if (!goog.isNull(image)) {
|
||||
goog.asserts.assert(!goog.isNull(texture), 'texture is not null');
|
||||
if (image) {
|
||||
goog.asserts.assert(texture, 'texture is truthy');
|
||||
|
||||
var canvas = this.mapRenderer.getContext().getCanvas();
|
||||
|
||||
@@ -234,7 +234,7 @@ ol.renderer.webgl.ImageLayer.prototype.hasFeatureAtCoordinate =
|
||||
*/
|
||||
ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.image_) || goog.isNull(this.image_.getImage())) {
|
||||
if (!this.image_ || !this.image_.getImage()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
var imageSize =
|
||||
[this.image_.getImage().width, this.image_.getImage().height];
|
||||
|
||||
if (goog.isNull(this.hitTransformationMatrix_)) {
|
||||
if (!this.hitTransformationMatrix_) {
|
||||
this.hitTransformationMatrix_ = this.getHitTransformationMatrix_(
|
||||
frameState.size, imageSize);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ ol.renderer.webgl.ImageLayer.prototype.forEachLayerAtPixel =
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (goog.isNull(this.hitCanvasContext_)) {
|
||||
if (!this.hitCanvasContext_) {
|
||||
this.hitCanvasContext_ = ol.dom.createCanvasContext2D(1, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ ol.renderer.webgl.Layer.prototype.composeFrame =
|
||||
var program = context.getProgram(fragmentShader, vertexShader);
|
||||
|
||||
var locations;
|
||||
if (goog.isNull(this.defaultLocations_)) {
|
||||
if (!this.defaultLocations_) {
|
||||
locations =
|
||||
new ol.renderer.webgl.map.shader.Default.Locations(gl, program);
|
||||
this.defaultLocations_ = locations;
|
||||
|
||||
@@ -100,7 +100,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
||||
preserveDrawingBuffer: false,
|
||||
stencil: true
|
||||
});
|
||||
goog.asserts.assert(!goog.isNull(this.gl_), 'got a WebGLRenderingContext');
|
||||
goog.asserts.assert(this.gl_, 'got a WebGLRenderingContext');
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -194,7 +194,7 @@ ol.renderer.webgl.Map.prototype.bindTileTexture =
|
||||
var tileKey = tile.getKey();
|
||||
if (this.textureCache_.containsKey(tileKey)) {
|
||||
var textureCacheEntry = this.textureCache_.get(tileKey);
|
||||
goog.asserts.assert(!goog.isNull(textureCacheEntry),
|
||||
goog.asserts.assert(textureCacheEntry,
|
||||
'a texture cache entry exists for key %s', tileKey);
|
||||
gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture);
|
||||
if (textureCacheEntry.magFilter != magFilter) {
|
||||
@@ -309,7 +309,7 @@ ol.renderer.webgl.Map.prototype.disposeInternal = function() {
|
||||
* Texture cache entry.
|
||||
*/
|
||||
function(textureCacheEntry) {
|
||||
if (!goog.isNull(textureCacheEntry)) {
|
||||
if (textureCacheEntry) {
|
||||
gl.deleteTexture(textureCacheEntry.texture);
|
||||
}
|
||||
});
|
||||
@@ -330,7 +330,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) {
|
||||
while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
|
||||
ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
|
||||
textureCacheEntry = this.textureCache_.peekLast();
|
||||
if (goog.isNull(textureCacheEntry)) {
|
||||
if (!textureCacheEntry) {
|
||||
if (+this.textureCache_.peekLastKey() == frameState.index) {
|
||||
break;
|
||||
} else {
|
||||
@@ -452,7 +452,7 @@ ol.renderer.webgl.Map.prototype.renderFrame = function(frameState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (goog.isNull(frameState)) {
|
||||
if (!frameState) {
|
||||
if (this.renderedVisible_) {
|
||||
goog.style.setElementShown(this.canvas_, false);
|
||||
this.renderedVisible_ = false;
|
||||
|
||||
@@ -186,7 +186,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
extent, tileResolution);
|
||||
|
||||
var framebufferExtent;
|
||||
if (!goog.isNull(this.renderedTileRange_) &&
|
||||
if (this.renderedTileRange_ &&
|
||||
this.renderedTileRange_.equals(tileRange) &&
|
||||
this.renderedRevision_ == tileSource.getRevision()) {
|
||||
framebufferExtent = this.renderedFramebufferExtent_;
|
||||
@@ -218,7 +218,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
|
||||
var program = context.getProgram(this.fragmentShader_, this.vertexShader_);
|
||||
context.useProgram(program);
|
||||
if (goog.isNull(this.locations_)) {
|
||||
if (!this.locations_) {
|
||||
this.locations_ =
|
||||
new ol.renderer.webgl.tilelayer.shader.Locations(gl, program);
|
||||
}
|
||||
@@ -275,7 +275,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
if (!fullyLoaded) {
|
||||
childTileRange = tileGrid.getTileCoordChildTileRange(
|
||||
tile.tileCoord, tmpTileRange, tmpExtent);
|
||||
if (!goog.isNull(childTileRange)) {
|
||||
if (childTileRange) {
|
||||
findLoadedTiles(z + 1, childTileRange);
|
||||
}
|
||||
}
|
||||
@@ -377,7 +377,7 @@ ol.renderer.webgl.TileLayer.prototype.prepareFrame =
|
||||
*/
|
||||
ol.renderer.webgl.TileLayer.prototype.forEachLayerAtPixel =
|
||||
function(pixel, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.framebuffer)) {
|
||||
if (!this.framebuffer) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ ol.renderer.webgl.VectorLayer.prototype.composeFrame =
|
||||
this.layerState_ = layerState;
|
||||
var viewState = frameState.viewState;
|
||||
var replayGroup = this.replayGroup_;
|
||||
if (!goog.isNull(replayGroup) && !replayGroup.isEmpty()) {
|
||||
if (replayGroup && !replayGroup.isEmpty()) {
|
||||
replayGroup.replay(context,
|
||||
viewState.center, viewState.resolution, viewState.rotation,
|
||||
frameState.size, frameState.pixelRatio, layerState.opacity,
|
||||
@@ -93,7 +93,7 @@ ol.renderer.webgl.VectorLayer.prototype.composeFrame =
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() {
|
||||
var replayGroup = this.replayGroup_;
|
||||
if (!goog.isNull(replayGroup)) {
|
||||
if (replayGroup) {
|
||||
var context = this.mapRenderer.getContext();
|
||||
replayGroup.getDeleteResourcesFunction(context)();
|
||||
this.replayGroup_ = null;
|
||||
@@ -107,7 +107,7 @@ ol.renderer.webgl.VectorLayer.prototype.disposeInternal = function() {
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
function(coordinate, frameState, callback, thisArg) {
|
||||
if (goog.isNull(this.replayGroup_) || goog.isNull(this.layerState_)) {
|
||||
if (!this.replayGroup_ || !this.layerState_) {
|
||||
return undefined;
|
||||
} else {
|
||||
var context = this.mapRenderer.getContext();
|
||||
@@ -141,7 +141,7 @@ ol.renderer.webgl.VectorLayer.prototype.forEachFeatureAtCoordinate =
|
||||
*/
|
||||
ol.renderer.webgl.VectorLayer.prototype.hasFeatureAtCoordinate =
|
||||
function(coordinate, frameState) {
|
||||
if (goog.isNull(this.replayGroup_) || goog.isNull(this.layerState_)) {
|
||||
if (!this.replayGroup_ || !this.layerState_) {
|
||||
return false;
|
||||
} else {
|
||||
var context = this.mapRenderer.getContext();
|
||||
@@ -233,7 +233,7 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!goog.isNull(this.replayGroup_)) {
|
||||
if (this.replayGroup_) {
|
||||
frameState.postRenderFunctions.push(
|
||||
this.replayGroup_.getDeleteResourcesFunction(context));
|
||||
}
|
||||
@@ -266,7 +266,7 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
this.dirty_ = this.dirty_ || dirty;
|
||||
}
|
||||
};
|
||||
if (!goog.isNull(vectorLayerRenderOrder)) {
|
||||
if (vectorLayerRenderOrder) {
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
var features = [];
|
||||
vectorSource.forEachFeatureInExtentAtResolution(extent, resolution,
|
||||
|
||||
@@ -130,7 +130,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
|
||||
goog.asserts.assert(ol.proj.equivalent(
|
||||
projection, sourceProjection),
|
||||
'projections are equivalent');
|
||||
if (goog.isNull(tileCoord)) {
|
||||
if (!tileCoord) {
|
||||
return undefined;
|
||||
} else {
|
||||
ol.tilecoord.createOrUpdate(tileCoord[0], tileCoord[1],
|
||||
|
||||
@@ -64,7 +64,7 @@ ol.source.ImageCanvas.prototype.getImage =
|
||||
resolution = this.findNearestResolution(resolution);
|
||||
|
||||
var canvas = this.canvas_;
|
||||
if (!goog.isNull(canvas) &&
|
||||
if (canvas &&
|
||||
this.renderedRevision_ == this.getRevision() &&
|
||||
canvas.getResolution() == resolution &&
|
||||
canvas.getPixelRatio() == pixelRatio &&
|
||||
@@ -80,7 +80,7 @@ ol.source.ImageCanvas.prototype.getImage =
|
||||
|
||||
var canvasElement = this.canvasFunction_(
|
||||
extent, resolution, pixelRatio, size, projection);
|
||||
if (!goog.isNull(canvasElement)) {
|
||||
if (canvasElement) {
|
||||
canvas = new ol.ImageCanvas(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), canvasElement);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ ol.source.ImageMapGuide.prototype.getImage =
|
||||
pixelRatio = this.hidpi_ ? pixelRatio : 1;
|
||||
|
||||
var image = this.image_;
|
||||
if (!goog.isNull(image) &&
|
||||
if (image &&
|
||||
this.renderedRevision_ == this.getRevision() &&
|
||||
image.getResolution() == resolution &&
|
||||
image.getPixelRatio() == pixelRatio &&
|
||||
|
||||
@@ -50,7 +50,7 @@ ol.source.Image = function(options) {
|
||||
*/
|
||||
this.resolutions_ = options.resolutions !== undefined ?
|
||||
options.resolutions : null;
|
||||
goog.asserts.assert(goog.isNull(this.resolutions_) ||
|
||||
goog.asserts.assert(!this.resolutions_ ||
|
||||
goog.array.isSorted(this.resolutions_,
|
||||
function(a, b) {
|
||||
return b - a;
|
||||
@@ -75,7 +75,7 @@ ol.source.Image.prototype.getResolutions = function() {
|
||||
*/
|
||||
ol.source.Image.prototype.findNearestResolution =
|
||||
function(resolution) {
|
||||
if (!goog.isNull(this.resolutions_)) {
|
||||
if (this.resolutions_) {
|
||||
var idx = ol.array.linearFindNearest(this.resolutions_, resolution, 0);
|
||||
resolution = this.resolutions_[idx];
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ ol.source.ImageVector.prototype.canvasFunctionInternal_ =
|
||||
*/
|
||||
ol.source.ImageVector.prototype.forEachFeatureAtCoordinate = function(
|
||||
coordinate, resolution, rotation, skippedFeatureUids, callback) {
|
||||
if (goog.isNull(this.replayGroup_)) {
|
||||
if (!this.replayGroup_) {
|
||||
return undefined;
|
||||
} else {
|
||||
/** @type {Object.<string, boolean>} */
|
||||
@@ -292,7 +292,7 @@ ol.source.ImageVector.prototype.renderFeature_ =
|
||||
*/
|
||||
ol.source.ImageVector.prototype.setStyle = function(style) {
|
||||
this.style_ = style !== undefined ? style : ol.style.defaultStyleFunction;
|
||||
this.styleFunction_ = goog.isNull(style) ?
|
||||
this.styleFunction_ = !style ?
|
||||
undefined : ol.style.createStyleFunction(this.style_);
|
||||
this.changed();
|
||||
};
|
||||
|
||||
@@ -223,7 +223,7 @@ ol.source.ImageWMS.prototype.getImage =
|
||||
extent[3] = centerY + imageResolution * height / 2;
|
||||
|
||||
var image = this.image_;
|
||||
if (!goog.isNull(image) &&
|
||||
if (image &&
|
||||
this.renderedRevision_ == this.getRevision() &&
|
||||
image.getResolution() == resolution &&
|
||||
image.getPixelRatio() == pixelRatio &&
|
||||
|
||||
@@ -319,7 +319,7 @@ ol.source.Raster.prototype.onWorkerComplete_ =
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
if (goog.isNull(output)) {
|
||||
if (!output) {
|
||||
// job aborted
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ ol.source.TileArcGISRest.prototype.tileUrlFunction_ =
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
|
||||
var tileGrid = this.getTileGrid();
|
||||
if (goog.isNull(tileGrid)) {
|
||||
if (!tileGrid) {
|
||||
tileGrid = this.getTileGridForProjection(projection);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ ol.source.TileDebug.prototype.getTile = function(z, x, y) {
|
||||
var tileSize = ol.size.toSize(this.tileGrid.getTileSize(z));
|
||||
var tileCoord = [z, x, y];
|
||||
var textTileCoord = this.getTileCoordForTileUrlFunction(tileCoord);
|
||||
var text = goog.isNull(textTileCoord) ? '' : ol.tilecoord.toString(
|
||||
var text = !textTileCoord ? '' : ol.tilecoord.toString(
|
||||
this.getTileCoordForTileUrlFunction(textTileCoord));
|
||||
var tile = new ol.DebugTile_(tileCoord, tileSize, text);
|
||||
this.tileCache.set(tileCoordKey, tile);
|
||||
|
||||
@@ -95,7 +95,7 @@ ol.source.TileImage.prototype.getTile =
|
||||
var tileCoord = [z, x, y];
|
||||
var urlTileCoord = this.getTileCoordForTileUrlFunction(
|
||||
tileCoord, projection);
|
||||
var tileUrl = goog.isNull(urlTileCoord) ? undefined :
|
||||
var tileUrl = !urlTileCoord ? undefined :
|
||||
this.tileUrlFunction(urlTileCoord, pixelRatio, projection);
|
||||
var tile = new this.tileClass(
|
||||
tileCoord,
|
||||
|
||||
@@ -78,8 +78,7 @@ ol.source.TileJSON.prototype.handleTileJSONResponse = function(tileJSON) {
|
||||
this.tileUrlFunction =
|
||||
ol.TileUrlFunction.createFromTemplates(tileJSON.tiles, tileGrid);
|
||||
|
||||
if (tileJSON.attribution !== undefined &&
|
||||
goog.isNull(this.getAttributions())) {
|
||||
if (tileJSON.attribution !== undefined && !this.getAttributions()) {
|
||||
var attributionExtent = extent !== undefined ?
|
||||
extent : epsg4326Projection.getExtent();
|
||||
/** @type {Object.<string, Array.<ol.TileRange>>} */
|
||||
|
||||
@@ -195,7 +195,7 @@ ol.source.Tile.prototype.getTileGrid = function() {
|
||||
* @return {ol.tilegrid.TileGrid} Tile grid.
|
||||
*/
|
||||
ol.source.Tile.prototype.getTileGridForProjection = function(projection) {
|
||||
if (goog.isNull(this.tileGrid)) {
|
||||
if (!this.tileGrid) {
|
||||
return ol.tilegrid.getForProjection(projection);
|
||||
} else {
|
||||
return this.tileGrid;
|
||||
@@ -231,7 +231,7 @@ ol.source.Tile.prototype.getTileCoordForTileUrlFunction =
|
||||
var projection = opt_projection !== undefined ?
|
||||
opt_projection : this.getProjection();
|
||||
var tileGrid = this.getTileGridForProjection(projection);
|
||||
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed');
|
||||
goog.asserts.assert(tileGrid, 'tile grid needed');
|
||||
if (this.getWrapX() && projection.isGlobal()) {
|
||||
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ ol.source.TileUTFGrid.prototype.getTemplate = function() {
|
||||
*/
|
||||
ol.source.TileUTFGrid.prototype.forDataAtCoordinateAndResolution = function(
|
||||
coordinate, resolution, callback, opt_this, opt_request) {
|
||||
if (!goog.isNull(this.tileGrid)) {
|
||||
if (this.tileGrid) {
|
||||
var tileCoord = this.tileGrid.getTileCoordForCoordAndResolution(
|
||||
coordinate, resolution);
|
||||
var tile = /** @type {!ol.source.TileUTFGridTile_} */(this.getTile(
|
||||
@@ -269,7 +269,7 @@ ol.source.TileUTFGridTile_.prototype.getImage = function(opt_context) {
|
||||
* @return {Object}
|
||||
*/
|
||||
ol.source.TileUTFGridTile_.prototype.getData = function(coordinate) {
|
||||
if (goog.isNull(this.grid_) || goog.isNull(this.keys_) || !this.data_) {
|
||||
if (!this.grid_ || !this.keys_ || !this.data_) {
|
||||
return null;
|
||||
}
|
||||
var xRelative = (coordinate[0] - this.extent_[0]) /
|
||||
|
||||
@@ -57,8 +57,7 @@ ol.source.TileVector = function(options) {
|
||||
this.tileLoadFunction_ = options.tileLoadFunction !== undefined ?
|
||||
options.tileLoadFunction : null;
|
||||
|
||||
goog.asserts.assert(!goog.isNull(this.format_) ||
|
||||
!goog.isNull(this.tileLoadFunction_),
|
||||
goog.asserts.assert(this.format_ || this.tileLoadFunction_,
|
||||
'Either format or tileLoadFunction are required');
|
||||
|
||||
/**
|
||||
@@ -252,7 +251,7 @@ ol.source.TileVector.prototype.getFeaturesInExtent = goog.abstractMethod;
|
||||
ol.source.TileVector.prototype.getTileCoordForTileUrlFunction =
|
||||
function(tileCoord, projection) {
|
||||
var tileGrid = this.tileGrid_;
|
||||
goog.asserts.assert(!goog.isNull(tileGrid), 'tile grid needed');
|
||||
goog.asserts.assert(tileGrid, 'tile grid needed');
|
||||
if (this.getWrapX() && projection.isGlobal()) {
|
||||
tileCoord = ol.tilecoord.wrapX(tileCoord, tileGrid, projection);
|
||||
}
|
||||
@@ -302,12 +301,12 @@ ol.source.TileVector.prototype.loadFeatures =
|
||||
tileCoord[2] = y;
|
||||
var urlTileCoord = this.getTileCoordForTileUrlFunction(
|
||||
tileCoord, projection);
|
||||
var url = goog.isNull(urlTileCoord) ? undefined :
|
||||
var url = !urlTileCoord ? undefined :
|
||||
tileUrlFunction(urlTileCoord, 1, projection);
|
||||
if (url !== undefined) {
|
||||
tiles[tileKey] = [];
|
||||
var tileSuccess = goog.partial(success, tileKey);
|
||||
if (!goog.isNull(this.tileLoadFunction_)) {
|
||||
if (this.tileLoadFunction_) {
|
||||
this.tileLoadFunction_(url, goog.bind(tileSuccess, this));
|
||||
} else {
|
||||
var loader = ol.featureloader.loadFeaturesXhr(url,
|
||||
|
||||
@@ -135,7 +135,7 @@ ol.source.TileWMS.prototype.getGetFeatureInfoUrl =
|
||||
var projectionObj = ol.proj.get(projection);
|
||||
|
||||
var tileGrid = this.getTileGrid();
|
||||
if (goog.isNull(tileGrid)) {
|
||||
if (!tileGrid) {
|
||||
tileGrid = this.getTileGridForProjection(projectionObj);
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ ol.source.TileWMS.prototype.tileUrlFunction_ =
|
||||
function(tileCoord, pixelRatio, projection) {
|
||||
|
||||
var tileGrid = this.getTileGrid();
|
||||
if (goog.isNull(tileGrid)) {
|
||||
if (!tileGrid) {
|
||||
tileGrid = this.getTileGridForProjection(projection);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
|
||||
var geometry = feature.getGeometry();
|
||||
if (geometry) {
|
||||
var extent = geometry.getExtent();
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.insert(extent, feature);
|
||||
}
|
||||
} else {
|
||||
@@ -307,7 +307,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
|
||||
this.nullGeometryFeatures_[featureKey] = feature;
|
||||
}
|
||||
}
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.load(extents, geometryFeatures);
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
|
||||
* @private
|
||||
*/
|
||||
ol.source.Vector.prototype.bindFeaturesCollection_ = function(collection) {
|
||||
goog.asserts.assert(goog.isNull(this.featuresCollection_),
|
||||
goog.asserts.assert(!this.featuresCollection_,
|
||||
'bindFeaturesCollection can only be called once');
|
||||
var modifyingCollection = false;
|
||||
goog.events.listen(this, ol.source.VectorEventType.ADDFEATURE,
|
||||
@@ -377,19 +377,19 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
|
||||
var keys = this.featureChangeKeys_[featureId];
|
||||
keys.forEach(goog.events.unlistenByKey);
|
||||
}
|
||||
if (goog.isNull(this.featuresCollection_)) {
|
||||
if (!this.featuresCollection_) {
|
||||
this.featureChangeKeys_ = {};
|
||||
this.idIndex_ = {};
|
||||
this.undefIdIndex_ = {};
|
||||
}
|
||||
} else {
|
||||
var rmFeatureInternal = this.removeFeatureInternal;
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.forEach(rmFeatureInternal, this);
|
||||
goog.object.forEach(this.nullGeometryFeatures_, rmFeatureInternal, this);
|
||||
}
|
||||
}
|
||||
if (!goog.isNull(this.featuresCollection_)) {
|
||||
if (this.featuresCollection_) {
|
||||
this.featuresCollection_.clear();
|
||||
}
|
||||
goog.asserts.assert(goog.object.isEmpty(this.featureChangeKeys_),
|
||||
@@ -399,7 +399,7 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
|
||||
goog.asserts.assert(goog.object.isEmpty(this.undefIdIndex_),
|
||||
'undefIdIndex is an empty object now');
|
||||
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.clear();
|
||||
}
|
||||
this.loadedExtentsRtree_.clear();
|
||||
@@ -424,9 +424,9 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.Vector.prototype.forEachFeature = function(callback, opt_this) {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
return this.featuresRtree_.forEach(callback, opt_this);
|
||||
} else if (!goog.isNull(this.featuresCollection_)) {
|
||||
} else if (this.featuresCollection_) {
|
||||
return this.featuresCollection_.forEach(callback, opt_this);
|
||||
}
|
||||
};
|
||||
@@ -483,9 +483,9 @@ ol.source.Vector.prototype.forEachFeatureAtCoordinateDirect =
|
||||
*/
|
||||
ol.source.Vector.prototype.forEachFeatureInExtent =
|
||||
function(extent, callback, opt_this) {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
return this.featuresRtree_.forEachInExtent(extent, callback, opt_this);
|
||||
} else if (!goog.isNull(this.featuresCollection_)) {
|
||||
} else if (this.featuresCollection_) {
|
||||
return this.featuresCollection_.forEach(callback, opt_this);
|
||||
}
|
||||
};
|
||||
@@ -563,9 +563,9 @@ ol.source.Vector.prototype.getFeaturesCollection = function() {
|
||||
*/
|
||||
ol.source.Vector.prototype.getFeatures = function() {
|
||||
var features;
|
||||
if (!goog.isNull(this.featuresCollection_)) {
|
||||
if (this.featuresCollection_) {
|
||||
features = this.featuresCollection_.getArray();
|
||||
} else if (!goog.isNull(this.featuresRtree_)) {
|
||||
} else if (this.featuresRtree_) {
|
||||
features = this.featuresRtree_.getAll();
|
||||
if (!goog.object.isEmpty(this.nullGeometryFeatures_)) {
|
||||
goog.array.extend(
|
||||
@@ -605,7 +605,7 @@ ol.source.Vector.prototype.getFeaturesAtCoordinate = function(coordinate) {
|
||||
* @api
|
||||
*/
|
||||
ol.source.Vector.prototype.getFeaturesInExtent = function(extent) {
|
||||
goog.asserts.assert(!goog.isNull(this.featuresRtree_),
|
||||
goog.asserts.assert(this.featuresRtree_,
|
||||
'getFeaturesInExtent does not work when useSpatialIndex is set to false');
|
||||
return this.featuresRtree_.getInExtent(extent);
|
||||
};
|
||||
@@ -635,7 +635,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
|
||||
var closestPoint = [NaN, NaN];
|
||||
var minSquaredDistance = Infinity;
|
||||
var extent = [-Infinity, -Infinity, Infinity, Infinity];
|
||||
goog.asserts.assert(!goog.isNull(this.featuresRtree_),
|
||||
goog.asserts.assert(this.featuresRtree_,
|
||||
'getClosestFeatureToCoordinate does not work with useSpatialIndex set ' +
|
||||
'to false');
|
||||
this.featuresRtree_.forEachInExtent(extent,
|
||||
@@ -675,7 +675,7 @@ ol.source.Vector.prototype.getClosestFeatureToCoordinate =
|
||||
* @api stable
|
||||
*/
|
||||
ol.source.Vector.prototype.getExtent = function() {
|
||||
goog.asserts.assert(!goog.isNull(this.featuresRtree_),
|
||||
goog.asserts.assert(this.featuresRtree_,
|
||||
'getExtent does not work when useSpatialIndex is set to false');
|
||||
return this.featuresRtree_.getExtent();
|
||||
};
|
||||
@@ -706,7 +706,7 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
var geometry = feature.getGeometry();
|
||||
if (!geometry) {
|
||||
if (!(featureKey in this.nullGeometryFeatures_)) {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.remove(feature);
|
||||
}
|
||||
this.nullGeometryFeatures_[featureKey] = feature;
|
||||
@@ -715,11 +715,11 @@ ol.source.Vector.prototype.handleFeatureChange_ = function(event) {
|
||||
var extent = geometry.getExtent();
|
||||
if (featureKey in this.nullGeometryFeatures_) {
|
||||
delete this.nullGeometryFeatures_[featureKey];
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.insert(extent, feature);
|
||||
}
|
||||
} else {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.update(extent, feature);
|
||||
}
|
||||
}
|
||||
@@ -805,7 +805,7 @@ ol.source.Vector.prototype.removeFeature = function(feature) {
|
||||
if (featureKey in this.nullGeometryFeatures_) {
|
||||
delete this.nullGeometryFeatures_[featureKey];
|
||||
} else {
|
||||
if (!goog.isNull(this.featuresRtree_)) {
|
||||
if (this.featuresRtree_) {
|
||||
this.featuresRtree_.remove(feature);
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user