ol/geom/flat/interiorpoint export

This commit is contained in:
raiyni
2018-02-13 08:11:05 -06:00
parent 837490b4a4
commit 4575569238
4 changed files with 12 additions and 14 deletions

View File

@@ -15,7 +15,7 @@ import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
import {linearRingssContainsXY} from '../geom/flat/contains.js';
import {deflateMultiCoordinatesArray} from '../geom/flat/deflate.js';
import {inflateMultiCoordinatesArray} from '../geom/flat/inflate.js';
import _ol_geom_flat_interiorpoint_ from '../geom/flat/interiorpoint.js';
import {getInteriorPointsOfMultiArray} from '../geom/flat/interiorpoint.js';
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import {quantizeMultiArray} from '../geom/flat/simplify.js';
@@ -209,7 +209,7 @@ MultiPolygon.prototype.getFlatInteriorPoints = function() {
if (this.flatInteriorPointsRevision_ != this.getRevision()) {
const flatCenters = linearRingssCenter(
this.flatCoordinates, 0, this.endss_, this.stride);
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRingss(
this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride,
flatCenters);
this.flatInteriorPointsRevision_ = this.getRevision();

View File

@@ -15,7 +15,7 @@ import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
import {linearRingsContainsXY} from '../geom/flat/contains.js';
import {deflateCoordinatesArray} from '../geom/flat/deflate.js';
import {inflateCoordinatesArray} from '../geom/flat/inflate.js';
import _ol_geom_flat_interiorpoint_ from '../geom/flat/interiorpoint.js';
import {getInteriorPointOfArray} from '../geom/flat/interiorpoint.js';
import _ol_geom_flat_intersectsextent_ from '../geom/flat/intersectsextent.js';
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
import {quantizeArray} from '../geom/flat/simplify.js';
@@ -198,7 +198,7 @@ Polygon.prototype.getEnds = function() {
Polygon.prototype.getFlatInteriorPoint = function() {
if (this.flatInteriorPointRevision_ != this.getRevision()) {
const flatCenter = getCenter(this.getExtent());
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
this.flatInteriorPoint_ = getInteriorPointOfArray(
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
flatCenter, 0);
this.flatInteriorPointRevision_ = this.getRevision();

View File

@@ -3,7 +3,6 @@
*/
import {numberSafeCompareFunction} from '../../array.js';
import {linearRingsContainsXY} from '../flat/contains.js';
const _ol_geom_flat_interiorpoint_ = {};
/**
@@ -19,7 +18,7 @@ const _ol_geom_flat_interiorpoint_ = {};
* @return {Array.<number>} Destination point as XYM coordinate, where M is the
* length of the horizontal intersection that the point belongs to.
*/
_ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
export function getInteriorPointOfArray(flatCoordinates, offset,
ends, stride, flatCenters, flatCentersOffset, opt_dest) {
let i, ii, x, x1, x2, y1, y2;
const y = flatCenters[flatCentersOffset + 1];
@@ -70,7 +69,7 @@ _ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
} else {
return [pointX, y, maxSegmentLength];
}
};
}
/**
@@ -82,14 +81,13 @@ _ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
* @return {Array.<number>} Interior points as XYM coordinates, where M is the
* length of the horizontal intersection that the point belongs to.
*/
_ol_geom_flat_interiorpoint_.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) {
export function getInteriorPointsOfMultiArray(flatCoordinates, offset, endss, stride, flatCenters) {
let interiorPoints = [];
for (let i = 0, ii = endss.length; i < ii; ++i) {
const ends = endss[i];
interiorPoints = _ol_geom_flat_interiorpoint_.linearRings(flatCoordinates,
interiorPoints = getInteriorPointOfArray(flatCoordinates,
offset, ends, stride, flatCenters, 2 * i, interiorPoints);
offset = ends[ends.length - 1];
}
return interiorPoints;
};
export default _ol_geom_flat_interiorpoint_;
}

View File

@@ -6,7 +6,7 @@ import {extend} from '../array.js';
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
import GeometryType from '../geom/GeometryType.js';
import {linearRingss as linearRingssCenter} from '../geom/flat/center.js';
import _ol_geom_flat_interiorpoint_ from '../geom/flat/interiorpoint.js';
import {getInteriorPointOfArray, getInteriorPointsOfMultiArray} from '../geom/flat/interiorpoint.js';
import _ol_geom_flat_interpolate_ from '../geom/flat/interpolate.js';
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
import _ol_transform_ from '../transform.js';
@@ -125,7 +125,7 @@ RenderFeature.prototype.getExtent = function() {
RenderFeature.prototype.getFlatInteriorPoint = function() {
if (!this.flatInteriorPoints_) {
const flatCenter = getCenter(this.getExtent());
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRings(
this.flatInteriorPoints_ = getInteriorPointOfArray(
this.flatCoordinates_, 0, this.ends_, 2, flatCenter, 0);
}
return this.flatInteriorPoints_;
@@ -139,7 +139,7 @@ RenderFeature.prototype.getFlatInteriorPoints = function() {
if (!this.flatInteriorPoints_) {
const flatCenters = linearRingssCenter(
this.flatCoordinates_, 0, this.ends_, 2);
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRingss(
this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(
this.flatCoordinates_, 0, this.ends_, 2, flatCenters);
}
return this.flatInteriorPoints_;