Add ol.geom.Point
This commit is contained in:
@@ -0,0 +1,64 @@
|
|||||||
|
goog.provide('ol.geom.Point');
|
||||||
|
|
||||||
|
goog.require('goog.asserts');
|
||||||
|
goog.require('ol.extent');
|
||||||
|
goog.require('ol.geom.Geometry');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @constructor
|
||||||
|
* @extends {ol.geom.Geometry}
|
||||||
|
* @param {ol.Coordinate} coordinate Coordinate.
|
||||||
|
*/
|
||||||
|
ol.geom.Point = function(coordinate) {
|
||||||
|
|
||||||
|
goog.base(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {Array.<number>}
|
||||||
|
*/
|
||||||
|
this.coordinate_ = coordinate;
|
||||||
|
|
||||||
|
};
|
||||||
|
goog.inherits(ol.geom.Point, ol.geom.Geometry);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return {ol.Coordinate} Coordinate.
|
||||||
|
*/
|
||||||
|
ol.geom.Point.prototype.getCoordinate = function() {
|
||||||
|
return this.coordinate_;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.geom.Point.prototype.getExtent = function(opt_extent) {
|
||||||
|
if (this.extentRevision != this.revision) {
|
||||||
|
this.extent = ol.extent.createOrUpdateFromCoordinate(
|
||||||
|
this.coordinate_, this.extent);
|
||||||
|
this.extentRevision = this.revision;
|
||||||
|
}
|
||||||
|
goog.asserts.assert(goog.isDef(this.extent));
|
||||||
|
return ol.extent.returnOrUpdate(this.extent, opt_extent);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
ol.geom.Point.prototype.getType = function() {
|
||||||
|
return ol.geom.GeometryType.POINT;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ol.Coordinate} coordinate Coordinate.
|
||||||
|
*/
|
||||||
|
ol.geom.Point.prototype.setCoordinate = function(coordinate) {
|
||||||
|
this.coordinate_ = coordinate;
|
||||||
|
this.dispatchChangeEvent();
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user