Function for getting extent intersection
This commit is contained in:
@@ -24,6 +24,30 @@ describe('ol.extent', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('getIntersection()', function() {
|
||||
it('returns the intersection of two extents', function() {
|
||||
var world = [-180, -90, 180, 90];
|
||||
var north = [-180, 0, 180, 90];
|
||||
var farNorth = [-180, 45, 180, 90];
|
||||
var east = [0, -90, 180, 90];
|
||||
var farEast = [90, -90, 180, 90];
|
||||
var south = [-180, -90, 180, 0];
|
||||
var farSouth = [-180, -90, 180, -45];
|
||||
var west = [-180, -90, 0, 90];
|
||||
var farWest = [-180, -90, -90, 90];
|
||||
var none = ol.extent.createEmpty();
|
||||
expect(ol.extent.getIntersection(world, none)).to.eql(none);
|
||||
expect(ol.extent.getIntersection(world, north)).to.eql(north);
|
||||
expect(ol.extent.getIntersection(world, east)).to.eql(east);
|
||||
expect(ol.extent.getIntersection(world, south)).to.eql(south);
|
||||
expect(ol.extent.getIntersection(world, west)).to.eql(west);
|
||||
expect(ol.extent.getIntersection(farEast, farWest)).to.eql(none);
|
||||
expect(ol.extent.getIntersection(farNorth, farSouth)).to.eql(none);
|
||||
expect(ol.extent.getIntersection(north, west)).to.eql([-180, 0, 0, 90]);
|
||||
expect(ol.extent.getIntersection(east, south)).to.eql([0, -90, 180, 0]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('containsCoordinate', function() {
|
||||
|
||||
describe('positive', function() {
|
||||
|
||||
Reference in New Issue
Block a user