123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- import { myBridge, previewMapBridge } from "./map.js";
- import { getMapToken, getServiceToken } from "@/service/map.js";
- export function invokeParams(ActionName, params) {
- console.log('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
- }
- })
- })
- }
- async function returnProxyUrl(url) {
- let arr = url.split('/');
- let username = '';
- let password = '';
- 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
- }
- }
- //回显各类集合体
- export async function geometryMeshEffect(params) {
- invokeParams('GeometryMeshEffect', {
- "status": params.status,
- "id": params.id,
- "data":params.data
- })
- }
- //回显二次绘制航线
- export async function showAndRedrawPath(params) {
- invokeParams('Draw', {
- "type": "polyline",
- "hasZ": true,
- "status": params.status,
- "path": params.path,
- "symbol": {
- "type": "line-3d",
- "symbolLayers": [
- {
- "type": "path",
- "profile": "circle",
- "material": {
- "color": params.color?params.color:[
- 0,
- 255,
- 0,
- 0.3
- ]
- },
- "width": params.radius?params.radius * 2 : 10,
- "height": params.radius?params.radius * 2 : 10,
- }
- ]
- },
- })
- }
- //查询航线网格
- export async function getPathCube(params) {
- invokeParams('GetPathCube', {
- "id": "pathCube",
- "status": params.status,
- "level": 23,
- "paths": params.paths,
- "radius": 5,
- })
- }
- //查询态势
- export async function movePoint(params) {
- invokeParams('MovePoint', {
- "status": params.status?"show":"hide"
- })
- }
|