First state of a geom package.
This commit is contained in:
12
src/api/geom/geometry.js
Normal file
12
src/api/geom/geometry.js
Normal file
@@ -0,0 +1,12 @@
|
||||
goog.provide('ol.geom.geometry');
|
||||
|
||||
goog.require('ol.geom.Geometry');
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @return {ol.geom.Geometry} Geometry..
|
||||
*/
|
||||
ol.geom.geometry = function(){
|
||||
var g = new ol.geom.Geometry();
|
||||
return g;
|
||||
};
|
||||
43
src/api/geom/point.js
Normal file
43
src/api/geom/point.js
Normal file
@@ -0,0 +1,43 @@
|
||||
goog.provide('ol.geom.point');
|
||||
|
||||
goog.require('ol.geom.Point');
|
||||
|
||||
/**
|
||||
* @typedef {ol.PointLike|Array.<number>|Object} point Point.
|
||||
*/
|
||||
ol.PointLike;
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @param {ol.PointLike} opt_arg Point.
|
||||
* @return {ol.geom.Point} Point.
|
||||
*/
|
||||
ol.geom.point = function(opt_arg){
|
||||
|
||||
if (opt_arg instanceof ol.geom.Point) {
|
||||
return opt_arg;
|
||||
}
|
||||
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var z;
|
||||
|
||||
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];
|
||||
} else if (goog.isObject(opt_arg)) {
|
||||
x = opt_arg.x;
|
||||
y = opt_arg.y;
|
||||
z = opt_arg.z;
|
||||
} else {
|
||||
throw new Error('ol.geom.point');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var p = new ol.geom.Point(x,y,z);
|
||||
return p;
|
||||
};
|
||||
goog.inherits(ol.geom.point, ol.geom.geometry);
|
||||
Reference in New Issue
Block a user