Merge branch 'master' of github.com:openlayers/ol3
This commit is contained in:
+2
-3
@@ -108,7 +108,7 @@ ol.layer.XYZ.prototype.setResolutions = function(resolutions) {
|
|||||||
*/
|
*/
|
||||||
ol.layer.XYZ.prototype.getData = function(bounds, resolution) {
|
ol.layer.XYZ.prototype.getData = function(bounds, resolution) {
|
||||||
var me = this,
|
var me = this,
|
||||||
zoom = me.zoomForResolution_(resolution);
|
zoom = me.zoomForResolution(resolution);
|
||||||
resolution = me.resolutions_[zoom];
|
resolution = me.resolutions_[zoom];
|
||||||
|
|
||||||
var boundsMinX = bounds.getMinX(),
|
var boundsMinX = bounds.getMinX(),
|
||||||
@@ -157,10 +157,9 @@ ol.layer.XYZ.prototype.getData = function(bounds, resolution) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the zoom level (z) for the given resolution.
|
* Get the zoom level (z) for the given resolution.
|
||||||
* @private
|
|
||||||
* @param {number} resolution
|
* @param {number} resolution
|
||||||
*/
|
*/
|
||||||
ol.layer.XYZ.prototype.zoomForResolution_ = function(resolution) {
|
ol.layer.XYZ.prototype.zoomForResolution = function(resolution) {
|
||||||
var delta = Number.POSITIVE_INFINITY,
|
var delta = Number.POSITIVE_INFINITY,
|
||||||
currentDelta,
|
currentDelta,
|
||||||
resolutions = this.resolutions_;
|
resolutions = this.resolutions_;
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
goog.provide('ol.mixins.coordinate');
|
|
||||||
goog.require('goog.object');
|
|
||||||
|
|
||||||
goog.object.extend(ol.mixins.coordinate, {
|
|
||||||
|
|
||||||
getX : function() {
|
|
||||||
return this.x_;
|
|
||||||
},
|
|
||||||
|
|
||||||
getY : function() {
|
|
||||||
return this.y_;
|
|
||||||
},
|
|
||||||
|
|
||||||
getZ : function() {
|
|
||||||
return this.z_;
|
|
||||||
},
|
|
||||||
|
|
||||||
setX : function(x) {
|
|
||||||
this.x_ = x;
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
|
|
||||||
setY : function(y) {
|
|
||||||
this.y_ = y;
|
|
||||||
return this;
|
|
||||||
},
|
|
||||||
setZ: function(z) {
|
|
||||||
this.z_ = z;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
<!-- include spec files here... -->
|
<!-- include spec files here... -->
|
||||||
<script type="text/javascript" src="spec/api/bounds.test.js"></script>
|
<script type="text/javascript" src="spec/api/bounds.test.js"></script>
|
||||||
<script type="text/javascript" src="spec/api/geom/geom.test.js"></script>
|
<script type="text/javascript" src="spec/api/geom/geom.test.js"></script>
|
||||||
|
<script type="text/javascript" src="spec/api/geom/point.test.js"></script>
|
||||||
<script type="text/javascript" src="spec/api/loc.test.js"></script>
|
<script type="text/javascript" src="spec/api/loc.test.js"></script>
|
||||||
<script type="text/javascript" src="spec/api/map.test.js"></script>
|
<script type="text/javascript" src="spec/api/map.test.js"></script>
|
||||||
<script type="text/javascript" src="spec/api/projection.test.js"></script>
|
<script type="text/javascript" src="spec/api/projection.test.js"></script>
|
||||||
|
|||||||
@@ -0,0 +1,134 @@
|
|||||||
|
describe("ol.geom.point", function() {
|
||||||
|
var pNoArgs,
|
||||||
|
pNoZ_arr,
|
||||||
|
pWithZ_arr,
|
||||||
|
p_arr,
|
||||||
|
pNoZ_obj,
|
||||||
|
pWithZ_obj,
|
||||||
|
p_obj,
|
||||||
|
proj = "EPSG:4326";
|
||||||
|
|
||||||
|
var instances = {
|
||||||
|
"no arguments passed": ol.geom.point(),
|
||||||
|
"one argument <Array[x,y]> passed": ol.geom.point([21, 4]),
|
||||||
|
"one argument <Array[x,y,z]> passed": ol.geom.point([21, 4, 8]),
|
||||||
|
"one argument <Array[x,y,z,projection]> passed": ol.geom.point([21, 4, 8, proj]),
|
||||||
|
"one argument <Object{x,y}> passed": ol.geom.point({x: 21, y: 4}),
|
||||||
|
"one argument <Object{x,y,z}> passed": ol.geom.point({x: 21, y: 4, z: 8}),
|
||||||
|
"one argument <Object{x,y,z,projection}> passed": ol.geom.point({x: 21, y: 4, z: 8, projection: proj})
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
proj = ol.projection("EPSG:4326");
|
||||||
|
instances = {
|
||||||
|
"no arguments passed": ol.geom.point(),
|
||||||
|
"one argument <Array[x,y]> passed": ol.geom.point([21, 4]),
|
||||||
|
"one argument <Array[x,y,z]> passed": ol.geom.point([21, 4, 8]),
|
||||||
|
"one argument <Array[x,y,z,projection]> passed": ol.geom.point([21, 4, 8, proj]),
|
||||||
|
"one argument <Object{x,y}> passed": ol.geom.point({x: 21, y: 4}),
|
||||||
|
"one argument <Object{x,y,z}> passed": ol.geom.point({x: 21, y: 4, z: 8}),
|
||||||
|
"one argument <Object{x,y,z,projection}> passed": ol.geom.point({x: 21, y: 4, z: 8, projection: proj})
|
||||||
|
};
|
||||||
|
pNoArgs = instances["no arguments passed"];
|
||||||
|
pNoZ_arr = instances["one argument <Array[x,y]> passed"];
|
||||||
|
pWithZ_arr = instances["one argument <Array[x,y,z]> passed"];
|
||||||
|
p_arr = instances["one argument <Array[x,y,z,projection]> passed"];
|
||||||
|
pNoZ_obj = instances["one argument <Object{x,y}> passed"];
|
||||||
|
pWithZ_obj = instances["one argument <Object{x,y,z}> passed"];
|
||||||
|
p_obj = instances["one argument <Object{x,y,z,projection}> passed"];
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
pNoArgs = null;
|
||||||
|
pNoZ_arr = pWithZ_arr = p_arr = null;
|
||||||
|
PNoZ_obj = pWithZ_obj = p_obj = null;
|
||||||
|
instances = {
|
||||||
|
"no arguments passed": ol.geom.point(),
|
||||||
|
"one argument <Array[x,y]> passed": ol.geom.point([21, 4]),
|
||||||
|
"one argument <Array[x,y,z]> passed": ol.geom.point([21, 4, 8]),
|
||||||
|
"one argument <Array[x,y,z,projection]> passed": ol.geom.point([21, 4, 8, proj]),
|
||||||
|
"one argument <Object{x,y}> passed": ol.geom.point({x: 21, y: 4}),
|
||||||
|
"one argument <Object{x,y,z}> passed": ol.geom.point({x: 21, y: 4, z: 8}),
|
||||||
|
"one argument <Object{x,y,z,projection}> passed": ol.geom.point({x: 21, y: 4, z: 8, projection: proj})
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
for (instancesDesc in instances) {
|
||||||
|
if (instances.hasOwnProperty(instancesDesc)) {
|
||||||
|
var instance = instances[instancesDesc];
|
||||||
|
|
||||||
|
it("constructs instances (" + instancesDesc + ")", function() {
|
||||||
|
expect(instance).toEqual(jasmine.any(ol.geom.Point));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("constructs instances of ol.geom.Geometry (" + instancesDesc + ")", function() {
|
||||||
|
expect(instance).toEqual(jasmine.any(ol.geom.Geometry));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has the coordinate accessor methods (" + instancesDesc + ")", function() {
|
||||||
|
expect(instance.getX).not.toBeUndefined();
|
||||||
|
expect(instance.getY).not.toBeUndefined();
|
||||||
|
expect(instance.getZ).not.toBeUndefined();
|
||||||
|
expect(instance.setX).not.toBeUndefined();
|
||||||
|
expect(instance.setY).not.toBeUndefined();
|
||||||
|
expect(instance.setZ).not.toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has the projection accessor methods (" + instancesDesc + ")", function() {
|
||||||
|
expect(instance.getProjection).not.toBeUndefined();
|
||||||
|
expect(instance.setProjection).not.toBeUndefined();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
it("has functional getters (no arguments passed)", function(){
|
||||||
|
expect(pNoArgs.getX()).toBe(0);
|
||||||
|
expect(pNoArgs.getY()).toBe(0);
|
||||||
|
expect(pNoArgs.getZ()).toBeUndefined();
|
||||||
|
expect(pNoArgs.getProjection()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Array[x,y]> passed)", function(){
|
||||||
|
expect(pNoZ_arr.getX()).toBe(21);
|
||||||
|
expect(pNoZ_arr.getY()).toBe(4);
|
||||||
|
expect(pNoZ_arr.getZ()).toBeUndefined();
|
||||||
|
expect(pNoZ_arr.getProjection()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Array[x,y,z]> passed)", function(){
|
||||||
|
expect(pWithZ_arr.getX()).toBe(21);
|
||||||
|
expect(pWithZ_arr.getY()).toBe(4);
|
||||||
|
expect(pWithZ_arr.getZ()).toBe(8);
|
||||||
|
expect(pWithZ_arr.getProjection()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Array[x,y,z,projection]> passed)", function(){
|
||||||
|
expect(p_arr.getX()).toBe(21);
|
||||||
|
expect(p_arr.getY()).toBe(4);
|
||||||
|
expect(p_arr.getZ()).toBe(8);
|
||||||
|
expect(p_arr.getProjection()).not.toBeNull();
|
||||||
|
expect(p_arr.getProjection()).toEqual(jasmine.any(ol.Projection));
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Object{x,y}> passed)", function(){
|
||||||
|
expect(pNoZ_obj.getX()).toBe(21);
|
||||||
|
expect(pNoZ_obj.getY()).toBe(4);
|
||||||
|
expect(pNoZ_obj.getZ()).toBeUndefined();
|
||||||
|
expect(pNoZ_obj.getProjection()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Object{x,y,z}> passed)", function(){
|
||||||
|
expect(pWithZ_obj.getX()).toBe(21);
|
||||||
|
expect(pWithZ_obj.getY()).toBe(4);
|
||||||
|
expect(pWithZ_obj.getZ()).toBe(8);
|
||||||
|
expect(pWithZ_obj.getProjection()).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has functional getters (one argument <Object{x,y,z,projection}> passed)", function(){
|
||||||
|
expect(p_obj.getX()).toBe(21);
|
||||||
|
expect(p_obj.getY()).toBe(4);
|
||||||
|
expect(p_obj.getZ()).toBe(8);
|
||||||
|
expect(p_obj.getProjection()).not.toBeNull();
|
||||||
|
expect(p_obj.getProjection()).toEqual(jasmine.any(ol.Projection));
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,44 +1,34 @@
|
|||||||
describe("ol.geom.Point", function() {
|
describe("ol.geom.Point", function() {
|
||||||
var pNoArgs,
|
var p2Args,
|
||||||
pNoZ_arr,
|
p3Args,
|
||||||
pWithZ_arr,
|
p4Args,
|
||||||
p_arr,
|
p_arr,
|
||||||
pNoZ_obj,
|
|
||||||
pWithZ_obj,
|
|
||||||
p_obj,
|
|
||||||
proj = "EPSG:4326";
|
proj = "EPSG:4326";
|
||||||
|
|
||||||
var instances = {
|
var instances = {
|
||||||
"no arguments passed": ol.geom.point(),
|
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj]),
|
|
||||||
"one argument {x,y} passed": ol.geom.point([21, 4]),
|
|
||||||
"one argument {x,y,z} passed": ol.geom.point([21, 4, 8]),
|
|
||||||
"one argument {x,y,z,projection} passed": ol.geom.point([21, 4, 8, proj])
|
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
proj = ol.projection("EPSG:4326");
|
proj = ol.projection("EPSG:4326");
|
||||||
instances = {
|
instances = {
|
||||||
"no arguments passed": ol.geom.point(),
|
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj])
|
|
||||||
};
|
};
|
||||||
pNoArgs = instances['no arguments passed'];
|
p2Args = instances['two arguments <x>,<y> passed'];
|
||||||
pNoZ = instances['one argument [x,y] passed'];
|
p3Args = instances['three arguments <x>,<y>,<z> passed'];
|
||||||
pWithZ = instances['one argument [x,y,z] passed'];
|
p4Args = instances['four arguments <x>,<y>,<z>,<projection> passed'];
|
||||||
p = instances['one argument [x,y,z,projection] passed'];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function() {
|
afterEach(function() {
|
||||||
pNoArgs = pNoZ = pWithZ = p = null;
|
p2Args = p3Args = p4Args = null;
|
||||||
instances = {
|
instances = {
|
||||||
"no arguments passed": ol.geom.point(),
|
"two arguments <x>,<y> passed": new ol.geom.Point(21, 4),
|
||||||
"one argument [x,y] passed": ol.geom.point([21, 4]),
|
"three arguments <x>,<y>,<z> passed": new ol.geom.Point(21, 4, 8),
|
||||||
"one argument [x,y,z] passed": ol.geom.point([21, 4, 8]),
|
"four arguments <x>,<y>,<z>,<projection> passed": new ol.geom.Point(21, 4, 8, proj)
|
||||||
"one argument [x,y,z,projection] passed": ol.geom.point([21, 4, 8, proj])
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -70,32 +60,27 @@ describe("ol.geom.Point", function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
it("has functional getters (no arguments passed)", function(){
|
it("has functional getters (two arguments <x>,<y> passed)", function(){
|
||||||
expect(pNoArgs.getX()).toBe(0);
|
|
||||||
expect(pNoArgs.getY()).toBe(0);
|
expect(p2Args.getX()).toBe(21);
|
||||||
expect(pNoArgs.getZ()).toBeUndefined();
|
expect(p2Args.getY()).toBe(4);
|
||||||
expect(pNoArgs.getProjection()).toBeNull();
|
expect(p2Args.getZ()).toBeUndefined();
|
||||||
|
expect(p2Args.getProjection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument [x,y] passed)", function(){
|
it("has functional getters (three arguments <x>,<y>,<z> passed)", function(){
|
||||||
expect(pNoZ.getX()).toBe(21);
|
expect(p3Args.getX()).toBe(21);
|
||||||
expect(pNoZ.getY()).toBe(4);
|
expect(p3Args.getY()).toBe(4);
|
||||||
expect(pNoZ.getZ()).toBeUndefined();
|
expect(p3Args.getZ()).not.toBeUndefined();
|
||||||
expect(pNoZ.getProjection()).toBeNull();
|
expect(p3Args.getZ()).toBe(8);
|
||||||
|
expect(p3Args.getProjection()).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("has functional getters (one argument [x,y,z] passed)", function(){
|
it("has functional getters (four arguments <x>,<y>,<z>,<projection> passed)", function(){
|
||||||
expect(pWithZ.getX()).toBe(21);
|
expect(p4Args.getX()).toBe(21);
|
||||||
expect(pWithZ.getY()).toBe(4);
|
expect(p4Args.getY()).toBe(4);
|
||||||
expect(pWithZ.getZ()).toBe(8);
|
expect(p4Args.getZ()).toBe(8);
|
||||||
expect(pWithZ.getProjection()).toBeNull();
|
expect(p4Args.getProjection()).not.toBeNull();
|
||||||
});
|
expect(p4Args.getProjection()).toBeA(ol.Projection);
|
||||||
|
|
||||||
it("has functional getters (one argument [x,y,z,projection] passed)", function(){
|
|
||||||
expect(p.getX()).toBe(21);
|
|
||||||
expect(p.getY()).toBe(4);
|
|
||||||
expect(p.getZ()).toBe(8);
|
|
||||||
expect(p.getProjection()).not.toBeNull();
|
|
||||||
expect(p.getProjection()).toEqual(jasmine.any(ol.Projection));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user