Remove goog.isDef for geometries
This commit is contained in:
@@ -23,7 +23,7 @@ goog.require('ol.proj');
|
|||||||
*/
|
*/
|
||||||
ol.geom.Circle = function(center, opt_radius, opt_layout) {
|
ol.geom.Circle = function(center, opt_radius, opt_layout) {
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
var radius = goog.isDef(opt_radius) ? opt_radius : 0;
|
var radius = opt_radius ? opt_radius : 0;
|
||||||
this.setCenterAndRadius(center, radius, opt_layout);
|
this.setCenterAndRadius(center, radius, opt_layout);
|
||||||
};
|
};
|
||||||
goog.inherits(ol.geom.Circle, ol.geom.SimpleGeometry);
|
goog.inherits(ol.geom.Circle, ol.geom.SimpleGeometry);
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
goog.asserts.assert(maxDelta > 0, 'maxDelta should be larger than 0');
|
goog.asserts.assert(maxDelta > 0, 'maxDelta should be larger than 0');
|
||||||
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
|
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||||
var index = offset + stride;
|
var index = offset + stride;
|
||||||
while (index < end) {
|
while (index < end) {
|
||||||
ol.geom.flat.closest.point(
|
ol.geom.flat.closest.point(
|
||||||
@@ -217,7 +217,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
|
|||||||
ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
||||||
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||||
opt_tmpPoint) {
|
opt_tmpPoint) {
|
||||||
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
|
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||||
var end = ends[i];
|
var end = ends[i];
|
||||||
@@ -247,7 +247,7 @@ ol.geom.flat.closest.getsClosestPoint = function(flatCoordinates, offset, ends,
|
|||||||
ol.geom.flat.closest.getssClosestPoint = function(flatCoordinates, offset,
|
ol.geom.flat.closest.getssClosestPoint = function(flatCoordinates, offset,
|
||||||
endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
|
||||||
opt_tmpPoint) {
|
opt_tmpPoint) {
|
||||||
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
|
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = endss.length; i < ii; ++i) {
|
for (i = 0, ii = endss.length; i < ii; ++i) {
|
||||||
var ends = endss[i];
|
var ends = endss[i];
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ ol.geom.flat.deflate.coordinates =
|
|||||||
*/
|
*/
|
||||||
ol.geom.flat.deflate.coordinatess =
|
ol.geom.flat.deflate.coordinatess =
|
||||||
function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||||
var ends = goog.isDef(opt_ends) ? opt_ends : [];
|
var ends = opt_ends ? opt_ends : [];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j, jj;
|
var j, jj;
|
||||||
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
||||||
@@ -79,7 +79,7 @@ ol.geom.flat.deflate.coordinatess =
|
|||||||
*/
|
*/
|
||||||
ol.geom.flat.deflate.coordinatesss =
|
ol.geom.flat.deflate.coordinatesss =
|
||||||
function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||||
var endss = goog.isDef(opt_endss) ? opt_endss : [];
|
var endss = opt_endss ? opt_endss : [];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j, jj;
|
var j, jj;
|
||||||
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
|
|||||||
// ring. Use the center of the the linear ring's extent.
|
// ring. Use the center of the the linear ring's extent.
|
||||||
pointX = flatCenters[flatCentersOffset];
|
pointX = flatCenters[flatCentersOffset];
|
||||||
}
|
}
|
||||||
if (goog.isDef(opt_dest)) {
|
if (opt_dest) {
|
||||||
opt_dest.push(pointX, y);
|
opt_dest.push(pointX, y);
|
||||||
return opt_dest;
|
return opt_dest;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
goog.provide('ol.geom.flat.orient');
|
goog.provide('ol.geom.flat.orient');
|
||||||
|
|
||||||
|
goog.require('ol');
|
||||||
goog.require('ol.geom.flat.reverse');
|
goog.require('ol.geom.flat.reverse');
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ ol.geom.flat.orient.linearRingIsClockwise =
|
|||||||
*/
|
*/
|
||||||
ol.geom.flat.orient.linearRingsAreOriented =
|
ol.geom.flat.orient.linearRingsAreOriented =
|
||||||
function(flatCoordinates, offset, ends, stride, opt_right) {
|
function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||||
var right = goog.isDef(opt_right) ? opt_right : false;
|
var right = ol.isDef(opt_right) ? opt_right : false;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||||
var end = ends[i];
|
var end = ends[i];
|
||||||
@@ -105,7 +106,7 @@ ol.geom.flat.orient.linearRingssAreOriented =
|
|||||||
*/
|
*/
|
||||||
ol.geom.flat.orient.orientLinearRings =
|
ol.geom.flat.orient.orientLinearRings =
|
||||||
function(flatCoordinates, offset, ends, stride, opt_right) {
|
function(flatCoordinates, offset, ends, stride, opt_right) {
|
||||||
var right = goog.isDef(opt_right) ? opt_right : false;
|
var right = ol.isDef(opt_right) ? opt_right : false;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = ends.length; i < ii; ++i) {
|
for (i = 0, ii = ends.length; i < ii; ++i) {
|
||||||
var end = ends[i];
|
var end = ends[i];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ ol.geom.flat.transform.transform2D =
|
|||||||
var m11 = goog.vec.Mat4.getElement(transform, 1, 1);
|
var m11 = goog.vec.Mat4.getElement(transform, 1, 1);
|
||||||
var m03 = goog.vec.Mat4.getElement(transform, 0, 3);
|
var m03 = goog.vec.Mat4.getElement(transform, 0, 3);
|
||||||
var m13 = goog.vec.Mat4.getElement(transform, 1, 3);
|
var m13 = goog.vec.Mat4.getElement(transform, 1, 3);
|
||||||
var dest = goog.isDef(opt_dest) ? opt_dest : [];
|
var dest = opt_dest ? opt_dest : [];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j;
|
var j;
|
||||||
for (j = offset; j < end; j += stride) {
|
for (j = offset; j < end; j += stride) {
|
||||||
@@ -29,7 +29,7 @@ ol.geom.flat.transform.transform2D =
|
|||||||
dest[i++] = m00 * x + m01 * y + m03;
|
dest[i++] = m00 * x + m01 * y + m03;
|
||||||
dest[i++] = m10 * x + m11 * y + m13;
|
dest[i++] = m10 * x + m11 * y + m13;
|
||||||
}
|
}
|
||||||
if (goog.isDef(opt_dest) && dest.length != i) {
|
if (opt_dest && dest.length != i) {
|
||||||
dest.length = i;
|
dest.length = i;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
@@ -48,7 +48,7 @@ ol.geom.flat.transform.transform2D =
|
|||||||
*/
|
*/
|
||||||
ol.geom.flat.transform.translate =
|
ol.geom.flat.transform.translate =
|
||||||
function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
function(flatCoordinates, offset, end, stride, deltaX, deltaY, opt_dest) {
|
||||||
var dest = goog.isDef(opt_dest) ? opt_dest : [];
|
var dest = opt_dest ? opt_dest : [];
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var j, k;
|
var j, k;
|
||||||
for (j = offset; j < end; j += stride) {
|
for (j = offset; j < end; j += stride) {
|
||||||
@@ -58,7 +58,7 @@ ol.geom.flat.transform.translate =
|
|||||||
dest[i++] = flatCoordinates[k];
|
dest[i++] = flatCoordinates[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDef(opt_dest) && dest.length != i) {
|
if (opt_dest && dest.length != i) {
|
||||||
dest.length = i;
|
dest.length = i;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ ol.geom.Geometry.prototype.closestPointXY = goog.abstractMethod;
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) {
|
ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) {
|
||||||
var closestPoint = goog.isDef(opt_closestPoint) ?
|
var closestPoint = opt_closestPoint ? opt_closestPoint : [NaN, NaN];
|
||||||
opt_closestPoint : [NaN, NaN];
|
|
||||||
this.closestPointXY(point[0], point[1], closestPoint, Infinity);
|
this.closestPointXY(point[0], point[1], closestPoint, Infinity);
|
||||||
return closestPoint;
|
return closestPoint;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ ol.geom.GeometryCollection = function(opt_geometries) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {Array.<ol.geom.Geometry>}
|
* @type {Array.<ol.geom.Geometry>}
|
||||||
*/
|
*/
|
||||||
this.geometries_ = goog.isDef(opt_geometries) ? opt_geometries : null;
|
this.geometries_ = opt_geometries ? opt_geometries : null;
|
||||||
|
|
||||||
this.listenGeometriesChange_();
|
this.listenGeometriesChange_();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ goog.provide('ol.geom.MultiLineString');
|
|||||||
|
|
||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
|
goog.require('ol');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.geom.GeometryLayout');
|
goog.require('ol.geom.GeometryLayout');
|
||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
@@ -135,8 +136,10 @@ ol.geom.MultiLineString.prototype.getCoordinateAtM =
|
|||||||
this.flatCoordinates.length === 0) {
|
this.flatCoordinates.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var extrapolate = goog.isDef(opt_extrapolate) ? opt_extrapolate : false;
|
var extrapolate = ol.isDef(opt_extrapolate) ?
|
||||||
var interpolate = goog.isDef(opt_interpolate) ? opt_interpolate : false;
|
/** @type {boolean} */ (opt_extrapolate) : false;
|
||||||
|
var interpolate = ol.isDef(opt_interpolate) ?
|
||||||
|
/** @type {boolean} */ (opt_interpolate) : false;
|
||||||
return ol.geom.flat.lineStringsCoordinateAtM(this.flatCoordinates, 0,
|
return ol.geom.flat.lineStringsCoordinateAtM(this.flatCoordinates, 0,
|
||||||
this.ends_, this.stride, m, extrapolate, interpolate);
|
this.ends_, this.stride, m, extrapolate, interpolate);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ goog.provide('ol.geom.MultiPolygon');
|
|||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
|
goog.require('ol');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.geom.GeometryLayout');
|
goog.require('ol.geom.GeometryLayout');
|
||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
@@ -182,7 +183,7 @@ ol.geom.MultiPolygon.prototype.getArea = function() {
|
|||||||
*/
|
*/
|
||||||
ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) {
|
ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) {
|
||||||
var flatCoordinates;
|
var flatCoordinates;
|
||||||
if (goog.isDef(opt_right)) {
|
if (ol.isDef(opt_right)) {
|
||||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||||
ol.geom.flat.orient.orientLinearRingss(
|
ol.geom.flat.orient.orientLinearRingss(
|
||||||
flatCoordinates, 0, this.endss_, this.stride, opt_right);
|
flatCoordinates, 0, this.endss_, this.stride, opt_right);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ goog.provide('ol.geom.Polygon');
|
|||||||
goog.require('goog.array');
|
goog.require('goog.array');
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.math');
|
goog.require('goog.math');
|
||||||
|
goog.require('ol');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.geom.GeometryLayout');
|
goog.require('ol.geom.GeometryLayout');
|
||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
@@ -169,7 +170,7 @@ ol.geom.Polygon.prototype.getArea = function() {
|
|||||||
*/
|
*/
|
||||||
ol.geom.Polygon.prototype.getCoordinates = function(opt_right) {
|
ol.geom.Polygon.prototype.getCoordinates = function(opt_right) {
|
||||||
var flatCoordinates;
|
var flatCoordinates;
|
||||||
if (goog.isDef(opt_right)) {
|
if (ol.isDef(opt_right)) {
|
||||||
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
flatCoordinates = this.getOrientedFlatCoordinates().slice();
|
||||||
ol.geom.flat.orient.orientLinearRings(
|
ol.geom.flat.orient.orientLinearRings(
|
||||||
flatCoordinates, 0, this.ends_, this.stride, opt_right);
|
flatCoordinates, 0, this.ends_, this.stride, opt_right);
|
||||||
@@ -388,7 +389,7 @@ ol.geom.Polygon.prototype.setFlatCoordinates =
|
|||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
|
ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
|
||||||
var n = goog.isDef(opt_n) ? opt_n : 32;
|
var n = opt_n ? opt_n : 32;
|
||||||
/** @type {Array.<number>} */
|
/** @type {Array.<number>} */
|
||||||
var flatCoordinates = [];
|
var flatCoordinates = [];
|
||||||
var i;
|
var i;
|
||||||
@@ -434,7 +435,7 @@ ol.geom.Polygon.fromExtent = function(extent) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
ol.geom.Polygon.fromCircle = function(circle, opt_sides, opt_angle) {
|
||||||
var sides = goog.isDef(opt_sides) ? opt_sides : 32;
|
var sides = opt_sides ? opt_sides : 32;
|
||||||
var stride = circle.getStride();
|
var stride = circle.getStride();
|
||||||
var layout = circle.getLayout();
|
var layout = circle.getLayout();
|
||||||
var polygon = new ol.geom.Polygon(null, layout);
|
var polygon = new ol.geom.Polygon(null, layout);
|
||||||
@@ -462,7 +463,7 @@ ol.geom.Polygon.makeRegular = function(polygon, center, radius, opt_angle) {
|
|||||||
var ends = polygon.getEnds();
|
var ends = polygon.getEnds();
|
||||||
goog.asserts.assert(ends.length === 1, 'only 1 ring is supported');
|
goog.asserts.assert(ends.length === 1, 'only 1 ring is supported');
|
||||||
var sides = flatCoordinates.length / stride - 1;
|
var sides = flatCoordinates.length / stride - 1;
|
||||||
var startAngle = goog.isDef(opt_angle) ? opt_angle : 0;
|
var startAngle = opt_angle ? opt_angle : 0;
|
||||||
var angle, coord, offset;
|
var angle, coord, offset;
|
||||||
for (var i = 0; i <= sides; ++i) {
|
for (var i = 0; i <= sides; ++i) {
|
||||||
offset = i * stride;
|
offset = i * stride;
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ ol.geom.SimpleGeometry.prototype.setLayout =
|
|||||||
function(layout, coordinates, nesting) {
|
function(layout, coordinates, nesting) {
|
||||||
/** @type {number} */
|
/** @type {number} */
|
||||||
var stride;
|
var stride;
|
||||||
if (goog.isDef(layout)) {
|
if (layout) {
|
||||||
stride = ol.geom.SimpleGeometry.getStrideForLayout(layout);
|
stride = ol.geom.SimpleGeometry.getStrideForLayout(layout);
|
||||||
} else {
|
} else {
|
||||||
var i;
|
var i;
|
||||||
|
|||||||
Reference in New Issue
Block a user