Add ol.geom.LinearRing
This commit is contained in:
@@ -16,6 +16,7 @@ goog.require('ol.geom.flat');
|
||||
ol.geom.Type = {
|
||||
POINT: 'Point',
|
||||
LINE_STRING: 'LineString',
|
||||
LINEAR_RING: 'LinearRing',
|
||||
POLYGON: 'Polygon',
|
||||
MULTI_POINT: 'MultiPoint',
|
||||
MULTI_LINE_STRING: 'MultiLineString',
|
||||
|
||||
4
src/ol/geom/linearring.exports
Normal file
4
src/ol/geom/linearring.exports
Normal file
@@ -0,0 +1,4 @@
|
||||
@exportSymbol ol.geom.LinearRing
|
||||
@exportProperty ol.geom.LinearRing.prototype.getCoordinates
|
||||
@exportProperty ol.geom.LinearRing.prototype.getType
|
||||
@exportProperty ol.geom.LinearRing.prototype.setCoordinates
|
||||
48
src/ol/geom/linearring.js
Normal file
48
src/ol/geom/linearring.js
Normal file
@@ -0,0 +1,48 @@
|
||||
goog.provide('ol.geom.LinearRing');
|
||||
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.flat');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.geom.Geometry}
|
||||
* @param {ol.geom.RawLinearRing} coordinates Coordinates.
|
||||
* @param {ol.geom.Layout=} opt_layout Layout.
|
||||
*/
|
||||
ol.geom.LinearRing = function(coordinates, opt_layout) {
|
||||
goog.base(this);
|
||||
this.setCoordinates(coordinates, opt_layout);
|
||||
};
|
||||
goog.inherits(ol.geom.LinearRing, ol.geom.Geometry);
|
||||
|
||||
|
||||
/**
|
||||
* @return {ol.geom.RawLinearRing} Coordinates.
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getCoordinates = function() {
|
||||
return ol.geom.flat.inflateCoordinates(
|
||||
this.flatCoordinates, 0, this.flatCoordinates.length, this.stride);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.getType = function() {
|
||||
return ol.geom.Type.LINEAR_RING;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.geom.RawLinearRing} coordinates Coordinates.
|
||||
* @param {ol.geom.Layout=} opt_layout Layout.
|
||||
*/
|
||||
ol.geom.LinearRing.prototype.setCoordinates =
|
||||
function(coordinates, opt_layout) {
|
||||
this.setLayout(opt_layout, coordinates, 1);
|
||||
ol.geom.flat.deflateCoordinates(
|
||||
this.flatCoordinates, 0, coordinates, this.stride);
|
||||
this.dispatchChangeEvent();
|
||||
};
|
||||
Reference in New Issue
Block a user