Geometry type enumeration
This commit is contained in:
@@ -2,6 +2,7 @@ goog.require('ol.Extent');
|
||||
goog.provide('ol.geom.Coordinate');
|
||||
goog.provide('ol.geom.CoordinateArray');
|
||||
goog.provide('ol.geom.Geometry');
|
||||
goog.provide('ol.geom.GeometryType');
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +26,13 @@ ol.geom.Geometry.prototype.dimension;
|
||||
ol.geom.Geometry.prototype.getBounds = goog.abstractMethod;
|
||||
|
||||
|
||||
/**
|
||||
* Get the geometry type.
|
||||
* @return {ol.geom.GeometryType} The geometry type.
|
||||
*/
|
||||
ol.geom.Geometry.prototype.getType = function() {};
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {Array.<number>}
|
||||
*/
|
||||
@@ -35,3 +43,16 @@ ol.geom.Coordinate;
|
||||
* @typedef {Array.<ol.geom.Coordinate>}
|
||||
*/
|
||||
ol.geom.CoordinateArray;
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
ol.geom.GeometryType = {
|
||||
POINT: 'point',
|
||||
LINESTRING: 'linestring',
|
||||
POLYGON: 'polygon',
|
||||
MULTIPOINT: 'multipoint',
|
||||
MULTILINESTRING: 'multilinestring',
|
||||
MULTIPOLYGON: 'multipolygon'
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
|
||||
|
||||
|
||||
@@ -71,3 +72,11 @@ ol.geom.LineString.prototype.getBounds = function() {
|
||||
}
|
||||
return this.bounds_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LineString.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.LINESTRING;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.provide('ol.geom.MultiLineString');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.GeometryCollection');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.LineString');
|
||||
|
||||
|
||||
@@ -39,3 +40,11 @@ ol.geom.MultiLineString = function(coordinates) {
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiLineString, ol.geom.GeometryCollection);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiLineString.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTILINESTRING;
|
||||
};
|
||||
|
||||
@@ -39,3 +39,11 @@ ol.geom.MultiPoint = function(coordinates) {
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiPoint, ol.geom.GeometryCollection);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPoint.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTIPOINT;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.provide('ol.geom.MultiPolygon');
|
||||
goog.require('goog.asserts');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.GeometryCollection');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.Polygon');
|
||||
|
||||
|
||||
@@ -40,3 +41,11 @@ ol.geom.MultiPolygon = function(coordinates) {
|
||||
|
||||
};
|
||||
goog.inherits(ol.geom.MultiPolygon, ol.geom.GeometryCollection);
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.MultiPolygon.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.MULTIPOLYGON;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.geom.Coordinate');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
|
||||
|
||||
|
||||
@@ -46,3 +47,11 @@ ol.geom.Point.prototype.getBounds = function() {
|
||||
}
|
||||
return this.bounds_;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Point.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.POINT;
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ goog.require('goog.vec.Float64Array');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.geom.CoordinateArray');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.LinearRing');
|
||||
|
||||
|
||||
@@ -54,3 +55,11 @@ ol.geom.Polygon = function(coordinates) {
|
||||
ol.geom.Polygon.prototype.getBounds = function() {
|
||||
return this.rings[0].getBounds();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.Polygon.prototype.getType = function() {
|
||||
return ol.geom.GeometryType.POLYGON;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user