Add ol.geom.Point

This commit is contained in:
Tom Payne
2013-11-06 20:45:53 +01:00
parent 7ff95adbb1
commit cb75fcad9f

64
src/ol/geom/point.js Normal file
View File

@@ -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();
};