Merge pull request #1784 from twpayne/interior-point
Export getInteriorPoint(s) methods
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.clone
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getArea
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getCoordinates
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getInteriorPoints
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getPolygons
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.getType
|
||||
@exportProperty ol.geom.MultiPolygon.prototype.setCoordinates
|
||||
|
||||
@@ -4,6 +4,7 @@ goog.require('goog.array');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.MultiPoint');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.closest');
|
||||
@@ -155,6 +156,17 @@ ol.geom.MultiPolygon.prototype.getFlatInteriorPoints = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.geom.MultiPoint} Interior points.
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
|
||||
var interiorPoints = new ol.geom.MultiPoint(null);
|
||||
interiorPoints.setFlatCoordinates(ol.geom.GeometryLayout.XY,
|
||||
this.getFlatInteriorPoints().slice());
|
||||
return interiorPoints;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<number>} Oriented flat coordinates.
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
@exportProperty ol.geom.Polygon.prototype.clone
|
||||
@exportProperty ol.geom.Polygon.prototype.getArea
|
||||
@exportProperty ol.geom.Polygon.prototype.getCoordinates
|
||||
@exportProperty ol.geom.Polygon.prototype.getInteriorPoint
|
||||
@exportProperty ol.geom.Polygon.prototype.getLinearRings
|
||||
@exportProperty ol.geom.Polygon.prototype.getType
|
||||
@exportProperty ol.geom.Polygon.prototype.setCoordinates
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.provide('ol.geom.Polygon');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
goog.require('ol.geom.Point');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.closest');
|
||||
goog.require('ol.geom.flat');
|
||||
@@ -152,6 +153,14 @@ ol.geom.Polygon.prototype.getFlatInteriorPoint = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.geom.Point} Interior point.
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getInteriorPoint = function() {
|
||||
return new ol.geom.Point(this.getFlatInteriorPoint());
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @return {Array.<ol.geom.LinearRing>} Linear rings.
|
||||
* @todo stability experimental
|
||||
|
||||
Reference in New Issue
Block a user