Add ol.geom.flatLinearRingIsClockwise

This commit is contained in:
Tom Payne
2013-11-11 20:15:49 +01:00
parent 72f64bd37a
commit 43d67736a8
2 changed files with 43 additions and 0 deletions

View File

@@ -54,6 +54,24 @@ describe('ol.geom', function() {
});
describe('ol.geom.flatLinearRingIsClockwise', function() {
it('identifies clockwise rings', function() {
var flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
var isClockwise = ol.geom.flatLinearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
expect(isClockwise).to.be(true);
});
it('identifies anti-clockwise rings', function() {
var flatCoordinates = [2, 2, 3, 2, 3, 3, 2, 3];
var isClockwise = ol.geom.flatLinearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
expect(isClockwise).to.be(false);
});
});
describe('ol.geom.reverseFlatCoordinates', function() {
describe('with a stride of 2', function() {