|
@@ -1,275 +1,285 @@
|
|
|
-import {myBridge,previewMapBridge} from "./map.js";
|
|
|
-import {getMapToken,getServiceToken} from "../../service/map.js";
|
|
|
+import { myBridge, previewMapBridge } from "./map.js";
|
|
|
+import { getMapToken, getServiceToken } from "../../service/map.js";
|
|
|
|
|
|
-export function invokeParams(ActionName,params){
|
|
|
- getMapToken().then(res =>{
|
|
|
- let token = res.data.msg[0].Rows[0].token;
|
|
|
- myBridge.bridgeContent.Invoke({
|
|
|
- 'ActionName': ActionName,
|
|
|
- "Parameters": {
|
|
|
- token: token,
|
|
|
- ...params
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+export function invokeParams(ActionName, params) {
|
|
|
+ getMapToken().then((res) => {
|
|
|
+ let token = res.data.msg[0].Rows[0].token;
|
|
|
+ myBridge.bridgeContent.Invoke({
|
|
|
+ ActionName: ActionName,
|
|
|
+ Parameters: {
|
|
|
+ token: token,
|
|
|
+ ...params,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
export function previewInvokeParams(ActionName, params) {
|
|
|
- getMapToken().then(res =>{
|
|
|
- let token = res.data.msg[0].Rows[0].token;
|
|
|
- previewMapBridge.bridgeContent.Invoke({
|
|
|
- 'ActionName': ActionName,
|
|
|
- "Parameters": {
|
|
|
- token: token,
|
|
|
- ...params
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ getMapToken().then((res) => {
|
|
|
+ let token = res.data.msg[0].Rows[0].token;
|
|
|
+ previewMapBridge.bridgeContent.Invoke({
|
|
|
+ ActionName: ActionName,
|
|
|
+ Parameters: {
|
|
|
+ token: token,
|
|
|
+ ...params,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-async function returnProxyUrl(url){
|
|
|
- let arr = url.split('/');
|
|
|
- let username = '';
|
|
|
- let password = '';
|
|
|
- debugger
|
|
|
- if(arr.indexOf('MapProxyApi') !== -1){ //不需要授权服务
|
|
|
- for(let i=0;i<arr.length;i++){
|
|
|
- if(arr[i] ==='getSceneServer'){
|
|
|
- username = arr[i+1];
|
|
|
- password = arr[i+2];
|
|
|
- const response = await getServiceToken(username,password);
|
|
|
- if(response?.data.length > 0){
|
|
|
- arr.splice(i-1, 4);
|
|
|
- return arr.join('/')+'/MapServiceProxy/'+response.data;
|
|
|
- }
|
|
|
- }
|
|
|
+async function returnProxyUrl(url) {
|
|
|
+ let arr = url.split("/");
|
|
|
+ let username = "";
|
|
|
+ let password = "";
|
|
|
+ debugger;
|
|
|
+ if (arr.indexOf("MapProxyApi") !== -1) {
|
|
|
+ //不需要授权服务
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ if (arr[i] === "getSceneServer") {
|
|
|
+ username = arr[i + 1];
|
|
|
+ password = arr[i + 2];
|
|
|
+ const response = await getServiceToken(username, password);
|
|
|
+ if (response?.data.length > 0) {
|
|
|
+ arr.splice(i - 1, 4);
|
|
|
+ return arr.join("/") + "/MapServiceProxy/" + response.data;
|
|
|
}
|
|
|
- }else{
|
|
|
- return url
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ return url;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-export function SetBackground(){
|
|
|
- invokeParams('SetBackground', {
|
|
|
- "opacity": 1,
|
|
|
- "color": "transparent",
|
|
|
- })
|
|
|
+export function SetBackground() {
|
|
|
+ invokeParams("SetBackground", {
|
|
|
+ opacity: 1,
|
|
|
+ color: "transparent",
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-export function FeatureThreeDimension(params){
|
|
|
- debugger
|
|
|
- if(params.token){
|
|
|
- params.url = "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/" + params.token;
|
|
|
- }
|
|
|
- invokeParams('FeatureThreeDimension', {
|
|
|
- "url": params.url,
|
|
|
- "status": params.status
|
|
|
- })
|
|
|
+export function FeatureThreeDimension(params) {
|
|
|
+ debugger;
|
|
|
+ if (params.token) {
|
|
|
+ params.url =
|
|
|
+ "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/" + params.token;
|
|
|
+ }
|
|
|
+ invokeParams("FeatureThreeDimension", {
|
|
|
+ url: params.url,
|
|
|
+ status: params.status,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//区县聚类
|
|
|
-export function MapClickByType(status){
|
|
|
- invokeParams('MapClickAll', {
|
|
|
- "status": status,
|
|
|
- "disableLayerIdList":["districtArea","districtStreet","bgFeaturelayer"]
|
|
|
- })
|
|
|
+export function MapClickByType(status) {
|
|
|
+ invokeParams("MapClickAll", {
|
|
|
+ status: status,
|
|
|
+ disableLayerIdList: ["districtArea", "districtStreet", "bgFeaturelayer"],
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//点查询
|
|
|
-export function AreaJsonRankShow(params){
|
|
|
- debugger
|
|
|
- invokeParams('AreaJsonRankShow', {
|
|
|
- "type": params.type, //qx、jz
|
|
|
- "district": null,
|
|
|
- "id": "AreaTextLayer",
|
|
|
- "title": "文本标绘",
|
|
|
- "status": params.status,
|
|
|
- "data": params.data,
|
|
|
- "symbol": {
|
|
|
- "color": [255, 255, 255, 1],
|
|
|
- "backgroundColor": [77, 161, 194, 0.4],
|
|
|
- "font": {
|
|
|
- "size": 12
|
|
|
- }
|
|
|
- },
|
|
|
- })
|
|
|
+export function AreaJsonRankShow(params) {
|
|
|
+ debugger;
|
|
|
+ invokeParams("AreaJsonRankShow", {
|
|
|
+ type: params.type, //qx、jz
|
|
|
+ district: null,
|
|
|
+ id: "AreaTextLayer",
|
|
|
+ title: "文本标绘",
|
|
|
+ status: params.status,
|
|
|
+ data: params.data,
|
|
|
+ symbol: {
|
|
|
+ color: [255, 255, 255, 1],
|
|
|
+ backgroundColor: [77, 161, 194, 0.4],
|
|
|
+ font: {
|
|
|
+ size: 12,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export async function AddBaseMapLayer() {
|
|
|
- let url = await returnProxyUrl("https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/93493321");
|
|
|
- console.log("1111",url);
|
|
|
- debugger
|
|
|
- invokeParams('AddBaseMapLayer', {
|
|
|
- "id": "BaseMap",
|
|
|
- "title": "BaseMap",
|
|
|
- "visible": true,
|
|
|
- "opacity": 1,
|
|
|
- url
|
|
|
- })
|
|
|
+ let url = await returnProxyUrl(
|
|
|
+ "https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/93493321"
|
|
|
+ );
|
|
|
+ console.log("1111", url);
|
|
|
+ debugger;
|
|
|
+ invokeParams("AddBaseMapLayer", {
|
|
|
+ id: "BaseMap",
|
|
|
+ title: "BaseMap",
|
|
|
+ visible: true,
|
|
|
+ opacity: 1,
|
|
|
+ url,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export async function AddZhenwuMapLayer() {
|
|
|
- let url = await returnProxyUrl("https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/37072265");
|
|
|
- console.log("1111",url);
|
|
|
- debugger
|
|
|
- invokeParams('AddBaseMapLayer', {
|
|
|
- "id": "BaseMapZhenwu",
|
|
|
- "title": "BaseMapZhenwu",
|
|
|
- "visible": true,
|
|
|
- "opacity": 1,
|
|
|
- url
|
|
|
- })
|
|
|
+ let url = await returnProxyUrl(
|
|
|
+ "https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/37072265"
|
|
|
+ );
|
|
|
+ console.log("1111", url);
|
|
|
+ debugger;
|
|
|
+ invokeParams("AddBaseMapLayer", {
|
|
|
+ id: "BaseMapZhenwu",
|
|
|
+ title: "BaseMapZhenwu",
|
|
|
+ visible: true,
|
|
|
+ opacity: 1,
|
|
|
+ url,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
export async function AddYaoganMapLayer() {
|
|
|
- let url = await returnProxyUrl("https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/50115036");
|
|
|
- console.log("1111",url);
|
|
|
- debugger
|
|
|
- invokeParams('AddBaseMapLayer', {
|
|
|
- "id": "BaseMapYaoGan",
|
|
|
- "title": "BaseMapYaoGan",
|
|
|
- "visible": true,
|
|
|
- "opacity": 1,
|
|
|
- "type": "tile",
|
|
|
- url
|
|
|
- })
|
|
|
+ let url = await returnProxyUrl(
|
|
|
+ "https://cimweb.zjw.sh.cegn.cn:2008/MapProxyApi/getSceneServer/ptgl/50115036"
|
|
|
+ );
|
|
|
+ console.log("1111", url);
|
|
|
+ debugger;
|
|
|
+ invokeParams("AddBaseMapLayer", {
|
|
|
+ id: "BaseMapYaoGan",
|
|
|
+ title: "BaseMapYaoGan",
|
|
|
+ visible: true,
|
|
|
+ opacity: 1,
|
|
|
+ type: "tile",
|
|
|
+ url,
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//关闭图层
|
|
|
export function clearAllLayer() {
|
|
|
- invokeParams('ClearMapLayers',{
|
|
|
- })
|
|
|
+ invokeParams("ClearMapLayers", {});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-export function AddSingleLayer(params){
|
|
|
- debugger;
|
|
|
- if(params.token){
|
|
|
- params.url = "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/" + params.token;
|
|
|
+export function AddSingleLayer(params) {
|
|
|
+ debugger;
|
|
|
+ if (params.token) {
|
|
|
+ params.url =
|
|
|
+ "https://cimweb.zjw.sh.cegn.cn:2008/MapServiceProxy/" + params.token;
|
|
|
+ }
|
|
|
+ let wkid = "0"; // 0 代表上海城建 1:代表3857
|
|
|
+ if (params.wkid) {
|
|
|
+ if (params.type == "动态地图" && params.wkid == "1") {
|
|
|
+ params.type = "dynamic";
|
|
|
}
|
|
|
- let wkid = "0" // 0 代表上海城建 1:代表3857
|
|
|
- if(params.wkid){
|
|
|
- if(params.type == "动态地图" && params.wkid =="1"){
|
|
|
- params.type = "dynamic"
|
|
|
- }
|
|
|
- if(params.type == "切片地图" && params.wkid =="1"){
|
|
|
- params.type = "tile"
|
|
|
- }
|
|
|
+ if (params.type == "切片地图" && params.wkid == "1") {
|
|
|
+ params.type = "tile";
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if(params.type=="scene"||params.type=='3DObject'){
|
|
|
- invokeParams('AddSingleLayer', {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "type": "scene",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- }
|
|
|
- else if(params.type=="bim"){
|
|
|
- switch (params.title) {
|
|
|
- case '朱家角车站':
|
|
|
- invokeParams('AddSingleLayer',
|
|
|
- {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "elevationInfo": { //下沉高度
|
|
|
- mode:"absolute-height",
|
|
|
- offset:-19.5
|
|
|
- },
|
|
|
- "type": "building",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- break;
|
|
|
- default:
|
|
|
- invokeParams('AddSingleLayer',
|
|
|
- {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "elevationInfo": { //下沉高度
|
|
|
- mode:"absolute-height",
|
|
|
- offset:-19.5
|
|
|
- },
|
|
|
- "type": "building",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- break
|
|
|
- }
|
|
|
+ if (params.type == "scene" || params.type == "3DObject") {
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ type: "scene",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ } else if (params.type == "bim") {
|
|
|
+ switch (params.title) {
|
|
|
+ case "朱家角车站":
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ elevationInfo: {
|
|
|
+ //下沉高度
|
|
|
+ mode: "absolute-height",
|
|
|
+ offset: -19.5,
|
|
|
+ },
|
|
|
+ type: "building",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ elevationInfo: {
|
|
|
+ //下沉高度
|
|
|
+ mode: "absolute-height",
|
|
|
+ offset: -19.5,
|
|
|
+ },
|
|
|
+ type: "building",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ break;
|
|
|
}
|
|
|
- else if(params.type=='mesh'){
|
|
|
- invokeParams('AddSingleLayer',
|
|
|
- {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- //"renderer":locationRenderer,
|
|
|
- "type": "mesh",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- return
|
|
|
- }
|
|
|
- else if(params.type=="dynamic"){
|
|
|
- invokeParams('AddSingleLayer', {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- // "sublayers": [
|
|
|
- // {
|
|
|
- // "id": 0
|
|
|
- // },{
|
|
|
- // "id": 1
|
|
|
- // }
|
|
|
- // ],
|
|
|
- "type": "dynamic",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- }
|
|
|
- else if(params.type=="tile"){
|
|
|
- invokeParams('AddSingleLayer', {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "type": "tile",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- }else if(params.type=="动态地图"){
|
|
|
- invokeParams('AddSingleLayer', {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "type": "shc_map",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- }else if(params.type=="切片地图"){
|
|
|
- let size = [256,256];
|
|
|
- let origin = {
|
|
|
- "x": -9080400.0,
|
|
|
- "y": 10002300
|
|
|
- };
|
|
|
- invokeParams('AddSingleLayer',
|
|
|
- {
|
|
|
- "id": params.id,
|
|
|
- "title": params.title,
|
|
|
- "visible": params.visible,
|
|
|
- "opacity": params.opacity === undefined?1:params.opacity,
|
|
|
- "url": params.url,
|
|
|
- "type": "shc_tile",
|
|
|
- "mapID": params.mapID
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
+ } else if (params.type == "mesh") {
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ //"renderer":locationRenderer,
|
|
|
+ type: "mesh",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } else if (params.type == "dynamic") {
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ // "sublayers": [
|
|
|
+ // {
|
|
|
+ // "id": 0
|
|
|
+ // },{
|
|
|
+ // "id": 1
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
+ type: "dynamic",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ } else if (params.type == "tile") {
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ type: "tile",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ } else if (params.type == "动态地图") {
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ type: "shc_map",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ } else if (params.type == "切片地图") {
|
|
|
+ let size = [256, 256];
|
|
|
+ let origin = {
|
|
|
+ x: -9080400.0,
|
|
|
+ y: 10002300,
|
|
|
+ };
|
|
|
+ invokeParams("AddSingleLayer", {
|
|
|
+ id: params.id,
|
|
|
+ title: params.title,
|
|
|
+ visible: params.visible,
|
|
|
+ opacity: params.opacity === undefined ? 1 : params.opacity,
|
|
|
+ url: params.url,
|
|
|
+ type: "shc_tile",
|
|
|
+ mapID: params.mapID,
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//地图洒点
|
|
|
+export function addDataPoint(is_clear, data) {
|
|
|
+ invokeParams("AddDataPoint", {
|
|
|
+ is_clear: true,
|
|
|
+ position: data,
|
|
|
+ is_goto: true,
|
|
|
+ });
|
|
|
+}
|