ol/geom/flat/interiorpoint export
This commit is contained in:
@@ -15,7 +15,7 @@ import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
|||||||
import {linearRingssContainsXY} from '../geom/flat/contains.js';
|
import {linearRingssContainsXY} from '../geom/flat/contains.js';
|
||||||
import {deflateMultiCoordinatesArray} from '../geom/flat/deflate.js';
|
import {deflateMultiCoordinatesArray} from '../geom/flat/deflate.js';
|
||||||
import {inflateMultiCoordinatesArray} from '../geom/flat/inflate.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_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||||
import {quantizeMultiArray} from '../geom/flat/simplify.js';
|
import {quantizeMultiArray} from '../geom/flat/simplify.js';
|
||||||
@@ -209,7 +209,7 @@ MultiPolygon.prototype.getFlatInteriorPoints = function() {
|
|||||||
if (this.flatInteriorPointsRevision_ != this.getRevision()) {
|
if (this.flatInteriorPointsRevision_ != this.getRevision()) {
|
||||||
const flatCenters = linearRingssCenter(
|
const flatCenters = linearRingssCenter(
|
||||||
this.flatCoordinates, 0, this.endss_, this.stride);
|
this.flatCoordinates, 0, this.endss_, this.stride);
|
||||||
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRingss(
|
this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(
|
||||||
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride,
|
this.getOrientedFlatCoordinates(), 0, this.endss_, this.stride,
|
||||||
flatCenters);
|
flatCenters);
|
||||||
this.flatInteriorPointsRevision_ = this.getRevision();
|
this.flatInteriorPointsRevision_ = this.getRevision();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import _ol_geom_flat_closest_ from '../geom/flat/closest.js';
|
|||||||
import {linearRingsContainsXY} from '../geom/flat/contains.js';
|
import {linearRingsContainsXY} from '../geom/flat/contains.js';
|
||||||
import {deflateCoordinatesArray} from '../geom/flat/deflate.js';
|
import {deflateCoordinatesArray} from '../geom/flat/deflate.js';
|
||||||
import {inflateCoordinatesArray} from '../geom/flat/inflate.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_intersectsextent_ from '../geom/flat/intersectsextent.js';
|
||||||
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
import _ol_geom_flat_orient_ from '../geom/flat/orient.js';
|
||||||
import {quantizeArray} from '../geom/flat/simplify.js';
|
import {quantizeArray} from '../geom/flat/simplify.js';
|
||||||
@@ -198,7 +198,7 @@ Polygon.prototype.getEnds = function() {
|
|||||||
Polygon.prototype.getFlatInteriorPoint = function() {
|
Polygon.prototype.getFlatInteriorPoint = function() {
|
||||||
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
if (this.flatInteriorPointRevision_ != this.getRevision()) {
|
||||||
const flatCenter = getCenter(this.getExtent());
|
const flatCenter = getCenter(this.getExtent());
|
||||||
this.flatInteriorPoint_ = _ol_geom_flat_interiorpoint_.linearRings(
|
this.flatInteriorPoint_ = getInteriorPointOfArray(
|
||||||
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
|
this.getOrientedFlatCoordinates(), 0, this.ends_, this.stride,
|
||||||
flatCenter, 0);
|
flatCenter, 0);
|
||||||
this.flatInteriorPointRevision_ = this.getRevision();
|
this.flatInteriorPointRevision_ = this.getRevision();
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
import {numberSafeCompareFunction} from '../../array.js';
|
import {numberSafeCompareFunction} from '../../array.js';
|
||||||
import {linearRingsContainsXY} from '../flat/contains.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
|
* @return {Array.<number>} Destination point as XYM coordinate, where M is the
|
||||||
* length of the horizontal intersection that the point belongs to.
|
* 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) {
|
ends, stride, flatCenters, flatCentersOffset, opt_dest) {
|
||||||
let i, ii, x, x1, x2, y1, y2;
|
let i, ii, x, x1, x2, y1, y2;
|
||||||
const y = flatCenters[flatCentersOffset + 1];
|
const y = flatCenters[flatCentersOffset + 1];
|
||||||
@@ -70,7 +69,7 @@ _ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset,
|
|||||||
} else {
|
} else {
|
||||||
return [pointX, y, maxSegmentLength];
|
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
|
* @return {Array.<number>} Interior points as XYM coordinates, where M is the
|
||||||
* length of the horizontal intersection that the point belongs to.
|
* 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 = [];
|
let interiorPoints = [];
|
||||||
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
for (let i = 0, ii = endss.length; i < ii; ++i) {
|
||||||
const ends = endss[i];
|
const ends = endss[i];
|
||||||
interiorPoints = _ol_geom_flat_interiorpoint_.linearRings(flatCoordinates,
|
interiorPoints = getInteriorPointOfArray(flatCoordinates,
|
||||||
offset, ends, stride, flatCenters, 2 * i, interiorPoints);
|
offset, ends, stride, flatCenters, 2 * i, interiorPoints);
|
||||||
offset = ends[ends.length - 1];
|
offset = ends[ends.length - 1];
|
||||||
}
|
}
|
||||||
return interiorPoints;
|
return interiorPoints;
|
||||||
};
|
}
|
||||||
export default _ol_geom_flat_interiorpoint_;
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {extend} from '../array.js';
|
|||||||
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
|
import {createOrUpdateFromCoordinate, createOrUpdateFromFlatCoordinates, getCenter, getHeight} from '../extent.js';
|
||||||
import GeometryType from '../geom/GeometryType.js';
|
import GeometryType from '../geom/GeometryType.js';
|
||||||
import {linearRingss as linearRingssCenter} from '../geom/flat/center.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_interpolate_ from '../geom/flat/interpolate.js';
|
||||||
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
import _ol_geom_flat_transform_ from '../geom/flat/transform.js';
|
||||||
import _ol_transform_ from '../transform.js';
|
import _ol_transform_ from '../transform.js';
|
||||||
@@ -125,7 +125,7 @@ RenderFeature.prototype.getExtent = function() {
|
|||||||
RenderFeature.prototype.getFlatInteriorPoint = function() {
|
RenderFeature.prototype.getFlatInteriorPoint = function() {
|
||||||
if (!this.flatInteriorPoints_) {
|
if (!this.flatInteriorPoints_) {
|
||||||
const flatCenter = getCenter(this.getExtent());
|
const flatCenter = getCenter(this.getExtent());
|
||||||
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRings(
|
this.flatInteriorPoints_ = getInteriorPointOfArray(
|
||||||
this.flatCoordinates_, 0, this.ends_, 2, flatCenter, 0);
|
this.flatCoordinates_, 0, this.ends_, 2, flatCenter, 0);
|
||||||
}
|
}
|
||||||
return this.flatInteriorPoints_;
|
return this.flatInteriorPoints_;
|
||||||
@@ -139,7 +139,7 @@ RenderFeature.prototype.getFlatInteriorPoints = function() {
|
|||||||
if (!this.flatInteriorPoints_) {
|
if (!this.flatInteriorPoints_) {
|
||||||
const flatCenters = linearRingssCenter(
|
const flatCenters = linearRingssCenter(
|
||||||
this.flatCoordinates_, 0, this.ends_, 2);
|
this.flatCoordinates_, 0, this.ends_, 2);
|
||||||
this.flatInteriorPoints_ = _ol_geom_flat_interiorpoint_.linearRingss(
|
this.flatInteriorPoints_ = getInteriorPointsOfMultiArray(
|
||||||
this.flatCoordinates_, 0, this.ends_, 2, flatCenters);
|
this.flatCoordinates_, 0, this.ends_, 2, flatCenters);
|
||||||
}
|
}
|
||||||
return this.flatInteriorPoints_;
|
return this.flatInteriorPoints_;
|
||||||
|
|||||||
Reference in New Issue
Block a user