Factor out ol.geom.flat.deflate
This commit is contained in:
@@ -5,6 +5,7 @@ goog.require('ol.extent');
|
|||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
goog.require('ol.geom.SimpleGeometry');
|
goog.require('ol.geom.SimpleGeometry');
|
||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -174,7 +175,7 @@ ol.geom.Circle.prototype.setCenterAndRadius =
|
|||||||
}
|
}
|
||||||
/** @type {Array.<number>} */
|
/** @type {Array.<number>} */
|
||||||
var flatCoordinates = this.flatCoordinates;
|
var flatCoordinates = this.flatCoordinates;
|
||||||
var offset = ol.geom.flat.deflateCoordinate(
|
var offset = ol.geom.flat.deflate.coordinate(
|
||||||
flatCoordinates, 0, center, this.stride);
|
flatCoordinates, 0, center, this.stride);
|
||||||
flatCoordinates[offset++] = flatCoordinates[0] + radius;
|
flatCoordinates[offset++] = flatCoordinates[0] + radius;
|
||||||
var i, ii;
|
var i, ii;
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
goog.provide('ol.geom.flat.deflate');
|
||||||
|
|
||||||
|
goog.require('goog.asserts');
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
|
* @param {number} offset Offset.
|
||||||
|
* @param {ol.Coordinate} coordinate Coordinate.
|
||||||
|
* @param {number} stride Stride.
|
||||||
|
* @return {number} offset Offset.
|
||||||
|
*/
|
||||||
|
ol.geom.flat.deflate.coordinate =
|
||||||
|
function(flatCoordinates, offset, coordinate, stride) {
|
||||||
|
goog.asserts.assert(coordinate.length == stride);
|
||||||
|
var i, ii;
|
||||||
|
for (i = 0, ii = coordinate.length; i < ii; ++i) {
|
||||||
|
flatCoordinates[offset++] = coordinate[i];
|
||||||
|
}
|
||||||
|
return offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
|
* @param {number} offset Offset.
|
||||||
|
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
|
||||||
|
* @param {number} stride Stride.
|
||||||
|
* @return {number} offset Offset.
|
||||||
|
*/
|
||||||
|
ol.geom.flat.deflate.coordinates =
|
||||||
|
function(flatCoordinates, offset, coordinates, stride) {
|
||||||
|
var i, ii;
|
||||||
|
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
||||||
|
var coordinate = coordinates[i];
|
||||||
|
goog.asserts.assert(coordinate.length == stride);
|
||||||
|
var j;
|
||||||
|
for (j = 0; j < stride; ++j) {
|
||||||
|
flatCoordinates[offset++] = coordinate[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
|
* @param {number} offset Offset.
|
||||||
|
* @param {Array.<Array.<ol.Coordinate>>} coordinatess Coordinatess.
|
||||||
|
* @param {number} stride Stride.
|
||||||
|
* @param {Array.<number>=} opt_ends Ends.
|
||||||
|
* @return {Array.<number>} Ends.
|
||||||
|
*/
|
||||||
|
ol.geom.flat.deflate.coordinatess =
|
||||||
|
function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
||||||
|
var ends = goog.isDef(opt_ends) ? opt_ends : [];
|
||||||
|
var i = 0;
|
||||||
|
var j, jj;
|
||||||
|
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
||||||
|
var end = ol.geom.flat.deflate.coordinates(
|
||||||
|
flatCoordinates, offset, coordinatess[j], stride);
|
||||||
|
ends[i++] = end;
|
||||||
|
offset = end;
|
||||||
|
}
|
||||||
|
ends.length = i;
|
||||||
|
return ends;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
|
* @param {number} offset Offset.
|
||||||
|
* @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinatesss Coordinatesss.
|
||||||
|
* @param {number} stride Stride.
|
||||||
|
* @param {Array.<Array.<number>>=} opt_endss Endss.
|
||||||
|
* @return {Array.<Array.<number>>} Endss.
|
||||||
|
*/
|
||||||
|
ol.geom.flat.deflate.coordinatesss =
|
||||||
|
function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
||||||
|
var endss = goog.isDef(opt_endss) ? opt_endss : [];
|
||||||
|
var i = 0;
|
||||||
|
var j, jj;
|
||||||
|
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
||||||
|
var ends = ol.geom.flat.deflate.coordinatess(
|
||||||
|
flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
|
||||||
|
endss[i++] = ends;
|
||||||
|
offset = ends[ends.length - 1];
|
||||||
|
}
|
||||||
|
endss.length = i;
|
||||||
|
return endss;
|
||||||
|
};
|
||||||
@@ -6,94 +6,6 @@ goog.require('goog.vec.Mat4');
|
|||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
|
||||||
* @param {number} offset Offset.
|
|
||||||
* @param {ol.Coordinate} coordinate Coordinate.
|
|
||||||
* @param {number} stride Stride.
|
|
||||||
* @return {number} offset Offset.
|
|
||||||
*/
|
|
||||||
ol.geom.flat.deflateCoordinate =
|
|
||||||
function(flatCoordinates, offset, coordinate, stride) {
|
|
||||||
goog.asserts.assert(coordinate.length == stride);
|
|
||||||
var i, ii;
|
|
||||||
for (i = 0, ii = coordinate.length; i < ii; ++i) {
|
|
||||||
flatCoordinates[offset++] = coordinate[i];
|
|
||||||
}
|
|
||||||
return offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
|
||||||
* @param {number} offset Offset.
|
|
||||||
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
|
|
||||||
* @param {number} stride Stride.
|
|
||||||
* @return {number} offset Offset.
|
|
||||||
*/
|
|
||||||
ol.geom.flat.deflateCoordinates =
|
|
||||||
function(flatCoordinates, offset, coordinates, stride) {
|
|
||||||
var i, ii;
|
|
||||||
for (i = 0, ii = coordinates.length; i < ii; ++i) {
|
|
||||||
var coordinate = coordinates[i];
|
|
||||||
goog.asserts.assert(coordinate.length == stride);
|
|
||||||
var j;
|
|
||||||
for (j = 0; j < stride; ++j) {
|
|
||||||
flatCoordinates[offset++] = coordinate[j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
|
||||||
* @param {number} offset Offset.
|
|
||||||
* @param {Array.<Array.<ol.Coordinate>>} coordinatess Coordinatess.
|
|
||||||
* @param {number} stride Stride.
|
|
||||||
* @param {Array.<number>=} opt_ends Ends.
|
|
||||||
* @return {Array.<number>} Ends.
|
|
||||||
*/
|
|
||||||
ol.geom.flat.deflateCoordinatess =
|
|
||||||
function(flatCoordinates, offset, coordinatess, stride, opt_ends) {
|
|
||||||
var ends = goog.isDef(opt_ends) ? opt_ends : [];
|
|
||||||
var i = 0;
|
|
||||||
var j, jj;
|
|
||||||
for (j = 0, jj = coordinatess.length; j < jj; ++j) {
|
|
||||||
var end = ol.geom.flat.deflateCoordinates(
|
|
||||||
flatCoordinates, offset, coordinatess[j], stride);
|
|
||||||
ends[i++] = end;
|
|
||||||
offset = end;
|
|
||||||
}
|
|
||||||
ends.length = i;
|
|
||||||
return ends;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
|
||||||
* @param {number} offset Offset.
|
|
||||||
* @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinatesss Coordinatesss.
|
|
||||||
* @param {number} stride Stride.
|
|
||||||
* @param {Array.<Array.<number>>=} opt_endss Endss.
|
|
||||||
* @return {Array.<Array.<number>>} Endss.
|
|
||||||
*/
|
|
||||||
ol.geom.flat.deflateCoordinatesss =
|
|
||||||
function(flatCoordinates, offset, coordinatesss, stride, opt_endss) {
|
|
||||||
var endss = goog.isDef(opt_endss) ? opt_endss : [];
|
|
||||||
var i = 0;
|
|
||||||
var j, jj;
|
|
||||||
for (j = 0, jj = coordinatesss.length; j < jj; ++j) {
|
|
||||||
var ends = ol.geom.flat.deflateCoordinatess(
|
|
||||||
flatCoordinates, offset, coordinatesss[j], stride, endss[i]);
|
|
||||||
endss[i++] = ends;
|
|
||||||
offset = ends[ends.length - 1];
|
|
||||||
}
|
|
||||||
endss.length = i;
|
|
||||||
return endss;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
||||||
* @param {number} offset Offset.
|
* @param {number} offset Offset.
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ goog.require('ol.geom.SimpleGeometry');
|
|||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
goog.require('ol.geom.flat.area');
|
goog.require('ol.geom.flat.area');
|
||||||
goog.require('ol.geom.flat.closest');
|
goog.require('ol.geom.flat.closest');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
|
|
||||||
|
|
||||||
@@ -127,7 +128,7 @@ ol.geom.LinearRing.prototype.setCoordinates =
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflateCoordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ goog.require('ol.geom.GeometryType');
|
|||||||
goog.require('ol.geom.SimpleGeometry');
|
goog.require('ol.geom.SimpleGeometry');
|
||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
goog.require('ol.geom.flat.closest');
|
goog.require('ol.geom.flat.closest');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
goog.require('ol.geom.flat.interpolate');
|
goog.require('ol.geom.flat.interpolate');
|
||||||
goog.require('ol.geom.flat.length');
|
goog.require('ol.geom.flat.length');
|
||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
@@ -194,7 +195,7 @@ ol.geom.LineString.prototype.setCoordinates =
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflateCoordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ goog.require('ol.geom.LineString');
|
|||||||
goog.require('ol.geom.SimpleGeometry');
|
goog.require('ol.geom.SimpleGeometry');
|
||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
goog.require('ol.geom.flat.closest');
|
goog.require('ol.geom.flat.closest');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
goog.require('ol.geom.flat.interpolate');
|
goog.require('ol.geom.flat.interpolate');
|
||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
|
|
||||||
@@ -247,7 +248,7 @@ ol.geom.MultiLineString.prototype.setCoordinates =
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
var ends = ol.geom.flat.deflateCoordinatess(
|
var ends = ol.geom.flat.deflate.coordinatess(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ goog.require('ol.geom.GeometryType');
|
|||||||
goog.require('ol.geom.Point');
|
goog.require('ol.geom.Point');
|
||||||
goog.require('ol.geom.SimpleGeometry');
|
goog.require('ol.geom.SimpleGeometry');
|
||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ ol.geom.MultiPoint.prototype.setCoordinates =
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflateCoordinates(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinates(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ goog.require('ol.geom.flat');
|
|||||||
goog.require('ol.geom.flat.area');
|
goog.require('ol.geom.flat.area');
|
||||||
goog.require('ol.geom.flat.closest');
|
goog.require('ol.geom.flat.closest');
|
||||||
goog.require('ol.geom.flat.contains');
|
goog.require('ol.geom.flat.contains');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
goog.require('ol.geom.flat.interiorpoint');
|
goog.require('ol.geom.flat.interiorpoint');
|
||||||
goog.require('ol.geom.flat.orient');
|
goog.require('ol.geom.flat.orient');
|
||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
@@ -317,7 +318,7 @@ ol.geom.MultiPolygon.prototype.setCoordinates =
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
var endss = ol.geom.flat.deflateCoordinatesss(
|
var endss = ol.geom.flat.deflate.coordinatesss(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride, this.endss_);
|
this.flatCoordinates, 0, coordinates, this.stride, this.endss_);
|
||||||
var lastEnds = endss[endss.length - 1];
|
var lastEnds = endss[endss.length - 1];
|
||||||
this.flatCoordinates.length = lastEnds.length === 0 ?
|
this.flatCoordinates.length = lastEnds.length === 0 ?
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ goog.require('ol.extent');
|
|||||||
goog.require('ol.geom.GeometryType');
|
goog.require('ol.geom.GeometryType');
|
||||||
goog.require('ol.geom.SimpleGeometry');
|
goog.require('ol.geom.SimpleGeometry');
|
||||||
goog.require('ol.geom.flat');
|
goog.require('ol.geom.flat');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
this.flatCoordinates.length = ol.geom.flat.deflateCoordinate(
|
this.flatCoordinates.length = ol.geom.flat.deflate.coordinate(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride);
|
this.flatCoordinates, 0, coordinates, this.stride);
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ goog.require('ol.geom.flat');
|
|||||||
goog.require('ol.geom.flat.area');
|
goog.require('ol.geom.flat.area');
|
||||||
goog.require('ol.geom.flat.closest');
|
goog.require('ol.geom.flat.closest');
|
||||||
goog.require('ol.geom.flat.contains');
|
goog.require('ol.geom.flat.contains');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
goog.require('ol.geom.flat.interiorpoint');
|
goog.require('ol.geom.flat.interiorpoint');
|
||||||
goog.require('ol.geom.flat.orient');
|
goog.require('ol.geom.flat.orient');
|
||||||
goog.require('ol.geom.flat.simplify');
|
goog.require('ol.geom.flat.simplify');
|
||||||
@@ -280,7 +281,7 @@ ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
if (goog.isNull(this.flatCoordinates)) {
|
if (goog.isNull(this.flatCoordinates)) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
}
|
}
|
||||||
var ends = ol.geom.flat.deflateCoordinatess(
|
var ends = ol.geom.flat.deflate.coordinatess(
|
||||||
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
this.flatCoordinates, 0, coordinates, this.stride, this.ends_);
|
||||||
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
this.flatCoordinates.length = ends.length === 0 ? 0 : ends[ends.length - 1];
|
||||||
this.dispatchChangeEvent();
|
this.dispatchChangeEvent();
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
goog.provide('ol.test.geom.flat.deflate');
|
||||||
|
|
||||||
|
describe('ol.geom.flat.deflate', function() {
|
||||||
|
|
||||||
|
describe('ol.geom.flat.deflate.coordinates', function() {
|
||||||
|
|
||||||
|
var flatCoordinates;
|
||||||
|
beforeEach(function() {
|
||||||
|
flatCoordinates = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
it('flattens coordinates', function() {
|
||||||
|
var offset = ol.geom.flat.deflate.coordinates(
|
||||||
|
flatCoordinates, 0, [[1, 2], [3, 4]], 2);
|
||||||
|
expect(offset).to.be(4);
|
||||||
|
expect(flatCoordinates).to.eql([1, 2, 3, 4]);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('ol.geom.flat.deflate.coordinatess', function() {
|
||||||
|
|
||||||
|
var flatCoordinates;
|
||||||
|
beforeEach(function() {
|
||||||
|
flatCoordinates = [];
|
||||||
|
});
|
||||||
|
|
||||||
|
it('flattens arrays of coordinates', function() {
|
||||||
|
var ends = ol.geom.flat.deflate.coordinatess(flatCoordinates, 0,
|
||||||
|
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], 2);
|
||||||
|
expect(ends).to.eql([4, 8]);
|
||||||
|
expect(flatCoordinates).to.eql([1, 2, 3, 4, 5, 6, 7, 8]);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
goog.require('ol.geom.flat');
|
||||||
|
goog.require('ol.geom.flat.deflate');
|
||||||
@@ -3,38 +3,6 @@ goog.provide('ol.test.geom.flat');
|
|||||||
|
|
||||||
describe('ol.geom.flat', function() {
|
describe('ol.geom.flat', function() {
|
||||||
|
|
||||||
describe('ol.geom.flat.deflateCoordinates', function() {
|
|
||||||
|
|
||||||
var flatCoordinates;
|
|
||||||
beforeEach(function() {
|
|
||||||
flatCoordinates = [];
|
|
||||||
});
|
|
||||||
|
|
||||||
it('flattens coordinates', function() {
|
|
||||||
var offset = ol.geom.flat.deflateCoordinates(
|
|
||||||
flatCoordinates, 0, [[1, 2], [3, 4]], 2);
|
|
||||||
expect(offset).to.be(4);
|
|
||||||
expect(flatCoordinates).to.eql([1, 2, 3, 4]);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('ol.geom.flat.deflateCoordinatess', function() {
|
|
||||||
|
|
||||||
var flatCoordinates;
|
|
||||||
beforeEach(function() {
|
|
||||||
flatCoordinates = [];
|
|
||||||
});
|
|
||||||
|
|
||||||
it('flattens arrays of coordinates', function() {
|
|
||||||
var ends = ol.geom.flat.deflateCoordinatess(flatCoordinates, 0,
|
|
||||||
[[[1, 2], [3, 4]], [[5, 6], [7, 8]]], 2);
|
|
||||||
expect(ends).to.eql([4, 8]);
|
|
||||||
expect(flatCoordinates).to.eql([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('ol.geom.flat.flipXY', function() {
|
describe('ol.geom.flat.flipXY', function() {
|
||||||
|
|
||||||
it('can flip XY coordinates', function() {
|
it('can flip XY coordinates', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user