Remove goog.isNull in geom classes

This commit is contained in:
Marc Jansen
2015-09-29 15:18:56 +02:00
parent eb5088eb40
commit 3c4e663224
10 changed files with 38 additions and 38 deletions

View File

@@ -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');