Factor out ol.geom.flat.orient

This commit is contained in:
Tom Payne
2014-03-12 12:27:12 +01:00
parent becd1318bd
commit 1363ce3a58
6 changed files with 150 additions and 135 deletions

View File

@@ -0,0 +1,26 @@
goog.provide('ol.test.geom.flat.orient');
describe('ol.geom.flat.orient', function() {
describe('ol.geom.flat.orient.linearRingIsClockwise', function() {
it('identifies clockwise rings', function() {
var flatCoordinates = [0, 1, 1, 4, 4, 3, 3, 0];
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
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.flat.orient.linearRingIsClockwise(
flatCoordinates, 0, flatCoordinates.length, 2);
expect(isClockwise).to.be(false);
});
});
});
goog.require('ol.geom.flat');
goog.require('ol.geom.flat.orient');