1. 程式人生 > >Arcgis實現多視窗同步功能

Arcgis實現多視窗同步功能

本功能通過arcgis javascript api 實現多視窗地圖範圍大小同步!

效果圖如下:

具體程式碼有:

dojo.connect(map, "onLoad", function () {
	dojo.connect(map, "onMouseDragEnd", showCoordinates);//滑鼠移動的同步
	dojo.connect(map, "onMouseWheel", showCoordinates);//滑鼠滾輪的同步
	dojo.connect(map, "onDblClick", showCoordinates);//雙擊事件的同步
});
//同步放大縮小
var mapList = ["map1", "map2", "map3", "map4"];
	function showCoordinates (event) {
		window.setTimeout (function () {
			var extent = map.extent;
			for (var i=0;i<mapList.length;i++) {
				var mapName = mapList[i];
				if (source != mapName) {
					if (parent.frames[mapName].map != null) {
						parent.frames[mapName].map.setExtent(extent, true);
					}
				}
			}
		}, 500);
	}