Remove the mixin approach and give the Point class a projection.

This commit is contained in:
Marc Jansen
2012-06-20 11:18:07 +02:00
parent 073c636cb2
commit aec8f953e5
5 changed files with 119 additions and 55 deletions

View File

@@ -1,6 +1,7 @@
goog.provide('ol.geom.point');
goog.require('ol.geom.Point');
goog.require('ol.projection');
/**
* @typedef {ol.PointLike|Array.<number>|Object} point Point.
@@ -21,23 +22,29 @@ ol.geom.point = function(opt_arg){
var x = 0;
var y = 0;
var z;
var projection;
if (arguments.length == 1 && goog.isDef(opt_arg)) {
if (goog.isArray(opt_arg)) {
x = opt_arg[0];
y = opt_arg[1];
z = opt_arg[2];
projection = opt_arg[3];
} else if (goog.isObject(opt_arg)) {
x = opt_arg.x;
y = opt_arg.y;
z = opt_arg.z;
projection = opt_arg.projection;
} else {
throw new Error('ol.geom.point');
}
}
if (goog.isDef(projection)) {
projection = ol.projection(projection);
}
var p = new ol.geom.Point(x,y,z);
var p = new ol.geom.Point(x,y,z,projection);
return p;
};
goog.inherits(ol.geom.point, ol.geom.geometry);