浏览代码

git-svn-id: https://192.168.57.71/svn/qt@90 12fe181a-e57f-b044-8676-16dc139aa63e

ld_zhoutl 8 年之前
父节点
当前提交
f89e086ba2

+ 5 - 2
jdc/jdcweb/trunk/src/main/webapp/WEB-INF/view/sys/command.jsp

@@ -42,8 +42,11 @@
 	<div id="divMap" class="divchangecmdmap" title="切换" style="display:none">
 		<a href="javascript:void(0)" id="mapLink" class="mapicon" onclick="changecmdmap('1');"></a>
 	</div>
-	<div id="divWaterway" class="divchangecmdmap" title="切换">
-		<a href="javascript:void(0)" id="satelliteLink" class="watericon" onclick="changecmdmap('2');"></a>
+	<div id="divSatellite" class="divchangecmdmap" title="切换">
+		<a href="javascript:void(0)" id="satelliteLink" class="satelliteicon" onclick="changecmdmap('2');"></a>
+	</div>
+	<div id="divWaterway" class="divchangecmdmap" title="切换" style="display:none">
+		<a href="javascript:void(0)" id="satelliteLink" class="watericon" onclick="changecmdmap('3');"></a>
 	</div>
 	<div id="divSmall" class="arrowdiv">
 		<a href="javascript:void(0)" class="arrowright" onclick="showRightDiv();"></a>

+ 72 - 32
jdc/jdcweb/trunk/src/main/webapp/static/xt/js/sys/common_command.js

@@ -5,6 +5,7 @@
 var basicType;
 
 var map;
+var airBaseLayer2;
 var commdBaseLayer;
 var roadPathStyle;
 var roadPathStyleSdyx;//速度优先
@@ -43,6 +44,8 @@ var terminalTrackLayer;
 var routeMarkerArr = [];
 /**任务ID*/
 var currentTaskId = null;
+// 终端设备
+var m_deviceId = null;
 
 /** 地图切换用 */ 
 // 当前地图类型(1.公路; 2.水路)
