Remove goog.isDef for geometries

This commit is contained in:
Tim Schaub
2015-09-21 05:59:47 +09:00
parent 1fceb4a709
commit b0fe36e609
12 changed files with 29 additions and 24 deletions
+3 -3
View File
@@ -154,7 +154,7 @@ ol.geom.flat.closest.getClosestPoint = function(flatCoordinates, offset, end,
}
}
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;
while (index < end) {
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,
stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
opt_tmpPoint) {
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++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,
endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance,
opt_tmpPoint) {
var tmpPoint = goog.isDef(opt_tmpPoint) ? opt_tmpPoint : [NaN, NaN];
var tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN];
var i, ii;
for (i = 0, ii = endss.length; i < ii; ++i) {
var ends = endss[i];
+2 -2
View File
@@ -55,7 +55,7 @@ ol.geom.flat.deflate.coordinates =
*/
ol.geom.flat.deflate.coordinatess =
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 j, jj;
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
@@ -79,7 +79,7 @@ ol.geom.flat.deflate.coordinatess =
*/
ol.geom.flat.deflate.coordinatesss =
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 j, jj;
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
+1 -1
View File
@@ -60,7 +60,7 @@ ol.geom.flat.interiorpoint.linearRings = function(flatCoordinates, offset,
// ring. Use the center of the the linear ring's extent.
pointX = flatCenters[flatCentersOffset];
}
if (goog.isDef(opt_dest)) {
if (opt_dest) {
opt_dest.push(pointX, y);
return opt_dest;
} else {
+3 -2
View File
@@ -1,5 +1,6 @@
goog.provide('ol.geom.flat.orient');
goog.require('ol');
goog.require('ol.geom.flat.reverse');
@@ -43,7 +44,7 @@ ol.geom.flat.orient.linearRingIsClockwise =
*/
ol.geom.flat.orient.linearRingsAreOriented =
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;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
@@ -105,7 +106,7 @@ ol.geom.flat.orient.linearRingssAreOriented =
*/
ol.geom.flat.orient.orientLinearRings =
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;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
+4 -4
View File
@@ -20,7 +20,7 @@ ol.geom.flat.transform.transform2D =
var m11 = goog.vec.Mat4.getElement(transform, 1, 1);
var m03 = goog.vec.Mat4.getElement(transform, 0, 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 j;
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++] = m10 * x + m11 * y + m13;
}
if (goog.isDef(opt_dest) && dest.length != i) {
if (opt_dest && dest.length != i) {
dest.length = i;
}
return dest;
@@ -48,7 +48,7 @@ ol.geom.flat.transform.transform2D =
*/
ol.geom.flat.transform.translate =
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 j, k;
for (j = offset; j < end; j += stride) {
@@ -58,7 +58,7 @@ ol.geom.flat.transform.translate =
dest[i++] = flatCoordinates[k];
}
}
if (goog.isDef(opt_dest) && dest.length != i) {
if (opt_dest && dest.length != i) {
dest.length = i;
}
return dest;