Add ol.geom.LinearRing#getArea

This commit is contained in:
Tom Payne
2013-12-02 14:47:32 +01:00
parent 01c185ef57
commit 2c40daea22
2 changed files with 10 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.LinearRing @exportSymbol ol.geom.LinearRing
@exportProperty ol.geom.LinearRing.prototype.getArea
@exportProperty ol.geom.LinearRing.prototype.getCoordinates @exportProperty ol.geom.LinearRing.prototype.getCoordinates
@exportProperty ol.geom.LinearRing.prototype.getType @exportProperty ol.geom.LinearRing.prototype.getType
@exportProperty ol.geom.LinearRing.prototype.setCoordinates @exportProperty ol.geom.LinearRing.prototype.setCoordinates

View File

@@ -18,6 +18,15 @@ ol.geom.LinearRing = function(coordinates, opt_layout) {
goog.inherits(ol.geom.LinearRing, ol.geom.Geometry); goog.inherits(ol.geom.LinearRing, ol.geom.Geometry);
/**
* @return {number} Area.
*/
ol.geom.LinearRing.prototype.getArea = function() {
return ol.geom.flat.linearRingArea(
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
};
/** /**
* @return {ol.geom.RawLinearRing} Coordinates. * @return {ol.geom.RawLinearRing} Coordinates.
*/ */