export function clearUpMap(saveEffect=false) { window.heatmapPrimitives = [] window.viewer.scene.groundPrimitives.removeAll() window.mmManager.removeAll() if(!saveEffect) { // for(let i = window.imageryManager.length-1; i>1; i--) { // window.imageryManager.remove(i) // } // window.pmtsManager.removeAll() // window.terrainManager.visible = false } return } export function clearResetMap(saveEffect=false) { window.heatmapPrimitives = [] window.viewer.scene.groundPrimitives.removeAll() window.mmManager.removeAll() setTimeout(() => { initPosition() }, 100) if(!saveEffect) { // for(let i = window.imageryManager.length-1; i>1; i--) { // window.imageryManager.remove(i) // } // window.pmtsManager.removeAll() // window.terrainManager.visible = false } return } export function mmClick(eventType, eventArg) { if (eventType == "EntSelected") { // console.log(eventArg._data.data) if(eventArg._data.data.pop) { eventArg._data.data.callback(eventArg) } } } export function AddLabelPoint(id, text, image, startPos, type, item, callback) { window.mmManager.add('Label', { id: id, position: [...startPos], text: text, image: image, data: { pop: true, iconType: type, callback: callback, ...item }, labelOption: { font: '18px sans-serif', fillColor: Freedo.Color.WHITE, outlineColor: Freedo.Color.ORANGE, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 文字水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.BOTTOM, //TOP|CENTER|BOTTOM, 文字竖直方向的焦点 pixelOffset: new Freedo.Cartesian2(0, -40), //文字的像素偏移量 disableDepthTestDistance: Number.POSITIVE_INFINITY, distanceDisplayCondition: new Freedo.DistanceDisplayCondition(0, 5000), //文字可显示的相机距离区间 show: true, //文字显示与否 }, billboardOption:{ disableDepthTestDistance: Number.POSITIVE_INFINITY, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 图片水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.BOTTOM, //TOP|CENTER|BOTTOM, 图片竖直方向的焦点 width: 32, //图片显示宽度, 默认为图片本身的像素宽度 height: 32, //图片显示高度, 默认为图片本身的像素高度 pixelOffset: new Freedo.Cartesian2(0, 0), //图片的像素偏移量 }, pointOption: { show: true, //点显示与否 } }); return } export function AddDivPointCase(item, color, text, callback) { const position = item.hasOwnProperty('longitude') ? [item.longitude, item.latitude, 0]: [item.lon, item.lat, 0] let size = 30 switch (text.length) { case 1: break case 2: break case 3: size = 40 break case 4: size = 50 break case 5: size = 60 break } window.mmManager.add('Label', { position, text, data: { pop: false, }, labelOption: { font: '16px sans-serif', fillColor: Freedo.Color.WHITE, outlineColor: Freedo.Color.WHITE, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 文字水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.CENTER, //TOP|CENTER|BOTTOM, 文字竖直方向的焦点 pixelOffset: new Freedo.Cartesian2(0, 0), //文字的像素偏移量 disableDepthTestDistance: Number.POSITIVE_INFINITY, show: true, //文字显示与否 }, billboardOption:{ show: false }, pointOption: { show: false, //点显示与否 } }); window.mmManager.add('DivPoint', { id: item.id, data: { pop: true, iconType: 'case', callback: callback, ...item }, show: true, position, text, color, size, }); return } export function AddOnlyLabel(id, text, startPos, type, item, callback) { window.mmManager.add('Label', { id: id, position: [...startPos], text: text, data: { pop: true, iconType: type, callback: callback, ...item }, labelOption: { font: '20px sans-serif', // fillColor: Freedo.Color.ORANGE, // outlineColor: Freedo.Color.ORANGE, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 文字水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.BOTTOM, //TOP|CENTER|BOTTOM, 文字竖直方向的焦点 pixelOffset: new Freedo.Cartesian2(0, 0), //文字的像素偏移量 disableDepthTestDistance: Number.POSITIVE_INFINITY, // distanceDisplayCondition: new Freedo.DistanceDisplayCondition(0, 5000), //文字可显示的相机距离区间 show: true, //文字显示与否 }, billboardOption:{ show: false }, pointOption: { show: false, //点显示与否 } }); return } export function AddLabel(id, text, startPos, type, item, callback) { window.mmManager.add('Label', { id: id, position: [...startPos], text: text, data: { pop: true, iconType: type, callback: callback, ...item }, labelOption: { font: '18px sans-serif', fillColor: Freedo.Color.WHITE, outlineColor: Freedo.Color.ORANGE, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 文字水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.BOTTOM, //TOP|CENTER|BOTTOM, 文字竖直方向的焦点 pixelOffset: new Freedo.Cartesian2(0, -40), //文字的像素偏移量 disableDepthTestDistance: Number.POSITIVE_INFINITY, // distanceDisplayCondition: new Freedo.DistanceDisplayCondition(0, 5000), //文字可显示的相机距离区间 show: true, //文字显示与否 }, billboardOption:{ disableDepthTestDistance: Number.POSITIVE_INFINITY, horizontalOrigin: Freedo.HorizontalOrigin.CENTER, //LEFT|CENTER|RIGHT, 图片水平方向的焦点 verticalOrigin: Freedo.VerticalOrigin.BOTTOM, //TOP|CENTER|BOTTOM, 图片竖直方向的焦点 width: 32, //图片显示宽度, 默认为图片本身的像素宽度 height: 32, //图片显示高度, 默认为图片本身的像素高度 pixelOffset: new Freedo.Cartesian2(0, 0), //图片的像素偏移量 }, pointOption: { show: true, //点显示与否 } }); return } export function AddDivPointHighlight(item, color) { const position = item.hasOwnProperty('longitude') ? [item.longitude, item.latitude, 0]: [item.lon, item.lat, 0] window.mmManager.add('DivPoint', { id: item.id, show: true, position, // offset: 50, color: color, size: 20, // maxDistance: 5000000 }); return } export function initPosition() { const cameraInfo = [114.86, 25.75, 30000.0, 0.0, -90.0, 0.0]; Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo) ; } export function initPage() { const cameraInfo = [114.86, 25.75, 14285000.0, 0.0, -90.0, 0.0]; Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo) ; } export function showPositin(lon,lat) { const cameraInfo = [lon, lat, 4000.0, 0.0, -90.0, 0.0]; Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo) ; } export function focusPoint(lon, lat) { const cameraInfo = [lon, lat, 1000.0, 0.0, -90.0, 0.0]; Freedo.FdCamera.flyToByCameraInfo(viewer.scene.camera, cameraInfo) ; } export function AddDynamicWall(positions, color) { return new Freedo.FdEffect.FdDynamicWall(viewer, { positions: Freedo.Cartesian3.fromDegreesArray(positions), color: new Freedo.Color(color[0], color[1], color[2], color[3] ), duration: 2000, //毫秒 direction: 1, height: 100, //高度 }, 2); } export function AddPolygon(positions, color, callback, id) { window.mmManager.add('Polygon', { // id: item.id, pts: positions, fillColor: color, // 面颜色 outline: true, // 是否显示边线 outlineColor: [255, 255, 255, 1], // 边线颜色 lineWidth: 2.0, // 边线宽度 clampToGround: true, //是否贴地显示 pointOption: { show: true, //点显示与否 }, data: { pop: true, callback: callback, id, }, // maxDistance: 5000000 }); return } export function AddPolygonLine(positions, color, callback, id) { console.log(positions, 'positions') window.mmManager.add('Line', { // id: item.id, pts: [positions], lineColor: [255, 255, 255, 1] // pts: positions, // // fillColor: color, // 面颜色 // // outline: true, // 是否显示边线 // // outlineColor: [255, 255, 255, 1], // 边线颜色 // // lineWidth: 2.0, // 边线宽度 // clampToGround: true, //是否贴地显示 // pointOption: { // show: true, //点显示与否 // }, // data: { // pop: true, // callback: callback, // id, // }, // maxDistance: 5000000 }); return }