another round of LatLon -> LonLat [99] revisions
git-svn-id: http://svn.openlayers.org/trunk/openlayers@103 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
<script src="lib/OpenLayers.js"></script>
|
<script src="lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
<!--
|
<!--
|
||||||
var lat = 40;
|
|
||||||
var lon = 5;
|
var lon = 5;
|
||||||
|
var lat = 40;
|
||||||
var zoom = 5;
|
var zoom = 5;
|
||||||
var map, layer;
|
var map, layer;
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ OpenLayers.Map.prototype = {
|
|||||||
* @return {OpenLayers.LonLat}
|
* @return {OpenLayers.LonLat}
|
||||||
*/
|
*/
|
||||||
getLonLatFromPixel: function (point) {
|
getLonLatFromPixel: function (point) {
|
||||||
var center = this.getCenter(); //map center lat/lon
|
var center = this.getCenter(); //map center lon/lat
|
||||||
var res = this.getResolution();
|
var res = this.getResolution();
|
||||||
var size = this.getSize();
|
var size = this.getSize();
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ OpenLayers.Size.prototype = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class This class represents a latitude and longitude pair
|
* @class This class represents a longitude and latitude pair
|
||||||
*/
|
*/
|
||||||
OpenLayers.LonLat = Class.create();
|
OpenLayers.LonLat = Class.create();
|
||||||
OpenLayers.LonLat.prototype = {
|
OpenLayers.LonLat.prototype = {
|
||||||
@@ -160,8 +160,8 @@ OpenLayers.LonLat.prototype = {
|
|||||||
* @param {float} lat
|
* @param {float} lat
|
||||||
*/
|
*/
|
||||||
initialize: function(lon, lat) {
|
initialize: function(lon, lat) {
|
||||||
this.lat = lat;
|
|
||||||
this.lon = lon;
|
this.lon = lon;
|
||||||
|
this.lat = lat;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +233,7 @@ OpenLayers.LonLat.fromString = function(str) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @class This class represents a bounding box.
|
* @class This class represents a bounding box.
|
||||||
* Data stored as Min and Max Latitudes and Longitudes
|
* Data stored as Min and Max Longitudes and Latitudes
|
||||||
*/
|
*/
|
||||||
OpenLayers.Bounds = Class.create();
|
OpenLayers.Bounds = Class.create();
|
||||||
OpenLayers.Bounds.prototype = {
|
OpenLayers.Bounds.prototype = {
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
t.plan( 5 );
|
t.plan( 5 );
|
||||||
bounds = new OpenLayers.Bounds(1,2,3,4);
|
bounds = new OpenLayers.Bounds(1,2,3,4);
|
||||||
t.ok( bounds instanceof OpenLayers.Bounds, "new OpenLayers.Bounds returns Bounds object" );
|
t.ok( bounds instanceof OpenLayers.Bounds, "new OpenLayers.Bounds returns Bounds object" );
|
||||||
t.eq( bounds.minlat, 1, "bounds.minlat is set correctly" );
|
|
||||||
t.eq( bounds.minlon, 2, "bounds.minlon is set correctly" );
|
t.eq( bounds.minlon, 2, "bounds.minlon is set correctly" );
|
||||||
t.eq( bounds.maxlat, 3, "bounds.maxlat is set correctly" );
|
t.eq( bounds.minlat, 1, "bounds.minlat is set correctly" );
|
||||||
t.eq( bounds.maxlon, 4, "bounds.maxlon is set correctly" );
|
t.eq( bounds.maxlon, 4, "bounds.maxlon is set correctly" );
|
||||||
|
t.eq( bounds.maxlat, 3, "bounds.maxlat is set correctly" );
|
||||||
|
|
||||||
}
|
}
|
||||||
function test_02_Bounds_toBBOX(t) {
|
function test_02_Bounds_toBBOX(t) {
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
t.plan( 3 );
|
t.plan( 3 );
|
||||||
lonlat = new OpenLayers.LonLat(6, 5);
|
lonlat = new OpenLayers.LonLat(6, 5);
|
||||||
t.ok( lonlat instanceof OpenLayers.LonLat, "new OpenLayers.LonLat returns LonLat object" );
|
t.ok( lonlat instanceof OpenLayers.LonLat, "new OpenLayers.LonLat returns LonLat object" );
|
||||||
t.eq( lonlat.lat, 5, "lonlat.lat is set correctly");
|
|
||||||
t.eq( lonlat.lon, 6, "lonlat.lon is set correctly");
|
t.eq( lonlat.lon, 6, "lonlat.lon is set correctly");
|
||||||
|
t.eq( lonlat.lat, 5, "lonlat.lat is set correctly");
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
t.ok( map.getCenter() instanceof OpenLayers.LonLat, "map.getCenter returns a LonLat");
|
t.ok( map.getCenter() instanceof OpenLayers.LonLat, "map.getCenter returns a LonLat");
|
||||||
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter");
|
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter");
|
||||||
t.eq( map.getResolution(), map.maxResolution, "map.getResolution() == map.maxResolution");
|
t.eq( map.getResolution(), map.maxResolution, "map.getResolution() == map.maxResolution");
|
||||||
t.eq( map.getCenter().lat, 1, "map center lat is correct after calling setCenter");
|
|
||||||
t.eq( map.getCenter().lon, 2, "map center lon is correct after calling setCenter");
|
t.eq( map.getCenter().lon, 2, "map center lon is correct after calling setCenter");
|
||||||
|
t.eq( map.getCenter().lat, 1, "map center lat is correct after calling setCenter");
|
||||||
}
|
}
|
||||||
function test_03_Map_add_layers(t) {
|
function test_03_Map_add_layers(t) {
|
||||||
t.plan(5);
|
t.plan(5);
|
||||||
@@ -59,8 +59,8 @@
|
|||||||
map.setCenter(new OpenLayers.LonLat(2, 1), 0);
|
map.setCenter(new OpenLayers.LonLat(2, 1), 0);
|
||||||
map.zoomIn();
|
map.zoomIn();
|
||||||
t.eq( map.getZoom(), 1, "map.zoom is correct after calling setCenter,zoom in");
|
t.eq( map.getZoom(), 1, "map.zoom is correct after calling setCenter,zoom in");
|
||||||
t.eq( map.getCenter().lat, 1, "map center lat is correct after calling setCenter,zoom in");
|
|
||||||
t.eq( map.getCenter().lon, 2, "map center lon is correct after calling setCenter, zoom in");
|
t.eq( map.getCenter().lon, 2, "map center lon is correct after calling setCenter, zoom in");
|
||||||
|
t.eq( map.getCenter().lat, 1, "map center lat is correct after calling setCenter,zoom in");
|
||||||
map.zoomOut();
|
map.zoomOut();
|
||||||
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
|
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
t.ok( marker instanceof OpenLayers.Marker, "new OpenLayers.Marker returns Marker object" );
|
t.ok( marker instanceof OpenLayers.Marker, "new OpenLayers.Marker returns Marker object" );
|
||||||
t.ok( marker.icon instanceof OpenLayers.Icon, "new marker.Icon returns Icon object" );
|
t.ok( marker.icon instanceof OpenLayers.Icon, "new marker.Icon returns Icon object" );
|
||||||
t.ok( marker.lonlat instanceof OpenLayers.LonLat, "new marker.lonlat returns LonLat object" );
|
t.ok( marker.lonlat instanceof OpenLayers.LonLat, "new marker.lonlat returns LonLat object" );
|
||||||
t.eq( marker.lonlat.lat, 1, "marker.lonlat.lat returns correct lat" );
|
|
||||||
t.eq( marker.lonlat.lon, 2, "marker.lonlat.lon returns correct lon" );
|
t.eq( marker.lonlat.lon, 2, "marker.lonlat.lon returns correct lon" );
|
||||||
|
t.eq( marker.lonlat.lat, 1, "marker.lonlat.lat returns correct lat" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
new OpenLayers.Size(5,6));
|
new OpenLayers.Size(5,6));
|
||||||
t.ok( tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object" );
|
t.ok( tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object" );
|
||||||
t.ok( tile.bounds instanceof OpenLayers.Bounds, "tile.bounds is a Bounds object" );
|
t.ok( tile.bounds instanceof OpenLayers.Bounds, "tile.bounds is a Bounds object" );
|
||||||
t.eq( tile.bounds.minlat, 1, "tile.bounds.minlat is set correctly");
|
|
||||||
t.eq( tile.bounds.maxlat, 3, "tile.bounds.maxlat is set correctly");
|
|
||||||
t.eq( tile.bounds.minlon, 2, "tile.bounds.minlon is set correctly");
|
t.eq( tile.bounds.minlon, 2, "tile.bounds.minlon is set correctly");
|
||||||
|
t.eq( tile.bounds.minlat, 1, "tile.bounds.minlat is set correctly");
|
||||||
t.eq( tile.bounds.maxlon, 4, "tile.bounds.maxlon is set correctly");
|
t.eq( tile.bounds.maxlon, 4, "tile.bounds.maxlon is set correctly");
|
||||||
|
t.eq( tile.bounds.maxlat, 3, "tile.bounds.maxlat is set correctly");
|
||||||
t.ok( tile.size instanceof OpenLayers.Size, "tile.size is a Size object" );
|
t.ok( tile.size instanceof OpenLayers.Size, "tile.size is a Size object" );
|
||||||
t.eq( tile.size.w, 5, "tile.size.w is set correctly");
|
t.eq( tile.size.w, 5, "tile.size.w is set correctly");
|
||||||
t.eq( tile.size.h, 6, "tile.size.h is set correctly");
|
t.eq( tile.size.h, 6, "tile.size.h is set correctly");
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
new OpenLayers.Size(5,6));
|
new OpenLayers.Size(5,6));
|
||||||
t.ok( tile instanceof OpenLayers.Tile.Image, "new OpenLayers.Tile returns Tile object" );
|
t.ok( tile instanceof OpenLayers.Tile.Image, "new OpenLayers.Tile returns Tile object" );
|
||||||
t.ok( tile.bounds instanceof OpenLayers.Bounds, "tile.bounds is a Bounds object" );
|
t.ok( tile.bounds instanceof OpenLayers.Bounds, "tile.bounds is a Bounds object" );
|
||||||
t.eq( tile.bounds.minlat, 1, "tile.bounds.minlat is set correctly");
|
|
||||||
t.eq( tile.bounds.maxlat, 3, "tile.bounds.maxlat is set correctly");
|
|
||||||
t.eq( tile.bounds.minlon, 2, "tile.bounds.minlon is set correctly");
|
t.eq( tile.bounds.minlon, 2, "tile.bounds.minlon is set correctly");
|
||||||
|
t.eq( tile.bounds.minlat, 1, "tile.bounds.minlat is set correctly");
|
||||||
t.eq( tile.bounds.maxlon, 4, "tile.bounds.maxlon is set correctly");
|
t.eq( tile.bounds.maxlon, 4, "tile.bounds.maxlon is set correctly");
|
||||||
|
t.eq( tile.bounds.maxlat, 3, "tile.bounds.maxlat is set correctly");
|
||||||
t.ok( tile.size instanceof OpenLayers.Size, "tile.size is a Size object" );
|
t.ok( tile.size instanceof OpenLayers.Size, "tile.size is a Size object" );
|
||||||
t.eq( tile.size.w, 5, "tile.size.w is set correctly");
|
t.eq( tile.size.w, 5, "tile.size.w is set correctly");
|
||||||
t.eq( tile.size.h, 6, "tile.size.h is set correctly");
|
t.eq( tile.size.h, 6, "tile.size.h is set correctly");
|
||||||
|
|||||||
Reference in New Issue
Block a user