Factor out ol.geom.flat.area
This commit is contained in:
33
test/spec/ol/geom/flat/areaflatgeom.test.js
Normal file
33
test/spec/ol/geom/flat/areaflatgeom.test.js
Normal file
@@ -0,0 +1,33 @@
|
||||
goog.provide('ol.test.geom.flat.area');
|
||||
|
||||
describe('ol.geom.flat.area', function() {
|
||||
|
||||
describe('ol.geom.flat.area.linearRing', function() {
|
||||
|
||||
it('calcaultes the area of a triangle', function() {
|
||||
var area = ol.geom.flat.area.linearRing([0, 0, 0.5, 1, 1, 0], 0, 6, 2);
|
||||
expect(area).to.be(0.5);
|
||||
});
|
||||
|
||||
it('calculates the area of a unit square', function() {
|
||||
var area =
|
||||
ol.geom.flat.area.linearRing([0, 0, 0, 1, 1, 1, 1, 0], 0, 8, 2);
|
||||
expect(area).to.be(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.area.linearRings', function() {
|
||||
|
||||
it('calculates the area with holes', function() {
|
||||
var area = ol.geom.flat.area.linearRings(
|
||||
[0, 0, 0, 3, 3, 3, 3, 0, 1, 1, 2, 1, 2, 2, 1, 2], 0, [8, 16], 2);
|
||||
expect(area).to.be(8);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.geom.flat');
|
||||
goog.require('ol.geom.flat.area');
|
||||
@@ -83,19 +83,6 @@ describe('ol.geom.flat', function() {
|
||||
expect(coordinatess).to.eql([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]);
|
||||
});
|
||||
|
||||
});
|
||||
describe('ol.geom.flat.linearRingArea', function() {
|
||||
|
||||
it('calcaultes the area of a triangle', function() {
|
||||
var area = ol.geom.flat.linearRingArea([0, 0, 0.5, 1, 1, 0], 0, 6, 2);
|
||||
expect(area).to.be(0.5);
|
||||
});
|
||||
|
||||
it('calculates the area of a unit square', function() {
|
||||
var area = ol.geom.flat.linearRingArea([0, 0, 0, 1, 1, 1, 1, 0], 0, 8, 2);
|
||||
expect(area).to.be(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.linearRingIsClockwise', function() {
|
||||
@@ -116,16 +103,6 @@ describe('ol.geom.flat', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.linearRingsArea', function() {
|
||||
|
||||
it('calculates the area with holes', function() {
|
||||
var area = ol.geom.flat.linearRingsArea(
|
||||
[0, 0, 0, 3, 3, 3, 3, 0, 1, 1, 2, 1, 2, 2, 1, 2], 0, [8, 16], 2);
|
||||
expect(area).to.be(8);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.flat.reverseCoordinates', function() {
|
||||
|
||||
describe('with a stride of 2', function() {
|
||||
|
||||
Reference in New Issue
Block a user