@@ -107,6 +110,10 @@ function initCommd() {
     matouVectorLayer = new SuperMap.Layer.Vector("Vector Layer", {renderers: ["Canvas2"]});
     boweiVectorLayer = new SuperMap.Layer.Vector("Vector Layer", {renderers: ["Canvas2"]});
     taskMarkerlayer = new SuperMap.Layer.Markers("任务图层"); // 任务信息
+    // 路径规划图层
+    ljghResSfzLayer = new SuperMap.Layer.Markers("路径规划资源图层收费站"); // // 路径规划资源图层收费站
+    ljghResFwqLayer = new SuperMap.Layer.Markers("路径规划资源图层服务区"); // // 路径规划资源图层服务区
+    ljghResCameraLayer = new SuperMap.Layer.Markers("路径规划资源图层摄像头"); // // 路径规划资源图层摄像头
 
     //给在vector图层上所选择的要素初始化
     gangquSelect = new SuperMap.Control.SelectFeature(gangquVectorLayer, {
@@ -142,7 +149,8 @@ function initCommd() {
             sdMarkerlayer, jczMarkerlayer, fwqMarkerlayer, sfzMarkerlayer
             , hczMarkerlayer,jtsnMarkerlayer,ptzdMarkerlayer
             ,tempMarkerLayer,aisMarkerlayer,
-            gangquVectorLayer, matouVectorLayer, boweiVectorLayer]);
+            gangquVectorLayer, matouVectorLayer, boweiVectorLayer,
+            ljghResSfzLayer,ljghResFwqLayer,ljghResCameraLayer]);
 
     basicType = [ 
     {
@@ -261,6 +269,10 @@ function initCommd() {
      * 每10秒查询飞机动态信息
      */
     setInterval(addAirData, 10000);
+    /**
+     * 每3秒查询终端图层信息
+     */
+    setInterval(addTerminalData, 5000);
 }
 /**
  * 初始化地图
@@ -294,9 +306,6 @@ function initCommdMap(baseUrl) {
     ljghSegmentLayer = new SuperMap.Layer.Vector("路径规划路段"); // 路段
     ljghMarkerLayer = new SuperMap.Layer.Markers("路径规划选中坐标"); // // 路径规划   图标层
     ljghResourcesLayer = new SuperMap.Layer.Markers("路径规划资源图层"); // // 路径规划资源图层
-    ljghResSfzLayer = new SuperMap.Layer.Markers("路径规划资源图层收费站"); // // 路径规划资源图层收费站
-    ljghResFwqLayer = new SuperMap.Layer.Markers("路径规划资源图层服务区"); // // 路径规划资源图层服务区
-    ljghResCameraLayer = new SuperMap.Layer.Markers("路径规划资源图层摄像头"); // // 路径规划资源图层摄像头
     // 终端轨迹图层
     terminalTrackLayer = new SuperMap.Layer.Vector("终端轨迹"); // 终端
 
@@ -349,11 +358,44 @@ function initCommdMap(baseUrl) {
         };
 
     commdBaseLayer.events.on({
-        "layerInitialized" : addWaterWayLayer
+        "layerInitialized" : addAirLayer
     });
 
 }
 
+/**
+ * 每3秒查询终端图层信息
+ * Ajax  GET 请求
+ * @param params
+ */
+function addTerminalData() {
+    var terminalFlg = $("#"+tc_terminal).prop("checked");
+	if(terminalFlg == true) {
+		$.get(basePath + "/terminal/getpos", {
+        	"userId" : ""
+        }, function(result) {
+            var len = result.length;
+            var targetLayer = $.getBasicLayer(tc_terminal, basicType);
+            targetLayer.clearMarkers();
+            for (var i = 0; i < len; i++) {
+                addTerminalMarker(result[i], tc_terminal);
+            }
+            if(terminalTrackLayer.features.length > 0 && m_deviceId != null) {
+            	// 并设置终端轨迹
+            	queryTerminalRoute(m_deviceId, null, null);
+            }
+        }, 'json');
+	}
+}
+function addAirLayer() {
+    //初始化图层
+    airBaseLayer2 = new SuperMap.Layer.TiledDynamicRESTLayer("底图2", img_base_url, {
+        transparent: true,
+        cacheEnabled: true
+    }, {maxResolution: "auto"});
+
+    airBaseLayer2.events.on({"layerInitialized": addWaterWayLayer});
+}
 function addWaterWayLayer() {
     //初始化水路图层
     waterWayBaseLayer = new SuperMap.Layer.TiledDynamicRESTLayer("底图", gk_url, {
@@ -363,14 +405,6 @@ function addWaterWayLayer() {
     //监听图层信息加载完成事件
     waterWayBaseLayer.events.on({"layerInitialized": addCommdIntersection});
 }
-function addWaterWayLayer1() {
-    //初始化水路图层2
-    waterWayBaseLayer2 = new SuperMap.Layer.TiledDynamicRESTLayer("底图2", gk1_url, {
-        transparent: true,
-        cacheEnabled: true
-    });
-    waterWayBaseLayer2.events.on({"layerInitialized": addCommdIntersection});
-}
 
 function addIntersection(type) {
     queryCity(type, function(result) {
@@ -500,16 +534,7 @@ function initCommandBasicInfoEvent(name) {
             queryUTFGrid(params, base_features_url, airPortStopAirCompleted);
         }
     } else if (name == tc_terminal) {
-        $.get(basePath + "/terminal/getpos", {
-        	"userId" : ""
-        }, function(result) {
-            var len = result.length;
-            var targetLayer = $.getBasicLayer(name, basicType);
-            targetLayer.clearMarkers();
-            for (var i = 0; i < len; i++) {
-                addTerminalMarker(result[i], name);
-            }
-        }, 'json');
+    	addTerminalData();
     } else if (name == tc_task) {
         $.get(basePath + "/commandTask/findTaskLjghList", {
         	id : ""
@@ -552,7 +577,7 @@ function initCommandBasicInfoEvent(name) {
     }  else if (name == "chuanbo") {
     	singleShipFlg = false;
         singleShipMmsi = "";
-        changecmdmap("2");
+        changecmdmap("3");
         addAisData(10);
     } else if (name == tc_jtsn || name == tc_ptzd) {
         // 在地图上添加铁路站点列表
@@ -665,11 +690,11 @@ function openCommandBasicInfoWin(objMarker) {
 
 function addCommdIntersection() {
     commdBaseLayer.isBaseLayer = true;
+    airBaseLayer2.isBaseLayer = true;
     waterWayBaseLayer.isBaseLayer = true;
 //    waterWayBaseLayer2.isBaseLayer = true;
-    map.addLayers([ commdBaseLayer, segmentLayer, intersectionLayer, selectMarkerLayer,
+    map.addLayers([ commdBaseLayer, airBaseLayer2, segmentLayer, intersectionLayer, selectMarkerLayer,
                     ljghSegmentLayer, ljghMarkerLayer, ljghResourcesLayer,
-                    ljghResSfzLayer,ljghResFwqLayer,ljghResCameraLayer,
                     waterWayBaseLayer, segmentWaterLayer]);
 
     // 显示地图范围
@@ -1087,7 +1112,7 @@ function closeRoutePopupWin() {
 function addTerminalMarker(obj, name) {
     var icon_url = "assets/images/basic/marker_terminal.png";
     var targetLayer = $.getBasicLayer(name, basicType);
-    var size = new SuperMap.Size(27, 39);
+    var size = new SuperMap.Size(21, 30);
     var icon = new SuperMap.Icon(icon_url, size, null);
     var marker = new SuperMap.Marker(new SuperMap.LonLat(obj.lon, obj.lat), icon);
     marker.events.on({
@@ -1136,6 +1161,7 @@ function getDeviceInfo(marker) {
  *
  */
 function queryTerminalRoute(deviceId,lon,lat) {
+	m_deviceId = deviceId;
     $.get(basePath + "/terminal/track", {'deviceId': deviceId}, function (result) {
     	/*if(result && result.length > 0) {
             // 缩放地图比例
@@ -1148,7 +1174,7 @@ function queryTerminalRoute(deviceId,lon,lat) {
     	}*/
         if(result && result.route) {
             // 缩放地图比例
-            setMapCenter(lat, lon, 11);
+            //setMapCenter(lat, lon, 11);
             // 绘制轨迹
             addTerminalPath(result);
         }
@@ -1210,15 +1236,29 @@ function changecmdmap(type){
     currMapType = type;
     if("1" == type) {
         $("#divMap").css("display","none");
-        $("#divWaterway").css("display","block");
+        $("#divSatellite").css("display","block");
+        $("#divWaterway").css("display","none");
         commdBaseLayer.setVisibility(true);
+        airBaseLayer2.setVisibility(false);
         waterWayBaseLayer.setVisibility(false);
-        //waterWayBaseLayer2.setVisibility(false);
         map.setBaseLayer(commdBaseLayer);
     } else if("2" == type) {
+        $("#divMap").css("display","none");
+        $("#divSatellite").css("display","none");
+        $("#divWaterway").css("display","block");
+        commdBaseLayer.setVisibility(false);
+        airBaseLayer2.setVisibility(true);
+        waterWayBaseLayer.setVisibility(false);
+        map.setBaseLayer(airBaseLayer2);
+        mapMoveChange();
+    } else if("3" == type) {
         $("#divMap").css("display","block");
+        $("#divSatellite").css("display","none");
         $("#divWaterway").css("display","none");
         commdBaseLayer.setVisibility(false);
+        airBaseLayer2.setVisibility(false);
+        waterWayBaseLayer.setVisibility(true);
+        map.setBaseLayer(waterWayBaseLayer);
         mapMoveChange();
     }
 }
@@ -1230,7 +1270,7 @@ function mapMoveChange() {
     // 当地图movechange后,水路Vertor层重新设置
     displayWaterLayer();
     zoom = map.getZoom();
-    if("2" == currMapType) {
+    if("3" == currMapType) {
 //        if (zoom > 4) {
 //            waterWayBaseLayer2.setVisibility(true);
 //            waterWayBaseLayer.setVisibility(false);
@@ -1255,7 +1295,7 @@ function mapMoveChange() {
  * 根据船舶信息定位d
  */
 function initShipInfoByMmsi(mmsi) {
-    changecmdmap("2");
+    changecmdmap("3");
     singleShipFlg = true;
     singleShipMmsi = mmsi;
     var params = {