Merge pull request #2565 from elemoine/apistable5

Add @api stable annotations for ol.Feature and the ol.geom namespace
This commit is contained in:
Éric Lemoine
2014-08-22 07:37:28 +02:00
13 changed files with 127 additions and 186 deletions

View File

@@ -55,7 +55,7 @@ goog.require('ol.style.Style');
* You may pass a Geometry object directly, or an object literal
* containing properties. If you pass an object literal, you may
* include a Geometry associated with a `geometry` key.
* @api
* @api stable
*/
ol.Feature = function(opt_geometryOrProperties) {
@@ -117,7 +117,7 @@ goog.inherits(ol.Feature, ol.Object);
* Clone this feature. If the original feature has a geometry it
* is also cloned. The feature id is not set in the clone.
* @return {ol.Feature} The clone.
* @api
* @api stable
*/
ol.Feature.prototype.clone = function() {
var clone = new ol.Feature(this.getProperties());
@@ -139,7 +139,7 @@ ol.Feature.prototype.clone = function() {
* with this feature using the current geometry name property. By
* default, this is `geometry` but it may be changed by calling
* `setGeometryName`.
* @api
* @api stable
* @observable
*/
ol.Feature.prototype.getGeometry = function() {
@@ -154,7 +154,7 @@ goog.exportProperty(
/**
* @return {number|string|undefined} Id.
* @api
* @api stable
*/
ol.Feature.prototype.getId = function() {
return this.id_;
@@ -165,7 +165,7 @@ ol.Feature.prototype.getId = function() {
* @return {string} Get the property name associated with the geometry for
* this feature. By default, this is `geometry` but it may be changed by
* calling `setGeometryName`.
* @api
* @api stable
*/
ol.Feature.prototype.getGeometryName = function() {
return this.geometryName_;
@@ -177,7 +177,7 @@ ol.Feature.prototype.getGeometryName = function() {
* ol.feature.FeatureStyleFunction} Return the style as set by setStyle in
* the same format that it was provided in. If setStyle has not been run,
* return `undefined`.
* @api
* @api stable
*/
ol.Feature.prototype.getStyle = function() {
return this.style_;
@@ -187,7 +187,7 @@ ol.Feature.prototype.getStyle = function() {
/**
* @return {ol.feature.FeatureStyleFunction|undefined} Return a function
* representing the current style of this feature.
* @api
* @api stable
*/
ol.Feature.prototype.getStyleFunction = function() {
return this.styleFunction_;
@@ -224,7 +224,7 @@ ol.Feature.prototype.handleGeometryChanged_ = function() {
* feature. This will update the property associated with the current
* geometry property name. By default, this is `geometry` but it can be
* changed by calling `setGeometryName`.
* @api
* @api stable
* @observable
*/
ol.Feature.prototype.setGeometry = function(geometry) {
@@ -239,7 +239,7 @@ goog.exportProperty(
/**
* @param {ol.style.Style|Array.<ol.style.Style>|
* ol.feature.FeatureStyleFunction} style Set the style for this feature.
* @api
* @api stable
*/
ol.Feature.prototype.setStyle = function(style) {
this.style_ = style;
@@ -252,7 +252,7 @@ ol.Feature.prototype.setStyle = function(style) {
* @param {number|string|undefined} id Set a unique id for this feature.
* The id may be used to retrieve a feature from a vector source with the
* {@link ol.source.Vector#getFeatureById} method.
* @api
* @api stable
*/
ol.Feature.prototype.setId = function(id) {
this.id_ = id;
@@ -263,7 +263,7 @@ ol.Feature.prototype.setId = function(id) {
/**
* @param {string} name Set the property name from which this feature's
* geometry will be fetched when calling `getGeometry`.
* @api
* @api stable
*/
ol.Feature.prototype.setGeometryName = function(name) {
goog.events.unlisten(
@@ -284,7 +284,7 @@ ol.Feature.prototype.setGeometryName = function(name) {
* {@link ol.Feature} to be styled.
*
* @typedef {function(this: ol.Feature, number): Array.<ol.style.Style>}
* @api
* @api stable
*/
ol.feature.FeatureStyleFunction;

View File

@@ -14,7 +14,7 @@ goog.require('ol.geom.flat.deflate');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawPoint} center Center.
* @param {ol.Coordinate} center Center.
* @param {number=} opt_radius Radius.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
@@ -82,7 +82,7 @@ ol.geom.Circle.prototype.containsXY = function(x, y) {
/**
* @return {ol.geom.RawPoint} Center.
* @return {ol.Coordinate} Center.
* @api
*/
ol.geom.Circle.prototype.getCenter = function() {
@@ -139,7 +139,7 @@ ol.geom.Circle.prototype.getType = function() {
/**
* @param {ol.geom.RawPoint} center Center.
* @param {ol.Coordinate} center Center.
* @api
*/
ol.geom.Circle.prototype.setCenter = function(center) {
@@ -157,7 +157,7 @@ ol.geom.Circle.prototype.setCenter = function(center) {
/**
* @param {ol.geom.RawPoint} center Center.
* @param {ol.Coordinate} center Center.
* @param {number} radius Radius.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api

View File

@@ -12,7 +12,7 @@ goog.require('ol.proj');
* `'Polygon'`, `'MultiPoint'`, `'MultiLineString'`, `'MultiPolygon'`,
* `'GeometryCollection'`, `'Circle'`.
* @enum {string}
* @api
* @api stable
*/
ol.geom.GeometryType = {
POINT: 'Point',
@@ -32,7 +32,7 @@ ol.geom.GeometryType = {
* or measure ('M') coordinate is available. Supported values are `'XY'`,
* `'XYZ'`, `'XYM'`, `'XYZM'`.
* @enum {string}
* @api
* @api stable
*/
ol.geom.GeometryLayout = {
XY: 'XY',
@@ -52,7 +52,7 @@ ol.geom.GeometryLayout = {
* @constructor
* @extends {ol.Observable}
* @fires change Triggered when the geometry changes.
* @api
* @api stable
*/
ol.geom.Geometry = function() {
@@ -96,7 +96,7 @@ goog.inherits(ol.geom.Geometry, ol.Observable);
* Make a complete copy of the geometry.
* @function
* @return {ol.geom.Geometry} Clone.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.clone = goog.abstractMethod;
@@ -115,7 +115,7 @@ ol.geom.Geometry.prototype.closestPointXY = goog.abstractMethod;
* @param {ol.Coordinate} point Point.
* @param {ol.Coordinate=} opt_closestPoint Closest point.
* @return {ol.Coordinate} Closest point.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.getClosestPoint = function(point, opt_closestPoint) {
var closestPoint = goog.isDef(opt_closestPoint) ?
@@ -147,7 +147,7 @@ ol.geom.Geometry.prototype.containsXY = goog.functions.FALSE;
* @function
* @param {ol.Extent=} opt_extent Extent.
* @return {ol.Extent} extent Extent.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.getExtent = goog.abstractMethod;
@@ -159,7 +159,6 @@ ol.geom.Geometry.prototype.getExtent = goog.abstractMethod;
* @function
* @param {number} squaredTolerance Squared tolerance.
* @return {ol.geom.Geometry} Simplified geometry.
* @api
*/
ol.geom.Geometry.prototype.getSimplifiedGeometry = goog.abstractMethod;
@@ -168,7 +167,7 @@ ol.geom.Geometry.prototype.getSimplifiedGeometry = goog.abstractMethod;
* Get the type of this geometry.
* @function
* @return {ol.geom.GeometryType} Geometry type.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.getType = goog.abstractMethod;
@@ -179,7 +178,7 @@ ol.geom.Geometry.prototype.getType = goog.abstractMethod;
* then use this function on the clone.
* @function
* @param {ol.TransformFunction} transformFn Transform.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.applyTransform = goog.abstractMethod;
@@ -196,65 +195,9 @@ ol.geom.Geometry.prototype.applyTransform = goog.abstractMethod;
* string identifier or a {@link ol.proj.Projection} object.
* @return {ol.geom.Geometry} This geometry. Note that original geometry is
* modified in place.
* @api
* @api stable
*/
ol.geom.Geometry.prototype.transform = function(source, destination) {
this.applyTransform(ol.proj.getTransform(source, destination));
return this;
};
/**
* Array representation of a point. Example: `[16, 48]`.
* @typedef {ol.Coordinate}
* @api
*/
ol.geom.RawPoint;
/**
* Array representation of a linestring.
* @typedef {Array.<ol.Coordinate>}
* @api
*/
ol.geom.RawLineString;
/**
* Array representation of a linear ring.
* @typedef {Array.<ol.Coordinate>}
* @api
*/
ol.geom.RawLinearRing;
/**
* Array representation of a polygon.
* @typedef {Array.<ol.geom.RawLinearRing>}
* @api
*/
ol.geom.RawPolygon;
/**
* Array representation of a multipoint.
* @typedef {Array.<ol.geom.RawPoint>}
* @api
*/
ol.geom.RawMultiPoint;
/**
* Array representation of a multilinestring.
* @typedef {Array.<ol.geom.RawLineString>}
* @api
*/
ol.geom.RawMultiLineString;
/**
* Array representation of a multipolygon.
* @typedef {Array.<ol.geom.RawPolygon>}
* @api
*/
ol.geom.RawMultiPolygon;

View File

@@ -18,7 +18,7 @@ goog.require('ol.geom.GeometryType');
* @constructor
* @extends {ol.geom.Geometry}
* @param {Array.<ol.geom.Geometry>=} opt_geometries Geometries.
* @api
* @api stable
*/
ol.geom.GeometryCollection = function(opt_geometries) {
@@ -84,7 +84,7 @@ ol.geom.GeometryCollection.prototype.listenGeometriesChange_ = function() {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.GeometryCollection.prototype.clone = function() {
var geometryCollection = new ol.geom.GeometryCollection(null);
@@ -129,7 +129,7 @@ ol.geom.GeometryCollection.prototype.containsXY = function(x, y) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.GeometryCollection.prototype.getExtent = function(opt_extent) {
if (this.extentRevision != this.getRevision()) {
@@ -149,7 +149,7 @@ ol.geom.GeometryCollection.prototype.getExtent = function(opt_extent) {
/**
* @return {Array.<ol.geom.Geometry>} Geometries.
* @api
* @api stable
*/
ol.geom.GeometryCollection.prototype.getGeometries = function() {
return ol.geom.GeometryCollection.cloneGeometries_(this.geometries_);
@@ -166,7 +166,6 @@ ol.geom.GeometryCollection.prototype.getGeometriesArray = function() {
/**
* @inheritDoc
* @api
*/
ol.geom.GeometryCollection.prototype.getSimplifiedGeometry =
function(squaredTolerance) {
@@ -211,7 +210,7 @@ ol.geom.GeometryCollection.prototype.getSimplifiedGeometry =
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.GeometryCollection.prototype.getType = function() {
return ol.geom.GeometryType.GEOMETRY_COLLECTION;
@@ -228,7 +227,7 @@ ol.geom.GeometryCollection.prototype.isEmpty = function() {
/**
* @param {Array.<ol.geom.Geometry>} geometries Geometries.
* @api
* @api stable
*/
ol.geom.GeometryCollection.prototype.setGeometries = function(geometries) {
this.setGeometriesArray(

View File

@@ -18,9 +18,9 @@ goog.require('ol.geom.flat.simplify');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawLinearRing} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.LinearRing = function(coordinates, opt_layout) {
@@ -47,7 +47,7 @@ goog.inherits(ol.geom.LinearRing, ol.geom.SimpleGeometry);
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.LinearRing.prototype.clone = function() {
var linearRing = new ol.geom.LinearRing(null);
@@ -78,7 +78,7 @@ ol.geom.LinearRing.prototype.closestPointXY =
/**
* @return {number} Area (on projected plane).
* @api
* @api stable
*/
ol.geom.LinearRing.prototype.getArea = function() {
return ol.geom.flat.area.linearRing(
@@ -87,8 +87,8 @@ ol.geom.LinearRing.prototype.getArea = function() {
/**
* @return {ol.geom.RawLinearRing} Coordinates.
* @api
* @return {Array.<ol.Coordinate>} Coordinates.
* @api stable
*/
ol.geom.LinearRing.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinates(
@@ -114,7 +114,7 @@ ol.geom.LinearRing.prototype.getSimplifiedGeometryInternal =
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.LinearRing.prototype.getType = function() {
return ol.geom.GeometryType.LINEAR_RING;
@@ -122,9 +122,9 @@ ol.geom.LinearRing.prototype.getType = function() {
/**
* @param {ol.geom.RawLinearRing} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.LinearRing.prototype.setCoordinates =
function(coordinates, opt_layout) {

View File

@@ -20,9 +20,9 @@ goog.require('ol.geom.flat.simplify');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawLineString} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.LineString = function(coordinates, opt_layout) {
@@ -61,7 +61,7 @@ goog.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
/**
* @param {ol.Coordinate} coordinate Coordinate.
* @api
* @api stable
*/
ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
goog.asserts.assert(coordinate.length == this.stride);
@@ -76,7 +76,7 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.LineString.prototype.clone = function() {
var lineString = new ol.geom.LineString(null);
@@ -117,7 +117,7 @@ ol.geom.LineString.prototype.closestPointXY =
* @param {number} m M.
* @param {boolean=} opt_extrapolate Extrapolate.
* @return {ol.Coordinate} Coordinate.
* @api
* @api stable
*/
ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
if (this.layout != ol.geom.GeometryLayout.XYM &&
@@ -131,8 +131,8 @@ ol.geom.LineString.prototype.getCoordinateAtM = function(m, opt_extrapolate) {
/**
* @return {ol.geom.RawLineString} Coordinates.
* @api
* @return {Array.<ol.Coordinate>} Coordinates.
* @api stable
*/
ol.geom.LineString.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinates(
@@ -142,7 +142,7 @@ ol.geom.LineString.prototype.getCoordinates = function() {
/**
* @return {number} Length (on projected plane).
* @api
* @api stable
*/
ol.geom.LineString.prototype.getLength = function() {
return ol.geom.flat.length.lineString(
@@ -182,7 +182,7 @@ ol.geom.LineString.prototype.getSimplifiedGeometryInternal =
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.LineString.prototype.getType = function() {
return ol.geom.GeometryType.LINE_STRING;
@@ -190,9 +190,9 @@ ol.geom.LineString.prototype.getType = function() {
/**
* @param {ol.geom.RawLineString} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.LineString.prototype.setCoordinates =
function(coordinates, opt_layout) {

View File

@@ -20,9 +20,9 @@ goog.require('ol.geom.flat.simplify');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawMultiLineString} coordinates Coordinates.
* @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiLineString = function(coordinates, opt_layout) {
@@ -55,7 +55,7 @@ goog.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
/**
* @param {ol.geom.LineString} lineString LineString.
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
goog.asserts.assert(lineString.getLayout() == this.layout);
@@ -72,7 +72,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.clone = function() {
var multiLineString = new ol.geom.MultiLineString(null);
@@ -122,7 +122,7 @@ ol.geom.MultiLineString.prototype.closestPointXY =
* @param {boolean=} opt_extrapolate Extrapolate.
* @param {boolean=} opt_interpolate Interpolate.
* @return {ol.Coordinate} Coordinate.
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.getCoordinateAtM =
function(m, opt_extrapolate, opt_interpolate) {
@@ -139,8 +139,8 @@ ol.geom.MultiLineString.prototype.getCoordinateAtM =
/**
* @return {ol.geom.RawMultiLineString} Coordinates.
* @api
* @return {Array.<Array.<ol.Coordinate>>} Coordinates.
* @api stable
*/
ol.geom.MultiLineString.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinatess(
@@ -159,7 +159,7 @@ ol.geom.MultiLineString.prototype.getEnds = function() {
/**
* @param {number} index Index.
* @return {ol.geom.LineString} LineString.
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.getLineString = function(index) {
goog.asserts.assert(0 <= index && index < this.ends_.length);
@@ -175,7 +175,7 @@ ol.geom.MultiLineString.prototype.getLineString = function(index) {
/**
* @return {Array.<ol.geom.LineString>} LineStrings.
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.getLineStrings = function() {
var flatCoordinates = this.flatCoordinates;
@@ -236,7 +236,7 @@ ol.geom.MultiLineString.prototype.getSimplifiedGeometryInternal =
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.getType = function() {
return ol.geom.GeometryType.MULTI_LINE_STRING;
@@ -244,9 +244,9 @@ ol.geom.MultiLineString.prototype.getType = function() {
/**
* @param {ol.geom.RawMultiLineString} coordinates Coordinates.
* @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiLineString.prototype.setCoordinates =
function(coordinates, opt_layout) {

View File

@@ -18,9 +18,9 @@ goog.require('ol.math');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawMultiPoint} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiPoint = function(coordinates, opt_layout) {
goog.base(this);
@@ -32,7 +32,7 @@ goog.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry);
/**
* @param {ol.geom.Point} point Point.
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.appendPoint = function(point) {
goog.asserts.assert(point.getLayout() == this.layout);
@@ -47,7 +47,7 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.clone = function() {
var multiPoint = new ol.geom.MultiPoint(null);
@@ -84,8 +84,8 @@ ol.geom.MultiPoint.prototype.closestPointXY =
/**
* @return {ol.geom.RawMultiPoint} Coordinates.
* @api
* @return {Array.<ol.Coordinate>} Coordinates.
* @api stable
*/
ol.geom.MultiPoint.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinates(
@@ -96,7 +96,7 @@ ol.geom.MultiPoint.prototype.getCoordinates = function() {
/**
* @param {number} index Index.
* @return {ol.geom.Point} Point.
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.getPoint = function(index) {
var n = goog.isNull(this.flatCoordinates) ?
@@ -114,7 +114,7 @@ ol.geom.MultiPoint.prototype.getPoint = function(index) {
/**
* @return {Array.<ol.geom.Point>} Points.
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.getPoints = function() {
var flatCoordinates = this.flatCoordinates;
@@ -134,7 +134,7 @@ ol.geom.MultiPoint.prototype.getPoints = function() {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.getType = function() {
return ol.geom.GeometryType.MULTI_POINT;
@@ -142,9 +142,9 @@ ol.geom.MultiPoint.prototype.getType = function() {
/**
* @param {ol.geom.RawMultiPoint} coordinates Coordinates.
* @param {Array.<ol.Coordinate>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiPoint.prototype.setCoordinates =
function(coordinates, opt_layout) {

View File

@@ -25,9 +25,9 @@ goog.require('ol.geom.flat.simplify');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawMultiPolygon} coordinates Coordinates.
* @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiPolygon = function(coordinates, opt_layout) {
@@ -84,7 +84,7 @@ goog.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry);
/**
* @param {ol.geom.Polygon} polygon Polygon.
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
goog.asserts.assert(polygon.getLayout() == this.layout);
@@ -110,7 +110,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.clone = function() {
var multiPolygon = new ol.geom.MultiPolygon(null);
@@ -151,7 +151,7 @@ ol.geom.MultiPolygon.prototype.containsXY = function(x, y) {
/**
* @return {number} Area (on projected plane).
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.getArea = function() {
return ol.geom.flat.area.linearRingss(
@@ -160,8 +160,8 @@ ol.geom.MultiPolygon.prototype.getArea = function() {
/**
* @return {ol.geom.RawMultiPolygon} Coordinates.
* @api
* @return {Array.<Array.<Array.<ol.Coordinate>>>} Coordinates.
* @api stable
*/
ol.geom.MultiPolygon.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinatesss(
@@ -195,7 +195,7 @@ ol.geom.MultiPolygon.prototype.getFlatInteriorPoints = function() {
/**
* @return {ol.geom.MultiPoint} Interior points.
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.getInteriorPoints = function() {
var interiorPoints = new ol.geom.MultiPoint(null);
@@ -247,7 +247,7 @@ ol.geom.MultiPolygon.prototype.getSimplifiedGeometryInternal =
/**
* @param {number} index Index.
* @return {ol.geom.Polygon} Polygon.
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.getPolygon = function(index) {
goog.asserts.assert(0 <= index && index < this.endss_.length);
@@ -278,7 +278,7 @@ ol.geom.MultiPolygon.prototype.getPolygon = function(index) {
/**
* @return {Array.<ol.geom.Polygon>} Polygons.
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.getPolygons = function() {
var layout = this.layout;
@@ -307,7 +307,7 @@ ol.geom.MultiPolygon.prototype.getPolygons = function() {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.getType = function() {
return ol.geom.GeometryType.MULTI_POLYGON;
@@ -315,9 +315,9 @@ ol.geom.MultiPolygon.prototype.getType = function() {
/**
* @param {ol.geom.RawMultiPolygon} coordinates Coordinates.
* @param {Array.<Array.<Array.<ol.Coordinate>>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.MultiPolygon.prototype.setCoordinates =
function(coordinates, opt_layout) {

View File

@@ -15,9 +15,9 @@ goog.require('ol.math');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawPoint} coordinates Coordinates.
* @param {ol.Coordinate} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.Point = function(coordinates, opt_layout) {
goog.base(this);
@@ -29,7 +29,7 @@ goog.inherits(ol.geom.Point, ol.geom.SimpleGeometry);
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.Point.prototype.clone = function() {
var point = new ol.geom.Point(null);
@@ -61,8 +61,8 @@ ol.geom.Point.prototype.closestPointXY =
/**
* @return {ol.geom.RawPoint} Coordinates.
* @api
* @return {ol.Coordinate} Coordinates.
* @api stable
*/
ol.geom.Point.prototype.getCoordinates = function() {
return goog.isNull(this.flatCoordinates) ? [] : this.flatCoordinates.slice();
@@ -85,7 +85,7 @@ ol.geom.Point.prototype.getExtent = function(opt_extent) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.Point.prototype.getType = function() {
return ol.geom.GeometryType.POINT;
@@ -93,9 +93,9 @@ ol.geom.Point.prototype.getType = function() {
/**
* @param {ol.geom.RawPoint} coordinates Coordinates.
* @param {ol.Coordinate} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.Point.prototype.setCoordinates = function(coordinates, opt_layout) {
if (goog.isNull(coordinates)) {

View File

@@ -25,9 +25,9 @@ goog.require('ol.geom.flat.simplify');
*
* @constructor
* @extends {ol.geom.SimpleGeometry}
* @param {ol.geom.RawPolygon} coordinates Coordinates.
* @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.Polygon = function(coordinates, opt_layout) {
@@ -84,7 +84,7 @@ goog.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
/**
* @param {ol.geom.LinearRing} linearRing Linear ring.
* @api
* @api stable
*/
ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
goog.asserts.assert(linearRing.getLayout() == this.layout);
@@ -100,7 +100,7 @@ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.Polygon.prototype.clone = function() {
var polygon = new ol.geom.Polygon(null);
@@ -141,7 +141,7 @@ ol.geom.Polygon.prototype.containsXY = function(x, y) {
/**
* @return {number} Area (on projected plane).
* @api
* @api stable
*/
ol.geom.Polygon.prototype.getArea = function() {
return ol.geom.flat.area.linearRings(
@@ -150,8 +150,8 @@ ol.geom.Polygon.prototype.getArea = function() {
/**
* @return {ol.geom.RawPolygon} Coordinates.
* @api
* @return {Array.<Array.<ol.Coordinate>>} Coordinates.
* @api stable
*/
ol.geom.Polygon.prototype.getCoordinates = function() {
return ol.geom.flat.inflate.coordinatess(
@@ -184,7 +184,7 @@ ol.geom.Polygon.prototype.getFlatInteriorPoint = function() {
/**
* @return {ol.geom.Point} Interior point.
* @api
* @api stable
*/
ol.geom.Polygon.prototype.getInteriorPoint = function() {
return new ol.geom.Point(this.getFlatInteriorPoint());
@@ -194,7 +194,7 @@ ol.geom.Polygon.prototype.getInteriorPoint = function() {
/**
* @param {number} index Index.
* @return {ol.geom.LinearRing} Linear ring.
* @api
* @api stable
*/
ol.geom.Polygon.prototype.getLinearRing = function(index) {
goog.asserts.assert(0 <= index && index < this.ends_.length);
@@ -210,7 +210,7 @@ ol.geom.Polygon.prototype.getLinearRing = function(index) {
/**
* @return {Array.<ol.geom.LinearRing>} Linear rings.
* @api
* @api stable
*/
ol.geom.Polygon.prototype.getLinearRings = function() {
var layout = this.layout;
@@ -271,7 +271,7 @@ ol.geom.Polygon.prototype.getSimplifiedGeometryInternal =
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.Polygon.prototype.getType = function() {
return ol.geom.GeometryType.POLYGON;
@@ -279,9 +279,9 @@ ol.geom.Polygon.prototype.getType = function() {
/**
* @param {ol.geom.RawPolygon} coordinates Coordinates.
* @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates.
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
* @api
* @api stable
*/
ol.geom.Polygon.prototype.setCoordinates = function(coordinates, opt_layout) {
if (goog.isNull(coordinates)) {
@@ -326,7 +326,7 @@ ol.geom.Polygon.prototype.setFlatCoordinates =
* @param {number} radius Radius.
* @param {number=} opt_n Optional number of points. Default is `32`.
* @return {ol.geom.Polygon} Circle geometry.
* @api
* @api stable
*/
ol.geom.Polygon.circular = function(sphere, center, radius, opt_n) {
var n = goog.isDef(opt_n) ? opt_n : 32;

View File

@@ -16,7 +16,7 @@ goog.require('ol.geom.flat.transform');
*
* @constructor
* @extends {ol.geom.Geometry}
* @api
* @api stable
*/
ol.geom.SimpleGeometry = function() {
@@ -90,7 +90,7 @@ ol.geom.SimpleGeometry.prototype.containsXY = goog.functions.FALSE;
/**
* @inheritDoc
* @api
* @api stable
*/
ol.geom.SimpleGeometry.prototype.getExtent = function(opt_extent) {
if (this.extentRevision != this.getRevision()) {
@@ -106,7 +106,7 @@ ol.geom.SimpleGeometry.prototype.getExtent = function(opt_extent) {
/**
* @return {ol.Coordinate} First coordinate.
* @api
* @api stable
*/
ol.geom.SimpleGeometry.prototype.getFirstCoordinate = function() {
return this.flatCoordinates.slice(0, this.stride);
@@ -123,7 +123,7 @@ ol.geom.SimpleGeometry.prototype.getFlatCoordinates = function() {
/**
* @return {ol.Coordinate} Last point.
* @api
* @api stable
*/
ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() {
return this.flatCoordinates.slice(this.flatCoordinates.length - this.stride);
@@ -132,7 +132,7 @@ ol.geom.SimpleGeometry.prototype.getLastCoordinate = function() {
/**
* @return {ol.geom.GeometryLayout} Layout.
* @api
* @api stable
*/
ol.geom.SimpleGeometry.prototype.getLayout = function() {
return this.layout;
@@ -141,7 +141,6 @@ ol.geom.SimpleGeometry.prototype.getLayout = function() {
/**
* @inheritDoc
* @api
*/
ol.geom.SimpleGeometry.prototype.getSimplifiedGeometry =
function(squaredTolerance) {

View File

@@ -166,10 +166,10 @@ ol.interaction.Draw = function(options) {
/**
* Sketch polygon. Used when drawing polygon.
* @type {ol.geom.RawPolygon}
* @type {Array.<Array.<ol.Coordinate>>}
* @private
*/
this.sketchRawPolygon_ = null;
this.sketchPolygonCoords_ = null;
/**
* Squared tolerance for handling up events. If the squared distance
@@ -331,8 +331,8 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) {
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
potentiallyDone = geometry.getCoordinates()[0].length >
this.minPointsPerRing_;
potentiallyFinishCoordinates = [this.sketchRawPolygon_[0][0],
this.sketchRawPolygon_[0][this.sketchRawPolygon_[0].length - 2]];
potentiallyFinishCoordinates = [this.sketchPolygonCoords_[0][0],
this.sketchPolygonCoords_[0][this.sketchPolygonCoords_[0].length - 2]];
}
if (potentiallyDone) {
var map = event.map;
@@ -388,8 +388,8 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) {
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
this.sketchLine_ = new ol.Feature(new ol.geom.LineString([start.slice(),
start.slice()]));
this.sketchRawPolygon_ = [[start.slice(), start.slice()]];
geometry = new ol.geom.Polygon(this.sketchRawPolygon_);
this.sketchPolygonCoords_ = [[start.slice(), start.slice()]];
geometry = new ol.geom.Polygon(this.sketchPolygonCoords_);
}
}
goog.asserts.assert(goog.isDef(geometry));
@@ -425,7 +425,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
coordinates = geometry.getCoordinates();
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
coordinates = this.sketchRawPolygon_[0];
coordinates = this.sketchPolygonCoords_[0];
}
if (this.atFinish_(event)) {
// snap to finish
@@ -445,7 +445,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString);
sketchLineGeom.setCoordinates(coordinates);
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
geometry.setCoordinates(this.sketchRawPolygon_);
geometry.setCoordinates(this.sketchPolygonCoords_);
}
}
this.updateSketchFeatures_();
@@ -468,9 +468,9 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
coordinates.push(coordinate.slice());
geometry.setCoordinates(coordinates);
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
this.sketchRawPolygon_[0].push(coordinate.slice());
this.sketchPolygonCoords_[0].push(coordinate.slice());
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
geometry.setCoordinates(this.sketchRawPolygon_);
geometry.setCoordinates(this.sketchPolygonCoords_);
}
this.updateSketchFeatures_();
};
@@ -500,9 +500,9 @@ ol.interaction.Draw.prototype.finishDrawing_ = function(event) {
// When we finish drawing a polygon on the last point,
// the last coordinate is duplicated as for LineString
// we force the replacement by the first point
this.sketchRawPolygon_[0].pop();
this.sketchRawPolygon_[0].push(this.sketchRawPolygon_[0][0]);
geometry.setCoordinates(this.sketchRawPolygon_);
this.sketchPolygonCoords_[0].pop();
this.sketchPolygonCoords_[0].push(this.sketchPolygonCoords_[0][0]);
geometry.setCoordinates(this.sketchPolygonCoords_);
coordinates = geometry.getCoordinates();
}