Allow flat coordinates for Polygon constructor
This commit is contained in:
@@ -247,7 +247,6 @@ GML3.prototype.readSurface_ = function(node, objectStack) {
|
|||||||
const flatLinearRings = pushParseAndPop([null],
|
const flatLinearRings = pushParseAndPop([null],
|
||||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
const polygon = new Polygon(null);
|
|
||||||
const flatCoordinates = flatLinearRings[0];
|
const flatCoordinates = flatLinearRings[0];
|
||||||
const ends = [flatCoordinates.length];
|
const ends = [flatCoordinates.length];
|
||||||
let i, ii;
|
let i, ii;
|
||||||
@@ -255,9 +254,7 @@ GML3.prototype.readSurface_ = function(node, objectStack) {
|
|||||||
extend(flatCoordinates, flatLinearRings[i]);
|
extend(flatCoordinates, flatLinearRings[i]);
|
||||||
ends.push(flatCoordinates.length);
|
ends.push(flatCoordinates.length);
|
||||||
}
|
}
|
||||||
polygon.setFlatCoordinates(
|
return new Polygon(flatCoordinates, GeometryLayout.XYZ, ends);
|
||||||
GeometryLayout.XYZ, flatCoordinates, ends);
|
|
||||||
return polygon;
|
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -444,7 +444,6 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
|
|||||||
const flatLinearRings = pushParseAndPop([null],
|
const flatLinearRings = pushParseAndPop([null],
|
||||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
const polygon = new Polygon(null);
|
|
||||||
const flatCoordinates = flatLinearRings[0];
|
const flatCoordinates = flatLinearRings[0];
|
||||||
const ends = [flatCoordinates.length];
|
const ends = [flatCoordinates.length];
|
||||||
let i, ii;
|
let i, ii;
|
||||||
@@ -452,8 +451,7 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
|
|||||||
extend(flatCoordinates, flatLinearRings[i]);
|
extend(flatCoordinates, flatLinearRings[i]);
|
||||||
ends.push(flatCoordinates.length);
|
ends.push(flatCoordinates.length);
|
||||||
}
|
}
|
||||||
polygon.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates, ends);
|
return new Polygon(flatCoordinates, GeometryLayout.XYZ, ends);
|
||||||
return polygon;
|
|
||||||
} else {
|
} else {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1047,9 +1047,7 @@ function readLinearRing(node, objectStack) {
|
|||||||
const flatCoordinates =
|
const flatCoordinates =
|
||||||
readFlatCoordinatesFromNode(node, objectStack);
|
readFlatCoordinatesFromNode(node, objectStack);
|
||||||
if (flatCoordinates) {
|
if (flatCoordinates) {
|
||||||
const polygon = new Polygon(null);
|
const polygon = new Polygon(flatCoordinates, GeometryLayout.XYZ, [flatCoordinates.length]);
|
||||||
polygon.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates,
|
|
||||||
[flatCoordinates.length]);
|
|
||||||
polygon.setProperties(properties);
|
polygon.setProperties(properties);
|
||||||
return polygon;
|
return polygon;
|
||||||
} else {
|
} else {
|
||||||
@@ -1179,14 +1177,13 @@ function readPolygon(node, objectStack) {
|
|||||||
const flatLinearRings = pushParseAndPop([null],
|
const flatLinearRings = pushParseAndPop([null],
|
||||||
FLAT_LINEAR_RINGS_PARSERS, node, objectStack);
|
FLAT_LINEAR_RINGS_PARSERS, node, objectStack);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
const polygon = new Polygon(null);
|
|
||||||
const flatCoordinates = flatLinearRings[0];
|
const flatCoordinates = flatLinearRings[0];
|
||||||
const ends = [flatCoordinates.length];
|
const ends = [flatCoordinates.length];
|
||||||
for (let i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
for (let i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
||||||
extend(flatCoordinates, flatLinearRings[i]);
|
extend(flatCoordinates, flatLinearRings[i]);
|
||||||
ends.push(flatCoordinates.length);
|
ends.push(flatCoordinates.length);
|
||||||
}
|
}
|
||||||
polygon.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates, ends);
|
const polygon = new Polygon(flatCoordinates, GeometryLayout.XYZ, ends);
|
||||||
polygon.setProperties(properties);
|
polygon.setProperties(properties);
|
||||||
return polygon;
|
return polygon;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -336,17 +336,19 @@ MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
|
|||||||
ends = endss;
|
ends = endss;
|
||||||
geom = new MultiPolygon(null);
|
geom = new MultiPolygon(null);
|
||||||
} else {
|
} else {
|
||||||
geom = new Polygon(null);
|
geom = new Polygon(flatCoordinates, GeometryLayout.XY, ends);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
geom = geometryType === GeometryType.POINT ? new Point(null) :
|
geom = geometryType === GeometryType.POINT ? new Point(null) :
|
||||||
geometryType === GeometryType.LINE_STRING ? new LineString(null) :
|
geometryType === GeometryType.LINE_STRING ? new LineString(null) :
|
||||||
geometryType === GeometryType.POLYGON ? new Polygon(null) :
|
geometryType === GeometryType.POLYGON ? new Polygon(flatCoordinates, GeometryLayout.XY, ends) :
|
||||||
geometryType === GeometryType.MULTI_POINT ? new MultiPoint (null) :
|
geometryType === GeometryType.MULTI_POINT ? new MultiPoint (null) :
|
||||||
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(null) :
|
geometryType === GeometryType.MULTI_LINE_STRING ? new MultiLineString(null) :
|
||||||
null;
|
null;
|
||||||
}
|
}
|
||||||
|
if (geometryType !== GeometryType.POLYGON) {
|
||||||
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
|
geom.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, ends);
|
||||||
|
}
|
||||||
feature = new this.featureClass_();
|
feature = new this.featureClass_();
|
||||||
if (this.geometryName_) {
|
if (this.geometryName_) {
|
||||||
feature.setGeometryName(this.geometryName_);
|
feature.setGeometryName(this.geometryName_);
|
||||||
|
|||||||
@@ -175,9 +175,7 @@ OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
|||||||
let geometry;
|
let geometry;
|
||||||
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
if (values.ndrefs[0] == values.ndrefs[values.ndrefs.length - 1]) {
|
||||||
// closed way
|
// closed way
|
||||||
geometry = new Polygon(null);
|
geometry = new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);
|
||||||
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates,
|
|
||||||
[flatCoordinates.length]);
|
|
||||||
} else {
|
} else {
|
||||||
geometry = new LineString(null);
|
geometry = new LineString(null);
|
||||||
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
geometry.setFlatCoordinates(GeometryLayout.XY, flatCoordinates);
|
||||||
|
|||||||
@@ -294,10 +294,7 @@ MultiPolygon.prototype.getPolygon = function(index) {
|
|||||||
ends[i] -= offset;
|
ends[i] -= offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const polygon = new Polygon(null);
|
return new Polygon(this.flatCoordinates.slice(offset, end), this.layout, ends);
|
||||||
polygon.setFlatCoordinates(
|
|
||||||
this.layout, this.flatCoordinates.slice(offset, end), ends);
|
|
||||||
return polygon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -320,9 +317,7 @@ MultiPolygon.prototype.getPolygons = function() {
|
|||||||
ends[j] -= offset;
|
ends[j] -= offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const polygon = new Polygon(null);
|
const polygon = new Polygon(flatCoordinates.slice(offset, end), layout, ends);
|
||||||
polygon.setFlatCoordinates(
|
|
||||||
layout, flatCoordinates.slice(offset, end), ends);
|
|
||||||
polygons.push(polygon);
|
polygons.push(polygon);
|
||||||
offset = end;
|
offset = end;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,16 +27,19 @@ import {modulo} from '../math.js';
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {module:ol/geom/SimpleGeometry}
|
* @extends {module:ol/geom/SimpleGeometry}
|
||||||
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} coordinates Array of linear
|
* @param {!Array.<Array.<module:ol/coordinate~Coordinate>>|!Array.<number>} coordinates
|
||||||
* rings that define the polygon. The first linear ring of the array
|
* Array of linear rings that define the polygon. The first linear ring of the
|
||||||
* defines the outer-boundary or surface of the polygon. Each subsequent
|
* array defines the outer-boundary or surface of the polygon. Each subsequent
|
||||||
* linear ring defines a hole in the surface of the polygon. A linear ring
|
* linear ring defines a hole in the surface of the polygon. A linear ring is
|
||||||
* is an array of vertices' coordinates where the first coordinate and the
|
* an array of vertices' coordinates where the first coordinate and the last are
|
||||||
* last are equivalent.
|
* equivalent. (For internal use, flat coordinates in combination with
|
||||||
|
* `opt_layout` and `opt_ends` are also accepted.)
|
||||||
* @param {module:ol/geom/GeometryLayout=} opt_layout Layout.
|
* @param {module:ol/geom/GeometryLayout=} opt_layout Layout.
|
||||||
|
* @param {Array.<number>=} opt_ends Ends (for internal use with flat
|
||||||
|
* coordinates).
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
const Polygon = function(coordinates, opt_layout) {
|
const Polygon = function(coordinates, opt_layout, opt_ends) {
|
||||||
|
|
||||||
SimpleGeometry.call(this);
|
SimpleGeometry.call(this);
|
||||||
|
|
||||||
@@ -82,7 +85,12 @@ const Polygon = function(coordinates, opt_layout) {
|
|||||||
*/
|
*/
|
||||||
this.orientedFlatCoordinates_ = null;
|
this.orientedFlatCoordinates_ = null;
|
||||||
|
|
||||||
|
if (opt_layout !== undefined && opt_ends) {
|
||||||
|
this.setFlatCoordinatesInternal(opt_layout, coordinates);
|
||||||
|
this.ends_ = opt_ends;
|
||||||
|
} else {
|
||||||
this.setCoordinates(coordinates, opt_layout);
|
this.setCoordinates(coordinates, opt_layout);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,10 +120,7 @@ Polygon.prototype.appendLinearRing = function(linearRing) {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
Polygon.prototype.clone = function() {
|
Polygon.prototype.clone = function() {
|
||||||
const polygon = new Polygon(null);
|
return new Polygon(this.flatCoordinates.slice(), this.layout, this.ends_.slice());
|
||||||
polygon.setFlatCoordinates(
|
|
||||||
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
|
|
||||||
return polygon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -304,10 +309,7 @@ Polygon.prototype.getSimplifiedGeometryInternal = function(squaredTolerance) {
|
|||||||
this.flatCoordinates, 0, this.ends_, this.stride,
|
this.flatCoordinates, 0, this.ends_, this.stride,
|
||||||
Math.sqrt(squaredTolerance),
|
Math.sqrt(squaredTolerance),
|
||||||
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
simplifiedFlatCoordinates, 0, simplifiedEnds);
|
||||||
const simplifiedPolygon = new Polygon(null);
|
return new Polygon(simplifiedFlatCoordinates, GeometryLayout.XY, simplifiedEnds);
|
||||||
simplifiedPolygon.setFlatCoordinates(
|
|
||||||
GeometryLayout.XY, simplifiedFlatCoordinates, simplifiedEnds);
|
|
||||||
return simplifiedPolygon;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -332,15 +334,12 @@ Polygon.prototype.intersectsExtent = function(extent) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the coordinates of the polygon.
|
* Set the coordinates of the polygon.
|
||||||
* @param {Array.<Array.<module:ol/coordinate~Coordinate>>} coordinates Coordinates.
|
* @param {!Array.<Array.<module:ol/coordinate~Coordinate>>} coordinates Coordinates.
|
||||||
* @param {module:ol/geom/GeometryLayout=} opt_layout Layout.
|
* @param {module:ol/geom/GeometryLayout=} opt_layout Layout.
|
||||||
* @override
|
* @override
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
||||||
if (!coordinates) {
|
|
||||||
this.setFlatCoordinates(GeometryLayout.XY, null, this.ends_);
|
|
||||||
} else {
|
|
||||||
this.setLayout(opt_layout, coordinates, 2);
|
this.setLayout(opt_layout, coordinates, 2);
|
||||||
if (!this.flatCoordinates) {
|
if (!this.flatCoordinates) {
|
||||||
this.flatCoordinates = [];
|
this.flatCoordinates = [];
|
||||||
@@ -349,19 +348,6 @@ Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
|
|||||||
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.changed();
|
this.changed();
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {module:ol/geom/GeometryLayout} layout Layout.
|
|
||||||
* @param {Array.<number>} flatCoordinates Flat coordinates.
|
|
||||||
* @param {Array.<number>} ends Ends.
|
|
||||||
*/
|
|
||||||
Polygon.prototype.setFlatCoordinates = function(layout, flatCoordinates, ends) {
|
|
||||||
this.setFlatCoordinatesInternal(layout, flatCoordinates);
|
|
||||||
this.ends_ = ends;
|
|
||||||
this.changed();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Polygon;
|
export default Polygon;
|
||||||
@@ -387,9 +373,7 @@ export function circular(center, radius, opt_n, opt_sphereRadius) {
|
|||||||
extend(flatCoordinates, sphereOffset(center, radius, 2 * Math.PI * i / n, opt_sphereRadius));
|
extend(flatCoordinates, sphereOffset(center, radius, 2 * Math.PI * i / n, opt_sphereRadius));
|
||||||
}
|
}
|
||||||
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
flatCoordinates.push(flatCoordinates[0], flatCoordinates[1]);
|
||||||
const polygon = new Polygon(null);
|
return new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);
|
||||||
polygon.setFlatCoordinates(GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
|
|
||||||
return polygon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -406,10 +390,7 @@ export function fromExtent(extent) {
|
|||||||
const maxY = extent[3];
|
const maxY = extent[3];
|
||||||
const flatCoordinates =
|
const flatCoordinates =
|
||||||
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
|
[minX, minY, minX, maxY, maxX, maxY, maxX, minY, minX, minY];
|
||||||
const polygon = new Polygon(null);
|
return new Polygon(flatCoordinates, GeometryLayout.XY, [flatCoordinates.length]);
|
||||||
polygon.setFlatCoordinates(
|
|
||||||
GeometryLayout.XY, flatCoordinates, [flatCoordinates.length]);
|
|
||||||
return polygon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -426,14 +407,13 @@ export function fromCircle(circle, opt_sides, opt_angle) {
|
|||||||
const sides = opt_sides ? opt_sides : 32;
|
const sides = opt_sides ? opt_sides : 32;
|
||||||
const stride = circle.getStride();
|
const stride = circle.getStride();
|
||||||
const layout = circle.getLayout();
|
const layout = circle.getLayout();
|
||||||
const polygon = new Polygon(null, layout);
|
|
||||||
const arrayLength = stride * (sides + 1);
|
const arrayLength = stride * (sides + 1);
|
||||||
const flatCoordinates = new Array(arrayLength);
|
const flatCoordinates = new Array(arrayLength);
|
||||||
for (let i = 0; i < arrayLength; i++) {
|
for (let i = 0; i < arrayLength; i++) {
|
||||||
flatCoordinates[i] = 0;
|
flatCoordinates[i] = 0;
|
||||||
}
|
}
|
||||||
const ends = [flatCoordinates.length];
|
const ends = [flatCoordinates.length];
|
||||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
const polygon = new Polygon(flatCoordinates, layout, ends);
|
||||||
makeRegular(polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
makeRegular(polygon, circle.getCenter(), circle.getRadius(), opt_angle);
|
||||||
return polygon;
|
return polygon;
|
||||||
}
|
}
|
||||||
@@ -449,9 +429,7 @@ export function fromCircle(circle, opt_sides, opt_angle) {
|
|||||||
*/
|
*/
|
||||||
export function makeRegular(polygon, center, radius, opt_angle) {
|
export function makeRegular(polygon, center, radius, opt_angle) {
|
||||||
const flatCoordinates = polygon.getFlatCoordinates();
|
const flatCoordinates = polygon.getFlatCoordinates();
|
||||||
const layout = polygon.getLayout();
|
|
||||||
const stride = polygon.getStride();
|
const stride = polygon.getStride();
|
||||||
const ends = polygon.getEnds();
|
|
||||||
const sides = flatCoordinates.length / stride - 1;
|
const sides = flatCoordinates.length / stride - 1;
|
||||||
const startAngle = opt_angle ? opt_angle : 0;
|
const startAngle = opt_angle ? opt_angle : 0;
|
||||||
for (let i = 0; i <= sides; ++i) {
|
for (let i = 0; i <= sides; ++i) {
|
||||||
@@ -460,5 +438,5 @@ export function makeRegular(polygon, center, radius, opt_angle) {
|
|||||||
flatCoordinates[offset] = center[0] + (radius * Math.cos(angle));
|
flatCoordinates[offset] = center[0] + (radius * Math.cos(angle));
|
||||||
flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle));
|
flatCoordinates[offset + 1] = center[1] + (radius * Math.sin(angle));
|
||||||
}
|
}
|
||||||
polygon.setFlatCoordinates(layout, flatCoordinates, ends);
|
polygon.changed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -988,14 +988,19 @@ export function createBox() {
|
|||||||
return (
|
return (
|
||||||
function(coordinates, opt_geometry) {
|
function(coordinates, opt_geometry) {
|
||||||
const extent = boundingExtent(coordinates);
|
const extent = boundingExtent(coordinates);
|
||||||
const geometry = opt_geometry || new Polygon(null);
|
const boxCoordinates = [[
|
||||||
geometry.setCoordinates([[
|
|
||||||
getBottomLeft(extent),
|
getBottomLeft(extent),
|
||||||
getBottomRight(extent),
|
getBottomRight(extent),
|
||||||
getTopRight(extent),
|
getTopRight(extent),
|
||||||
getTopLeft(extent),
|
getTopLeft(extent),
|
||||||
getBottomLeft(extent)
|
getBottomLeft(extent)
|
||||||
]]);
|
]];
|
||||||
|
let geometry = opt_geometry;
|
||||||
|
if (geometry) {
|
||||||
|
geometry.setCoordinates(boxCoordinates);
|
||||||
|
} else {
|
||||||
|
geometry = new Polygon(boxCoordinates);
|
||||||
|
}
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -287,8 +287,7 @@ describe('ol.rendering.style.Text', function() {
|
|||||||
|
|
||||||
it('renders text along a Polygon', function(done) {
|
it('renders text along a Polygon', function(done) {
|
||||||
createMap('canvas');
|
createMap('canvas');
|
||||||
const geom = new Polygon(null);
|
const geom = new Polygon(polygon, 'XY', [polygon.length]);
|
||||||
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
|
||||||
const feature = new Feature(geom);
|
const feature = new Feature(geom);
|
||||||
feature.setStyle(new Style({
|
feature.setStyle(new Style({
|
||||||
text: new Text({
|
text: new Text({
|
||||||
@@ -305,8 +304,7 @@ describe('ol.rendering.style.Text', function() {
|
|||||||
|
|
||||||
it('renders text along a MultiPolygon', function(done) {
|
it('renders text along a MultiPolygon', function(done) {
|
||||||
createMap('canvas');
|
createMap('canvas');
|
||||||
let geom = new Polygon(null);
|
let geom = new Polygon(polygon, 'XY', [polygon.length]);
|
||||||
geom.setFlatCoordinates('XY', polygon, [polygon.length]);
|
|
||||||
const multiPolygon = new MultiPolygon(null);
|
const multiPolygon = new MultiPolygon(null);
|
||||||
multiPolygon.appendPolygon(geom);
|
multiPolygon.appendPolygon(geom);
|
||||||
geom = geom.clone();
|
geom = geom.clone();
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import Polygon, {fromCircle, fromExtent} from '../../../../src/ol/geom/Polygon.j
|
|||||||
|
|
||||||
describe('ol/geom/Polygon', function() {
|
describe('ol/geom/Polygon', function() {
|
||||||
|
|
||||||
it('can be constructed with a null geometry', function() {
|
it('cannot be constructed with a null geometry', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
return new Polygon(null);
|
return new Polygon(null);
|
||||||
}).not.to.throwException();
|
}).to.throwException();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('construct empty', function() {
|
describe('construct empty', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user