Named exports from ol/geom/flat/flip

This commit is contained in:
Frederic Junod
2018-01-26 16:33:02 +01:00
parent d15c4ce511
commit 62bc7b75d7
3 changed files with 10 additions and 18 deletions

View File

@@ -9,7 +9,7 @@ import TextFeature from '../format/TextFeature.js';
import GeometryLayout from '../geom/GeometryLayout.js';
import LineString from '../geom/LineString.js';
import {getStrideForLayout} from '../geom/SimpleGeometry.js';
import _ol_geom_flat_flip_ from '../geom/flat/flip.js';
import {flipXY} from '../geom/flat/flip.js';
import _ol_geom_flat_inflate_ from '../geom/flat/inflate.js';
import {get as getProjection} from '../proj.js';
@@ -326,8 +326,7 @@ Polyline.prototype.readGeometry;
Polyline.prototype.readGeometryFromText = function(text, opt_options) {
const stride = getStrideForLayout(this.geometryLayout_);
const flatCoordinates = decodeDeltas(text, stride, this.factor_);
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
const coordinates = _ol_geom_flat_inflate_.coordinates(
flatCoordinates, 0, flatCoordinates.length, stride);
@@ -392,8 +391,7 @@ Polyline.prototype.writeGeometryText = function(geometry, opt_options) {
(transformWithOptions(geometry, true, this.adaptOptions(opt_options)));
const flatCoordinates = geometry.getFlatCoordinates();
const stride = geometry.getStride();
_ol_geom_flat_flip_.flipXY(
flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
flipXY(flatCoordinates, 0, flatCoordinates.length, stride, flatCoordinates);
return encodeDeltas(flatCoordinates, stride, this.factor_);
};
export default Polyline;

View File

@@ -1,7 +1,6 @@
/**
* @module ol/geom/flat/flip
*/
const _ol_geom_flat_flip_ = {};
/**
@@ -13,7 +12,7 @@ const _ol_geom_flat_flip_ = {};
* @param {number=} opt_destOffset Destination offset.
* @return {Array.<number>} Flat coordinates.
*/
_ol_geom_flat_flip_.flipXY = function(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
export function flipXY(flatCoordinates, offset, end, stride, opt_dest, opt_destOffset) {
let dest, destOffset;
if (opt_dest !== undefined) {
dest = opt_dest;
@@ -33,5 +32,4 @@ _ol_geom_flat_flip_.flipXY = function(flatCoordinates, offset, end, stride, opt_
}
dest.length = destOffset;
return dest;
};
export default _ol_geom_flat_flip_;
}