Toward natural JavaScript syntax

This commit is contained in:
Tim Schaub
2015-09-25 12:16:42 -06:00
parent d610b206f7
commit 0927c55b3c
40 changed files with 146 additions and 188 deletions

View File

@@ -44,7 +44,7 @@ ol.geom.flat.orient.linearRingIsClockwise =
*/
ol.geom.flat.orient.linearRingsAreOriented =
function(flatCoordinates, offset, ends, stride, opt_right) {
var right = ol.isDef(opt_right) ? opt_right : false;
var right = opt_right !== undefined ? opt_right : false;
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
@@ -106,7 +106,7 @@ ol.geom.flat.orient.linearRingssAreOriented =
*/
ol.geom.flat.orient.orientLinearRings =
function(flatCoordinates, offset, ends, stride, opt_right) {
var right = ol.isDef(opt_right) ? opt_right : false;
var right = opt_right !== undefined ? opt_right : false;
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];

View File

@@ -149,8 +149,7 @@ ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
this.layout != ol.geom.GeometryLayout.XYZM) {
return null;
}
var extrapolate = ol.isDef(opt_extrapolate) ?
/** @type {boolean} */ (opt_extrapolate) : false;
var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
return ol.geom.flat.lineStringCoordinateAtM(this.flatCoordinates, 0,
this.flatCoordinates.length, this.stride, m, extrapolate);
};

View File

@@ -136,10 +136,8 @@ ol.geom.MultiLineString.prototype.getCoordinateAtM =
this.flatCoordinates.length === 0) {
return null;
}
var extrapolate = ol.isDef(opt_extrapolate) ?
/** @type {boolean} */ (opt_extrapolate) : false;
var interpolate = ol.isDef(opt_interpolate) ?
/** @type {boolean} */ (opt_interpolate) : false;
var extrapolate = opt_extrapolate !== undefined ? opt_extrapolate : false;
var interpolate = opt_interpolate !== undefined ? opt_interpolate : false;
return ol.geom.flat.lineStringsCoordinateAtM(this.flatCoordinates, 0,
this.ends_, this.stride, m, extrapolate, interpolate);
};

View File

@@ -183,7 +183,7 @@ ol.geom.MultiPolygon.prototype.getArea = function() {
*/
ol.geom.MultiPolygon.prototype.getCoordinates = function(opt_right) {
var flatCoordinates;
if (ol.isDef(opt_right)) {
if (opt_right !== undefined) {
flatCoordinates = this.getOrientedFlatCoordinates().slice();
ol.geom.flat.orient.orientLinearRingss(
flatCoordinates, 0, this.endss_, this.stride, opt_right);

View File

@@ -170,7 +170,7 @@ ol.geom.Polygon.prototype.getArea = function() {
*/
ol.geom.Polygon.prototype.getCoordinates = function(opt_right) {
var flatCoordinates;
if (ol.isDef(opt_right)) {
if (opt_right !== undefined) {
flatCoordinates = this.getOrientedFlatCoordinates().slice();
ol.geom.flat.orient.orientLinearRings(
flatCoordinates, 0, this.ends_, this.stride, opt_right);