Compare commits
11 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba42a3a1b5 | ||
|
|
739b821570 | ||
|
|
82f786c630 | ||
|
|
eb783aab37 | ||
|
|
a668730ec1 | ||
|
|
3aca63eabe | ||
|
|
7ca9d2ec83 | ||
|
|
0500b9cba2 | ||
|
|
581df4e5f1 | ||
|
|
a7da80c24b | ||
|
|
00dfc669d2 |
@@ -18,7 +18,7 @@
|
||||
{layers: 'basic'} );
|
||||
|
||||
var jpl_wms = new OpenLayers.Layer.KaMap( "Satellite",
|
||||
"/world/index.php", {g: "satellite", map: "world"});
|
||||
"http://www.openlayers.org/world/index.php", {g: "satellite", map: "world"});
|
||||
var dm_wms = new OpenLayers.Layer.WMS( "Canada",
|
||||
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
|
||||
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -60,6 +60,7 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 1);
|
||||
Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -124,20 +125,24 @@ OpenLayers.Control.MouseDefaults.prototype =
|
||||
defaultMouseUp: function (evt) {
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
if (this.zoomBox) {
|
||||
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||
|
||||
Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) {
|
||||
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
}
|
||||
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
|
||||
this.zoomBox = null;
|
||||
|
||||
} else {
|
||||
if (this.performedDrag) {
|
||||
this.map.setCenter(this.map.center);
|
||||
|
||||
@@ -47,9 +47,7 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
|
||||
this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan.");
|
||||
centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0));
|
||||
this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz, "Hold alt when clicking to show distance between selected points");
|
||||
this.switchModeTo("pan");
|
||||
this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); });
|
||||
return this.div;
|
||||
|
||||
},
|
||||
@@ -95,6 +93,8 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
this.performedDrag = false;
|
||||
var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
this.map.setCenter(newCenter, this.map.zoom + 2);
|
||||
Event.stop(evt);
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -104,8 +104,10 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
this.mouseDragStart = evt.xy.clone();
|
||||
this.performedDrag = false;
|
||||
this.startViaKeyboard = false;
|
||||
if (evt.shiftKey && this.mode !="zoombox") {
|
||||
this.switchModeTo("zoombox");
|
||||
this.startViaKeyboard = true;
|
||||
} else if (evt.altKey && this.mode !="measure") {
|
||||
this.switchModeTo("measure");
|
||||
} else if (!this.mode) {
|
||||
@@ -238,21 +240,24 @@ OpenLayers.Control.MouseToolbar.prototype =
|
||||
if (!Event.isLeftClick(evt)) return;
|
||||
switch (this.mode) {
|
||||
case "zoombox":
|
||||
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||
|
||||
Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) {
|
||||
var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );
|
||||
var end = this.map.getLonLatFromViewPortPx( evt.xy );
|
||||
var top = Math.max(start.lat, end.lat);
|
||||
var bottom = Math.min(start.lat, end.lat);
|
||||
var left = Math.min(start.lon, end.lon);
|
||||
var right = Math.max(start.lon, end.lon);
|
||||
var bounds = new OpenLayers.Bounds(left, bottom, right, top);
|
||||
var zoom = this.map.getZoomForExtent(bounds);
|
||||
this.map.setCenter(new OpenLayers.LonLat(
|
||||
(start.lon + end.lon) / 2,
|
||||
(start.lat + end.lat) / 2
|
||||
), zoom);
|
||||
}
|
||||
this.map.viewPortDiv.removeChild(document.getElementById("zoomBox"));
|
||||
this.zoomBox = null;
|
||||
this.leaveMode();
|
||||
if (this.startViaKeyboard) this.leaveMode();
|
||||
break;
|
||||
case "pan":
|
||||
if (this.performedDrag) {
|
||||
|
||||
@@ -182,6 +182,9 @@ OpenLayers.Layer.prototype = {
|
||||
'minExtent', 'maxExtent',
|
||||
'numZoomLevels'
|
||||
);
|
||||
if (this.map.maxZoomLevel && !this.numZoomLevels) {
|
||||
this.numZoomLevels = this.map.maxZoomLevel + 1;
|
||||
}
|
||||
for(var i=0; i < properties.length; i++) {
|
||||
if (this[properties[i]] == null) {
|
||||
this[properties[i]] = this.map[properties[i]];
|
||||
|
||||
@@ -63,7 +63,6 @@ OpenLayers.Layer.EventPane.prototype =
|
||||
} else {
|
||||
this.map.layerContainerDiv.appendChild(this.pane);
|
||||
}
|
||||
this.map.events.attachToElement(this.pane);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -49,7 +49,7 @@ OpenLayers.Layer.KaMap.prototype =
|
||||
*/
|
||||
getURL: function (bounds) {
|
||||
var mapRes = this.map.getResolution();
|
||||
var scale = this.map.getScale();
|
||||
var scale = Math.round((this.map.getScale() * 10000)) / 10000;
|
||||
var cellSize = new OpenLayers.Size(mapRes*this.tileSize.w, mapRes*this.tileSize.h);
|
||||
var pX = Math.round(((bounds.left) / cellSize.w) * this.tileSize.w);
|
||||
var pY = -Math.round(((bounds.top) / cellSize.h) * this.tileSize.h);
|
||||
|
||||
Reference in New Issue
Block a user