Replace goog.isDefAndNotNull() with truthy checks
This commit is contained in:
@@ -395,7 +395,7 @@ ol.control.OverviewMap.prototype.updateBox_ = function() {
|
|||||||
overlay.setPosition(rotateBottomLeft);
|
overlay.setPosition(rotateBottomLeft);
|
||||||
|
|
||||||
// set box size calculated from map extent size and overview map resolution
|
// set box size calculated from map extent size and overview map resolution
|
||||||
if (goog.isDefAndNotNull(box)) {
|
if (box) {
|
||||||
var boxWidth = Math.abs((bottomLeft[0] - topRight[0]) / ovresolution);
|
var boxWidth = Math.abs((bottomLeft[0] - topRight[0]) / ovresolution);
|
||||||
var boxHeight = Math.abs((topRight[1] - bottomLeft[1]) / ovresolution);
|
var boxHeight = Math.abs((topRight[1] - bottomLeft[1]) / ovresolution);
|
||||||
goog.style.setBorderBoxSize(box, new goog.math.Size(
|
goog.style.setBorderBoxSize(box, new goog.math.Size(
|
||||||
|
|||||||
+2
-2
@@ -124,7 +124,7 @@ ol.Feature.prototype.clone = function() {
|
|||||||
var clone = new ol.Feature(this.getProperties());
|
var clone = new ol.Feature(this.getProperties());
|
||||||
clone.setGeometryName(this.getGeometryName());
|
clone.setGeometryName(this.getGeometryName());
|
||||||
var geometry = this.getGeometry();
|
var geometry = this.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
clone.setGeometry(geometry.clone());
|
clone.setGeometry(geometry.clone());
|
||||||
}
|
}
|
||||||
var style = this.getStyle();
|
var style = this.getStyle();
|
||||||
@@ -215,7 +215,7 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
|
|||||||
this.geometryChangeKey_ = null;
|
this.geometryChangeKey_ = null;
|
||||||
}
|
}
|
||||||
var geometry = this.getGeometry();
|
var geometry = this.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
this.geometryChangeKey_ = goog.events.listen(geometry,
|
this.geometryChangeKey_ = goog.events.listen(geometry,
|
||||||
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
|
goog.events.EventType.CHANGE, this.handleGeometryChange_, false, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ ol.featureloader.loadFeaturesXhr = function(url, format, success) {
|
|||||||
} else {
|
} else {
|
||||||
goog.asserts.fail('unexpected format type');
|
goog.asserts.fail('unexpected format type');
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(source)) {
|
if (source) {
|
||||||
var features = format.readFeatures(source,
|
var features = format.readFeatures(source,
|
||||||
{featureProjection: projection});
|
{featureProjection: projection});
|
||||||
success.call(this, features);
|
success.call(this, features);
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ ol.format.EsriJSON.prototype.writeFeatureObject = function(
|
|||||||
opt_options = this.adaptOptions(opt_options);
|
opt_options = this.adaptOptions(opt_options);
|
||||||
var object = {};
|
var object = {};
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
object['geometry'] =
|
object['geometry'] =
|
||||||
ol.format.EsriJSON.writeGeometry_(geometry, opt_options);
|
ol.format.EsriJSON.writeGeometry_(geometry, opt_options);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ ol.format.GeoJSON.prototype.readProjection;
|
|||||||
ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
|
ol.format.GeoJSON.prototype.readProjectionFromObject = function(object) {
|
||||||
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
|
var geoJSONObject = /** @type {GeoJSONObject} */ (object);
|
||||||
var crs = geoJSONObject.crs;
|
var crs = geoJSONObject.crs;
|
||||||
if (goog.isDefAndNotNull(crs)) {
|
if (crs) {
|
||||||
if (crs.type == 'name') {
|
if (crs.type == 'name') {
|
||||||
return ol.proj.get(crs.properties.name);
|
return ol.proj.get(crs.properties.name);
|
||||||
} else if (crs.type == 'EPSG') {
|
} else if (crs.type == 'EPSG') {
|
||||||
@@ -530,11 +530,11 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
|
|||||||
'type': 'Feature'
|
'type': 'Feature'
|
||||||
};
|
};
|
||||||
var id = feature.getId();
|
var id = feature.getId();
|
||||||
if (goog.isDefAndNotNull(id)) {
|
if (id) {
|
||||||
object['id'] = id;
|
object['id'] = id;
|
||||||
}
|
}
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
object['geometry'] =
|
object['geometry'] =
|
||||||
ol.format.GeoJSON.writeGeometry_(geometry, opt_options);
|
ol.format.GeoJSON.writeGeometry_(geometry, opt_options);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
|||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
axisOrientation = ol.proj.get(srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
var point = value.getCoordinates();
|
var point = value.getCoordinates();
|
||||||
@@ -666,7 +666,7 @@ ol.format.GML3.prototype.writePos_ = function(node, value, objectStack) {
|
|||||||
*/
|
*/
|
||||||
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
|
ol.format.GML3.prototype.getCoords_ = function(point, opt_srsName) {
|
||||||
var axisOrientation = 'enu';
|
var axisOrientation = 'enu';
|
||||||
if (goog.isDefAndNotNull(opt_srsName)) {
|
if (opt_srsName) {
|
||||||
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
axisOrientation = ol.proj.get(opt_srsName).getAxisOrientation();
|
||||||
}
|
}
|
||||||
return ((axisOrientation.substr(0, 2) === 'en') ?
|
return ((axisOrientation.substr(0, 2) === 'en') ?
|
||||||
@@ -708,7 +708,7 @@ ol.format.GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
|
|||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var pos = ol.xml.createElementNS(node.namespaceURI, 'pos');
|
var pos = ol.xml.createElementNS(node.namespaceURI, 'pos');
|
||||||
@@ -763,7 +763,7 @@ ol.format.GML3.prototype.writeLinearRing_ =
|
|||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var posList = ol.xml.createElementNS(node.namespaceURI, 'posList');
|
var posList = ol.xml.createElementNS(node.namespaceURI, 'posList');
|
||||||
@@ -864,7 +864,7 @@ ol.format.GML3.prototype.writeMultiSurfaceOrPolygon_ =
|
|||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var surface = context['surface'];
|
var surface = context['surface'];
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var polygons = geometry.getPolygons();
|
var polygons = geometry.getPolygons();
|
||||||
@@ -886,7 +886,7 @@ ol.format.GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
|||||||
var context = objectStack[objectStack.length - 1];
|
var context = objectStack[objectStack.length - 1];
|
||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var points = geometry.getPoints();
|
var points = geometry.getPoints();
|
||||||
@@ -909,7 +909,7 @@ ol.format.GML3.prototype.writeMultiCurveOrLineString_ =
|
|||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
var srsName = context['srsName'];
|
var srsName = context['srsName'];
|
||||||
var curve = context['curve'];
|
var curve = context['curve'];
|
||||||
if (goog.isDefAndNotNull(srsName)) {
|
if (srsName) {
|
||||||
node.setAttribute('srsName', srsName);
|
node.setAttribute('srsName', srsName);
|
||||||
}
|
}
|
||||||
var lines = geometry.getLineStrings();
|
var lines = geometry.getLineStrings();
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
|||||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||||
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
|
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
|
||||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, context));
|
ol.format.Feature.transformWithOptions(geometry, false, context));
|
||||||
} else {
|
} else {
|
||||||
@@ -243,7 +243,7 @@ ol.format.GMLBase.prototype.readPoint = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.localName == 'Point', 'localName should be Point');
|
goog.asserts.assert(node.localName == 'Point', 'localName should be Point');
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
this.readFlatCoordinatesFromNode_(node, objectStack);
|
this.readFlatCoordinatesFromNode_(node, objectStack);
|
||||||
if (goog.isDefAndNotNull(flatCoordinates)) {
|
if (flatCoordinates) {
|
||||||
var point = new ol.geom.Point(null);
|
var point = new ol.geom.Point(null);
|
||||||
goog.asserts.assert(flatCoordinates.length == 3,
|
goog.asserts.assert(flatCoordinates.length == 3,
|
||||||
'flatCoordinates should have a length of 3');
|
'flatCoordinates should have a length of 3');
|
||||||
@@ -382,7 +382,7 @@ ol.format.GMLBase.prototype.readLineString = function(node, objectStack) {
|
|||||||
'localName should be LineString');
|
'localName should be LineString');
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
this.readFlatCoordinatesFromNode_(node, objectStack);
|
this.readFlatCoordinatesFromNode_(node, objectStack);
|
||||||
if (goog.isDefAndNotNull(flatCoordinates)) {
|
if (flatCoordinates) {
|
||||||
var lineString = new ol.geom.LineString(null);
|
var lineString = new ol.geom.LineString(null);
|
||||||
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
|
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
|
||||||
return lineString;
|
return lineString;
|
||||||
@@ -406,7 +406,7 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
|
|||||||
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
|
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
|
||||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||||
objectStack, this);
|
objectStack, this);
|
||||||
if (goog.isDefAndNotNull(ring)) {
|
if (ring) {
|
||||||
return ring;
|
return ring;
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -950,7 +950,7 @@ ol.format.KML.readPoint_ = function(node, objectStack) {
|
|||||||
objectStack);
|
objectStack);
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack);
|
ol.format.KML.readFlatCoordinatesFromNode_(node, objectStack);
|
||||||
if (goog.isDefAndNotNull(flatCoordinates)) {
|
if (flatCoordinates) {
|
||||||
var point = new ol.geom.Point(null);
|
var point = new ol.geom.Point(null);
|
||||||
goog.asserts.assert(flatCoordinates.length == 3,
|
goog.asserts.assert(flatCoordinates.length == 3,
|
||||||
'flatCoordinates should have a length of 3');
|
'flatCoordinates should have a length of 3');
|
||||||
@@ -1684,7 +1684,7 @@ ol.format.KML.prototype.readPlacemark_ = function(node, objectStack) {
|
|||||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||||
|
|
||||||
var geometry = object['geometry'];
|
var geometry = object['geometry'];
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
ol.format.Feature.transformWithOptions(geometry, false, options);
|
ol.format.Feature.transformWithOptions(geometry, false, options);
|
||||||
}
|
}
|
||||||
feature.setGeometry(geometry);
|
feature.setGeometry(geometry);
|
||||||
@@ -2295,7 +2295,7 @@ ol.format.KML.writePlacemark_ = function(node, feature, objectStack) {
|
|||||||
// serialize geometry
|
// serialize geometry
|
||||||
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
|
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
geometry =
|
geometry =
|
||||||
ol.format.Feature.transformWithOptions(geometry, true, options);
|
ol.format.Feature.transformWithOptions(geometry, true, options);
|
||||||
}
|
}
|
||||||
@@ -2751,7 +2751,7 @@ ol.format.KML.DOCUMENT_NODE_FACTORY_ = function(value, objectStack,
|
|||||||
*/
|
*/
|
||||||
ol.format.KML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
|
ol.format.KML.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
|
||||||
opt_nodeName) {
|
opt_nodeName) {
|
||||||
if (goog.isDefAndNotNull(value)) {
|
if (value) {
|
||||||
goog.asserts.assertInstanceof(value, ol.geom.Geometry,
|
goog.asserts.assertInstanceof(value, ol.geom.Geometry,
|
||||||
'value should be an ol.geom.Geometry');
|
'value should be an ol.geom.Geometry');
|
||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ ol.format.Polyline.prototype.readProjection;
|
|||||||
*/
|
*/
|
||||||
ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
|
ol.format.Polyline.prototype.writeFeatureText = function(feature, opt_options) {
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
return this.writeGeometryText(geometry, opt_options);
|
return this.writeGeometryText(geometry, opt_options);
|
||||||
} else {
|
} else {
|
||||||
goog.asserts.fail('geometry needs to be defined');
|
goog.asserts.fail('geometry needs to be defined');
|
||||||
|
|||||||
@@ -697,7 +697,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
}
|
}
|
||||||
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
ol.xml.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
'xsi:schemaLocation', this.schemaLocation_);
|
'xsi:schemaLocation', this.schemaLocation_);
|
||||||
if (goog.isDefAndNotNull(inserts)) {
|
if (inserts) {
|
||||||
obj = {node: node, featureNS: options.featureNS,
|
obj = {node: node, featureNS: options.featureNS,
|
||||||
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||||
goog.object.extend(obj, baseObj);
|
goog.object.extend(obj, baseObj);
|
||||||
@@ -706,7 +706,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
ol.xml.makeSimpleNodeFactory('Insert'), inserts,
|
ol.xml.makeSimpleNodeFactory('Insert'), inserts,
|
||||||
objectStack);
|
objectStack);
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(updates)) {
|
if (updates) {
|
||||||
obj = {node: node, featureNS: options.featureNS,
|
obj = {node: node, featureNS: options.featureNS,
|
||||||
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
featureType: options.featureType, featurePrefix: options.featurePrefix};
|
||||||
goog.object.extend(obj, baseObj);
|
goog.object.extend(obj, baseObj);
|
||||||
@@ -715,7 +715,7 @@ ol.format.WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
|||||||
ol.xml.makeSimpleNodeFactory('Update'), updates,
|
ol.xml.makeSimpleNodeFactory('Update'), updates,
|
||||||
objectStack);
|
objectStack);
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(deletes)) {
|
if (deletes) {
|
||||||
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
ol.xml.pushSerializeAndPop({node: node, featureNS: options.featureNS,
|
||||||
featureType: options.featureType, featurePrefix: options.featurePrefix},
|
featureType: options.featureType, featurePrefix: options.featurePrefix},
|
||||||
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
ol.format.WFS.TRANSACTION_SERIALIZERS_,
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ ol.Geolocation.prototype.disposeInternal = function() {
|
|||||||
*/
|
*/
|
||||||
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||||
var projection = this.getProjection();
|
var projection = this.getProjection();
|
||||||
if (goog.isDefAndNotNull(projection)) {
|
if (projection) {
|
||||||
this.transform_ = ol.proj.getTransformFromProjections(
|
this.transform_ = ol.proj.getTransformFromProjections(
|
||||||
ol.proj.get('EPSG:4326'), projection);
|
ol.proj.get('EPSG:4326'), projection);
|
||||||
if (!goog.isNull(this.position_)) {
|
if (!goog.isNull(this.position_)) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ ol.geom.flat.interpolate.lineString =
|
|||||||
pointY = flatCoordinates[offset + index * stride + 1];
|
pointY = flatCoordinates[offset + index * stride + 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(opt_dest)) {
|
if (opt_dest) {
|
||||||
opt_dest[0] = pointX;
|
opt_dest[0] = pointX;
|
||||||
opt_dest[1] = pointY;
|
opt_dest[1] = pointY;
|
||||||
return opt_dest;
|
return opt_dest;
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ ol.interaction.DragAndDrop.prototype.handleResult_ = function(file, result) {
|
|||||||
for (j = 0, jj = readFeatures.length; j < jj; ++j) {
|
for (j = 0, jj = readFeatures.length; j < jj; ++j) {
|
||||||
var feature = readFeatures[j];
|
var feature = readFeatures[j];
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
geometry.applyTransform(transform);
|
geometry.applyTransform(transform);
|
||||||
}
|
}
|
||||||
features.push(feature);
|
features.push(feature);
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ ol.interaction.Interaction.rotate =
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Interaction.rotateWithoutConstraints =
|
ol.interaction.Interaction.rotateWithoutConstraints =
|
||||||
function(map, view, rotation, opt_anchor, opt_duration) {
|
function(map, view, rotation, opt_anchor, opt_duration) {
|
||||||
if (goog.isDefAndNotNull(rotation)) {
|
if (rotation !== undefined) {
|
||||||
var currentRotation = view.getRotation();
|
var currentRotation = view.getRotation();
|
||||||
var currentCenter = view.getCenter();
|
var currentCenter = view.getCenter();
|
||||||
if (currentRotation !== undefined && currentCenter &&
|
if (currentRotation !== undefined && currentCenter &&
|
||||||
@@ -218,7 +218,7 @@ ol.interaction.Interaction.zoomByDelta =
|
|||||||
*/
|
*/
|
||||||
ol.interaction.Interaction.zoomWithoutConstraints =
|
ol.interaction.Interaction.zoomWithoutConstraints =
|
||||||
function(map, view, resolution, opt_anchor, opt_duration) {
|
function(map, view, resolution, opt_anchor, opt_duration) {
|
||||||
if (goog.isDefAndNotNull(resolution)) {
|
if (resolution) {
|
||||||
var currentResolution = view.getResolution();
|
var currentResolution = view.getResolution();
|
||||||
var currentCenter = view.getCenter();
|
var currentCenter = view.getCenter();
|
||||||
if (currentResolution !== undefined && currentCenter &&
|
if (currentResolution !== undefined && currentCenter &&
|
||||||
@@ -237,7 +237,7 @@ ol.interaction.Interaction.zoomWithoutConstraints =
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(opt_anchor)) {
|
if (opt_anchor) {
|
||||||
var center = view.calculateCenterZoom(resolution, opt_anchor);
|
var center = view.calculateCenterZoom(resolution, opt_anchor);
|
||||||
view.setCenter(center);
|
view.setCenter(center);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ ol.layer.Group = function(opt_options) {
|
|||||||
ol.Object.getChangeEventType(ol.layer.GroupProperty.LAYERS),
|
ol.Object.getChangeEventType(ol.layer.GroupProperty.LAYERS),
|
||||||
this.handleLayersChanged_, false, this);
|
this.handleLayersChanged_, false, this);
|
||||||
|
|
||||||
if (goog.isDefAndNotNull(layers)) {
|
if (layers) {
|
||||||
if (goog.isArray(layers)) {
|
if (goog.isArray(layers)) {
|
||||||
layers = new ol.Collection(layers.slice());
|
layers = new ol.Collection(layers.slice());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-1
@@ -1123,7 +1123,7 @@ ol.Map.prototype.handleLayerGroupChanged_ = function() {
|
|||||||
this.layerGroupPropertyListenerKeys_ = null;
|
this.layerGroupPropertyListenerKeys_ = null;
|
||||||
}
|
}
|
||||||
var layerGroup = this.getLayerGroup();
|
var layerGroup = this.getLayerGroup();
|
||||||
if (goog.isDefAndNotNull(layerGroup)) {
|
if (layerGroup) {
|
||||||
this.layerGroupPropertyListenerKeys_ = [
|
this.layerGroupPropertyListenerKeys_ = [
|
||||||
goog.events.listen(
|
goog.events.listen(
|
||||||
layerGroup, ol.ObjectEventType.PROPERTYCHANGE,
|
layerGroup, ol.ObjectEventType.PROPERTYCHANGE,
|
||||||
|
|||||||
+2
-2
@@ -244,7 +244,7 @@ ol.Overlay.prototype.getPositioning = function() {
|
|||||||
ol.Overlay.prototype.handleElementChanged = function() {
|
ol.Overlay.prototype.handleElementChanged = function() {
|
||||||
goog.dom.removeChildren(this.element_);
|
goog.dom.removeChildren(this.element_);
|
||||||
var element = this.getElement();
|
var element = this.getElement();
|
||||||
if (goog.isDefAndNotNull(element)) {
|
if (element) {
|
||||||
goog.dom.append(/** @type {!Node} */ (this.element_), element);
|
goog.dom.append(/** @type {!Node} */ (this.element_), element);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -260,7 +260,7 @@ ol.Overlay.prototype.handleMapChanged = function() {
|
|||||||
this.mapPostrenderListenerKey_ = null;
|
this.mapPostrenderListenerKey_ = null;
|
||||||
}
|
}
|
||||||
var map = this.getMap();
|
var map = this.getMap();
|
||||||
if (goog.isDefAndNotNull(map)) {
|
if (map) {
|
||||||
this.mapPostrenderListenerKey_ = goog.events.listen(map,
|
this.mapPostrenderListenerKey_ = goog.events.listen(map,
|
||||||
ol.MapEventType.POSTRENDER, this.render, false, this);
|
ol.MapEventType.POSTRENDER, this.render, false, this);
|
||||||
this.updatePixelPosition();
|
this.updatePixelPosition();
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ ol.renderer.canvas.VectorLayer.prototype.prepareFrame =
|
|||||||
styles = styleFunction(feature, resolution);
|
styles = styleFunction(feature, resolution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(styles)) {
|
if (styles) {
|
||||||
var dirty = this.renderFeature(
|
var dirty = this.renderFeature(
|
||||||
feature, resolution, pixelRatio, styles, replayGroup);
|
feature, resolution, pixelRatio, styles, replayGroup);
|
||||||
this.dirty_ = this.dirty_ || dirty;
|
this.dirty_ = this.dirty_ || dirty;
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ ol.renderer.dom.VectorLayer.prototype.prepareFrame =
|
|||||||
styles = styleFunction(feature, resolution);
|
styles = styleFunction(feature, resolution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(styles)) {
|
if (styles) {
|
||||||
var dirty = this.renderFeature(
|
var dirty = this.renderFeature(
|
||||||
feature, resolution, pixelRatio, styles, replayGroup);
|
feature, resolution, pixelRatio, styles, replayGroup);
|
||||||
this.dirty_ = this.dirty_ || dirty;
|
this.dirty_ = this.dirty_ || dirty;
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ ol.renderer.Layer.prototype.scheduleExpireCache =
|
|||||||
*/
|
*/
|
||||||
ol.renderer.Layer.prototype.updateAttributions =
|
ol.renderer.Layer.prototype.updateAttributions =
|
||||||
function(attributionsSet, attributions) {
|
function(attributionsSet, attributions) {
|
||||||
if (goog.isDefAndNotNull(attributions)) {
|
if (attributions) {
|
||||||
var attribution, i, ii;
|
var attribution, i, ii;
|
||||||
for (i = 0, ii = attributions.length; i < ii; ++i) {
|
for (i = 0, ii = attributions.length; i < ii; ++i) {
|
||||||
attribution = attributions[i];
|
attribution = attributions[i];
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
|||||||
styles = styleFunction(feature, resolution);
|
styles = styleFunction(feature, resolution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDefAndNotNull(styles)) {
|
if (styles) {
|
||||||
var dirty = this.renderFeature(
|
var dirty = this.renderFeature(
|
||||||
feature, resolution, pixelRatio, styles, replayGroup);
|
feature, resolution, pixelRatio, styles, replayGroup);
|
||||||
this.dirty_ = this.dirty_ || dirty;
|
this.dirty_ = this.dirty_ || dirty;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ ol.source.Vector.prototype.addFeatureInternal = function(feature) {
|
|||||||
this.setupChangeEvents_(featureKey, feature);
|
this.setupChangeEvents_(featureKey, feature);
|
||||||
|
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
var extent = geometry.getExtent();
|
var extent = geometry.getExtent();
|
||||||
if (!goog.isNull(this.featuresRtree_)) {
|
if (!goog.isNull(this.featuresRtree_)) {
|
||||||
this.featuresRtree_.insert(extent, feature);
|
this.featuresRtree_.insert(extent, feature);
|
||||||
@@ -299,7 +299,7 @@ ol.source.Vector.prototype.addFeaturesInternal = function(features) {
|
|||||||
this.setupChangeEvents_(featureKey, feature);
|
this.setupChangeEvents_(featureKey, feature);
|
||||||
|
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (goog.isDefAndNotNull(geometry)) {
|
if (geometry) {
|
||||||
var extent = geometry.getExtent();
|
var extent = geometry.getExtent();
|
||||||
extents.push(extent);
|
extents.push(extent);
|
||||||
geometryFeatures.push(feature);
|
geometryFeatures.push(feature);
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ ol.style.Style.prototype.setGeometry = function(geometry) {
|
|||||||
} else if (goog.isString(geometry)) {
|
} else if (goog.isString(geometry)) {
|
||||||
this.geometryFunction_ = function(feature) {
|
this.geometryFunction_ = function(feature) {
|
||||||
var result = feature.get(geometry);
|
var result = feature.get(geometry);
|
||||||
if (goog.isDefAndNotNull(result)) {
|
if (result) {
|
||||||
goog.asserts.assertInstanceof(result, ol.geom.Geometry,
|
goog.asserts.assertInstanceof(result, ol.geom.Geometry,
|
||||||
'feature geometry must be an ol.geom.Geometry instance');
|
'feature geometry must be an ol.geom.Geometry instance');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ ol.tilegrid.TileGrid = function(options) {
|
|||||||
}
|
}
|
||||||
return tileRange;
|
return tileRange;
|
||||||
}, this);
|
}, this);
|
||||||
} else if (goog.isDefAndNotNull(extent)) {
|
} else if (extent) {
|
||||||
this.calculateTileRanges_(extent);
|
this.calculateTileRanges_(extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user