Remove case of MulitPolygon RenderFeature
This commit is contained in:
@@ -373,12 +373,6 @@ export function toGeometry(renderFeature) {
|
|||||||
return endss.length > 1
|
return endss.length > 1
|
||||||
? new MultiPolygon(flatCoordinates, GeometryLayout.XY, endss)
|
? new MultiPolygon(flatCoordinates, GeometryLayout.XY, endss)
|
||||||
: new Polygon(flatCoordinates, GeometryLayout.XY, ends);
|
: new Polygon(flatCoordinates, GeometryLayout.XY, ends);
|
||||||
case GeometryType.MULTI_POLYGON:
|
|
||||||
return new MultiPolygon(
|
|
||||||
renderFeature.getFlatCoordinates(),
|
|
||||||
GeometryLayout.XY,
|
|
||||||
/** @type {Array<Array<number>>} */ (renderFeature.getEndss())
|
|
||||||
);
|
|
||||||
default:
|
default:
|
||||||
throw new Error('Invalid geometry type:' + geometryType);
|
throw new Error('Invalid geometry type:' + geometryType);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,44 +153,6 @@ describe('ol/render/Feature', function () {
|
|||||||
expect(converted.getEndss()).to.eql(geometry.getEndss());
|
expect(converted.getEndss()).to.eql(geometry.getEndss());
|
||||||
expect(converted.getProperties()).to.eql({});
|
expect(converted.getProperties()).to.eql({});
|
||||||
});
|
});
|
||||||
it('creates a MultiPolygon', function () {
|
|
||||||
const geometry = new MultiPolygon([
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[0, 0],
|
|
||||||
[5, 0],
|
|
||||||
[5, 5],
|
|
||||||
[0, 0],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[1, 1],
|
|
||||||
[4, 1],
|
|
||||||
[4, 4],
|
|
||||||
[1, 1],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
[
|
|
||||||
[-0, -0],
|
|
||||||
[-5, -0],
|
|
||||||
[-5, -5],
|
|
||||||
[-0, -0],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
const renderFeature = new RenderFeature(
|
|
||||||
geometry.getType(),
|
|
||||||
geometry.getFlatCoordinates().slice(),
|
|
||||||
geometry.getEndss().slice()
|
|
||||||
);
|
|
||||||
const converted = toGeometry(renderFeature);
|
|
||||||
expect(converted).to.be.a(MultiPolygon);
|
|
||||||
expect(converted.getFlatCoordinates()).to.eql(
|
|
||||||
geometry.getFlatCoordinates()
|
|
||||||
);
|
|
||||||
expect(converted.getEndss()).to.eql(geometry.getEndss());
|
|
||||||
expect(converted.getProperties()).to.eql({});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ol/render/Feature.toFeature()', function () {
|
describe('ol/render/Feature.toFeature()', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user