Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions

View File

@@ -1,6 +1,8 @@
goog.provide('ol.geom.flat.orient');
goog.require('ol.geom.flat.reverse');
/**
* @module ol/geom/flat/orient
*/
import _ol_geom_flat_reverse_ from '../flat/reverse.js';
var _ol_geom_flat_orient_ = {};
/**
@@ -10,7 +12,7 @@ goog.require('ol.geom.flat.reverse');
* @param {number} stride Stride.
* @return {boolean} Is clockwise.
*/
ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
_ol_geom_flat_orient_.linearRingIsClockwise = function(flatCoordinates, offset, end, stride) {
// http://tinyurl.com/clockwise-method
// https://github.com/OSGeo/gdal/blob/trunk/gdal/ogr/ogrlinearring.cpp
var edge = 0;
@@ -40,12 +42,12 @@ ol.geom.flat.orient.linearRingIsClockwise = function(flatCoordinates, offset, en
* (counter-clockwise exterior ring and clockwise interior rings).
* @return {boolean} Rings are correctly oriented.
*/
ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
_ol_geom_flat_orient_.linearRingsAreOriented = function(flatCoordinates, offset, ends, stride, opt_right) {
var right = opt_right !== undefined ? opt_right : false;
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, offset, end, stride);
if (i === 0) {
if ((right && isClockwise) || (!right && !isClockwise)) {
@@ -75,10 +77,10 @@ ol.geom.flat.orient.linearRingsAreOriented = function(flatCoordinates, offset, e
* (counter-clockwise exterior ring and clockwise interior rings).
* @return {boolean} Rings are correctly oriented.
*/
ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
_ol_geom_flat_orient_.linearRingssAreOriented = function(flatCoordinates, offset, endss, stride, opt_right) {
var i, ii;
for (i = 0, ii = endss.length; i < ii; ++i) {
if (!ol.geom.flat.orient.linearRingsAreOriented(
if (!_ol_geom_flat_orient_.linearRingsAreOriented(
flatCoordinates, offset, endss[i], stride, opt_right)) {
return false;
}
@@ -100,18 +102,18 @@ ol.geom.flat.orient.linearRingssAreOriented = function(flatCoordinates, offset,
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
* @return {number} End.
*/
ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
_ol_geom_flat_orient_.orientLinearRings = function(flatCoordinates, offset, ends, stride, opt_right) {
var right = opt_right !== undefined ? opt_right : false;
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
var end = ends[i];
var isClockwise = ol.geom.flat.orient.linearRingIsClockwise(
var isClockwise = _ol_geom_flat_orient_.linearRingIsClockwise(
flatCoordinates, offset, end, stride);
var reverse = i === 0 ?
(right && isClockwise) || (!right && !isClockwise) :
(right && !isClockwise) || (!right && isClockwise);
if (reverse) {
ol.geom.flat.reverse.coordinates(flatCoordinates, offset, end, stride);
_ol_geom_flat_reverse_.coordinates(flatCoordinates, offset, end, stride);
}
offset = end;
}
@@ -132,11 +134,12 @@ ol.geom.flat.orient.orientLinearRings = function(flatCoordinates, offset, ends,
* @param {boolean=} opt_right Follow the right-hand rule for orientation.
* @return {number} End.
*/
ol.geom.flat.orient.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
_ol_geom_flat_orient_.orientLinearRingss = function(flatCoordinates, offset, endss, stride, opt_right) {
var i, ii;
for (i = 0, ii = endss.length; i < ii; ++i) {
offset = ol.geom.flat.orient.orientLinearRings(
offset = _ol_geom_flat_orient_.orientLinearRings(
flatCoordinates, offset, endss[i], stride, opt_right);
}
return offset;
};
export default _ol_geom_flat_orient_;