Implement clone for simple geometries

This commit is contained in:
Tom Payne
2013-12-11 15:03:56 +01:00
parent 6295fa6088
commit 802d1644bb
14 changed files with 80 additions and 0 deletions

View File

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

View File

@@ -36,6 +36,16 @@ ol.geom.LinearRing = function(coordinates, opt_layout) {
goog.inherits(ol.geom.LinearRing, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.LinearRing.prototype.clone = function() {
var linearRing = new ol.geom.LinearRing(null);
linearRing.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
return linearRing;
};
/**
* @inheritDoc
*/

View File

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

View File

@@ -36,6 +36,16 @@ ol.geom.LineString = function(coordinates, opt_layout) {
goog.inherits(ol.geom.LineString, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.LineString.prototype.clone = function() {
var lineString = new ol.geom.LineString(null);
lineString.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
return lineString;
};
/**
* @inheritDoc
*/

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.MultiLineString
@exportProperty ol.geom.MultiLineString.prototype.clone
@exportProperty ol.geom.MultiLineString.prototype.getCoordinates
@exportProperty ol.geom.MultiLineString.prototype.getLineStrings
@exportProperty ol.geom.MultiLineString.prototype.getType

View File

@@ -43,6 +43,17 @@ ol.geom.MultiLineString = function(coordinates, opt_layout) {
goog.inherits(ol.geom.MultiLineString, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.MultiLineString.prototype.clone = function() {
var multiLineString = new ol.geom.MultiLineString(null);
multiLineString.setFlatCoordinates(
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
return multiLineString;
};
/**
* @inheritDoc
*/

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.MultiPoint
@exportProperty ol.geom.MultiPoint.prototype.clone
@exportProperty ol.geom.MultiPoint.prototype.getCoordinates
@exportProperty ol.geom.MultiPoint.prototype.getPoints
@exportProperty ol.geom.MultiPoint.prototype.getType

View File

@@ -20,6 +20,16 @@ ol.geom.MultiPoint = function(coordinates, opt_layout) {
goog.inherits(ol.geom.MultiPoint, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.MultiPoint.prototype.clone = function() {
var multiPoint = new ol.geom.MultiPoint(null);
multiPoint.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
return multiPoint;
};
/**
* @inheritDoc
*/

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.MultiPolygon
@exportProperty ol.geom.MultiPolygon.prototype.clone
@exportProperty ol.geom.MultiPolygon.prototype.getArea
@exportProperty ol.geom.MultiPolygon.prototype.getCoordinates
@exportProperty ol.geom.MultiPolygon.prototype.getPolygons

View File

@@ -55,6 +55,17 @@ ol.geom.MultiPolygon = function(coordinates, opt_layout) {
goog.inherits(ol.geom.MultiPolygon, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.MultiPolygon.prototype.clone = function() {
var multiPolygon = new ol.geom.MultiPolygon(null);
multiPolygon.setFlatCoordinates(
this.layout, this.flatCoordinates.slice(), this.endss_.slice());
return multiPolygon;
};
/**
* @inheritDoc
*/

View File

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

View File

@@ -20,6 +20,16 @@ ol.geom.Point = function(coordinates, opt_layout) {
goog.inherits(ol.geom.Point, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.Point.prototype.clone = function() {
var point = new ol.geom.Point(null);
point.setFlatCoordinates(this.layout, this.flatCoordinates.slice());
return point;
};
/**
* @inheritDoc
*/

View File

@@ -1,4 +1,5 @@
@exportSymbol ol.geom.Polygon
@exportProperty ol.geom.Polygon.prototype.clone
@exportProperty ol.geom.Polygon.prototype.getArea
@exportProperty ol.geom.Polygon.prototype.getCoordinates
@exportProperty ol.geom.Polygon.prototype.getLinearRings

View File

@@ -55,6 +55,17 @@ ol.geom.Polygon = function(coordinates, opt_layout) {
goog.inherits(ol.geom.Polygon, ol.geom.SimpleGeometry);
/**
* @inheritDoc
*/
ol.geom.Polygon.prototype.clone = function() {
var polygon = new ol.geom.Polygon(null);
polygon.setFlatCoordinates(
this.layout, this.flatCoordinates.slice(), this.ends_.slice());
return polygon;
};
/**
* @inheritDoc
*/