Remove the ol.geom.RawPolygon type
This commit is contained in:
@@ -203,14 +203,6 @@ ol.geom.Geometry.prototype.transform = function(source, destination) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Array representation of a polygon.
|
|
||||||
* @typedef {Array.<Array.<ol.Coordinate>>}
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
ol.geom.RawPolygon;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array representation of a multipoint.
|
* Array representation of a multipoint.
|
||||||
* @typedef {Array.<ol.Coordinate>}
|
* @typedef {Array.<ol.Coordinate>}
|
||||||
@@ -229,7 +221,7 @@ ol.geom.RawMultiLineString;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Array representation of a multipolygon.
|
* Array representation of a multipolygon.
|
||||||
* @typedef {Array.<ol.geom.RawPolygon>}
|
* @typedef {Array.<Array.<Array.<ol.Coordinate>>>}
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.geom.RawMultiPolygon;
|
ol.geom.RawMultiPolygon;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ goog.require('ol.geom.flat.simplify');
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.geom.SimpleGeometry}
|
* @extends {ol.geom.SimpleGeometry}
|
||||||
* @param {ol.geom.RawPolygon} coordinates Coordinates.
|
* @param {Array.<Array.<ol.Coordinate>>} coordinates Coordinates.
|
||||||
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
@@ -150,7 +150,7 @@ ol.geom.Polygon.prototype.getArea = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {ol.geom.RawPolygon} Coordinates.
|
* @return {Array.<Array.<ol.Coordinate>>} Coordinates.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
ol.geom.Polygon.prototype.getCoordinates = function() {
|
ol.geom.Polygon.prototype.getCoordinates = function() {
|
||||||
@@ -279,7 +279,7 @@ 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.
|
* @param {ol.geom.GeometryLayout=} opt_layout Layout.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -166,10 +166,10 @@ ol.interaction.Draw = function(options) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sketch polygon. Used when drawing polygon.
|
* Sketch polygon. Used when drawing polygon.
|
||||||
* @type {ol.geom.RawPolygon}
|
* @type {Array.<Array.<ol.Coordinate>>}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.sketchRawPolygon_ = null;
|
this.sketchPolygonCoords_ = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Squared tolerance for handling up events. If the squared distance
|
* 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);
|
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||||
potentiallyDone = geometry.getCoordinates()[0].length >
|
potentiallyDone = geometry.getCoordinates()[0].length >
|
||||||
this.minPointsPerRing_;
|
this.minPointsPerRing_;
|
||||||
potentiallyFinishCoordinates = [this.sketchRawPolygon_[0][0],
|
potentiallyFinishCoordinates = [this.sketchPolygonCoords_[0][0],
|
||||||
this.sketchRawPolygon_[0][this.sketchRawPolygon_[0].length - 2]];
|
this.sketchPolygonCoords_[0][this.sketchPolygonCoords_[0].length - 2]];
|
||||||
}
|
}
|
||||||
if (potentiallyDone) {
|
if (potentiallyDone) {
|
||||||
var map = event.map;
|
var map = event.map;
|
||||||
@@ -388,8 +388,8 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) {
|
|||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||||
this.sketchLine_ = new ol.Feature(new ol.geom.LineString([start.slice(),
|
this.sketchLine_ = new ol.Feature(new ol.geom.LineString([start.slice(),
|
||||||
start.slice()]));
|
start.slice()]));
|
||||||
this.sketchRawPolygon_ = [[start.slice(), start.slice()]];
|
this.sketchPolygonCoords_ = [[start.slice(), start.slice()]];
|
||||||
geometry = new ol.geom.Polygon(this.sketchRawPolygon_);
|
geometry = new ol.geom.Polygon(this.sketchPolygonCoords_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
goog.asserts.assert(goog.isDef(geometry));
|
goog.asserts.assert(goog.isDef(geometry));
|
||||||
@@ -425,7 +425,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
|||||||
coordinates = geometry.getCoordinates();
|
coordinates = geometry.getCoordinates();
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
||||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||||
coordinates = this.sketchRawPolygon_[0];
|
coordinates = this.sketchPolygonCoords_[0];
|
||||||
}
|
}
|
||||||
if (this.atFinish_(event)) {
|
if (this.atFinish_(event)) {
|
||||||
// snap to finish
|
// snap to finish
|
||||||
@@ -445,7 +445,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) {
|
|||||||
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString);
|
goog.asserts.assertInstanceof(sketchLineGeom, ol.geom.LineString);
|
||||||
sketchLineGeom.setCoordinates(coordinates);
|
sketchLineGeom.setCoordinates(coordinates);
|
||||||
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||||
geometry.setCoordinates(this.sketchRawPolygon_);
|
geometry.setCoordinates(this.sketchPolygonCoords_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.updateSketchFeatures_();
|
this.updateSketchFeatures_();
|
||||||
@@ -468,9 +468,9 @@ ol.interaction.Draw.prototype.addToDrawing_ = function(event) {
|
|||||||
coordinates.push(coordinate.slice());
|
coordinates.push(coordinate.slice());
|
||||||
geometry.setCoordinates(coordinates);
|
geometry.setCoordinates(coordinates);
|
||||||
} else if (this.mode_ === ol.interaction.DrawMode.POLYGON) {
|
} 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);
|
goog.asserts.assertInstanceof(geometry, ol.geom.Polygon);
|
||||||
geometry.setCoordinates(this.sketchRawPolygon_);
|
geometry.setCoordinates(this.sketchPolygonCoords_);
|
||||||
}
|
}
|
||||||
this.updateSketchFeatures_();
|
this.updateSketchFeatures_();
|
||||||
};
|
};
|
||||||
@@ -500,9 +500,9 @@ ol.interaction.Draw.prototype.finishDrawing_ = function(event) {
|
|||||||
// When we finish drawing a polygon on the last point,
|
// When we finish drawing a polygon on the last point,
|
||||||
// the last coordinate is duplicated as for LineString
|
// the last coordinate is duplicated as for LineString
|
||||||
// we force the replacement by the first point
|
// we force the replacement by the first point
|
||||||
this.sketchRawPolygon_[0].pop();
|
this.sketchPolygonCoords_[0].pop();
|
||||||
this.sketchRawPolygon_[0].push(this.sketchRawPolygon_[0][0]);
|
this.sketchPolygonCoords_[0].push(this.sketchPolygonCoords_[0][0]);
|
||||||
geometry.setCoordinates(this.sketchRawPolygon_);
|
geometry.setCoordinates(this.sketchPolygonCoords_);
|
||||||
coordinates = geometry.getCoordinates();
|
coordinates = geometry.getCoordinates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user