diff --git a/src/main/resources/static/js/synthesisQuery/common.js b/src/main/resources/static/js/synthesisQuery/common.js new file mode 100644 index 0000000..b0a79e2 --- /dev/null +++ b/src/main/resources/static/js/synthesisQuery/common.js @@ -0,0 +1,1927 @@ +"use script"; + +const parentGlobal = window.parent || window; + +parentGlobal.mars3d = mars3d; // widget中使用 + +const newMapOptions = { + scene: { + center: { + lat: 30.526361, + lng: 116.335987, + alt: 45187, + heading: 0, + pitch: -45, + }, + scene3DOnly: false, + shadows: false, + removeDblClick: true, + sceneMode: 3, + showSun: true, + showMoon: true, + showSkyBox: true, + showSkyAtmosphere: true, + fog: true, + fxaa: true, + orderIndependentTranslucency: true, + requestRenderMode: false, + contextOptions: { + requestWebgl1: false, + }, + globe: { + depthTestAgainstTerrain: false, + baseColor: "#546a53", + showGroundAtmosphere: true, + enableLighting: false, + }, + cameraController: { + zoomFactor: 3.0, + minimumZoomDistance: 1, + maximumZoomDistance: 50000000, + enableRotate: true, + enableTranslate: true, + enableTilt: true, + enableZoom: true, + enableCollisionDetection: true, + minimumCollisionTerrainHeight: 15000, + }, + }, + control: { + homeButton: true, + baseLayerPicker: true, + sceneModePicker: true, + vrButton: false, + fullscreenButton: true, + navigationHelpButton: true, + animation: false, + timeline: false, + infoBox: false, + geocoder: false, + selectionIndicator: false, + contextmenu: { hasDefault: false }, + mouseDownView: true, + zoom: { insertIndex: 1 }, + compass: { bottom: "toolbar", left: "5px" }, + distanceLegend: { left: "10px", bottom: "2px" }, + locationBar: { + fps: true, + crs: "CGCS2000_GK_Zone_3", + crsDecimal: 0, + template: + "
经度:{lng}
纬度:{lat}
横{crsx} 纵{crsy}
海拔:{alt}米
层级:{level}
方向:{heading}°
俯仰角:{pitch}°
视高:{cameraHeight}米
", + }, + }, + method: { + templateValues: { + mars3d_data: "//data.mars3d.cn", + }, + }, + terrain: { + url: "https://data.mars3d.cn/terrain", + show: true, + }, + basemaps: [ + { id: 10, name: "地图底图", type: "group" }, + { + id: 2021, + pid: 10, + name: "天地图影像", + icon: "../../img/mars-map-img/tdt_img.png", + type: "group", + layers: [ + { name: "底图", type: "tdt", layer: "img_d" }, + { name: "注记", type: "tdt", layer: "img_z" }, + ], + show: true, + }, + { + pid: 10, + name: "天地图电子", + icon: "../../img/mars-map-img/tdt_vec.png", + type: "group", + layers: [ + { name: "底图", type: "tdt", layer: "vec_d" }, + { name: "注记", type: "tdt", layer: "vec_z" }, + ], + }, + { + pid: 10, + name: "高德影像", + type: "group", + icon: "../../img/mars-map-img/gaode_img.png", + layers: [ + { name: "底图", type: "gaode", layer: "img_d" }, + { name: "注记", type: "gaode", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "高德电子", + type: "gaode", + icon: "../../img/mars-map-img/gaode_vec.png", + layer: "vec", + }, + { + pid: 10, + name: "百度影像", + type: "group", + icon: "../../img/mars-map-img/bd-img.png", + layers: [ + { name: "底图", type: "baidu", layer: "img_d" }, + { name: "注记", type: "baidu", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "百度电子", + icon: "../../img/mars-map-img/bd-vec.png", + type: "baidu", + layer: "vec", + }, + { + pid: 10, + name: "腾讯影像", + icon: "../../img/mars-map-img/tencent_img.png", + type: "group", + layers: [ + { name: "底图", type: "tencent", layer: "img_d" }, + { name: "注记", type: "tencent", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "腾讯电子", + icon: "../../img/mars-map-img/tencent_vec.png", + type: "tencent", + layer: "vec", + }, + { + pid: 10, + name: "ArcGIS影像", + icon: "../../img/mars-map-img/esriWorldImagery.png", + type: "xyz", + url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", + enablePickFeatures: false, + }, + ], + layers: [ + { + id: 50, + name: "辅助图层", + type: "group", + }, + { + pid: 50, + type: "graticule", + name: "经纬网", + }, + { + pid: 50, + name: "行政区划界线", + type: "tdt", + layer: "xzqh", + mapSplit: false, + }, + { + pid: 50, + name: "高德实时路况", + type: "gaode", + layer: "time", + minimumTerrainLevel: 4, + minimumLevel: 4, + proxy: "//server.mars3d.cn/proxy/", + mapSplit: false, + }, + { + pid: 50, + name: "百度实时路况", + type: "baidu", + layer: "time", + mapSplit: false, + }, + { + id: 60, + name: "地形", + type: "group", + }, + { + pid: 60, + type: "terrain", + name: "Cesium地形", + terrainType: "ion", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "Mars3D地形", + terrainType: "xyz", + url: "{mars3d_data}/terrain", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "ArcGIS地形", + terrainType: "arcgis", + url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "无地形", + terrainType: "none", + radio: true, + }, + { + id: 40, + name: "栅格数据", + type: "group", + }, + { + id: 4020, + pid: 40, + name: "OGC WMS服务", + type: "group", + }, + { + pid: 4020, + name: "教育设施点", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfjy", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + popup: "名称:{项目名称}
类型:{设施类型}
面积:{用地面积}亩
位置:{具体位置}", + mapSplit: false, + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "道路线", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfdl", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + center: { + lat: 31.743214, + lng: 117.277097, + alt: 47197.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "all", + mapSplit: false, + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "建筑物面", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfjzw", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + highlight: { + showTime: 5000, + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.79513, + lng: 117.236172, + alt: 3784.6, + heading: 0.7, + pitch: -42.2, + }, + popup: "all", + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "规划面", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfgh", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + center: { + lat: 31.743214, + lng: 117.277097, + alt: 47197.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "all", + show: false, + flyTo: true, + }, + { + id: 4030, + pid: 40, + name: "ArcGIS 瓦片", + type: "group", + }, + { + pid: 4030, + name: "合肥规划图", + type: "arcgis_cache", + url: "{mars3d_data}/arcgis_cache/hfgh/_alllayers/{z}/{y}/{x}.png", + minimumLevel: 1, + maximumLevel: 17, + minimumTerrainLevel: 1, + maximumTerrainLevel: 17, + rectangle: { + xmin: 116.846, + xmax: 117.642, + ymin: 31.533, + ymax: 32.185, + }, + }, + { + id: 4010, + pid: 40, + name: "ArcGIS Dynamic", + type: "group", + }, + { + id: 401085, + pid: 4010, + type: "arcgis", + name: "主要道路", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + layers: "24", + highlight: { + type: "polyline", + color: "#2deaf7", + width: 4, + clampToGround: true, + }, + center: { + lat: 31.814176, + lng: 117.225362, + alt: 5105.3, + heading: 359.2, + pitch: -83.1, + }, + popup: "all", + mapSplit: false, + }, + { + id: 401086, + pid: 4010, + type: "arcgis", + name: "建筑物", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + layers: "35,36,37,39", + highlight: { + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 2916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + id: 401087, + pid: 4010, + type: "arcgis", + name: "规划", + url: "//server.mars3d.cn/arcgis/rest/services/mars/guihua/MapServer", + highlight: { + showTime: 5000, + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 2916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: [ + { + field: "用地名称", + name: "名称", + }, + { + field: "用地编号", + name: "编号", + }, + { + field: "规划用地", + name: "规划", + }, + { + type: "html", + html: "
数据仅供参考
", + }, + ], + popupNoTitle: true, + }, + { + id: 30, + name: "矢量数据", + type: "group", + }, + { + id: 3030, + pid: 30, + name: "GeoJSON数据", + type: "group", + }, + { + id: 303011, + pid: 3030, + type: "geojson", + name: "平台标绘", + url: "{mars3d_data}/file/geojson/mars3d-draw.json", + popup: "{type}{name}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "用地规划", + url: "{mars3d_data}/file/geojson/guihua.json", + symbol: { + styleOptions: { + opacity: 0.6, + color: "#0000FF", + width: 3, + clampToGround: true, + }, + styleField: "类型", + styleFieldOptions: { + 一类居住用地: { + color: "#FFDF7F", + }, + 二类居住用地: { + color: "#FFFF00", + }, + 社区服务用地: { + color: "#FF6A38", + }, + 幼托用地: { + color: "#FF6A38", + }, + 商住混合用地: { + color: "#FF850A", + }, + 行政办公用地: { + color: "#FF00FF", + }, + 文化设施用地: { + color: "#FF00FF", + }, + 小学用地: { + color: "#FF7FFF", + }, + 初中用地: { + color: "#FF7FFF", + }, + 体育场用地: { + color: "#00A57C", + }, + 医院用地: { + color: "#A5527C", + }, + 社会福利用地: { + color: "#FF7F9F", + }, + 商业用地: { + color: "#FF0000", + }, + 商务用地: { + color: "#7F0000", + }, + 营业网点用地: { + color: "#FF7F7F", + }, + 一类工业用地: { + color: "#A57C52", + }, + 社会停车场用地: { + color: "#C0C0C0", + }, + 通信用地: { + color: "#007CA5", + }, + 排水用地: { + color: "#00BFFF", + }, + 公园绿地: { + color: "#00FF00", + }, + 防护绿地: { + color: "#007F00", + }, + 河流水域: { + color: "#7FFFFF", + }, + 配建停车场: { + color: "#ffffff", + }, + 道路用地: { + color: "#ffffff", + }, + }, + }, + popup: "{类型}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "建筑物面", + url: "{mars3d_data}/file/geojson/buildings-demo.json", + symbol: { + styleOptions: { + color: "#0d3685", + outlineColor: "#0d3685", + opacity: 0.8, + }, + }, + buildings: { + cloumn: "floors", + height: "flo_height", + }, + popup: "all", + flyTo: true, + flyToOptions: { + minHeight: 2000, + }, + }, + { + pid: 3030, + type: "geojson", + name: "安徽各市", + url: "{mars3d_data}/file/geojson/areas/340000_full.json", + symbol: { + type: "polygon", + styleOptions: { + materialType: "PolyGradient", + materialOptions: { + color: "rgb(15,176,255)", + opacity: 0.7, + alphaPower: 1.3, + }, + label: { + text: "{name}", + opacity: 1, + font_size: 25, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + outlineWidth: 3, + scaleByDistance: true, + scaleByDistance_far: 2743804, + scaleByDistance_farValue: 0.3, + scaleByDistance_near: 10000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 2743804, + distanceDisplayCondition_near: 0, + }, + }, + }, + popup: "{name}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "中国省界", + url: "{mars3d_data}/file/geojson/areas/100000_full.json", + symbol: { + type: "polylineP", + styleOptions: { + color: "#ffffff", + width: 2, + opacity: 0.8, + label: { + text: "{name}", + position: "center", + font_size: 30, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + scaleByDistance: true, + scaleByDistance_far: 60000000, + scaleByDistance_farValue: 0.2, + scaleByDistance_near: 1000000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 12000000, + distanceDisplayCondition_near: 0, + }, + }, + }, + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "西藏垭口", + url: "{mars3d_data}/file/geojson/xizangyakou.json", + symbol: { + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scaleByDistance: true, + scaleByDistance_far: 5000000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + verticalOrigin: 1, + horizontalOrigin: 0, + clampToGround: true, + label: { + text: "{NAME}", + font_size: 25, + color: "#ffff00", + font_family: "微软雅黑", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -40, + scaleByDistance: true, + scaleByDistance_far: 1000000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 1000000, + distanceDisplayCondition_near: 0, + visibleDepth: true, + }, + }, + }, + popup: [ + { + field: "NAME", + name: "名称", + }, + { + type: "details", + callback: "showPopupDetails", + field: "图片", + className: "mars3d-popup-btn-custom", + }, + ], + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "体育设施点", + url: "{mars3d_data}/file/geojson/hfty-point.json", + symbol: { + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scale: 1, + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + verticalOrigin: 1, + horizontalOrigin: 0, + clampToGround: true, + label: { + text: "{项目名称}", + font_size: 25, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -25, + scaleByDistance: true, + scaleByDistance_far: 80000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 80000, + distanceDisplayCondition_near: 0, + }, + }, + }, + popup: [ + { + field: "项目名称", + name: "项目名称", + }, + { + field: "建设性质", + name: "建设性质", + }, + { + field: "设施级别", + name: "设施级别", + }, + { + field: "所属区县", + name: "所属区县", + }, + { + field: "建筑内容及", + name: "建筑内容", + }, + { + field: "新增用地(", + name: "新增用地", + }, + { + field: "开工", + name: "开工", + }, + { + field: "总投资(万", + name: "总投资", + }, + { + field: "资金来源", + name: "资金来源", + }, + { + field: "初步选址", + name: "初步选址", + }, + { + field: "设施类型", + name: "设施类型", + }, + { + field: "设施等级", + name: "设施等级", + }, + { + field: "所在区县", + name: "所在区县", + }, + { + field: "具体位置", + name: "具体位置", + }, + { + field: "建设内容(", + name: "建设内容", + }, + { + field: "用地面积(", + name: "用地面积", + format: "mars3d.MeasureUtil.formatArea", + }, + { + field: "设施规模(", + name: "设施规模", + }, + { + field: "举办者类型", + name: "举办者类型", + }, + { + field: "开工时间", + name: "开工时间", + }, + { + field: "总投资额(", + name: "总投资额", + unit: "亿元", + }, + { + field: "项目推进主", + name: "项目推进主体", + }, + { + field: "项目进度", + name: "项目进度", + }, + { + field: "项目来源", + name: "项目来源", + }, + { + field: "备注", + name: "备注", + }, + ], + show: false, + flyTo: true, + }, + { + id: 3070, + pid: 30, + name: "GeoServer WFS", + type: "group", + }, + { + pid: 3070, + type: "wfs", + name: "建筑物面", + url: "//server.mars3d.cn/geoserver/mars/ows", + layer: "mars:hfjzw", + parameters: { + maxFeatures: 500, + }, + minimumLevel: 15, + symbol: { + type: "polygonP", + styleOptions: { + color: "#00469c", + outline: false, + opacity: 1, + }, + }, + buildings: { + cloumn: "floor", + }, + center: { + lat: 31.818396, + lng: 117.229083, + alt: 2554.4, + heading: 359.2, + pitch: -83.1, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + pid: 3070, + name: "教育设施点", + type: "wfs", + url: "//server.mars3d.cn/geoserver/mars/ows", + layer: "mars:hfjy", + parameters: { + maxFeatures: 500, + }, + minimumLevel: 13, + symbol: { + type: "billboardP", + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.6, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + clampToGround: true, + label: { + text: "{项目名称}", + font_size: 15, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -30, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 2000, + distanceDisplayCondition_near: 0, + }, + }, + }, + center: { + lat: 31.812256, + lng: 117.229873, + alt: 4683.91, + heading: 357.4, + pitch: -65.4, + }, + popup: "all", + }, + { + id: 3010, + pid: 30, + name: "ArcGIS WFS", + type: "group", + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "兴趣点", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/1", + where: " 1=1 ", + minimumLevel: 15, + center: { + lat: 31.818396, + lng: 117.229083, + alt: 2554.4, + heading: 359.2, + pitch: -83.1, + }, + symbol: { + type: "billboardP", + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-blue.png", + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.6, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + clampToGround: true, + label: { + text: "{NAME}", + font_size: 15, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -30, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 3000, + distanceDisplayCondition_near: 0, + }, + }, + styleField: "address", + styleFieldOptions: { + AB03: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + }, + A980: { + image: "https://data.mars3d.cn/img/marker/mark-blue.png", + }, + A900: { + image: "https://data.mars3d.cn/img/marker/mark-green.png", + }, + }, + }, + popup: "名称:{NAME}
地址:{address}", + show: false, + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "道路", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/28", + minimumLevel: 14, + symbol: { + type: "polylineP", + styleOptions: { + color: "#3388ff", + width: 3, + clampToGround: true, + }, + styleField: "NAME", + styleFieldOptions: { + 祁门路: { + color: "#8744c0", + width: 3, + }, + 东流路: { + color: "#f7ba2a", + width: 3, + }, + 翡翠路: { + color: "#20a0ff", + width: 3, + }, + 岳西路: { + color: "#50bfff", + width: 3, + }, + }, + }, + popup: "名称:{NAME}", + center: { + lat: 31.814176, + lng: 117.225362, + alt: 5105.3, + heading: 359.2, + pitch: -83.1, + }, + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "建筑物面", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/37", + minimumLevel: 15, + symbol: { + styleOptions: { + color: "#0d3685", + outlineColor: "#0d3685", + opacity: 0.8, + }, + }, + buildings: { + cloumn: "floor", + }, + debuggerTileInfo: false, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 1916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + id: 3060, + pid: 30, + name: "CZML数据", + type: "group", + }, + { + id: 306010, + pid: 3060, + type: "czml", + name: "汽车", + url: "{mars3d_data}/file/czml/car.czml", + center: { + lat: 40.894745, + lng: 121.920252, + alt: 904, + heading: 64, + pitch: -67, + }, + radio: true, + flyTo: true, + }, + { + id: 306011, + pid: 3060, + type: "czml", + name: "卫星轨道", + url: "{mars3d_data}/file/czml/satellite-simple.czml", + popup: "all", + radio: true, + flyTo: true, + }, + { + id: 3050, + pid: 30, + name: "KML数据", + type: "group", + }, + { + pid: 3050, + type: "kml", + name: "海上安全警告", + url: "{mars3d_data}/file/kml/NAVWARN.kmz", + popup: "all", + }, + { + pid: 3050, + type: "kml", + name: "国境线", + url: "{mars3d_data}/file/kml/countryboundary.kml", + symbol: { + styleOptions: { + color: "#FED976", + width: 2, + }, + }, + }, + { + pid: 3050, + type: "kml", + name: "省界线", + url: "{mars3d_data}/file/kml/province.kml", + symbol: { + styleOptions: { + color: "#00FF00", + width: 2, + }, + }, + }, + { + id: 20, + name: "三维模型", + type: "group", + }, + { + id: 2010, + pid: 20, + name: "gltf模型", + type: "group", + }, + { + pid: 2010, + type: "graphic", + name: "风力发电机", + data: [ + { + type: "modelP", + position: [117.219071, 31.828783, 39.87], + style: { + url: "https://data.mars3d.cn/gltf/mars/fengche.gltf", + scale: 50, + heading: -93, + }, + }, + ], + popup: "示例信息,这是一个风力发电机", + center: { + lat: 31.821083, + lng: 117.21832, + alt: 832.64, + heading: 2.3, + pitch: -39.2, + }, + }, + { + pid: 2010, + type: "graphic", + name: "警车", + data: [ + { + type: "modelP", + position: [117.217458, 31.815349, 35.03], + style: { + url: "https://data.mars3d.cn/gltf/mars/jingche/jingche.gltf", + scale: 2, + heading: -95, + clampToGround: true, + }, + }, + ], + center: { + lat: 31.815363, + lng: 117.215958, + alt: 107.35, + heading: 90.7, + pitch: -26.1, + }, + }, + { + id: 2040, + pid: 20, + name: "城市白模", + type: "group", + }, + { + id: 204011, + pid: 2040, + type: "tileset", + name: "合肥市区", + url: "{mars3d_data}/3dtiles/jzw-hefei/tileset.json", + maximumScreenSpaceError: 1, + maxMemory: 1024, + style: { + color: { + conditions: [["true", "color('rgba(42, 160, 224, 1)')"]], + }, + }, + marsJzwStyle: true, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "objectid", + name: "编号", + }, + { + field: "name", + name: "名称", + }, + { + field: "height", + name: "楼高", + unit: "米", + }, + ], + center: { + lat: 31.786281, + lng: 117.223716, + alt: 3718, + heading: 2, + pitch: -45, + }, + }, + { + pid: 2040, + type: "tileset", + name: "合肥市区-带贴图", + url: "{mars3d_data}/3dtiles/jzw-hefei-cz/tileset.json", + maximumScreenSpaceError: 1, + maxMemory: 1024, + marsJzwStyle: true, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "objectid", + name: "编号", + }, + { + field: "remark", + name: "名称", + }, + { + field: "height", + name: "楼高", + unit: "米", + }, + ], + center: { + lat: 31.786281, + lng: 117.223716, + alt: 3718, + heading: 2, + pitch: -45, + }, + }, + { + id: 204012, + pid: 2040, + type: "tileset", + name: "上海市区", + url: "{mars3d_data}/3dtiles/jzw-shanghai/tileset.json", + maximumScreenSpaceError: 4, + maxMemory: 2048, + style: { + color: { + conditions: [ + ["${floor} >= 200", "rgba(45, 0, 75, 0.5)"], + ["${floor} >= 100", "rgb(170, 162, 204)"], + ["${floor} >= 50", "rgb(224, 226, 238)"], + ["${floor} >= 25", "rgb(252, 230, 200)"], + ["${floor} >= 10", "rgb(248, 176, 87)"], + ["${floor} >= 5", "rgb(198, 106, 11)"], + ["true", "rgb(127, 59, 8)"], + ], + }, + }, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "name", + name: "名称", + }, + { + field: "floor", + name: "楼层", + }, + ], + center: { + lat: 31.257341, + lng: 121.466139, + alt: 2170.8, + heading: 122.2, + pitch: -31.8, + }, + }, + { + id: 2050, + pid: 20, + name: "点云", + type: "group", + }, + { + id: 202016, + pid: 2050, + type: "tileset", + name: "高压线塔杆", + url: "{mars3d_data}/3dtiles/pnts-ganta/tileset.json", + maximumScreenSpaceError: 1, + position: { + alt: 31, + }, + style: { + color: { + conditions: [ + [ + "(${Classification} >= 4) && (${Classification} < 5) ", + "color('#DC143C')", + ], + [ + "(${Classification} >= 7) && (${Classification} < 8) ", + "color('#7B68EE')", + ], + [ + "(${Classification} >= 16) && (${Classification} < 17) ", + "color('#00CED1')", + ], + [ + "(${Classification} >= 17) && (${Classification} < 18) ", + "color('#3CB371')", + ], + [ + "(${Classification} >= 18) && (${Classification} < 19) ", + "color('#FFFF00')", + ], + [ + "(${Classification} >= 19) && (${Classification} < 20) ", + "color('#FFA500')", + ], + [ + "(${Classification} >= 20) && (${Classification} < 21) ", + "color('#FF6347')", + ], + ], + }, + }, + hasOpacity: false, + center: { + lat: 31.504746, + lng: 118.264278, + alt: 580, + heading: 29, + pitch: -49, + }, + }, + { + id: 2060, + pid: 20, + name: "BIM模型", + type: "group", + }, + { + id: 20601121, + pid: 2060, + type: "tileset", + name: "大学教学楼", + url: "{mars3d_data}/3dtiles/bim-daxue/tileset.json", + position: { + lng: 117.251229, + lat: 31.844015, + alt: 31.2, + }, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.842516, + lng: 117.25107, + alt: 145, + heading: 8, + pitch: -39, + }, + }, + { + pid: 2060, + type: "tileset", + name: "轻轨地铁站", + url: "{mars3d_data}/3dtiles/bim-ditiezhan/tileset.json", + position: { + lng: 117.203994, + lat: 31.857999, + alt: 28.9, + }, + rotation: { + z: 168.1, + }, + maxMemory: 2048, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.856125, + lng: 117.204513, + alt: 155, + heading: 350, + pitch: -31, + }, + }, + { + id: 206012, + pid: 2060, + type: "tileset", + name: "桥梁", + url: "{mars3d_data}/3dtiles/bim-qiaoliang/tileset.json", + position: { + lng: 117.096906, + lat: 31.851564, + alt: 45, + }, + rotation: { + z: 17.5, + }, + maximumScreenSpaceError: 16, + skipLevelOfDetail: true, + loadSiblings: true, + cullRequestsWhileMoving: true, + cullRequestsWhileMovingMultiplier: 10, + preferLeaves: true, + progressiveResolutionHeightFraction: 0.5, + dynamicScreenSpaceError: true, + preloadWhenHidden: true, + center: { + lat: 31.849357, + lng: 117.099194, + alt: 306.2, + heading: 327.1, + pitch: -30.9, + }, + scenetree: "scenetree.json", + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + }, + { + id: 2020, + pid: 20, + name: "人工建模", + type: "group", + }, + { + id: 202013, + pid: 2020, + type: "tileset", + name: "地下管网", + url: "{mars3d_data}/3dtiles/max-piping/tileset.json", + position: { + lng: 117.215457, + lat: 31.843363, + alt: -3.6, + }, + rotation: { + z: 336.7, + }, + maximumScreenSpaceError: 2, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + center: { + lat: 31.838821, + lng: 117.216402, + alt: 461, + heading: 0, + pitch: -46, + }, + msg: "演示数据,地下数据拖动时会在地面漂移", + }, + { + id: 202012, + pid: 2020, + type: "tileset", + name: "石化工厂", + url: "{mars3d_data}/3dtiles/max-shihua/tileset.json", + position: { + lng: 117.077158, + lat: 31.659116, + alt: -2.0, + }, + maximumScreenSpaceError: 1, + maxMemory: 2048, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.654916, + lng: 117.08278, + alt: 279, + heading: 316, + pitch: -29, + }, + }, + { + id: 202030, + pid: 2020, + name: "水利闸门", + type: "group", + open: false, + center: { + lat: 29.794301, + lng: 121.47998, + alt: 262, + heading: 191, + pitch: -35, + }, + }, + { + pid: 202030, + name: "闸门", + type: "graphic", + data: [ + { + type: "modelP", + position: [121.479813, 29.791278, 16], + style: { + url: "https://data.mars3d.cn/gltf/mars/zhamen.glb", + heading: 105, + }, + }, + ], + center: { + lat: 29.791607, + lng: 121.479925, + alt: 27, + heading: 198, + pitch: -18, + }, + }, + { + id: 202011, + pid: 202030, + type: "tileset", + name: "整体", + url: "{mars3d_data}/3dtiles/max-fsdzm/tileset.json", + position: { + alt: 15.2, + }, + maximumScreenSpaceError: 1, + center: { + lat: 29.792675, + lng: 121.480207, + alt: 190.8, + heading: 196.1, + pitch: -49, + }, + }, + { + id: 2030, + pid: 20, + name: "倾斜摄影", + type: "group", + }, + { + pid: 2030, + type: "tileset", + name: "大雁塔", + url: "{mars3d_data}/3dtiles/qx-dyt/tileset.json", + position: { + alt: -27, + }, + maximumScreenSpaceError: 1, + center: { + lat: 34.215516, + lng: 108.960251, + alt: 834, + heading: 4, + pitch: -48, + }, + flat: { + enabled: true, + editHeight: -24, + }, + flyTo: false, + show: false, + }, + { + pid: 2030, + name: "校园(含单体)", + type: "group", + hasOpacity: true, + center: { + lat: 43.821193, + lng: 125.143124, + alt: 990, + heading: 342, + pitch: -50, + }, + layers: [ + { + type: "geojson", + name: "校园-单体化", + url: "{mars3d_data}/file/geojson/dth-xuexiao-fd.json", + symbol: { + type: "polygonP", + styleOptions: { + color: "rgba(255, 255, 255, 0.01)", + clampToGround: true, + classification: true, + buffer: 1, + highlight: { + type: "click", + color: "rgba(255,255,0,0.4)", + }, + }, + }, + popup: [ + { + field: "name", + name: "学校场所", + }, + { + field: "sfkf", + name: "是否开放", + }, + { + field: "remark", + name: "备注信息", + }, + ], + }, + { + pid: 2030, + type: "tileset", + name: "校园", + url: "{mars3d_data}/3dtiles/qx-xuexiao/tileset.json", + position: { + alt: 279.0, + }, + maximumScreenSpaceError: 1, + }, + ], + }, + { + id: 203014, + pid: 2030, + type: "tileset", + name: "县城社区", + url: "{mars3d_data}/3dtiles/qx-shequ/tileset.json", + position: { + alt: 148.2, + }, + maximumScreenSpaceError: 2, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + center: { + lat: 28.440864, + lng: 119.486477, + alt: 588.23, + heading: 268.6, + pitch: -37.8, + }, + show: false, + flyTo: false, + }, + { + id: 203015, + pid: 2030, + name: "合肥天鹅湖", + type: "tileset", + url: "{mars3d_data}/3dtiles/qx-teh/tileset.json", + position: { + lng: 117.218434, + lat: 31.81807, + alt: 163, + }, + maximumScreenSpaceError: 16, + maxMemory: 2048, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + skipLevelOfDetail: true, + preferLeaves: true, + center: { + lat: 31.795308, + lng: 117.21948, + alt: 1820, + heading: 0, + pitch: -39, + }, + }, + { + id: 203013, + pid: 2030, + type: "geojson", + name: "文庙-单体化", + url: " {mars3d_data}/file/geojson/dth-wm.json", + symbol: { + type: "polygonP", + styleOptions: { + color: "rgba(255, 255, 255, 0.01)", + clampToGround: true, + classification: true, + buffer: 1, + highlight: { + color: "rgba(255,255,0,0.4)", + }, + }, + }, + popup: [ + { + field: "name", + name: "房屋名称", + }, + { + field: "jznf", + name: "建造年份", + }, + { + field: "ssdw", + name: "所属单位", + }, + { + field: "remark", + name: "备注信息", + }, + ], + }, + { + id: 203012, + pid: 2030, + type: "tileset", + name: "文庙", + url: "{mars3d_data}/3dtiles/qx-simiao/tileset.json", + position: { + alt: 38.8, + }, + maximumScreenSpaceError: 2, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + skipLevelOfDetail: true, + preferLeaves: true, + center: { + lat: 33.589536, + lng: 119.032216, + alt: 145.08, + heading: 3.1, + pitch: -22.9, + }, + }, + { + id: 99, + name: "数据图层", + type: "group", + }, + ], +}; + +function init() { + // 判断webgl支持 + if (!mars3d.Util.webglreport()) { + mars3d.Util.webglerror(); + } + + //创建三维地球场景 + const initMapFun = window.initMap ? window.initMap : globalInitMap; + var map = initMapFun(newMapOptions); + if (map && map.then) { + map.then(function (map) { + if (window.onMounted) { + window.onMounted(map); + } + if (window.initUI) { + window.initUI(); + } + + if (window.es5widget) { + initWidget(map); + } + }); + return; + } + + if (window.onMounted) { + window.onMounted(map); + } + if (window.initUI) { + window.initUI(); + } + + if (window.es5widget) { + initWidget(map); + } +} +init(); + +// 构造地图主方法【必须】 +function globalInitMap(options) { + if (window.mapOptions) { + if (typeof window.mapOptions === "function") { + options = window.mapOptions(options) || options; + } else { + window.mapOptions = options = mars3d.Util.merge( + options, + window.mapOptions + ); + } + } + + // 创建三维地球场景 + return new mars3d.Map("map-box", options); +} + +//初始化widget相关 +function initWidget(map) { + //初始化widget管理器 + es5widget.init( + map, + { + defaultOptions: { + style: "dark", + windowOptions: { + skin: "layer-mars-dialog animation-scale-up", + position: { bottom: 50, left: 10 }, + }, + }, + openAtStart: [ + { + name: "右上角工具栏", + uri: "widgets/toolButton/menuBtn.js", + }, + ], + widgets: [ + { + name: "图层管理", + uri: "widgets/manageLayers/widget.js", + group: "forlayer", + autoCenter: true, + windowOptions: { + position: { top: 10, bottom: 40, left: 50 }, + }, + autoDisable: false, + disableOther: false, + }, + ], + }, + "/" + ); +} + +// 调用项目的消息提示(自动消失) +function globalMsg(content) { + if (window.layer) { + window.layer.msg(content); // 此方法需要引用layer.js + } else if (window.toastr) { + window.toastr.info(content); // 此方法需要引用toastr + } else { + window.alert(content); + } +} + +// 调用项目的弹窗提示(手动单击确定关闭窗口) +function globalAlert(content, title) { + if (window.layer) { + // 此方法需要引用layer.js + window.layer.alert(content, { + title: title || "提示", + skin: "layui-layer-lan layer-mars-dialog", + closeBtn: 0, + anim: 0, + }); + } else if (window.toastr) { + window.toastr.info(content, title); // 此方法需要引用toastr + } else { + window.alert(content); + } +} + +// 调用项目的右上角信息提示(可关闭) +function globalNotify(title, content) { + if (window.toastr) { + window.toastr.warning(content, title); // 此方法需要引用toastr + } else if (window.layer) { + // 此方法需要引用layer.js + window.layer.alert(content, { + title: title || "提示", + skin: "layui-layer-lan layer-mars-dialog", + closeBtn: 0, + anim: 0, + }); + } else { + window.alert(content); + } +} + +function showLoading() { + haoutil.loading.show(); +} + +function hideLoading() { + haoutil.loading.close(); +} diff --git a/src/main/resources/static/js/synthesisQuery/config/config.json b/src/main/resources/static/js/synthesisQuery/config/config.json index c29562c..6d1d164 100644 --- a/src/main/resources/static/js/synthesisQuery/config/config.json +++ b/src/main/resources/static/js/synthesisQuery/config/config.json @@ -1,11 +1,11 @@ { "scene": { "center": { - "lat": 31.686288, - "lng": 117.229619, - "alt": 11333.9, - "heading": 359.2, - "pitch": -39.5 + "lat": 30.526361, + "lng": 116.335987, + "alt": 45187, + "heading": 0, + "pitch": -45 }, "scene3DOnly": false, "shadows": false, @@ -17,7 +17,11 @@ "showSkyAtmosphere": true, "fog": true, "fxaa": true, + "orderIndependentTranslucency": true, "requestRenderMode": false, + "contextOptions": { + "requestWebgl1": false + }, "globe": { "depthTestAgainstTerrain": false, "baseColor": "#546a53", @@ -37,119 +41,1886 @@ } }, "control": { - "homeButton": true, + "toolbar": { + "position": "left-bottom" + }, + "homeButton": { + "icon": "https://data.mars3d.cn/img/control/homeButton.svg" + }, + "fullscreenButton": { + "icon": "https://data.mars3d.cn/img/control/fullscreenButton.svg" + }, + "navigationHelpButton": { + "icon": "https://data.mars3d.cn/img/control/navigationHelpButton.svg" + }, "baseLayerPicker": true, "sceneModePicker": true, "vrButton": false, - "fullscreenButton": true, - "navigationHelpButton": true, "animation": false, "timeline": false, "infoBox": false, "geocoder": false, "selectionIndicator": false, - "contextmenu": { "hasDefault": false }, + "showRenderLoopErrors": true, + "contextmenu": { + "hasDefault": true + }, "mouseDownView": true, - "zoom": { "insertIndex": 1 }, - "compass": { "bottom": "toolbar", "right": "5px" }, - "distanceLegend": { "left": "10px", "bottom": "2px" }, + "zoom": { + "insertBefore": "sceneModePicker", + "zoomOutIcon": "https://data.mars3d.cn/img/control/zoom-out.svg", + "zoomInIcon": "https://data.mars3d.cn/img/control/zoom-in.svg" + }, + "compass": { + "style": { + "bottom": "toolbar", + "left": "5px", + "merge": false + } + }, + "distanceLegend": { + "style": { + "left": "10px", + "bottom": "2px", + "merge": false + } + }, "locationBar": { - "fps": true, "crs": "CGCS2000_GK_Zone_3", "crsDecimal": 0, - "template": "
经度:{lng}
纬度:{lat}
横{crsx} 纵{crsy}
海拔:{alt}米
层级:{level}
方向:{heading}°
俯仰角:{pitch}°
视高:{cameraHeight}米
" + "template": "
经度:{lng}
纬度:{lat}
横{crsx} 纵{crsy}
海拔:{alt}米
层级:{level}
方向:{heading}°
俯仰角:{pitch}°
视高:{cameraHeight}米
帧率:{fps} FPS
" } }, - "templateValues": { - "dataServer": "//data.mars3d.cn", - "gltfServerUrl": "//data.mars3d.cn/gltf" + "method": { + "templateValues": { + "mars3d_data": "//data.mars3d.cn" + } }, "terrain": { - "url": "//data.mars3d.cn/terrain", + "url": "https://data.mars3d.cn/terrain", "show": true }, "basemaps": [ - { "id": 10, "name": "地图底图", "type": "group" }, + { + "id": 10, + "name": "地图底图", + "type": "group" + }, { "id": 2021, "pid": 10, "name": "天地图影像", - "icon": "../../../img/mars-map-img/tdt_img.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/tdt_img.png", "type": "group", "layers": [ - { "name": "底图", "type": "tdt", "layer": "img_d" }, - { "name": "注记", "type": "tdt", "layer": "img_z" } + { + "name": "底图", + "type": "tdt", + "layer": "img_d" + }, + { + "name": "注记", + "type": "tdt", + "layer": "img_z" + } ], "show": true }, { "pid": 10, "name": "天地图电子", - "icon": "../../../img/mars-map-img/tdt_vec.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/tdt_vec.png", "type": "group", "layers": [ - { "name": "底图", "type": "tdt", "layer": "vec_d" }, - { "name": "注记", "type": "tdt", "layer": "vec_z" } + { + "name": "底图", + "type": "tdt", + "layer": "vec_d" + }, + { + "name": "注记", + "type": "tdt", + "layer": "vec_z" + } ] }, { "pid": 10, "name": "高德影像", "type": "group", - "icon": "../../../img/mars-map-img/gaode_img.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/gaode_img.png", "layers": [ - { "name": "底图", "type": "gaode", "layer": "img_d" }, - { "name": "注记", "type": "gaode", "layer": "img_z" } + { + "name": "底图", + "type": "gaode", + "layer": "img_d" + }, + { + "name": "注记", + "type": "gaode", + "layer": "img_z" + } ] }, { "pid": 10, "name": "高德电子", "type": "gaode", - "icon": "../../../img/mars-map-img/gaode_vec.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/gaode_vec.png", "layer": "vec" }, { "pid": 10, "name": "百度影像", "type": "group", - "icon": "../../../img/mars-map-img/bd-img.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/bd_img.png", "layers": [ - { "name": "底图", "type": "baidu", "layer": "img_d" }, - { "name": "注记", "type": "baidu", "layer": "img_z" } + { + "name": "底图", + "type": "baidu", + "layer": "img_d" + }, + { + "name": "注记", + "type": "baidu", + "layer": "img_z" + } ] }, { "pid": 10, "name": "百度电子", - "icon": "../../../img/mars-map-img/bd-vec.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/bd_vec.png", "type": "baidu", "layer": "vec" }, { "pid": 10, "name": "腾讯影像", - "icon": "../../../img/mars-map-img/tencent_img.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/tencent_img.png", "type": "group", "layers": [ - { "name": "底图", "type": "tencent", "layer": "img_d" }, - { "name": "注记", "type": "tencent", "layer": "img_z" } + { + "name": "底图", + "type": "tencent", + "layer": "img_d" + }, + { + "name": "注记", + "type": "tencent", + "layer": "img_z" + } ] }, { "pid": 10, "name": "腾讯电子", - "icon": "../../../img/mars-map-img/tencent_vec.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/tencent_vec.png", "type": "tencent", "layer": "vec" }, + { + "id": 2017, + "pid": 10, + "name": "蓝色底图", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/my_blue.png", + "type": "gaode", + "layer": "vec", + "chinaCRS": "GCJ02", + "invertColor": true, + "filterColor": "#4e70a6", + "brightness": 0.6, + "contrast": 1.8, + "gamma": 0.3, + "hue": 1, + "saturation": 0 + }, + { + "pid": 10, + "name": "绿色底图", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/my_green.png", + "type": "gaode", + "layer": "vec", + "chinaCRS": "GCJ02", + "invertColor": true, + "filterColor": "rgba(12, 238, 230)", + "brightness": 1, + "contrast": 1.0, + "gamma": 0.2, + "hue": 1, + "saturation": 0 + }, + { + "pid": 10, + "name": "黑色底图", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/my_dark.png", + "type": "gaode", + "layer": "vec", + "chinaCRS": "GCJ02", + "invertColor": true, + "filterColor": "#909090", + "brightness": 0.6, + "contrast": 1.8, + "gamma": 0.3, + "hue": 1, + "saturation": 0 + }, + { "pid": 10, "name": "ArcGIS影像", - "icon": "../../../img/mars-map-img/esriWorldImagery.png", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/arcgis_img.png", "type": "xyz", "url": "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", "enablePickFeatures": false + }, + { + "pid": 10, + "name": "微软影像", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/bing_img.png", + "type": "bing", + "layer": "Aerial" + }, + { + "pid": 10, + "name": "离线影像地图 (供参考)", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/google_img.png", + "type": "xyz", + "url": "{mars3d_data}/tile/img/{z}/{x}/{y}.jpg", + "chinaCRS": "GCJ02", + "maximumLevel": 13 + }, + { + "pid": 10, + "name": "单张图片", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/offline.png", + "type": "image", + "url": "https://data.mars3d.cn/img/map/world/world.jpg" + }, + { + "id": 2023, + "pid": 10, + "name": "无底图", + "icon": "https://data.mars3d.cn/img/thumbnail/basemap/null.png", + "type": "grid", + "color": "#ffffff", + "alpha": 0.03, + "cells": 2 + } + ], + "layers": [ + { + "id": 50, + "name": "辅助图层", + "type": "group" + }, + { + "pid": 50, + "type": "graticule", + "name": "经纬网" + }, + { + "pid": 50, + "name": "行政区划界线", + "type": "tdt", + "layer": "xzqh", + "mapSplit": false + }, + { + "pid": 50, + "name": "高德实时路况", + "type": "gaode", + "layer": "time", + "minimumTerrainLevel": 4, + "minimumLevel": 4, + "proxy": "//server.mars3d.cn/proxy/", + "mapSplit": false + }, + { + "pid": 50, + "name": "百度实时路况", + "type": "baidu", + "layer": "time", + "mapSplit": false + }, + { + "id": 60, + "name": "地形", + "type": "group" + }, + { + "pid": 60, + "type": "terrain", + "name": "Cesium地形", + "terrainType": "ion", + "radio": true + }, + { + "pid": 60, + "type": "terrain", + "name": "Mars3D地形", + "terrainType": "xyz", + "url": "{mars3d_data}/terrain", + "radio": true + }, + { + "pid": 60, + "type": "terrain", + "name": "ArcGIS地形", + "terrainType": "arcgis", + "url": "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", + "radio": true + }, + { + "pid": 60, + "type": "terrain", + "name": "无地形", + "terrainType": "none", + "radio": true + }, + { + "id": 40, + "name": "栅格数据", + "type": "group" + }, + { + "id": 4020, + "pid": 40, + "name": "OGC WMS服务", + "type": "group" + }, + { + "pid": 4020, + "name": "教育设施点", + "type": "wms", + "url": "//server.mars3d.cn/geoserver/mars/wms", + "layers": "mars:hfjy", + "crs": "EPSG:4326", + "parameters": { + "transparent": "true", + "format": "image/png" + }, + "popup": "名称:{项目名称}
类型:{设施类型}
面积:{用地面积}亩
位置:{具体位置}", + "mapSplit": false, + "show": false, + "flyTo": true + }, + { + "pid": 4020, + "name": "道路线", + "type": "wms", + "url": "//server.mars3d.cn/geoserver/mars/wms", + "layers": "mars:hfdl", + "crs": "EPSG:4326", + "parameters": { + "transparent": "true", + "format": "image/png" + }, + "center": { + "lat": 31.743214, + "lng": 117.277097, + "alt": 47197.7, + "heading": 0.3, + "pitch": -78.8 + }, + "popup": "all", + "mapSplit": false, + "show": false, + "flyTo": true + }, + { + "pid": 4020, + "name": "建筑物面", + "type": "wms", + "url": "//server.mars3d.cn/geoserver/mars/wms", + "layers": "mars:hfjzw", + "crs": "EPSG:4326", + "parameters": { + "transparent": "true", + "format": "image/png" + }, + "highlight": { + "showTime": 5000, + "fill": true, + "color": "#2deaf7", + "opacity": 0.6, + "outline": true, + "outlineWidth": 3, + "outlineColor": "#e000d9", + "outlineOpacity": 1.0, + "clampToGround": true + }, + "center": { + "lat": 31.79513, + "lng": 117.236172, + "alt": 3784.6, + "heading": 0.7, + "pitch": -42.2 + }, + "popup": "all", + "show": false, + "flyTo": true + }, + { + "pid": 4020, + "name": "规划面", + "type": "wms", + "url": "//server.mars3d.cn/geoserver/mars/wms", + "layers": "mars:hfgh", + "crs": "EPSG:4326", + "parameters": { + "transparent": "true", + "format": "image/png" + }, + "center": { + "lat": 31.743214, + "lng": 117.277097, + "alt": 47197.7, + "heading": 0.3, + "pitch": -78.8 + }, + "popup": "all", + "show": false, + "flyTo": true + }, + { + "id": 4030, + "pid": 40, + "name": "ArcGIS 瓦片", + "type": "group" + }, + { + "pid": 4030, + "name": "合肥规划图", + "type": "arcgis_cache", + "url": "{mars3d_data}/arcgis_cache/hfgh/_alllayers/{z}/{y}/{x}.png", + "minimumLevel": 1, + "maximumLevel": 17, + "minimumTerrainLevel": 1, + "maximumTerrainLevel": 17, + "rectangle": { + "xmin": 116.846, + "xmax": 117.642, + "ymin": 31.533, + "ymax": 32.185 + } + }, + { + "id": 4010, + "pid": 40, + "name": "ArcGIS Dynamic", + "type": "group" + }, + { + "id": 401085, + "pid": 4010, + "type": "arcgis", + "name": "主要道路", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + "layers": "24", + "highlight": { + "type": "polyline", + "color": "#2deaf7", + "width": 4, + "clampToGround": true + }, + "center": { + "lat": 31.814176, + "lng": 117.225362, + "alt": 5105.3, + "heading": 359.2, + "pitch": -83.1 + }, + "popup": "all", + "mapSplit": false + }, + { + "id": 401086, + "pid": 4010, + "type": "arcgis", + "name": "建筑物", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + "layers": "35,36,37,39", + "highlight": { + "fill": true, + "color": "#2deaf7", + "opacity": 0.6, + "outline": true, + "outlineWidth": 3, + "outlineColor": "#e000d9", + "outlineOpacity": 1.0, + "clampToGround": true + }, + "center": { + "lat": 31.816951, + "lng": 117.22898, + "alt": 2916.7, + "heading": 0.3, + "pitch": -78.8 + }, + "popup": "名称:{NAME}
层数:{floor}" + }, + { + "id": 401087, + "pid": 4010, + "type": "arcgis", + "name": "规划", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/guihua/MapServer", + "highlight": { + "showTime": 5000, + "fill": true, + "color": "#2deaf7", + "opacity": 0.6, + "outline": true, + "outlineWidth": 3, + "outlineColor": "#e000d9", + "outlineOpacity": 1.0, + "clampToGround": true + }, + "center": { + "lat": 31.816951, + "lng": 117.22898, + "alt": 2916.7, + "heading": 0.3, + "pitch": -78.8 + }, + "popup": [ + { + "field": "用地名称", + "name": "名称" + }, + { + "field": "用地编号", + "name": "编号" + }, + { + "field": "规划用地", + "name": "规划" + }, + { + "type": "html", + "html": "
数据仅供参考
" + } + ], + "popupNoTitle": true + }, + { + "id": 30, + "name": "矢量数据", + "type": "group" + }, + { + "id": 3030, + "pid": 30, + "name": "GeoJSON数据", + "type": "group" + }, + { + "id": 303011, + "pid": 3030, + "type": "geojson", + "name": "平台标绘", + "url": "{mars3d_data}/file/geojson/mars3d-draw.json", + "popup": "{type}{name}", + "show": false, + "flyTo": true + }, + { + "pid": 3030, + "type": "geojson", + "name": "用地规划", + "url": "{mars3d_data}/file/geojson/guihua.json", + "symbol": { + "styleOptions": { + "opacity": 0.6, + "color": "#0000FF", + "width": 3, + "clampToGround": true + }, + "styleField": "类型", + "styleFieldOptions": { + "一类居住用地": { + "color": "#FFDF7F" + }, + "二类居住用地": { + "color": "#FFFF00" + }, + "社区服务用地": { + "color": "#FF6A38" + }, + "幼托用地": { + "color": "#FF6A38" + }, + "商住混合用地": { + "color": "#FF850A" + }, + "行政办公用地": { + "color": "#FF00FF" + }, + "文化设施用地": { + "color": "#FF00FF" + }, + "小学用地": { + "color": "#FF7FFF" + }, + "初中用地": { + "color": "#FF7FFF" + }, + "体育场用地": { + "color": "#00A57C" + }, + "医院用地": { + "color": "#A5527C" + }, + "社会福利用地": { + "color": "#FF7F9F" + }, + "商业用地": { + "color": "#FF0000" + }, + "商务用地": { + "color": "#7F0000" + }, + "营业网点用地": { + "color": "#FF7F7F" + }, + "一类工业用地": { + "color": "#A57C52" + }, + "社会停车场用地": { + "color": "#C0C0C0" + }, + "通信用地": { + "color": "#007CA5" + }, + "排水用地": { + "color": "#00BFFF" + }, + "公园绿地": { + "color": "#00FF00" + }, + "防护绿地": { + "color": "#007F00" + }, + "河流水域": { + "color": "#7FFFFF" + }, + "配建停车场": { + "color": "#ffffff" + }, + "道路用地": { + "color": "#ffffff" + } + } + }, + "popup": "{类型}", + "show": false, + "flyTo": true + }, + { + "pid": 3030, + "type": "geojson", + "name": "建筑物面", + "url": "{mars3d_data}/file/geojson/buildings-demo.json", + "symbol": { + "styleOptions": { + "color": "#0d3685", + "outlineColor": "#0d3685", + "opacity": 0.8 + } + }, + "buildings": { + "cloumn": "floors", + "height": "flo_height" + }, + "popup": "all", + "flyTo": true, + "flyToOptions": { + "minHeight": 2000 + } + }, + { + "pid": 3030, + "type": "geojson", + "name": "安徽各市", + "url": "{mars3d_data}/file/geojson/areas/340000_full.json", + "symbol": { + "type": "polygon", + "styleOptions": { + "materialType": "PolyGradient", + "materialOptions": { + "color": "rgb(15,176,255)", + "opacity": 0.7, + "alphaPower": 1.3 + }, + "label": { + "text": "{name}", + "opacity": 1, + "font_size": 25, + "color": "#ffffff", + "outline": true, + "outlineColor": "#000000", + "outlineWidth": 3, + "scaleByDistance": true, + "scaleByDistance_far": 2743804, + "scaleByDistance_farValue": 0.3, + "scaleByDistance_near": 10000, + "scaleByDistance_nearValue": 1, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 2743804, + "distanceDisplayCondition_near": 0 + } + } + }, + "popup": "{name}", + "show": false, + "flyTo": true + }, + { + "pid": 3030, + "type": "geojson", + "name": "中国省界", + "url": "{mars3d_data}/file/geojson/areas/100000_full.json", + "symbol": { + "type": "polylineP", + "styleOptions": { + "color": "#ffffff", + "width": 2, + "opacity": 0.8, + "label": { + "text": "{name}", + "position": "center", + "font_size": 30, + "color": "#ffffff", + "outline": true, + "outlineColor": "#000000", + "scaleByDistance": true, + "scaleByDistance_far": 60000000, + "scaleByDistance_farValue": 0.2, + "scaleByDistance_near": 1000000, + "scaleByDistance_nearValue": 1, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 12000000, + "distanceDisplayCondition_near": 0 + } + } + }, + "show": false, + "flyTo": true + }, + { + "pid": 3030, + "type": "geojson", + "name": "西藏垭口", + "url": "{mars3d_data}/file/geojson/xizangyakou.json", + "symbol": { + "styleOptions": { + "image": "https://data.mars3d.cn/img/marker/mark-red.png", + "scaleByDistance": true, + "scaleByDistance_far": 5000000, + "scaleByDistance_farValue": 0.5, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "verticalOrigin": 1, + "horizontalOrigin": 0, + "clampToGround": true, + "label": { + "text": "{NAME}", + "font_size": 25, + "color": "#ffff00", + "font_family": "微软雅黑", + "outline": true, + "outlineColor": "#000000", + "pixelOffsetY": -40, + "scaleByDistance": true, + "scaleByDistance_far": 1000000, + "scaleByDistance_farValue": 0.5, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 1000000, + "distanceDisplayCondition_near": 0, + "visibleDepth": true + } + } + }, + "popup": [ + { + "field": "NAME", + "name": "名称" + }, + { + "type": "details", + "callback": "showPopupDetails", + "field": "图片", + "className": "mars3d-popup-btn-custom" + } + ], + "show": false, + "flyTo": true + }, + { + "pid": 3030, + "type": "geojson", + "name": "体育设施点", + "url": "{mars3d_data}/file/geojson/hfty-point.json", + "symbol": { + "styleOptions": { + "image": "https://data.mars3d.cn/img/marker/mark-red.png", + "scale": 1, + "scaleByDistance": true, + "scaleByDistance_far": 20000, + "scaleByDistance_farValue": 0.5, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "verticalOrigin": 1, + "horizontalOrigin": 0, + "clampToGround": true, + "label": { + "text": "{项目名称}", + "font_size": 25, + "color": "#ffffff", + "outline": true, + "outlineColor": "#000000", + "pixelOffsetY": -25, + "scaleByDistance": true, + "scaleByDistance_far": 80000, + "scaleByDistance_farValue": 0.5, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 80000, + "distanceDisplayCondition_near": 0 + } + } + }, + "popup": [ + { + "field": "项目名称", + "name": "项目名称" + }, + { + "field": "建设性质", + "name": "建设性质" + }, + { + "field": "设施级别", + "name": "设施级别" + }, + { + "field": "所属区县", + "name": "所属区县" + }, + { + "field": "建筑内容及", + "name": "建筑内容" + }, + { + "field": "新增用地(", + "name": "新增用地" + }, + { + "field": "开工", + "name": "开工" + }, + { + "field": "总投资(万", + "name": "总投资" + }, + { + "field": "资金来源", + "name": "资金来源" + }, + { + "field": "初步选址", + "name": "初步选址" + }, + { + "field": "设施类型", + "name": "设施类型" + }, + { + "field": "设施等级", + "name": "设施等级" + }, + { + "field": "所在区县", + "name": "所在区县" + }, + { + "field": "具体位置", + "name": "具体位置" + }, + { + "field": "建设内容(", + "name": "建设内容" + }, + { + "field": "用地面积(", + "name": "用地面积", + "format": "mars3d.MeasureUtil.formatArea" + }, + { + "field": "设施规模(", + "name": "设施规模" + }, + { + "field": "举办者类型", + "name": "举办者类型" + }, + { + "field": "开工时间", + "name": "开工时间" + }, + { + "field": "总投资额(", + "name": "总投资额", + "unit": "亿元" + }, + { + "field": "项目推进主", + "name": "项目推进主体" + }, + { + "field": "项目进度", + "name": "项目进度" + }, + { + "field": "项目来源", + "name": "项目来源" + }, + { + "field": "备注", + "name": "备注" + } + ], + "show": false, + "flyTo": true + }, + { + "id": 3070, + "pid": 30, + "name": "GeoServer WFS", + "type": "group" + }, + { + "pid": 3070, + "type": "wfs", + "name": "建筑物面", + "url": "//server.mars3d.cn/geoserver/mars/ows", + "layer": "mars:hfjzw", + "parameters": { + "maxFeatures": 500 + }, + "minimumLevel": 15, + "symbol": { + "type": "polygonP", + "styleOptions": { + "color": "#00469c", + "outline": false, + "opacity": 1 + } + }, + "buildings": { + "cloumn": "floor" + }, + "center": { + "lat": 31.818396, + "lng": 117.229083, + "alt": 2554.4, + "heading": 359.2, + "pitch": -83.1 + }, + "popup": "名称:{NAME}
层数:{floor}" + }, + { + "pid": 3070, + "name": "教育设施点", + "type": "wfs", + "url": "//server.mars3d.cn/geoserver/mars/ows", + "layer": "mars:hfjy", + "parameters": { + "maxFeatures": 500 + }, + "minimumLevel": 13, + "symbol": { + "type": "billboardP", + "styleOptions": { + "image": "https://data.mars3d.cn/img/marker/mark-red.png", + "scaleByDistance": true, + "scaleByDistance_far": 20000, + "scaleByDistance_farValue": 0.6, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "clampToGround": true, + "label": { + "text": "{项目名称}", + "font_size": 15, + "color": "#ffffff", + "outline": true, + "outlineColor": "#000000", + "pixelOffsetY": -30, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 2000, + "distanceDisplayCondition_near": 0 + } + } + }, + "center": { + "lat": 31.812256, + "lng": 117.229873, + "alt": 4683.91, + "heading": 357.4, + "pitch": -65.4 + }, + "popup": "all" + }, + { + "id": 3010, + "pid": 30, + "name": "ArcGIS WFS", + "type": "group" + }, + { + "pid": 3010, + "type": "arcgis_wfs", + "name": "兴趣点", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/1", + "where": " 1=1 ", + "minimumLevel": 15, + "center": { + "lat": 31.818396, + "lng": 117.229083, + "alt": 2554.4, + "heading": 359.2, + "pitch": -83.1 + }, + "symbol": { + "type": "billboardP", + "styleOptions": { + "image": "https://data.mars3d.cn/img/marker/mark-blue.png", + "scaleByDistance": true, + "scaleByDistance_far": 20000, + "scaleByDistance_farValue": 0.6, + "scaleByDistance_near": 1000, + "scaleByDistance_nearValue": 1, + "clampToGround": true, + "label": { + "text": "{NAME}", + "font_size": 15, + "color": "#ffffff", + "outline": true, + "outlineColor": "#000000", + "pixelOffsetY": -30, + "distanceDisplayCondition": true, + "distanceDisplayCondition_far": 3000, + "distanceDisplayCondition_near": 0 + } + }, + "styleField": "address", + "styleFieldOptions": { + "AB03": { + "image": "https://data.mars3d.cn/img/marker/mark-red.png" + }, + "A980": { + "image": "https://data.mars3d.cn/img/marker/mark-blue.png" + }, + "A900": { + "image": "https://data.mars3d.cn/img/marker/mark-green.png" + } + } + }, + "popup": "名称:{NAME}
地址:{address}", + "show": false + }, + { + "pid": 3010, + "type": "arcgis_wfs", + "name": "道路", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/28", + "minimumLevel": 14, + "symbol": { + "type": "polylineP", + "styleOptions": { + "color": "#3388ff", + "width": 3, + "clampToGround": true + }, + "styleField": "NAME", + "styleFieldOptions": { + "祁门路": { + "color": "#8744c0", + "width": 3 + }, + "东流路": { + "color": "#f7ba2a", + "width": 3 + }, + "翡翠路": { + "color": "#20a0ff", + "width": 3 + }, + "岳西路": { + "color": "#50bfff", + "width": 3 + } + } + }, + "popup": "名称:{NAME}", + "center": { + "lat": 31.814176, + "lng": 117.225362, + "alt": 5105.3, + "heading": 359.2, + "pitch": -83.1 + } + }, + { + "pid": 3010, + "type": "arcgis_wfs", + "name": "建筑物面", + "url": "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/37", + "minimumLevel": 15, + "symbol": { + "styleOptions": { + "color": "#0d3685", + "outlineColor": "#0d3685", + "opacity": 0.8 + } + }, + "buildings": { + "cloumn": "floor" + }, + "debuggerTileInfo": false, + "center": { + "lat": 31.816951, + "lng": 117.22898, + "alt": 1916.7, + "heading": 0.3, + "pitch": -78.8 + }, + "popup": "名称:{NAME}
层数:{floor}" + }, + { + "id": 3060, + "pid": 30, + "name": "CZML数据", + "type": "group" + }, + { + "id": 306010, + "pid": 3060, + "type": "czml", + "name": "汽车", + "url": "{mars3d_data}/file/czml/car.czml", + "center": { + "lat": 40.894745, + "lng": 121.920252, + "alt": 904, + "heading": 64, + "pitch": -67 + }, + "radio": true, + "flyTo": true + }, + { + "id": 306011, + "pid": 3060, + "type": "czml", + "name": "卫星轨道", + "url": "{mars3d_data}/file/czml/satellite-simple.czml", + "popup": "all", + "radio": true, + "flyTo": true + }, + { + "id": 3050, + "pid": 30, + "name": "KML数据", + "type": "group" + }, + { + "pid": 3050, + "type": "kml", + "name": "海上安全警告", + "url": "{mars3d_data}/file/kml/NAVWARN.kmz", + "popup": "all" + }, + { + "pid": 3050, + "type": "kml", + "name": "国境线", + "url": "{mars3d_data}/file/kml/countryboundary.kml", + "symbol": { + "styleOptions": { + "color": "#FED976", + "width": 2 + } + } + }, + { + "pid": 3050, + "type": "kml", + "name": "省界线", + "url": "{mars3d_data}/file/kml/province.kml", + "symbol": { + "styleOptions": { + "color": "#00FF00", + "width": 2 + } + } + }, + { + "id": 20, + "name": "三维模型", + "type": "group" + }, + { + "id": 2010, + "pid": 20, + "name": "gltf模型", + "type": "group" + }, + { + "pid": 2010, + "type": "graphic", + "name": "风力发电机", + "data": [ + { + "type": "modelP", + "position": [117.219071, 31.828783, 39.87], + "style": { + "url": "https://data.mars3d.cn/gltf/mars/fengche.gltf", + "scale": 50, + "heading": -93 + } + } + ], + "popup": "示例信息,这是一个风力发电机", + "center": { + "lat": 31.821083, + "lng": 117.21832, + "alt": 832.64, + "heading": 2.3, + "pitch": -39.2 + } + }, + { + "pid": 2010, + "type": "graphic", + "name": "警车", + "data": [ + { + "type": "modelP", + "position": [117.217458, 31.815349, 35.03], + "style": { + "url": "https://data.mars3d.cn/gltf/mars/jingche/jingche.gltf", + "scale": 2, + "heading": -95, + "clampToGround": true + } + } + ], + "center": { + "lat": 31.815363, + "lng": 117.215958, + "alt": 107.35, + "heading": 90.7, + "pitch": -26.1 + } + }, + { + "id": 2040, + "pid": 20, + "name": "城市白模", + "type": "group" + }, + { + "id": 204011, + "pid": 2040, + "type": "tileset", + "name": "合肥市区", + "url": "{mars3d_data}/3dtiles/jzw-hefei/tileset.json", + "maximumScreenSpaceError": 1, + "maxMemory": 1024, + "style": { + "color": { + "conditions": [["true", "color('rgba(42, 160, 224, 1)')"]] + } + }, + "marsJzwStyle": true, + "highlight": { + "type": "click", + "color": "#FFFF00" + }, + "popup": [ + { + "field": "objectid", + "name": "编号" + }, + { + "field": "name", + "name": "名称" + }, + { + "field": "height", + "name": "楼高", + "unit": "米" + } + ], + "center": { + "lat": 31.786281, + "lng": 117.223716, + "alt": 3718, + "heading": 2, + "pitch": -45 + } + }, + { + "pid": 2040, + "type": "tileset", + "name": "合肥市区-带贴图", + "url": "{mars3d_data}/3dtiles/jzw-hefei-cz/tileset.json", + "maximumScreenSpaceError": 1, + "maxMemory": 1024, + "marsJzwStyle": true, + "highlight": { + "type": "click", + "color": "#FFFF00" + }, + "popup": [ + { + "field": "objectid", + "name": "编号" + }, + { + "field": "remark", + "name": "名称" + }, + { + "field": "height", + "name": "楼高", + "unit": "米" + } + ], + "center": { + "lat": 31.786281, + "lng": 117.223716, + "alt": 3718, + "heading": 2, + "pitch": -45 + } + }, + { + "id": 204012, + "pid": 2040, + "type": "tileset", + "name": "上海市区", + "url": "{mars3d_data}/3dtiles/jzw-shanghai/tileset.json", + "maximumScreenSpaceError": 4, + "maxMemory": 2048, + "style": { + "color": { + "conditions": [ + ["${floor} >= 200", "rgba(45, 0, 75, 0.5)"], + ["${floor} >= 100", "rgb(170, 162, 204)"], + ["${floor} >= 50", "rgb(224, 226, 238)"], + ["${floor} >= 25", "rgb(252, 230, 200)"], + ["${floor} >= 10", "rgb(248, 176, 87)"], + ["${floor} >= 5", "rgb(198, 106, 11)"], + ["true", "rgb(127, 59, 8)"] + ] + } + }, + "highlight": { + "type": "click", + "color": "#FFFF00" + }, + "popup": [ + { + "field": "name", + "name": "名称" + }, + { + "field": "floor", + "name": "楼层" + } + ], + "center": { + "lat": 31.257341, + "lng": 121.466139, + "alt": 2170.8, + "heading": 122.2, + "pitch": -31.8 + } + }, + { + "id": 2050, + "pid": 20, + "name": "点云", + "type": "group" + }, + { + "id": 202016, + "pid": 2050, + "type": "tileset", + "name": "高压线塔杆", + "url": "{mars3d_data}/3dtiles/pnts-ganta/tileset.json", + "maximumScreenSpaceError": 1, + "position": { + "alt": 31 + }, + "style": { + "color": { + "conditions": [ + [ + "(${Classification} >= 4) && (${Classification} < 5) ", + "color('#DC143C')" + ], + [ + "(${Classification} >= 7) && (${Classification} < 8) ", + "color('#7B68EE')" + ], + [ + "(${Classification} >= 16) && (${Classification} < 17) ", + "color('#00CED1')" + ], + [ + "(${Classification} >= 17) && (${Classification} < 18) ", + "color('#3CB371')" + ], + [ + "(${Classification} >= 18) && (${Classification} < 19) ", + "color('#FFFF00')" + ], + [ + "(${Classification} >= 19) && (${Classification} < 20) ", + "color('#FFA500')" + ], + [ + "(${Classification} >= 20) && (${Classification} < 21) ", + "color('#FF6347')" + ] + ] + } + }, + "hasOpacity": false, + "center": { + "lat": 31.504746, + "lng": 118.264278, + "alt": 580, + "heading": 29, + "pitch": -49 + } + }, + { + "id": 2060, + "pid": 20, + "name": "BIM模型", + "type": "group" + }, + { + "id": 20601121, + "pid": 2060, + "type": "tileset", + "name": "大学教学楼", + "url": "{mars3d_data}/3dtiles/bim-daxue/tileset.json", + "position": { + "lng": 117.251229, + "lat": 31.844015, + "alt": 31.2 + }, + "highlight": { + "type": "click", + "color": "#FFFF00" + }, + "popup": "all", + "scenetree": "scenetree.json", + "center": { + "lat": 31.842516, + "lng": 117.25107, + "alt": 145, + "heading": 8, + "pitch": -39 + } + }, + { + "pid": 2060, + "type": "tileset", + "name": "轻轨地铁站", + "url": "{mars3d_data}/3dtiles/bim-ditiezhan/tileset.json", + "position": { + "lng": 117.203994, + "lat": 31.857999, + "alt": 28.9 + }, + "rotation": { + "z": 168.1 + }, + "maxMemory": 2048, + "highlight": { + "type": "click", + "color": "#00FF00" + }, + "popup": "all", + "scenetree": "scenetree.json", + "center": { + "lat": 31.856125, + "lng": 117.204513, + "alt": 155, + "heading": 350, + "pitch": -31 + } + }, + { + "id": 206012, + "pid": 2060, + "type": "tileset", + "name": "桥梁", + "url": "{mars3d_data}/3dtiles/bim-qiaoliang/tileset.json", + "position": { + "lng": 117.096906, + "lat": 31.851564, + "alt": 45 + }, + "rotation": { + "z": 17.5 + }, + "maximumScreenSpaceError": 16, + "skipLevelOfDetail": true, + "loadSiblings": true, + "cullRequestsWhileMoving": true, + "cullRequestsWhileMovingMultiplier": 10, + "preferLeaves": true, + "progressiveResolutionHeightFraction": 0.5, + "dynamicScreenSpaceError": true, + "preloadWhenHidden": true, + "center": { + "lat": 31.849357, + "lng": 117.099194, + "alt": 306.2, + "heading": 327.1, + "pitch": -30.9 + }, + "scenetree": "scenetree.json", + "highlight": { + "type": "click", + "color": "#00FF00" + }, + "popup": "all" + }, + { + "id": 2020, + "pid": 20, + "name": "人工建模", + "type": "group" + }, + { + "id": 202013, + "pid": 2020, + "type": "tileset", + "name": "地下管网", + "url": "{mars3d_data}/3dtiles/max-piping/tileset.json", + "position": { + "lng": 117.215457, + "lat": 31.843363, + "alt": -3.6 + }, + "rotation": { + "z": 336.7 + }, + "maximumScreenSpaceError": 2, + "highlight": { + "type": "click", + "color": "#00FF00" + }, + "popup": "all", + "center": { + "lat": 31.838821, + "lng": 117.216402, + "alt": 461, + "heading": 0, + "pitch": -46 + }, + "msg": "演示数据,地下数据拖动时会在地面漂移" + }, + { + "id": 202012, + "pid": 2020, + "type": "tileset", + "name": "石化工厂", + "url": "{mars3d_data}/3dtiles/max-shihua/tileset.json", + "position": { + "lng": 117.077158, + "lat": 31.659116, + "alt": -2.0 + }, + "maximumScreenSpaceError": 1, + "maxMemory": 2048, + "highlight": { + "type": "click", + "color": "#00FF00" + }, + "popup": "all", + "scenetree": "scenetree.json", + "center": { + "lat": 31.654916, + "lng": 117.08278, + "alt": 279, + "heading": 316, + "pitch": -29 + } + }, + { + "id": 202030, + "pid": 2020, + "name": "水利闸门", + "type": "group", + "open": false, + "center": { + "lat": 29.794301, + "lng": 121.47998, + "alt": 262, + "heading": 191, + "pitch": -35 + } + }, + { + "pid": 202030, + "name": "闸门", + "type": "graphic", + "data": [ + { + "type": "modelP", + "position": [121.479813, 29.791278, 16], + "style": { + "url": "https://data.mars3d.cn/gltf/mars/zhamen.glb", + "heading": 105 + } + } + ], + "center": { + "lat": 29.791607, + "lng": 121.479925, + "alt": 27, + "heading": 198, + "pitch": -18 + } + }, + { + "id": 202011, + "pid": 202030, + "type": "tileset", + "name": "整体", + "url": "{mars3d_data}/3dtiles/max-fsdzm/tileset.json", + "position": { + "alt": 15.2 + }, + "maximumScreenSpaceError": 1, + "center": { + "lat": 29.792675, + "lng": 121.480207, + "alt": 190.8, + "heading": 196.1, + "pitch": -49 + } + }, + { + "id": 2030, + "pid": 20, + "name": "倾斜摄影", + "type": "group" + }, + { + "pid": 2030, + "type": "tileset", + "name": "大雁塔", + "url": "{mars3d_data}/3dtiles/qx-dyt/tileset.json", + "position": { + "alt": -27 + }, + "maximumScreenSpaceError": 1, + "center": { + "lat": 34.215516, + "lng": 108.960251, + "alt": 834, + "heading": 4, + "pitch": -48 + }, + "flat": { + "enabled": true, + "editHeight": -24 + }, + "flyTo": false, + "show": false + }, + { + "pid": 2030, + "name": "校园(含单体)", + "type": "group", + "hasOpacity": true, + "center": { + "lat": 43.821193, + "lng": 125.143124, + "alt": 990, + "heading": 342, + "pitch": -50 + }, + "layers": [ + { + "type": "geojson", + "name": "校园-单体化", + "url": "{mars3d_data}/file/geojson/dth-xuexiao-fd.json", + "symbol": { + "type": "polygonP", + "styleOptions": { + "color": "rgba(255, 255, 255, 0.01)", + "clampToGround": true, + "classification": true, + "buffer": 1, + "highlight": { + "type": "click", + "color": "rgba(255,255,0,0.4)" + } + } + }, + "popup": [ + { + "field": "name", + "name": "学校场所" + }, + { + "field": "sfkf", + "name": "是否开放" + }, + { + "field": "remark", + "name": "备注信息" + } + ] + }, + { + "pid": 2030, + "type": "tileset", + "name": "校园", + "url": "{mars3d_data}/3dtiles/qx-xuexiao/tileset.json", + "position": { + "alt": 279.0 + }, + "maximumScreenSpaceError": 1 + } + ] + }, + { + "id": 203014, + "pid": 2030, + "type": "tileset", + "name": "县城社区", + "url": "{mars3d_data}/3dtiles/qx-shequ/tileset.json", + "position": { + "alt": 148.2 + }, + "maximumScreenSpaceError": 2, + "dynamicScreenSpaceError": true, + "cullWithChildrenBounds": false, + "center": { + "lat": 28.440864, + "lng": 119.486477, + "alt": 588.23, + "heading": 268.6, + "pitch": -37.8 + }, + "show": false, + "flyTo": false + }, + { + "id": 203015, + "pid": 2030, + "name": "合肥天鹅湖", + "type": "tileset", + "url": "{mars3d_data}/3dtiles/qx-teh/tileset.json", + "position": { + "lng": 117.218434, + "lat": 31.81807, + "alt": 163 + }, + "maximumScreenSpaceError": 16, + "maxMemory": 2048, + "dynamicScreenSpaceError": true, + "cullWithChildrenBounds": false, + "skipLevelOfDetail": true, + "preferLeaves": true, + "center": { + "lat": 31.795308, + "lng": 117.21948, + "alt": 1820, + "heading": 0, + "pitch": -39 + } + }, + { + "id": 203013, + "pid": 2030, + "type": "geojson", + "name": "文庙-单体化", + "url": " {mars3d_data}/file/geojson/dth-wm.json", + "symbol": { + "type": "polygonP", + "styleOptions": { + "color": "rgba(255, 255, 255, 0.01)", + "clampToGround": true, + "classification": true, + "buffer": 1, + "highlight": { + "color": "rgba(255,255,0,0.4)" + } + } + }, + "popup": [ + { + "field": "name", + "name": "房屋名称" + }, + { + "field": "jznf", + "name": "建造年份" + }, + { + "field": "ssdw", + "name": "所属单位" + }, + { + "field": "remark", + "name": "备注信息" + } + ] + }, + { + "id": 203012, + "pid": 2030, + "type": "tileset", + "name": "文庙", + "url": "{mars3d_data}/3dtiles/qx-simiao/tileset.json", + "position": { + "alt": 38.8 + }, + "maximumScreenSpaceError": 2, + "dynamicScreenSpaceError": true, + "cullWithChildrenBounds": false, + "skipLevelOfDetail": true, + "preferLeaves": true, + "center": { + "lat": 33.589536, + "lng": 119.032216, + "alt": 145.08, + "heading": 3.1, + "pitch": -22.9 + } + }, + { + "id": 99, + "name": "数据图层", + "type": "group" } ] } diff --git a/src/main/resources/static/js/synthesisQuery/digitalSignage-new.js b/src/main/resources/static/js/synthesisQuery/digitalSignage-new.js index f9a4452..c800cd9 100644 --- a/src/main/resources/static/js/synthesisQuery/digitalSignage-new.js +++ b/src/main/resources/static/js/synthesisQuery/digitalSignage-new.js @@ -16,6 +16,9 @@ let isMap = true; // 是否是地图模式 let projectOverview = ""; // 工程概况 let projectTitle = ""; // 项目名称 let centerTitle = ""; // 中间标题 +let polylines1 = []; +let polylines2 = []; +let polylines3 = []; // 转换函数 function dmsToDecimal(dmsString) { @@ -36,6 +39,312 @@ function dmsToDecimal(dmsString) { return degrees + minutes / 60 + seconds / 3600; } +/** + * 根据经纬度获取海拔高度 + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米),如果获取失败则返回0 + */ +async function getAltitude(lng, lat) { + try { + // 确保 map 实例已初始化 + if (!map || !map.scene) { + console.warn("地图未初始化,无法获取海拔高度"); + return 0; + } + + const Cesium = window.mars3d.Cesium; + + // 将经纬度转换为 Cartographic 对象(弧度) + const cartographic = Cesium.Cartographic.fromDegrees(lng, lat); + + // 方法1: 使用 sampleTerrainMostDetailed 获取精确的地形高度(推荐) + const terrainProvider = map.scene.terrainProvider; + if (terrainProvider) { + try { + // 检查地形提供者是否支持采样 + if (terrainProvider.availability || terrainProvider.ready) { + const positions = [cartographic]; + const updatedPositions = + await Cesium.sampleTerrainMostDetailed( + terrainProvider, + positions + ); + if ( + updatedPositions && + updatedPositions.length > 0 && + updatedPositions[0].height !== undefined && + updatedPositions[0].height !== null + ) { + return updatedPositions[0].height; + } + } + } catch (error) { + console.warn( + "使用 sampleTerrainMostDetailed 获取海拔失败:", + error + ); + } + } + + // 方法2: 使用 sampleTerrain 作为备选方案(精度较低但更兼容) + if (terrainProvider && Cesium.sampleTerrain) { + try { + const level = 11; // 地形级别,可以根据需要调整 + const positions = [cartographic]; + const updatedPositions = await Cesium.sampleTerrain( + terrainProvider, + level, + positions + ); + if ( + updatedPositions && + updatedPositions.length > 0 && + updatedPositions[0].height !== undefined && + updatedPositions[0].height !== null + ) { + return updatedPositions[0].height; + } + } catch (error) { + console.warn("使用 sampleTerrain 获取海拔失败:", error); + } + } + + // 方法3: 如果以上方法都失败,返回0作为默认值 + console.warn(`无法获取坐标(${lng}, ${lat})的海拔高度,返回默认值0`); + return 0; + } catch (error) { + console.error("获取海拔高度时发生错误:", error); + return 0; + } +} + +/** + * 方案1: 使用第三方 OpenElevation API 获取海拔(推荐,不依赖地形服务) + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByAPI(lng, lat) { + try { + // 使用 OpenElevation API(免费,无需API密钥) + const response = await fetch( + `https://api.open-elevation.com/api/v1/lookup?locations=${lat},${lng}` + ); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const data = await response.json(); + if (data.results && data.results.length > 0) { + const elevation = data.results[0].elevation; + console.log(`API获取海拔成功: ${elevation}米 (${lng}, ${lat})`); + return elevation; + } + return 0; + } catch (error) { + console.warn("OpenElevation API 获取海拔失败:", error); + // 尝试备用API + return await getElevationByBackupAPI(lng, lat); + } +} + +/** + * 备用API方案: 使用其他高程API服务 + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByBackupAPI(lng, lat) { + try { + // 备用方案1: 使用 elevation-api.io(需要注册但免费额度较大) + // const response = await fetch( + // `https://api.elevation-api.io/api/v1/lookup?locations=${lat},${lng}` + // ); + + // 备用方案2: 使用 Google Elevation API(需要API密钥) + // const response = await fetch( + // `https://maps.googleapis.com/maps/api/elevation/json?locations=${lat},${lng}&key=YOUR_API_KEY` + // ); + + // 备用方案3: 使用 MapBox Elevation API(需要API密钥) + // const response = await fetch( + // `https://api.mapbox.com/v4/mapbox.terrain-rgb/${lng},${lat}.json?access_token=YOUR_ACCESS_TOKEN` + // ); + + // 如果以上API都不可用,返回0 + return 0; + } catch (error) { + console.warn("备用API获取海拔失败:", error); + return 0; + } +} + +/** + * 方案2: 使用 mars3d/Cesium 的地形采样(需要地形服务已加载) + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByTerrain(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const Cesium = window.mars3d.Cesium; + const cartographic = Cesium.Cartographic.fromDegrees(lng, lat); + const terrainProvider = map.scene.terrainProvider; + + if (!terrainProvider) { + console.warn("地形提供者未加载"); + return 0; + } + + // 等待地形提供者准备就绪 + if (terrainProvider.readyPromise) { + await terrainProvider.readyPromise; + } + + // 使用 sampleTerrainMostDetailed + const positions = [cartographic]; + const updatedPositions = await Cesium.sampleTerrainMostDetailed( + terrainProvider, + positions + ); + + if ( + updatedPositions && + updatedPositions.length > 0 && + updatedPositions[0].height !== undefined && + updatedPositions[0].height !== null + ) { + const elevation = updatedPositions[0].height; + console.log( + `地形采样获取海拔成功: ${elevation}米 (${lng}, ${lat})` + ); + return elevation; + } + + return 0; + } catch (error) { + console.warn("地形采样获取海拔失败:", error); + return 0; + } +} + +/** + * 方案3: 使用 Cesium 的 pickPosition 方法(需要场景已渲染) + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByPickPosition(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const Cesium = window.mars3d.Cesium; + const cartesian = Cesium.Cartesian3.fromDegrees(lng, lat, 10000); + const cartographic = Cesium.Cartographic.fromCartesian(cartesian); + + // 使用 pickPosition 获取地形高度 + const pickedPosition = map.scene.pickPosition(cartesian); + if (pickedPosition) { + const pickedCartographic = + Cesium.Cartographic.fromCartesian(pickedPosition); + const elevation = pickedCartographic.height; + console.log( + `pickPosition获取海拔成功: ${elevation}米 (${lng}, ${lat})` + ); + return elevation; + } + + return 0; + } catch (error) { + console.warn("pickPosition获取海拔失败:", error); + return 0; + } +} + +/** + * 方案4: 使用 mars3d 的工具方法(如果可用) + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByMars3dUtil(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const mars3d = window.mars3d; + const Cesium = window.mars3d.Cesium; + + // 尝试使用 mars3d 的工具方法 + if (mars3d.PointUtil && mars3d.PointUtil.getTerrainHeight) { + const height = await mars3d.PointUtil.getTerrainHeight( + map.scene, + lng, + lat + ); + if (height !== undefined && height !== null) { + console.log( + `mars3d工具获取海拔成功: ${height}米 (${lng}, ${lat})` + ); + return height; + } + } + + return 0; + } catch (error) { + console.warn("mars3d工具获取海拔失败:", error); + return 0; + } +} + +/** + * 综合方案: 按优先级尝试多种方法获取海拔 + * @param {number} lng - 经度 + * @param {number} lat - 纬度 + * @returns {Promise} 返回海拔高度(米) + */ +async function getElevationByLngLat(lng, lat) { + // 方案1: 优先使用第三方 API(最可靠,不依赖地形服务) + let elevation = await getElevationByAPI(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案2: 尝试使用 mars3d 工具方法 + elevation = await getElevationByMars3dUtil(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案3: 尝试使用地形采样 + elevation = await getElevationByTerrain(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案4: 尝试使用 pickPosition + elevation = await getElevationByPickPosition(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 所有方法都失败,返回0 + console.warn( + `所有方法都无法获取坐标(${lng}, ${lat})的海拔高度,返回默认值0` + ); + return 0; +} + const mapConfig = { scene: { center: { @@ -375,105 +684,6 @@ function getLocationInfo(id) { ); } -// // 百度地图初始化 -// async function initMap() { -// // if (map) { -// // map.destroy(); -// // map = null; -// // } -// // if (!mars3d.Util.webglreport()) { -// // mars3d.Util.webglerror(); -// // } - -// // try { -// // mapConfig.scene.center.lat = intLat || 31.686288; -// // mapConfig.scene.center.lng = intLng || 117.229619; -// // map = new mars3d.Map("map-box", mapConfig); -// // let graphicLayer = new mars3d.layer.GraphicLayer(); -// // map.addLayer(graphicLayer); - -// // addAllMapPoints(graphicLayer); -// // addMapLine(graphicLayer); -// // addMapAThousandFields(graphicLayer); -// // } catch (error) { -// // console.log("初始化地图出错", error); -// // haoutil.alert(error?.message, "出错了"); -// // } - -// try { -// // 1. 彻底清理旧地图实例 -// if (map) { -// // 移除所有自定义图层 -// if (graphicLayer) { -// graphicLayerList.forEach((e) => { -// graphicLayer.removeGraphic(e); -// }); -// // graphicLayer.clear(); -// // map.removeLayer(graphicLayer, true); // true表示彻底销毁 -// // graphicLayer = null; -// } - -// // 销毁地图实例 -// // map.destroy(); -// // map = null; - -// // // 强制垃圾回收(非必要但建议) -// // if (window.gc) window.gc(); - -// // 5. 添加内容 - -// const centerPoint = [intLng, intLat]; - -// // 方式1:直接飞向目标点 -// map.flyToPoint(centerPoint, { -// radius: 5000, // 可视范围半径(米) -// duration: 2, // 飞行时间(秒) -// heading: 0, // 视角方向(0-360度) -// pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视) -// }); -// await addAllMapPoints(); -// await addMapLine(); -// await addMapAThousandFields(); -// } else { -// // 2. WebGL兼容性检查 -// if (!mars3d.Util.webglreport()) { -// mars3d.Util.webglerror(); -// return; -// } - -// // 3. 初始化新地图 -// mapConfig.scene.center.lat = intLat || 31.686288; -// mapConfig.scene.center.lng = intLng || 117.229619; -// map = new mars3d.Map("map-box", mapConfig); - -// // 4. 创建新的图形图层 -// graphicLayer = new mars3d.layer.GraphicLayer(); - -// const centerPoint = [intLng, intLat]; - -// map.flyToPoint(centerPoint, { -// radius: 5000, // 可视范围半径(米) -// duration: 5, // 飞行时间(秒) -// heading: 0, // 视角方向(0-360度) -// pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视) -// }); - -// map.addLayer(graphicLayer); - -// // 5. 添加内容 -// await addAllMapPoints(); -// await addMapLine(); -// await addMapAThousandFields(); -// } -// } catch (error) { -// // 失败时也清理残留 -// if (map) { -// map.destroy(); -// map = null; -// } -// } -// } - async function initMap() { const mars3d = window.mars3d; // 静态资源引入时,对象都是挂载在window中 const Cesium = window.mars3d.Cesium; @@ -484,6 +694,20 @@ async function initMap() { graphicLayerList.forEach((e) => { graphicLayer.removeGraphic(e); }); + + polylines1.forEach((e) => { + graphicLayer.removeGraphic(e); + }); + polylines2.forEach((e) => { + graphicLayer.removeGraphic(e); + }); + polylines3.forEach((e) => { + graphicLayer.removeGraphic(e); + }); + + polylines1 = []; + polylines2 = []; + polylines3 = []; } const centerPoint = [intLng, intLat]; @@ -679,7 +903,55 @@ async function addAllMapPoints(graphicLayer, mars3d, Cesium) { // 绘制杆塔 if (towerList && towerList.length > 0) { - towerList.forEach((pointData, index) => { + // showData(towerList, graphicLayer); + + const towerList1 = towerList; + + // 异步获取所有点的海拔高度 + // const hList = [ + // 1719.018, 1692.086, 1603.903, 1613.565, 1766.005, 1731.971, 1740.48, + // 1751.94, 1762.712, 1711.249, + // ]; + + const newTowerList2D = towerList1.filter( + (item) => + item.towerProgress != 6 && + item.towerProgress != 7 && + item.towerProgress != 8 && + item.towerProgress != 9 && + item.towerProgress != 10 + ); + const newTowerList3D = towerList1.filter( + (item) => + item.towerProgress == 6 || + item.towerProgress == 7 || + item.towerProgress == 8 || + item.towerProgress == 9 || + item.towerProgress == 10 + ); + const newTowerList3DData = await Promise.all( + newTowerList3D.map(async (item, index) => { + const altitude = await getElevationByLngLat( + item.baiduLon, + item.baiduLat + ); + return { + alt: altitude - 56, // 海拔高度 根据经纬度计算 + heading: 23.0667, // 方向 + headingStr: "23°4′", // 方向字符串 + height: 56, // 杆塔高度 + lat: item.baiduLat, // 纬度 + lon: item.baiduLon, // 经度 + ...item, + }; + }) + ); + + // 过滤出需要绘制3D塔的数据 + + showData(newTowerList3DData, graphicLayer); + + newTowerList2D.forEach((pointData, index) => { const isEven = index % 2 === 0; // 标点垂直方向设置 const billboardVerticalOrigin = Cesium.VerticalOrigin.BOTTOM; // 标点固定底部对齐 @@ -932,115 +1204,121 @@ async function addAllMapPoints(graphicLayer, mars3d, Cesium) { // 添加标点折线(智能绘制虚实线) async function addMapLine(graphicLayer, mars3d, Cesium) { + const newTowerList1 = towerList.filter( + (item) => + item.towerProgress != 6 && + item.towerProgress != 7 && + item.towerProgress != 8 && + item.towerProgress != 9 && + item.towerProgress != 10 + ); + + console.log(newTowerList1, "newTowerList1----"); // 存储所有线段 const segments = []; // 绘制杆塔线 - if (towerList.length > 0) { - for (let i = 0; i < towerList.length - 1; i++) { - const startPoint = towerList[i]; - const endPoint = towerList[i + 1]; + for (let i = 0; i < newTowerList1.length - 1; i++) { + const startPoint = newTowerList1[i]; + const endPoint = newTowerList1[i + 1]; - let lineColor = ""; - let lineMaterial = null; // 用于存储线材质 + let lineColor = ""; + let lineMaterial = null; // 用于存储线材质 - // 判断条件部分保持不变 - if ( - (startPoint.towerProgress == 8 && - endPoint.towerProgress == 8) || - startPoint.towerProgress == 8 - ) { - // lineColor = "#FFFF00"; - // lineMaterial = new Cesium.ColorMaterialProperty({ - // // 实线 - // color: Cesium.Color.fromCssColorString("#FFFF00"), - // }); + // 判断条件部分保持不变 + if ( + (startPoint.towerProgress == 8 && endPoint.towerProgress == 8) || + startPoint.towerProgress == 8 + ) { + // lineColor = "#FFFF00"; + // lineMaterial = new Cesium.ColorMaterialProperty({ + // // 实线 + // color: Cesium.Color.fromCssColorString("#FFFF00"), + // }); - // 创建线段点数组 - const positions = [ - [startPoint.baiduLon, startPoint.baiduLat, 500], - [endPoint.baiduLon, endPoint.baiduLat, 500], - ]; - const polyline = new mars3d.graphic.PolylineEntity({ - positions: positions, - eventParent: false, - style: { - width: 2, // 线宽(像素) - color: "#FFFF00", // 使用动态设置的材质 - clampToGround: true, // 是否贴地(山区建议设为true) - }, - }); - graphicLayer.addGraphic(polyline); - graphicLayerList.push(polyline); - } else if ( - endPoint.existSpan === 1 && - startPoint.existSpan === 1 && - startPoint.towerProgress != 9 && - endPoint.towerProgress != 9 && - startPoint.towerProgress != 8 && - endPoint.towerProgress != 8 && - startPoint.towerProgress != 10 && - endPoint.towerProgress != 10 - ) { - // lineColor = "#d81e06"; - // lineMaterial = new Cesium.PolylineDashMaterialProperty({ - // // 虚线 - // color: Cesium.Color.fromCssColorString(lineColor), - // dashLength: 16.0, // 可调整虚线长度 - // }); - // // 创建线段点数组 - // const positions = [ - // [startPoint.baiduLon, startPoint.baiduLat, 500], - // [endPoint.baiduLon, endPoint.baiduLat, 500], - // ]; - // const polyline = new mars3d.graphic.PolylineEntity({ - // positions: positions, - // eventParent: false, - // style: { - // width: 2, // 线宽(像素) - // material: lineMaterial, // 使用动态设置的材质 - // clampToGround: true, // 是否贴地(山区建议设为true) - // }, - // }); - // graphicLayer.addGraphic(polyline); - // graphicLayerList.push(polyline); - } else if ( - (startPoint.towerProgress === 9 && - endPoint.towerProgress === 9) || - (startPoint.towerProgress === 10 && - endPoint.towerProgress === 10) || - startPoint.towerProgress === 9 - ) { - // lineColor = "#d81e06"; - // lineMaterial = new Cesium.ColorMaterialProperty({ - // // 实线 - // color: Cesium.Color.fromCssColorString(lineColor), - // }); + // 创建线段点数组 + const positions = [ + [startPoint.baiduLon, startPoint.baiduLat, 500], + [endPoint.baiduLon, endPoint.baiduLat, 500], + ]; + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#FFFF00", // 使用动态设置的材质 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } else if ( + endPoint.existSpan === 1 && + startPoint.existSpan === 1 && + startPoint.towerProgress != 9 && + endPoint.towerProgress != 9 && + startPoint.towerProgress != 8 && + endPoint.towerProgress != 8 && + startPoint.towerProgress != 10 && + endPoint.towerProgress != 10 + ) { + // lineColor = "#d81e06"; + // lineMaterial = new Cesium.PolylineDashMaterialProperty({ + // // 虚线 + // color: Cesium.Color.fromCssColorString(lineColor), + // dashLength: 16.0, // 可调整虚线长度 + // }); + // // 创建线段点数组 + // const positions = [ + // [startPoint.baiduLon, startPoint.baiduLat, 500], + // [endPoint.baiduLon, endPoint.baiduLat, 500], + // ]; + // const polyline = new mars3d.graphic.PolylineEntity({ + // positions: positions, + // eventParent: false, + // style: { + // width: 2, // 线宽(像素) + // material: lineMaterial, // 使用动态设置的材质 + // clampToGround: true, // 是否贴地(山区建议设为true) + // }, + // }); + // graphicLayer.addGraphic(polyline); + // graphicLayerList.push(polyline); + } else if ( + (startPoint.towerProgress === 9 && endPoint.towerProgress === 9) || + (startPoint.towerProgress === 10 && + endPoint.towerProgress === 10) || + startPoint.towerProgress === 9 + ) { + // lineColor = "#d81e06"; + // lineMaterial = new Cesium.ColorMaterialProperty({ + // // 实线 + // color: Cesium.Color.fromCssColorString(lineColor), + // }); - // 创建线段点数组 - const positions = [ - [startPoint.baiduLon, startPoint.baiduLat], - [endPoint.baiduLon, endPoint.baiduLat], - ]; - const polyline = new mars3d.graphic.PolylineEntity({ - positions: positions, - eventParent: false, - style: { - width: 2, // 线宽(像素) - color: "#d81e06", // 使用动态设置的材质 - clampToGround: true, // 是否贴地(山区建议设为true) - }, - }); - graphicLayer.addGraphic(polyline); - graphicLayerList.push(polyline); - } else { - lineColor = "#fff"; - lineMaterial = new Cesium.PolylineDashMaterialProperty({ - // 虚线 - // color: Cesium.Color.fromCssColorString(lineColor), - color: Cesium.Color.TRANSPARENT, - dashLength: 16.0, // 可调整虚线长度 - }); - } + // 创建线段点数组 + const positions = [ + [startPoint.baiduLon, startPoint.baiduLat], + [endPoint.baiduLon, endPoint.baiduLat], + ]; + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#d81e06", // 使用动态设置的材质 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } else { + lineColor = "#fff"; + lineMaterial = new Cesium.PolylineDashMaterialProperty({ + // 虚线 + // color: Cesium.Color.fromCssColorString(lineColor), + color: Cesium.Color.TRANSPARENT, + dashLength: 16.0, // 可调整虚线长度 + }); } } @@ -1254,6 +1532,275 @@ async function addMapAThousandFields(graphicLayer, mars3d, Cesium) { }); } } + +function showData(arrdata, graphicLayer) { + const polylinesTB = []; // 图标显示的点 + + // 预处理坐标及角度 + for (let i = 0, len = arrdata.length; i < len; i++) { + const item = arrdata[i]; + const position = Cesium.Cartesian3.fromDegrees( + item.lon, + item.lat, + item.alt + ); + item.position = position; + item.index = i + 1; + + // 模型比例,根据塔高换算 + item.scale = item.height / 52; + + // 测试塔顶高度与实际高度是否一致 + // const positionTop = mars3d.PointUtil.addPositionsHeight(position, item.height) // 顶部点 + // const graphic2 = new mars3d.graphic.PointPrimitive({ + // position: positionTop, + // style: { + // color: "#ff0000", + // pixelSize: 8, + // outlineColor: "#ffffff", + // outlineWidth: 2 + // } + // }) + // graphicLayer.addGraphic(graphic2) + + // 计算电线塔转角角度 + if (i !== 0) { + const priorPt = arrdata[i - 1].position; + item.lineHeading = mars3d.MeasureUtil.getAngle(priorPt, position); // 线的角度 + } + } + + // 计算各坐标及路线坐标,并渲染矢量对象 + for (let i = 0, len = arrdata.length; i < len; i++) { + const item = arrdata[i]; + const position = item.position; + + // 计算电线塔转角角度 + let degree = -2.2333; + // if (degree) { + // item.degree = item.lineHeading - item.heading + // } else { + if (i === 0) { + degree = arrdata[i + 1].lineHeading; + } else if (i === len - 1) { + degree = arrdata[i].lineHeading; + } else { + const nextTower = arrdata[i + 1]; + let stepAngle = (nextTower.lineHeading - item.lineHeading) / 2; + if (stepAngle > 90) { + stepAngle = 180 - stepAngle; + } else if (stepAngle < -90) { + stepAngle = stepAngle + 180; + } + degree = item.lineHeading + stepAngle; + } + item.degree = degree; + // } + + const hpr = new Cesium.HeadingPitchRoll( + Cesium.Math.toRadians(degree), + 0, + 0 + ); + + // 3个悬垂串的位置 + const offsetLineZ = item.height - 3.9; + let newPoint1 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, 10.6, offsetLineZ), + hpr + ); // 左边挂线 + let newPoint2 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, 0, offsetLineZ), + hpr + ); // 中间线 + let newPoint3 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, -10.6, offsetLineZ), + hpr + ); // 右边挂线 + + // polylinesTB.push(newPoint2); // 图标显示的点 + + drawWireTowerModel(graphicLayer, position, degree, item.scale, item); + drawWireTowerJYZModel(newPoint1, degree, graphicLayer); // 3个悬垂串模型 + drawWireTowerJYZModel(newPoint2, degree, graphicLayer); + drawWireTowerJYZModel(newPoint3, degree, graphicLayer); + + // 计算路线点 + const jyzHeight = -5; + newPoint1 = mars3d.PointUtil.addPositionsHeight(newPoint1, jyzHeight); + newPoint2 = mars3d.PointUtil.addPositionsHeight(newPoint2, jyzHeight); + newPoint3 = mars3d.PointUtil.addPositionsHeight(newPoint3, jyzHeight); + + if (i === 0) { + polylines1.push(newPoint1); + polylines2.push(newPoint2); + polylines3.push(newPoint3); + } else { + const angularityFactor = -5000; + const num = 50; + let positions = mars3d.PolyUtil.getLinkedPointList( + polylines1[polylines1.length - 1], + newPoint1, + angularityFactor, + num + ); // 计算曲线点 + polylines1 = polylines1.concat(positions); + + positions = mars3d.PolyUtil.getLinkedPointList( + polylines2[polylines2.length - 1], + newPoint2, + angularityFactor, + num + ); // 计算曲线点 + polylines2 = polylines2.concat(positions); + + positions = mars3d.PolyUtil.getLinkedPointList( + polylines3[polylines3.length - 1], + newPoint3, + angularityFactor, + num + ); // 计算曲线点 + polylines3 = polylines3.concat(positions); + } + } + + // 绘制路线 + drawGuideLine(polylines1, "#0000ff", graphicLayer); + drawGuideLine(polylines2, "#cccccc", graphicLayer); + drawGuideLine(polylines3, "#ff0000", graphicLayer); + + polylines1 = mars3d.LngLatArray.toArray(polylines1); + polylines2 = mars3d.LngLatArray.toArray(polylines2); + polylines3 = mars3d.LngLatArray.toArray(polylines3); +} + +// 绘制电线塔模型 +function drawWireTowerModel(graphicLayer, position, degree, scale, item) { + console.log(item, "item----123"); + const item1 = { + alt: 488.28, + heading: -2.2333, + headingStr: "-2°14′", + height: 52, + lat: item.baiduLat, + lon: item.baiduLon, + }; + // const html = mars3d.Util.getTemplateHtml({ + // title: "塔杆", + // template: [ + // { field: "towerName", name: "杆塔名称" }, + // { field: "time1", name: "协调完成" }, + // { field: "time2", name: "基础开挖" }, + // { field: "height", name: "杆塔高度" }, + // { field: "alt", name: "海拔高度" }, + // ], + // attr: item, + // }); + + const graphic = new mars3d.graphic.ModelPrimitive({ + position, + style: { + url: "https://data.mars3d.cn/gltf/mars/tower/tower-500kV.glb", + heading: degree, + scale: scale, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 0, + 4000.0 + ), + }, + // popup: html, + }); + + // 添加点击事件 + graphic.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + let infoContent = ` +
+

${item.towerName}

+
+ 协调完成 + ${item.time1 || "/"} +
+
+ 基础开挖 + ${item.time2 || "/"} +
+
+ 基础开挖完成 + ${item.time3 || "/"} +
+
+ 基础浇筑 + ${item.time4 || "/"} +
+
+ 基础浇筑完成 + ${item.time5 || "/"} +
+
+ 铁塔组立 + ${item.time6 || "/"} +
+
+ 铁塔组立完成 + ${item.time7 || "/"} +
+
+ 架线施工 + ${item.time8 || "/"} +
+
+ 架线施工完成 + ${item.time9 || "/"} +
+
+ 附件安装完成 + ${item.time10 || "/"} +
+
`; + // 创建自定义信息窗体 + graphicLayer.bindPopup(infoContent, { + position: graphic.position, + }); + }); + graphicLayer.addGraphic(graphic); + graphicLayerList.push(graphic); +} + +function drawWireTowerJYZModel(position, degree, graphicLayer) { + const graphic2 = new mars3d.graphic.ModelPrimitive({ + position, + style: { + url: "https://data.mars3d.cn/gltf/mars/tower/tower-jyz.glb", + heading: degree, + pitch: 90, // 模型本身不是竖直,需要加pitch纠正 + scale: 1, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 0, + 4000.0 + ), + }, + }); + graphicLayer.addGraphic(graphic2); + graphicLayerList.push(graphic2); +} + +function drawGuideLine(positions, color, graphicLayer) { + const graphic = new mars3d.graphic.PolylinePrimitive({ + positions, + style: { + width: 4, + color, + }, + }); + graphicLayer.addGraphic(graphic); + graphicLayerList.push(graphic); +} + // 获取组织树数据 function getOrgTreeData() { ajaxRequest( diff --git a/src/main/resources/static/js/synthesisQuery/digitalSignage-new3.js b/src/main/resources/static/js/synthesisQuery/digitalSignage-new3.js new file mode 100644 index 0000000..e237aa7 --- /dev/null +++ b/src/main/resources/static/js/synthesisQuery/digitalSignage-new3.js @@ -0,0 +1,3311 @@ +var map; // mars3d.Map三维地图对象 + +var graphicLayer; // 矢量图层对象 +var testGraphicLayer; +var treeGraphicLayer; + +var echartTarget = new mars3d.BaseClass(); + +let graphicLayerList = []; // 图形图层列表 +let treeData = []; // 组织机构树数据 +let nodeId = ""; // 当前选中的节点ID +let cablewayList = []; // 索道列表 +let towerList = []; // 塔列表 +let crossingList = []; // 跨越列表 +let crossingListNew = []; // 跨越列表 +let crossingLineListNew = []; // 跨越线列表 +let highwayList = []; // 公路列表 +let aThousandFieldsList = []; // 牵张场地 +let intLng = 116.254; // 初始经度 +let intLat = 39.965; // 初始纬度 +let isMap = true; // 是否是地图模式 +let projectOverview = ""; // 工程概况 +let projectTitle = ""; // 项目名称 +let centerTitle = ""; // 中间标题 + +// 需要覆盖config.json中地图属性参数(当前示例框架中自动处理合并) +const newMapOptions = { + scene: { + center: { + lat: 30.526361, + lng: 116.335987, + alt: 45187, + heading: 0, + pitch: -45, + }, + scene3DOnly: false, + shadows: false, + removeDblClick: true, + sceneMode: 3, + showSun: true, + showMoon: true, + showSkyBox: true, + showSkyAtmosphere: true, + fog: true, + fxaa: true, + orderIndependentTranslucency: true, + requestRenderMode: false, + contextOptions: { + requestWebgl1: false, + }, + globe: { + depthTestAgainstTerrain: false, + baseColor: "#546a53", + showGroundAtmosphere: true, + enableLighting: false, + }, + cameraController: { + zoomFactor: 3.0, + minimumZoomDistance: 1, + maximumZoomDistance: 50000000, + enableRotate: true, + enableTranslate: true, + enableTilt: true, + enableZoom: true, + enableCollisionDetection: true, + minimumCollisionTerrainHeight: 15000, + }, + }, + control: { + homeButton: true, + baseLayerPicker: true, + sceneModePicker: true, + vrButton: false, + fullscreenButton: true, + navigationHelpButton: true, + animation: false, + timeline: false, + infoBox: false, + geocoder: false, + selectionIndicator: false, + contextmenu: { hasDefault: false }, + mouseDownView: true, + zoom: { insertIndex: 1 }, + compass: { bottom: "toolbar", left: "5px" }, + distanceLegend: { left: "10px", bottom: "2px" }, + locationBar: { + fps: true, + crs: "CGCS2000_GK_Zone_3", + crsDecimal: 0, + template: + "
经度:{lng}
纬度:{lat}
横{crsx} 纵{crsy}
海拔:{alt}米
层级:{level}
方向:{heading}°
俯仰角:{pitch}°
视高:{cameraHeight}米
", + }, + }, + method: { + templateValues: { + mars3d_data: "//data.mars3d.cn", + }, + }, + terrain: { + url: "https://data.mars3d.cn/terrain", + show: true, + }, + basemaps: [ + { id: 10, name: "地图底图", type: "group" }, + { + id: 2021, + pid: 10, + name: "天地图影像", + icon: "../../img/mars-map-img/tdt_img.png", + type: "group", + layers: [ + { name: "底图", type: "tdt", layer: "img_d" }, + { name: "注记", type: "tdt", layer: "img_z" }, + ], + show: true, + }, + { + pid: 10, + name: "天地图电子", + icon: "../../img/mars-map-img/tdt_vec.png", + type: "group", + layers: [ + { name: "底图", type: "tdt", layer: "vec_d" }, + { name: "注记", type: "tdt", layer: "vec_z" }, + ], + }, + { + pid: 10, + name: "高德影像", + type: "group", + icon: "../../img/mars-map-img/gaode_img.png", + layers: [ + { name: "底图", type: "gaode", layer: "img_d" }, + { name: "注记", type: "gaode", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "高德电子", + type: "gaode", + icon: "../../img/mars-map-img/gaode_vec.png", + layer: "vec", + }, + { + pid: 10, + name: "百度影像", + type: "group", + icon: "../../img/mars-map-img/bd-img.png", + layers: [ + { name: "底图", type: "baidu", layer: "img_d" }, + { name: "注记", type: "baidu", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "百度电子", + icon: "../../img/mars-map-img/bd-vec.png", + type: "baidu", + layer: "vec", + }, + { + pid: 10, + name: "腾讯影像", + icon: "../../img/mars-map-img/tencent_img.png", + type: "group", + layers: [ + { name: "底图", type: "tencent", layer: "img_d" }, + { name: "注记", type: "tencent", layer: "img_z" }, + ], + }, + { + pid: 10, + name: "腾讯电子", + icon: "../../img/mars-map-img/tencent_vec.png", + type: "tencent", + layer: "vec", + }, + { + pid: 10, + name: "ArcGIS影像", + icon: "../../img/mars-map-img/esriWorldImagery.png", + type: "xyz", + url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", + enablePickFeatures: false, + }, + ], + layers: [ + { + id: 50, + name: "辅助图层", + type: "group", + }, + { + pid: 50, + type: "graticule", + name: "经纬网", + }, + { + pid: 50, + name: "行政区划界线", + type: "tdt", + layer: "xzqh", + mapSplit: false, + }, + { + pid: 50, + name: "高德实时路况", + type: "gaode", + layer: "time", + minimumTerrainLevel: 4, + minimumLevel: 4, + proxy: "//server.mars3d.cn/proxy/", + mapSplit: false, + }, + { + pid: 50, + name: "百度实时路况", + type: "baidu", + layer: "time", + mapSplit: false, + }, + { + id: 60, + name: "地形", + type: "group", + }, + { + pid: 60, + type: "terrain", + name: "Cesium地形", + terrainType: "ion", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "Mars3D地形", + terrainType: "xyz", + url: "{mars3d_data}/terrain", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "ArcGIS地形", + terrainType: "arcgis", + url: "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer", + radio: true, + }, + { + pid: 60, + type: "terrain", + name: "无地形", + terrainType: "none", + radio: true, + }, + { + id: 40, + name: "栅格数据", + type: "group", + }, + { + id: 4020, + pid: 40, + name: "OGC WMS服务", + type: "group", + }, + { + pid: 4020, + name: "教育设施点", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfjy", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + popup: "名称:{项目名称}
类型:{设施类型}
面积:{用地面积}亩
位置:{具体位置}", + mapSplit: false, + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "道路线", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfdl", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + center: { + lat: 31.743214, + lng: 117.277097, + alt: 47197.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "all", + mapSplit: false, + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "建筑物面", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfjzw", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + highlight: { + showTime: 5000, + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.79513, + lng: 117.236172, + alt: 3784.6, + heading: 0.7, + pitch: -42.2, + }, + popup: "all", + show: false, + flyTo: true, + }, + { + pid: 4020, + name: "规划面", + type: "wms", + url: "//server.mars3d.cn/geoserver/mars/wms", + layers: "mars:hfgh", + crs: "EPSG:4326", + parameters: { + transparent: "true", + format: "image/png", + }, + center: { + lat: 31.743214, + lng: 117.277097, + alt: 47197.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "all", + show: false, + flyTo: true, + }, + { + id: 4030, + pid: 40, + name: "ArcGIS 瓦片", + type: "group", + }, + { + pid: 4030, + name: "合肥规划图", + type: "arcgis_cache", + url: "{mars3d_data}/arcgis_cache/hfgh/_alllayers/{z}/{y}/{x}.png", + minimumLevel: 1, + maximumLevel: 17, + minimumTerrainLevel: 1, + maximumTerrainLevel: 17, + rectangle: { + xmin: 116.846, + xmax: 117.642, + ymin: 31.533, + ymax: 32.185, + }, + }, + { + id: 4010, + pid: 40, + name: "ArcGIS Dynamic", + type: "group", + }, + { + id: 401085, + pid: 4010, + type: "arcgis", + name: "主要道路", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + layers: "24", + highlight: { + type: "polyline", + color: "#2deaf7", + width: 4, + clampToGround: true, + }, + center: { + lat: 31.814176, + lng: 117.225362, + alt: 5105.3, + heading: 359.2, + pitch: -83.1, + }, + popup: "all", + mapSplit: false, + }, + { + id: 401086, + pid: 4010, + type: "arcgis", + name: "建筑物", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer", + layers: "35,36,37,39", + highlight: { + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 2916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + id: 401087, + pid: 4010, + type: "arcgis", + name: "规划", + url: "//server.mars3d.cn/arcgis/rest/services/mars/guihua/MapServer", + highlight: { + showTime: 5000, + fill: true, + color: "#2deaf7", + opacity: 0.6, + outline: true, + outlineWidth: 3, + outlineColor: "#e000d9", + outlineOpacity: 1.0, + clampToGround: true, + }, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 2916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: [ + { + field: "用地名称", + name: "名称", + }, + { + field: "用地编号", + name: "编号", + }, + { + field: "规划用地", + name: "规划", + }, + { + type: "html", + html: "
数据仅供参考
", + }, + ], + popupNoTitle: true, + }, + { + id: 30, + name: "矢量数据", + type: "group", + }, + { + id: 3030, + pid: 30, + name: "GeoJSON数据", + type: "group", + }, + { + id: 303011, + pid: 3030, + type: "geojson", + name: "平台标绘", + url: "{mars3d_data}/file/geojson/mars3d-draw.json", + popup: "{type}{name}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "用地规划", + url: "{mars3d_data}/file/geojson/guihua.json", + symbol: { + styleOptions: { + opacity: 0.6, + color: "#0000FF", + width: 3, + clampToGround: true, + }, + styleField: "类型", + styleFieldOptions: { + 一类居住用地: { + color: "#FFDF7F", + }, + 二类居住用地: { + color: "#FFFF00", + }, + 社区服务用地: { + color: "#FF6A38", + }, + 幼托用地: { + color: "#FF6A38", + }, + 商住混合用地: { + color: "#FF850A", + }, + 行政办公用地: { + color: "#FF00FF", + }, + 文化设施用地: { + color: "#FF00FF", + }, + 小学用地: { + color: "#FF7FFF", + }, + 初中用地: { + color: "#FF7FFF", + }, + 体育场用地: { + color: "#00A57C", + }, + 医院用地: { + color: "#A5527C", + }, + 社会福利用地: { + color: "#FF7F9F", + }, + 商业用地: { + color: "#FF0000", + }, + 商务用地: { + color: "#7F0000", + }, + 营业网点用地: { + color: "#FF7F7F", + }, + 一类工业用地: { + color: "#A57C52", + }, + 社会停车场用地: { + color: "#C0C0C0", + }, + 通信用地: { + color: "#007CA5", + }, + 排水用地: { + color: "#00BFFF", + }, + 公园绿地: { + color: "#00FF00", + }, + 防护绿地: { + color: "#007F00", + }, + 河流水域: { + color: "#7FFFFF", + }, + 配建停车场: { + color: "#ffffff", + }, + 道路用地: { + color: "#ffffff", + }, + }, + }, + popup: "{类型}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "建筑物面", + url: "{mars3d_data}/file/geojson/buildings-demo.json", + symbol: { + styleOptions: { + color: "#0d3685", + outlineColor: "#0d3685", + opacity: 0.8, + }, + }, + buildings: { + cloumn: "floors", + height: "flo_height", + }, + popup: "all", + flyTo: true, + flyToOptions: { + minHeight: 2000, + }, + }, + { + pid: 3030, + type: "geojson", + name: "安徽各市", + url: "{mars3d_data}/file/geojson/areas/340000_full.json", + symbol: { + type: "polygon", + styleOptions: { + materialType: "PolyGradient", + materialOptions: { + color: "rgb(15,176,255)", + opacity: 0.7, + alphaPower: 1.3, + }, + label: { + text: "{name}", + opacity: 1, + font_size: 25, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + outlineWidth: 3, + scaleByDistance: true, + scaleByDistance_far: 2743804, + scaleByDistance_farValue: 0.3, + scaleByDistance_near: 10000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 2743804, + distanceDisplayCondition_near: 0, + }, + }, + }, + popup: "{name}", + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "中国省界", + url: "{mars3d_data}/file/geojson/areas/100000_full.json", + symbol: { + type: "polylineP", + styleOptions: { + color: "#ffffff", + width: 2, + opacity: 0.8, + label: { + text: "{name}", + position: "center", + font_size: 30, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + scaleByDistance: true, + scaleByDistance_far: 60000000, + scaleByDistance_farValue: 0.2, + scaleByDistance_near: 1000000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 12000000, + distanceDisplayCondition_near: 0, + }, + }, + }, + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "西藏垭口", + url: "{mars3d_data}/file/geojson/xizangyakou.json", + symbol: { + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scaleByDistance: true, + scaleByDistance_far: 5000000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + verticalOrigin: 1, + horizontalOrigin: 0, + clampToGround: true, + label: { + text: "{NAME}", + font_size: 25, + color: "#ffff00", + font_family: "微软雅黑", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -40, + scaleByDistance: true, + scaleByDistance_far: 1000000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 1000000, + distanceDisplayCondition_near: 0, + visibleDepth: true, + }, + }, + }, + popup: [ + { + field: "NAME", + name: "名称", + }, + { + type: "details", + callback: "showPopupDetails", + field: "图片", + className: "mars3d-popup-btn-custom", + }, + ], + show: false, + flyTo: true, + }, + { + pid: 3030, + type: "geojson", + name: "体育设施点", + url: "{mars3d_data}/file/geojson/hfty-point.json", + symbol: { + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scale: 1, + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + verticalOrigin: 1, + horizontalOrigin: 0, + clampToGround: true, + label: { + text: "{项目名称}", + font_size: 25, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -25, + scaleByDistance: true, + scaleByDistance_far: 80000, + scaleByDistance_farValue: 0.5, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 80000, + distanceDisplayCondition_near: 0, + }, + }, + }, + popup: [ + { + field: "项目名称", + name: "项目名称", + }, + { + field: "建设性质", + name: "建设性质", + }, + { + field: "设施级别", + name: "设施级别", + }, + { + field: "所属区县", + name: "所属区县", + }, + { + field: "建筑内容及", + name: "建筑内容", + }, + { + field: "新增用地(", + name: "新增用地", + }, + { + field: "开工", + name: "开工", + }, + { + field: "总投资(万", + name: "总投资", + }, + { + field: "资金来源", + name: "资金来源", + }, + { + field: "初步选址", + name: "初步选址", + }, + { + field: "设施类型", + name: "设施类型", + }, + { + field: "设施等级", + name: "设施等级", + }, + { + field: "所在区县", + name: "所在区县", + }, + { + field: "具体位置", + name: "具体位置", + }, + { + field: "建设内容(", + name: "建设内容", + }, + { + field: "用地面积(", + name: "用地面积", + format: "mars3d.MeasureUtil.formatArea", + }, + { + field: "设施规模(", + name: "设施规模", + }, + { + field: "举办者类型", + name: "举办者类型", + }, + { + field: "开工时间", + name: "开工时间", + }, + { + field: "总投资额(", + name: "总投资额", + unit: "亿元", + }, + { + field: "项目推进主", + name: "项目推进主体", + }, + { + field: "项目进度", + name: "项目进度", + }, + { + field: "项目来源", + name: "项目来源", + }, + { + field: "备注", + name: "备注", + }, + ], + show: false, + flyTo: true, + }, + { + id: 3070, + pid: 30, + name: "GeoServer WFS", + type: "group", + }, + { + pid: 3070, + type: "wfs", + name: "建筑物面", + url: "//server.mars3d.cn/geoserver/mars/ows", + layer: "mars:hfjzw", + parameters: { + maxFeatures: 500, + }, + minimumLevel: 15, + symbol: { + type: "polygonP", + styleOptions: { + color: "#00469c", + outline: false, + opacity: 1, + }, + }, + buildings: { + cloumn: "floor", + }, + center: { + lat: 31.818396, + lng: 117.229083, + alt: 2554.4, + heading: 359.2, + pitch: -83.1, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + pid: 3070, + name: "教育设施点", + type: "wfs", + url: "//server.mars3d.cn/geoserver/mars/ows", + layer: "mars:hfjy", + parameters: { + maxFeatures: 500, + }, + minimumLevel: 13, + symbol: { + type: "billboardP", + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.6, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + clampToGround: true, + label: { + text: "{项目名称}", + font_size: 15, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -30, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 2000, + distanceDisplayCondition_near: 0, + }, + }, + }, + center: { + lat: 31.812256, + lng: 117.229873, + alt: 4683.91, + heading: 357.4, + pitch: -65.4, + }, + popup: "all", + }, + { + id: 3010, + pid: 30, + name: "ArcGIS WFS", + type: "group", + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "兴趣点", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/1", + where: " 1=1 ", + minimumLevel: 15, + center: { + lat: 31.818396, + lng: 117.229083, + alt: 2554.4, + heading: 359.2, + pitch: -83.1, + }, + symbol: { + type: "billboardP", + styleOptions: { + image: "https://data.mars3d.cn/img/marker/mark-blue.png", + scaleByDistance: true, + scaleByDistance_far: 20000, + scaleByDistance_farValue: 0.6, + scaleByDistance_near: 1000, + scaleByDistance_nearValue: 1, + clampToGround: true, + label: { + text: "{NAME}", + font_size: 15, + color: "#ffffff", + outline: true, + outlineColor: "#000000", + pixelOffsetY: -30, + distanceDisplayCondition: true, + distanceDisplayCondition_far: 3000, + distanceDisplayCondition_near: 0, + }, + }, + styleField: "address", + styleFieldOptions: { + AB03: { + image: "https://data.mars3d.cn/img/marker/mark-red.png", + }, + A980: { + image: "https://data.mars3d.cn/img/marker/mark-blue.png", + }, + A900: { + image: "https://data.mars3d.cn/img/marker/mark-green.png", + }, + }, + }, + popup: "名称:{NAME}
地址:{address}", + show: false, + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "道路", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/28", + minimumLevel: 14, + symbol: { + type: "polylineP", + styleOptions: { + color: "#3388ff", + width: 3, + clampToGround: true, + }, + styleField: "NAME", + styleFieldOptions: { + 祁门路: { + color: "#8744c0", + width: 3, + }, + 东流路: { + color: "#f7ba2a", + width: 3, + }, + 翡翠路: { + color: "#20a0ff", + width: 3, + }, + 岳西路: { + color: "#50bfff", + width: 3, + }, + }, + }, + popup: "名称:{NAME}", + center: { + lat: 31.814176, + lng: 117.225362, + alt: 5105.3, + heading: 359.2, + pitch: -83.1, + }, + }, + { + pid: 3010, + type: "arcgis_wfs", + name: "建筑物面", + url: "//server.mars3d.cn/arcgis/rest/services/mars/hefei/MapServer/37", + minimumLevel: 15, + symbol: { + styleOptions: { + color: "#0d3685", + outlineColor: "#0d3685", + opacity: 0.8, + }, + }, + buildings: { + cloumn: "floor", + }, + debuggerTileInfo: false, + center: { + lat: 31.816951, + lng: 117.22898, + alt: 1916.7, + heading: 0.3, + pitch: -78.8, + }, + popup: "名称:{NAME}
层数:{floor}", + }, + { + id: 3060, + pid: 30, + name: "CZML数据", + type: "group", + }, + { + id: 306010, + pid: 3060, + type: "czml", + name: "汽车", + url: "{mars3d_data}/file/czml/car.czml", + center: { + lat: 40.894745, + lng: 121.920252, + alt: 904, + heading: 64, + pitch: -67, + }, + radio: true, + flyTo: true, + }, + { + id: 306011, + pid: 3060, + type: "czml", + name: "卫星轨道", + url: "{mars3d_data}/file/czml/satellite-simple.czml", + popup: "all", + radio: true, + flyTo: true, + }, + { + id: 3050, + pid: 30, + name: "KML数据", + type: "group", + }, + { + pid: 3050, + type: "kml", + name: "海上安全警告", + url: "{mars3d_data}/file/kml/NAVWARN.kmz", + popup: "all", + }, + { + pid: 3050, + type: "kml", + name: "国境线", + url: "{mars3d_data}/file/kml/countryboundary.kml", + symbol: { + styleOptions: { + color: "#FED976", + width: 2, + }, + }, + }, + { + pid: 3050, + type: "kml", + name: "省界线", + url: "{mars3d_data}/file/kml/province.kml", + symbol: { + styleOptions: { + color: "#00FF00", + width: 2, + }, + }, + }, + { + id: 20, + name: "三维模型", + type: "group", + }, + { + id: 2010, + pid: 20, + name: "gltf模型", + type: "group", + }, + { + pid: 2010, + type: "graphic", + name: "风力发电机", + data: [ + { + type: "modelP", + position: [117.219071, 31.828783, 39.87], + style: { + url: "https://data.mars3d.cn/gltf/mars/fengche.gltf", + scale: 50, + heading: -93, + }, + }, + ], + popup: "示例信息,这是一个风力发电机", + center: { + lat: 31.821083, + lng: 117.21832, + alt: 832.64, + heading: 2.3, + pitch: -39.2, + }, + }, + { + pid: 2010, + type: "graphic", + name: "警车", + data: [ + { + type: "modelP", + position: [117.217458, 31.815349, 35.03], + style: { + url: "https://data.mars3d.cn/gltf/mars/jingche/jingche.gltf", + scale: 2, + heading: -95, + clampToGround: true, + }, + }, + ], + center: { + lat: 31.815363, + lng: 117.215958, + alt: 107.35, + heading: 90.7, + pitch: -26.1, + }, + }, + { + id: 2040, + pid: 20, + name: "城市白模", + type: "group", + }, + { + id: 204011, + pid: 2040, + type: "tileset", + name: "合肥市区", + url: "{mars3d_data}/3dtiles/jzw-hefei/tileset.json", + maximumScreenSpaceError: 1, + maxMemory: 1024, + style: { + color: { + conditions: [["true", "color('rgba(42, 160, 224, 1)')"]], + }, + }, + marsJzwStyle: true, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "objectid", + name: "编号", + }, + { + field: "name", + name: "名称", + }, + { + field: "height", + name: "楼高", + unit: "米", + }, + ], + center: { + lat: 31.786281, + lng: 117.223716, + alt: 3718, + heading: 2, + pitch: -45, + }, + }, + { + pid: 2040, + type: "tileset", + name: "合肥市区-带贴图", + url: "{mars3d_data}/3dtiles/jzw-hefei-cz/tileset.json", + maximumScreenSpaceError: 1, + maxMemory: 1024, + marsJzwStyle: true, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "objectid", + name: "编号", + }, + { + field: "remark", + name: "名称", + }, + { + field: "height", + name: "楼高", + unit: "米", + }, + ], + center: { + lat: 31.786281, + lng: 117.223716, + alt: 3718, + heading: 2, + pitch: -45, + }, + }, + { + id: 204012, + pid: 2040, + type: "tileset", + name: "上海市区", + url: "{mars3d_data}/3dtiles/jzw-shanghai/tileset.json", + maximumScreenSpaceError: 4, + maxMemory: 2048, + style: { + color: { + conditions: [ + ["${floor} >= 200", "rgba(45, 0, 75, 0.5)"], + ["${floor} >= 100", "rgb(170, 162, 204)"], + ["${floor} >= 50", "rgb(224, 226, 238)"], + ["${floor} >= 25", "rgb(252, 230, 200)"], + ["${floor} >= 10", "rgb(248, 176, 87)"], + ["${floor} >= 5", "rgb(198, 106, 11)"], + ["true", "rgb(127, 59, 8)"], + ], + }, + }, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: [ + { + field: "name", + name: "名称", + }, + { + field: "floor", + name: "楼层", + }, + ], + center: { + lat: 31.257341, + lng: 121.466139, + alt: 2170.8, + heading: 122.2, + pitch: -31.8, + }, + }, + { + id: 2050, + pid: 20, + name: "点云", + type: "group", + }, + { + id: 202016, + pid: 2050, + type: "tileset", + name: "高压线塔杆", + url: "{mars3d_data}/3dtiles/pnts-ganta/tileset.json", + maximumScreenSpaceError: 1, + position: { + alt: 31, + }, + style: { + color: { + conditions: [ + [ + "(${Classification} >= 4) && (${Classification} < 5) ", + "color('#DC143C')", + ], + [ + "(${Classification} >= 7) && (${Classification} < 8) ", + "color('#7B68EE')", + ], + [ + "(${Classification} >= 16) && (${Classification} < 17) ", + "color('#00CED1')", + ], + [ + "(${Classification} >= 17) && (${Classification} < 18) ", + "color('#3CB371')", + ], + [ + "(${Classification} >= 18) && (${Classification} < 19) ", + "color('#FFFF00')", + ], + [ + "(${Classification} >= 19) && (${Classification} < 20) ", + "color('#FFA500')", + ], + [ + "(${Classification} >= 20) && (${Classification} < 21) ", + "color('#FF6347')", + ], + ], + }, + }, + hasOpacity: false, + center: { + lat: 31.504746, + lng: 118.264278, + alt: 580, + heading: 29, + pitch: -49, + }, + }, + { + id: 2060, + pid: 20, + name: "BIM模型", + type: "group", + }, + { + id: 20601121, + pid: 2060, + type: "tileset", + name: "大学教学楼", + url: "{mars3d_data}/3dtiles/bim-daxue/tileset.json", + position: { + lng: 117.251229, + lat: 31.844015, + alt: 31.2, + }, + highlight: { + type: "click", + color: "#FFFF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.842516, + lng: 117.25107, + alt: 145, + heading: 8, + pitch: -39, + }, + }, + { + pid: 2060, + type: "tileset", + name: "轻轨地铁站", + url: "{mars3d_data}/3dtiles/bim-ditiezhan/tileset.json", + position: { + lng: 117.203994, + lat: 31.857999, + alt: 28.9, + }, + rotation: { + z: 168.1, + }, + maxMemory: 2048, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.856125, + lng: 117.204513, + alt: 155, + heading: 350, + pitch: -31, + }, + }, + { + id: 206012, + pid: 2060, + type: "tileset", + name: "桥梁", + url: "{mars3d_data}/3dtiles/bim-qiaoliang/tileset.json", + position: { + lng: 117.096906, + lat: 31.851564, + alt: 45, + }, + rotation: { + z: 17.5, + }, + maximumScreenSpaceError: 16, + skipLevelOfDetail: true, + loadSiblings: true, + cullRequestsWhileMoving: true, + cullRequestsWhileMovingMultiplier: 10, + preferLeaves: true, + progressiveResolutionHeightFraction: 0.5, + dynamicScreenSpaceError: true, + preloadWhenHidden: true, + center: { + lat: 31.849357, + lng: 117.099194, + alt: 306.2, + heading: 327.1, + pitch: -30.9, + }, + scenetree: "scenetree.json", + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + }, + { + id: 2020, + pid: 20, + name: "人工建模", + type: "group", + }, + { + id: 202013, + pid: 2020, + type: "tileset", + name: "地下管网", + url: "{mars3d_data}/3dtiles/max-piping/tileset.json", + position: { + lng: 117.215457, + lat: 31.843363, + alt: -3.6, + }, + rotation: { + z: 336.7, + }, + maximumScreenSpaceError: 2, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + center: { + lat: 31.838821, + lng: 117.216402, + alt: 461, + heading: 0, + pitch: -46, + }, + msg: "演示数据,地下数据拖动时会在地面漂移", + }, + { + id: 202012, + pid: 2020, + type: "tileset", + name: "石化工厂", + url: "{mars3d_data}/3dtiles/max-shihua/tileset.json", + position: { + lng: 117.077158, + lat: 31.659116, + alt: -2.0, + }, + maximumScreenSpaceError: 1, + maxMemory: 2048, + highlight: { + type: "click", + color: "#00FF00", + }, + popup: "all", + scenetree: "scenetree.json", + center: { + lat: 31.654916, + lng: 117.08278, + alt: 279, + heading: 316, + pitch: -29, + }, + }, + { + id: 202030, + pid: 2020, + name: "水利闸门", + type: "group", + open: false, + center: { + lat: 29.794301, + lng: 121.47998, + alt: 262, + heading: 191, + pitch: -35, + }, + }, + { + pid: 202030, + name: "闸门", + type: "graphic", + data: [ + { + type: "modelP", + position: [121.479813, 29.791278, 16], + style: { + url: "https://data.mars3d.cn/gltf/mars/zhamen.glb", + heading: 105, + }, + }, + ], + center: { + lat: 29.791607, + lng: 121.479925, + alt: 27, + heading: 198, + pitch: -18, + }, + }, + { + id: 202011, + pid: 202030, + type: "tileset", + name: "整体", + url: "{mars3d_data}/3dtiles/max-fsdzm/tileset.json", + position: { + alt: 15.2, + }, + maximumScreenSpaceError: 1, + center: { + lat: 29.792675, + lng: 121.480207, + alt: 190.8, + heading: 196.1, + pitch: -49, + }, + }, + { + id: 2030, + pid: 20, + name: "倾斜摄影", + type: "group", + }, + { + pid: 2030, + type: "tileset", + name: "大雁塔", + url: "{mars3d_data}/3dtiles/qx-dyt/tileset.json", + position: { + alt: -27, + }, + maximumScreenSpaceError: 1, + center: { + lat: 34.215516, + lng: 108.960251, + alt: 834, + heading: 4, + pitch: -48, + }, + flat: { + enabled: true, + editHeight: -24, + }, + flyTo: false, + show: false, + }, + { + pid: 2030, + name: "校园(含单体)", + type: "group", + hasOpacity: true, + center: { + lat: 43.821193, + lng: 125.143124, + alt: 990, + heading: 342, + pitch: -50, + }, + layers: [ + { + type: "geojson", + name: "校园-单体化", + url: "{mars3d_data}/file/geojson/dth-xuexiao-fd.json", + symbol: { + type: "polygonP", + styleOptions: { + color: "rgba(255, 255, 255, 0.01)", + clampToGround: true, + classification: true, + buffer: 1, + highlight: { + type: "click", + color: "rgba(255,255,0,0.4)", + }, + }, + }, + popup: [ + { + field: "name", + name: "学校场所", + }, + { + field: "sfkf", + name: "是否开放", + }, + { + field: "remark", + name: "备注信息", + }, + ], + }, + { + pid: 2030, + type: "tileset", + name: "校园", + url: "{mars3d_data}/3dtiles/qx-xuexiao/tileset.json", + position: { + alt: 279.0, + }, + maximumScreenSpaceError: 1, + }, + ], + }, + { + id: 203014, + pid: 2030, + type: "tileset", + name: "县城社区", + url: "{mars3d_data}/3dtiles/qx-shequ/tileset.json", + position: { + alt: 148.2, + }, + maximumScreenSpaceError: 2, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + center: { + lat: 28.440864, + lng: 119.486477, + alt: 588.23, + heading: 268.6, + pitch: -37.8, + }, + show: false, + flyTo: false, + }, + { + id: 203015, + pid: 2030, + name: "合肥天鹅湖", + type: "tileset", + url: "{mars3d_data}/3dtiles/qx-teh/tileset.json", + position: { + lng: 117.218434, + lat: 31.81807, + alt: 163, + }, + maximumScreenSpaceError: 16, + maxMemory: 2048, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + skipLevelOfDetail: true, + preferLeaves: true, + center: { + lat: 31.795308, + lng: 117.21948, + alt: 1820, + heading: 0, + pitch: -39, + }, + }, + { + id: 203013, + pid: 2030, + type: "geojson", + name: "文庙-单体化", + url: " {mars3d_data}/file/geojson/dth-wm.json", + symbol: { + type: "polygonP", + styleOptions: { + color: "rgba(255, 255, 255, 0.01)", + clampToGround: true, + classification: true, + buffer: 1, + highlight: { + color: "rgba(255,255,0,0.4)", + }, + }, + }, + popup: [ + { + field: "name", + name: "房屋名称", + }, + { + field: "jznf", + name: "建造年份", + }, + { + field: "ssdw", + name: "所属单位", + }, + { + field: "remark", + name: "备注信息", + }, + ], + }, + { + id: 203012, + pid: 2030, + type: "tileset", + name: "文庙", + url: "{mars3d_data}/3dtiles/qx-simiao/tileset.json", + position: { + alt: 38.8, + }, + maximumScreenSpaceError: 2, + dynamicScreenSpaceError: true, + cullWithChildrenBounds: false, + skipLevelOfDetail: true, + preferLeaves: true, + center: { + lat: 33.589536, + lng: 119.032216, + alt: 145.08, + heading: 3.1, + pitch: -22.9, + }, + }, + { + id: 99, + name: "数据图层", + type: "group", + }, + ], +}; + +// 初始化地图 +// 初始化地图业务,生命周期钩子函数(必须),框架在地图初始化完成后自动调用该函数 +async function initMap() { + const mars3d = window.mars3d; // 静态资源引入时,对象都是挂载在window中 + const Cesium = window.mars3d.Cesium; + try { + if (map) { + // 移除所有自定义图层 + if (graphicLayer) { + graphicLayerList.forEach((e) => { + graphicLayer.removeGraphic(e); + }); + } + const centerPoint = [intLng, intLat]; + + // 方式1:直接飞向目标点 + map.flyToPoint(centerPoint, { + radius: 5000, // 可视范围半径(米) + duration: 2, // 飞行时间(秒) + heading: 0, // 视角方向(0-360度) + pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视) + }); + await addAllMapPoints(graphicLayer, mars3d, Cesium); + await addMapLine(graphicLayer, mars3d, Cesium); + await addMapAThousandFields(graphicLayer, mars3d, Cesium); + } else { + // 2. WebGL兼容性检查 + if (!mars3d.Util.webglreport()) { + mars3d.Util.webglerror(); + return; + } + + // 3. 初始化新地图 + newMapOptions.scene.center.lat = intLat || 31.686288; + newMapOptions.scene.center.lng = intLng || 117.229619; + map = new mars3d.Map("map-box", newMapOptions); + + // 4. 创建新的图形图层 + graphicLayer = new mars3d.layer.GraphicLayer(); + + const centerPoint = [intLng, intLat]; + + map.flyToPoint(centerPoint, { + radius: 5000, // 可视范围半径(米) + duration: 5, // 飞行时间(秒) + heading: 0, // 视角方向(0-360度) + pitch: -45, // 俯仰角度(-90俯视,0平视,90仰视) + }); + + map.addLayer(graphicLayer); + + // 5. 添加内容 + await addAllMapPoints(graphicLayer, mars3d, Cesium); + await addMapLine(graphicLayer, mars3d, Cesium); + await addMapAThousandFields(graphicLayer, mars3d, Cesium); + } + } catch (error) { + // 失败时也清理残留 + if (map) { + map.destroy(); + map = null; + } + } +} + +// 释放当前地图业务的生命周期函数,具体项目中时必须写onMounted的反向操作(如解绑事件、对象销毁、变量置空) +function destroyMap() { + map = null; +} + +// 获取组织树数据 +function getOrgTreeData() { + ajaxRequest( + dataUrl + "/backstage/digitalSignage/getProTree", + "POST", + {}, + true, + function () {}, + function (result) { + console.log(result, "组织机构树数据获取成功---"); + + const { data } = result; + + // 判断是否有工程 有的话取第一个 + if (data && data.length > 0) { + setSpreadToNodes(data); + treeData = data; + // 获取第一个工程 + if ( + data[0].children && + data[0].children.length > 0 && + data[0].children[0].children && + data[0].children[0].children.length > 0 + ) { + nodeId = data[0].children[0].children[0].id; + + if ( + data[0].children[0].children[0].lon && + data[0].children[0].children[0].lat + ) { + intLng = data[0].children[0].children[0].lon; + intLat = data[0].children[0].children[0].lat; + projectTitle = data[0].children[0].children[0].title; + } + + if (treeData[0].children[0].children[0].title) { + projectTitle = + treeData[0].children[0].children[0].title; + $(".center-title-box").text(projectTitle + "作战图"); + } + + // getScrollData(nodeId); + $(".project-overview-content").text( + treeData[0].children[0].children[0].projectOverview || + "暂无" + ); + getLegendData(nodeId); + getLocationInfo(nodeId); + } else { + initMap(); + } + } + }, + function (xhr) { + error(xhr); + } + ); +} + +getOrgTreeData(); + +// 递归 +function setSpreadToNodes(nodes, spreadValue = true) { + if (!nodes || !Array.isArray(nodes)) return; + + nodes.forEach((node) => { + node.spread = spreadValue; + + if (node.children && node.children.length > 0) { + setSpreadToNodes(node.children, spreadValue); + } + }); +} + +// 获取位置信息 +function getLocationInfo(id) { + const params = { + encryptedData: encryptCBC(JSON.stringify({ id })), + }; + ajaxRequest( + dataUrl + "/backstage/digitalSignage/getTowersInfo", + "POST", + params, + true, + function () {}, + function (result) { + console.log(result, "获取位置信息---"); + const { data } = result; + + crossingList = []; + crossingListNew = []; + crossingLineListNew = []; + cablewayList = []; + towerList = []; + + if (data.cablewaTransVos.length > 0) { + cablewayList = data.cablewaTransVos; + } else { + cablewayList = []; + } + if (data.towerInfoVos.length > 0) { + towerList = data.towerInfoVos; + } else { + towerList = []; + } + if (data.spanInfoVos.length > 0) { + crossingList = data.spanInfoVos; + } else { + crossingList = []; + crossingListNew = []; + crossingLineListNew = []; + } + + if (data.highwayList.length > 0) { + highwayList = data.highwayList; + } else { + highwayList = []; + } + + if (data.aThousandFieldsList.length > 0) { + aThousandFieldsList = data.aThousandFieldsList; + } else { + aThousandFieldsList = []; + } + + // 处理一下交叉信息 + if (crossingList && crossingList.length > 0) { + crossingList.forEach((item) => { + let lineList = []; + if (item.lonAndLat && item.lonAndLat.indexOf(",") > -1) { + const lonAndLatList = item.lonAndLat.split(","); + + lonAndLatList.forEach((lonAndLat, index) => { + const lonAndLatItem = lonAndLat.split("@"); + crossingListNew.push({ + baiduLon: lonAndLatItem[0], + baiduLat: lonAndLatItem[1], + ...item, + }); + + lineList.push({ + baiduLon: lonAndLatItem[0], + baiduLat: lonAndLatItem[1], + ...item, + }); + }); + } + + crossingLineListNew.push({ lineList }); + }); + } + initMap(); + }, + function (xhr) { + error(xhr); + } + ); +} + +// 获取左下角图例数据源 +function getLegendData(id) { + const params = { + encryptedData: encryptCBC(JSON.stringify({ id })), + }; + + ajaxRequest( + dataUrl + "/backstage/digitalSignage/getTowerProgressNum", + "POST", + params, + true, + function () {}, + function (result) { + const { data } = result; + + if (data) { + Object.values(data).forEach((value, index) => { + legendData[index].value = value; + }); + } + + const legendBox = $(".legend-box"); + let innerHtml = ""; + legendData.forEach((item, index) => { + innerHtml += ` +
+ + ${item.name} + ${item.value} +
+ `; + }); + + legendBox.html(innerHtml); + }, + function (xhr) { + error(xhr); + } + ); +} + +// 添加标点 +async function addAllMapPoints(graphicLayer, mars3d, Cesium) { + const iconTypeList = { + // 1: "../../img/digitalSignage/icon_three.png", + 1: "../../img/digitalSignage/icon_three_new.png", + // 2: "../../img/digitalSignage/icon_two.png", + 2: "../../img/digitalSignage/icon_two_new.png", + // 3: "../../img/digitalSignage/icon_five.png", + 3: "../../img/digitalSignage/icon_five_new.png", + // 4: "../../img/digitalSignage/icon_seven.png", + // 4: "../../img/digitalSignage/icon_purple.png", + 4: "../../img/digitalSignage/icon_seven_new.png", + // 5: "../../img/digitalSignage/icon_four.png", + 5: "../../img/digitalSignage/icon_four_new.png", + // 6: "../../img/digitalSignage/icon_six.png", + 6: "../../img/digitalSignage/zt_orange.png", + 7: "../../img/digitalSignage/zt_red.png", + 8: "../../img/digitalSignage/zt_red.png", // 新增的工序 + 9: "../../img/digitalSignage/zt_red.png", + 10: "../../img/digitalSignage/zt_green.png", + // 0: "../../img/digitalSignage/icon_one.png", + 0: "../../img/digitalSignage/icon_one_new.png", + 12: "../../img/digitalSignage/sd.png", + 20: "../../img/digitalSignage/project.png", + // 21: "../../img/digitalSignage/zt_white.png", + 21: "../../img/digitalSignage/zt_gary.png", + }; + + // 绘制索道标点 + if (cablewayList && cablewayList.length > 0) { + cablewayList.forEach((pointData, index) => { + if ( + pointData.cablewaTransPointVoList && + pointData.cablewaTransPointVoList.length > 0 + ) { + const billboard = new mars3d.graphic.BillboardEntity({ + position: [ + pointData.cablewaTransPointVoList[0].lng, + pointData.cablewaTransPointVoList[0].lat, + 1000, + ], + style: { + image: iconTypeList[12], + width: 30, + height: 30, + scale: 1, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + clampToGround: true, + }, + }); + + // 添加点击事件 + billboard.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + const infoContent = ` +
+

+ 索道运输 +

+
+ 索道位置 + ${pointData.towerName} +
+
+ 索道长度 + ${pointData.cablewayLength} KM +
+
+ 最大载重 + ${pointData.maxHeight} kg +
+
+ 安全距离 + ${pointData.safetyDistance} m +
+
+ 最大坡度 + ${pointData.maxSlope} ° +
+
+ 索道宽度 + ${pointData.cablewayWidth} m +
+
`; + // 创建自定义信息窗体 + graphicLayer.bindPopup(infoContent, { + position: graphic.position, + }); + }); + + graphicLayer.addGraphic(billboard); + + graphicLayerList.push(billboard); + } + }); + } + + // 绘制项目部 + if (intLng && intLat) { + // const positionNew = mars3d.PointTrans.bd2wgs([intLng, intLat]); + const billboard = new mars3d.graphic.BillboardEntity({ + position: [intLng, intLat, 1000], + style: { + image: iconTypeList[20], + width: 30, + height: 30, + + scale: 1, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + clampToGround: true, + }, + }); + + // 添加点击事件 + billboard.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + const infoContent = ` +
+

+ ${projectTitle} +

+
`; + // 创建自定义信息窗体 + graphicLayer.bindPopup(infoContent, { + position: graphic.position, + }); + }); + + graphicLayer.addGraphic(billboard); + graphicLayerList.push(billboard); + } + + // 绘制杆塔 + if (towerList && towerList.length > 0) { + // showData(towerList, graphicLayer); + + const towerList1 = towerList; + + const newTowerList = await Promise.all( + towerList1.map(async (item, index) => { + const altitude = await getElevationByLngLat( + item.baiduLon, + item.baiduLat + ); + return { + alt: altitude - 56, // 海拔高度 根据经纬度计算 + heading: 23.0667, // 方向 + headingStr: "23°4′", // 方向字符串 + height: 56, // 杆塔高度 + lat: item.baiduLat, // 纬度 + lon: item.baiduLon, // 经度 + }; + }) + ); + + console.log(newTowerList, "newTowerList----"); + + showData(newTowerList, graphicLayer); + if (1 + 1 == 2) return; + + mars3d.Util.fetchJson({ + url: "https://data.mars3d.cn/file/apidemo/tower-taihu.json", + }) + .then(function (res) { + showData(res, graphicLayer); + }) + .catch(function (error) { + console.log("加载JSON出错", error); + }); + towerList.forEach((pointData, index) => { + const isEven = index % 2 === 0; + // 标点垂直方向设置 + const billboardVerticalOrigin = Cesium.VerticalOrigin.BOTTOM; // 标点固定底部对齐 + + // 标签位置设置 + const labelVerticalOrigin = isEven + ? Cesium.VerticalOrigin.BOTTOM + : Cesium.VerticalOrigin.TOP; + const pixelOffsetY = isEven ? 40 : -70; // 调整偏移量(根据标点大小适当调整) + + const iconUrl = iconTypeList[parseInt(pointData.towerProgress)]; + + const billboard = new mars3d.graphic.BillboardEntity({ + position: [pointData.baiduLon, pointData.baiduLat], + style: { + image: iconUrl, + width: 30, + height: 30, + scale: 1, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + clampToGround: true, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, // 必须设置 + disableDepthTestDistance: Number.POSITIVE_INFINITY, // 防止被地形遮挡 + }, + // 其他属性 + attr: { + id: index, + name: pointData.towerName, + }, + }); + + const label2 = new mars3d.graphic.DivGraphic({ + position: [pointData.baiduLon, pointData.baiduLat], + style: { + html: `
${pointData.towerName}
`, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: labelVerticalOrigin, + scaleByDistance: true, + offsetY: isEven ? -40 : 10, + heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, + disableDepthTestDistance: Number.POSITIVE_INFINITY, + }, + }); + + graphicLayer.addGraphic(billboard); + graphicLayer.addGraphic(label2); + + // 添加点击事件 + billboard.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + let infoContent = ` +
+

${pointData.towerName}

+
+ 协调完成 + ${pointData.time1 || "/"} +
+
+ 基础开挖 + ${pointData.time2 || "/"} +
+
+ 基础开挖完成 + ${pointData.time3 || "/"} +
+
+ 基础浇筑 + ${pointData.time4 || "/"} +
+
+ 基础浇筑完成 + ${pointData.time5 || "/"} +
+
+ 铁塔组立 + ${pointData.time6 || "/"} +
+
+ 铁塔组立完成 + ${pointData.time7 || "/"} +
+
+ 架线施工 + ${pointData.time8 || "/"} +
+
+ 架线施工完成 + ${pointData.time9 || "/"} +
+
+ 附件安装完成 + ${pointData.time10 || "/"} +
+
`; + // 创建自定义信息窗体 + graphicLayer.bindPopup(infoContent, { + position: graphic.position, + }); + }); + + graphicLayerList.push(billboard); + graphicLayerList.push(label2); + }); + } + + // 绘制交叉跨越 + if (crossingListNew.length > 0) { + crossingListNew.forEach((pointData, index) => { + // const positionNew = mars3d.PointTrans.bd2wgs([ + // pointData.baiduLon, + // pointData.baiduLat, + // ]); + const billboard = new mars3d.graphic.BillboardEntity({ + position: [pointData.baiduLon, pointData.baiduLat, 1000], + style: { + image: iconTypeList[21], + width: 30, + height: 30, + scale: 1, + horizontalOrigin: Cesium.HorizontalOrigin.CENTER, + verticalOrigin: Cesium.VerticalOrigin.BOTTOM, + clampToGround: true, + }, + }); + + // 添加点击事件 + billboard.on(mars3d.EventType.click, function (event) { + const graphic = event.graphic; + const infoContent = ` +
+ +
+

+ 交叉跨越信息 ( ${pointData.spanTowerName} ) +

+
+ 上层线路 + ${pointData.upperLine} +
+
+ 下层线路 + ${pointData.lowerLine} +
+
+ 交叉角度 + ${pointData.intersectionAngle} ° +
+
+ 垂直距离 + ${pointData.verticalDistance} m +
+
+ 安全裕度 + ${pointData.safetyMargin} m +
+
+
`; + // 创建自定义信息窗体 + graphicLayer.bindPopup(infoContent, { + position: graphic.position, + }); + }); + + graphicLayer.addGraphic(billboard); + graphicLayerList.push(billboard); + }); + } +} + +// 添加标点折线(智能绘制虚实线) +async function addMapLine(graphicLayer, mars3d, Cesium) { + // 存储所有线段 + const segments = []; + // 绘制杆塔线 + if (towerList.length > 1000) { + for (let i = 0; i < towerList.length - 1; i++) { + const startPoint = towerList[i]; + const endPoint = towerList[i + 1]; + + let lineColor = ""; + let lineMaterial = null; // 用于存储线材质 + + // 判断条件部分保持不变 + if ( + (startPoint.towerProgress == 8 && + endPoint.towerProgress == 8) || + startPoint.towerProgress == 8 + ) { + // lineColor = "#FFFF00"; + // lineMaterial = new Cesium.ColorMaterialProperty({ + // // 实线 + // color: Cesium.Color.fromCssColorString("#FFFF00"), + // }); + + // 创建线段点数组 + const positions = [ + [startPoint.baiduLon, startPoint.baiduLat, 500], + [endPoint.baiduLon, endPoint.baiduLat, 500], + ]; + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#FFFF00", // 使用动态设置的材质 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } else if ( + endPoint.existSpan === 1 && + startPoint.existSpan === 1 && + startPoint.towerProgress != 9 && + endPoint.towerProgress != 9 && + startPoint.towerProgress != 8 && + endPoint.towerProgress != 8 && + startPoint.towerProgress != 10 && + endPoint.towerProgress != 10 + ) { + // lineColor = "#d81e06"; + // lineMaterial = new Cesium.PolylineDashMaterialProperty({ + // // 虚线 + // color: Cesium.Color.fromCssColorString(lineColor), + // dashLength: 16.0, // 可调整虚线长度 + // }); + // // 创建线段点数组 + // const positions = [ + // [startPoint.baiduLon, startPoint.baiduLat, 500], + // [endPoint.baiduLon, endPoint.baiduLat, 500], + // ]; + // const polyline = new mars3d.graphic.PolylineEntity({ + // positions: positions, + // eventParent: false, + // style: { + // width: 2, // 线宽(像素) + // material: lineMaterial, // 使用动态设置的材质 + // clampToGround: true, // 是否贴地(山区建议设为true) + // }, + // }); + // graphicLayer.addGraphic(polyline); + // graphicLayerList.push(polyline); + } else if ( + (startPoint.towerProgress === 9 && + endPoint.towerProgress === 9) || + (startPoint.towerProgress === 10 && + endPoint.towerProgress === 10) || + startPoint.towerProgress === 9 + ) { + // lineColor = "#d81e06"; + // lineMaterial = new Cesium.ColorMaterialProperty({ + // // 实线 + // color: Cesium.Color.fromCssColorString(lineColor), + // }); + + // 创建线段点数组 + const positions = [ + [startPoint.baiduLon, startPoint.baiduLat], + [endPoint.baiduLon, endPoint.baiduLat], + ]; + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#d81e06", // 使用动态设置的材质 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } else { + lineColor = "#fff"; + lineMaterial = new Cesium.PolylineDashMaterialProperty({ + // 虚线 + // color: Cesium.Color.fromCssColorString(lineColor), + color: Cesium.Color.TRANSPARENT, + dashLength: 16.0, // 可调整虚线长度 + }); + } + } + } + + // 绘制交叉线路 + if (crossingLineListNew.length > 0) { + for (let i = 0; i < crossingLineListNew.length; i++) { + for ( + let j = 0; + j < crossingLineListNew[i].lineList.length - 1; + j++ + ) { + const startPoint = crossingLineListNew[i].lineList[j]; + const endPoint = crossingLineListNew[i].lineList[j + 1]; + + // 创建线段点数组 + const positions = [ + [startPoint.baiduLon, startPoint.baiduLat], + [endPoint.baiduLon, endPoint.baiduLat], + ]; + + // const positions2 = positions.map((item) => { + // return mars3d.PointTrans.bd2wgs(item); + // }); + + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#800080", // 线颜色 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } + } + } + + // 绘制索道线 + if (cablewayList.length > 0) { + cablewayList.forEach((pointData) => { + if ( + pointData.cablewaTransPointVoList && + pointData.cablewaTransPointVoList.length > 0 + ) { + for ( + let j = 0; + j < pointData.cablewaTransPointVoList.length - 1; + j++ + ) { + const startPoint = pointData.cablewaTransPointVoList[j]; + const endPoint = pointData.cablewaTransPointVoList[j + 1]; + + // 创建线段点数组 + const positions = [ + [startPoint.lng, startPoint.lat], + [endPoint.lng, endPoint.lat], + ]; + + // const positions2 = positions.map((item) => { + // return mars3d.PointTrans.bd2wgs(item); + // }); + + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + eventParent: false, + style: { + width: 2, // 线宽(像素) + color: "#262fc9", // 线颜色 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } + } + }); + } + + // 绘制公路线 + if (highwayList.length > 0) { + for (let i = 0; i < highwayList.length; i++) { + if (highwayList[i].cablewaTransPointVoList.length > 0) { + for ( + let j = 0; + j < highwayList[i].cablewaTransPointVoList.length - 1; + j++ + ) { + const startPoint = + highwayList[i].cablewaTransPointVoList[j]; + const endPoint = + highwayList[i].cablewaTransPointVoList[j + 1]; + + // 创建线段点数组 + const positions = [ + [startPoint.lng, startPoint.lat], + [endPoint.lng, endPoint.lat], + ]; + + // const positions2 = positions.map((item) => { + // return mars3d.PointTrans.bd2wgs(item); + // }); + + const polyline = new mars3d.graphic.PolylineEntity({ + positions: positions, + // eventParent: true, + style: { + width: 2, // 线宽(像素) + color: "#FFFF00", // 线颜色 + clampToGround: true, // 是否贴地(山区建议设为true) + }, + }); + + // 添加点击事件 + polyline.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + let infoContent = ` +
+

公路所在杆塔:${highwayList[i].towerName}

+
+ 宽度 + ${highwayList[i].cablewayWidth || "/"} +
+
+ 长度 + ${highwayList[i].cablewayLength || "/"} +
+
`; + // 创建自定义信息窗体 + // graphicLayer.bindPopup(infoContent, { + // position: graphic.position, + // }); + + graphic.bindPopup(infoContent); + graphic.openPopup(); + }); + graphicLayer.addGraphic(polyline); + graphicLayerList.push(polyline); + } + } + } + } + + // 将所有线段添加到地图 + segments.forEach((segment) => map.addOverlay(segment)); +} + +// 绘制牵张场地区域图 +async function addMapAThousandFields(graphicLayer, mars3d, Cesium) { + if (aThousandFieldsList.length > 0) { + aThousandFieldsList.forEach((item) => { + if ( + item.cablewaTransPointVoList && + item.cablewaTransPointVoList.length > 0 + ) { + let points = []; + // 根据sort字段排序 防止点位顺序不一致 + item.cablewaTransPointVoList.forEach((j) => { + points.push([j.lng, j.lat]); + }); + + // const positions2 = points.map((item) => { + // return mars3d.PointTrans.bd2wgs(item); + // }); + + if (points.length > 0) { + const graphic = new mars3d.graphic.PolygonEntity({ + positions: points, + // eventParent: false, + style: { + color: "#00FFFF", // 区域填充颜色 + opacity: 0.5, // 透明度(0-1) + outline: true, // 是否显示边框 + outlineWidth: 2, // 边框宽度(像素) + outlineColor: "#00FFFF", // 边框颜色 + clampToGround: true, + }, + attr: { remark: "示例区域" }, + }); + + // 添加点击事件 + graphic.on(mars3d.EventType.click, function (event) { + // console.log("点击了标点", event.graphic.attr); + const graphic = event.graphic; + let infoContent = ` +
+

名称:${item.name}

+
+ 宽度 + ${item.cablewayWidth || "/"} +
+
+ 长度 + ${item.cablewayLength || "/"} +
+
`; + // 创建自定义信息窗体 + // graphicLayer.bindPopup(infoContent, { + // position: graphic.position, + // }); + + graphic.bindPopup(infoContent); + graphic.openPopup(); + }); + graphicLayer.addGraphic(graphic); + graphicLayerList.push(graphic); + } + } + }); + } +} + +let polylines1 = []; +let polylines2 = []; +let polylines3 = []; + +function showData(arrdata, graphicLayer) { + const polylinesTB = []; // 图标显示的点 + + // 预处理坐标及角度 + for (let i = 0, len = arrdata.length; i < len; i++) { + const item = arrdata[i]; + const position = Cesium.Cartesian3.fromDegrees( + item.lon, + item.lat, + item.alt + ); + item.position = position; + item.index = i + 1; + + // 模型比例,根据塔高换算 + item.scale = item.height / 52; + + // 测试塔顶高度与实际高度是否一致 + // const positionTop = mars3d.PointUtil.addPositionsHeight(position, item.height) // 顶部点 + // const graphic2 = new mars3d.graphic.PointPrimitive({ + // position: positionTop, + // style: { + // color: "#ff0000", + // pixelSize: 8, + // outlineColor: "#ffffff", + // outlineWidth: 2 + // } + // }) + // graphicLayer.addGraphic(graphic2) + + // 计算电线塔转角角度 + if (i !== 0) { + const priorPt = arrdata[i - 1].position; + item.lineHeading = mars3d.MeasureUtil.getAngle(priorPt, position); // 线的角度 + } + } + + // 计算各坐标及路线坐标,并渲染矢量对象 + for (let i = 0, len = arrdata.length; i < len; i++) { + const item = arrdata[i]; + const position = item.position; + + // 计算电线塔转角角度 + let degree = -2.2333; + // if (degree) { + // item.degree = item.lineHeading - item.heading + // } else { + if (i === 0) { + degree = arrdata[i + 1].lineHeading; + } else if (i === len - 1) { + degree = arrdata[i].lineHeading; + } else { + const nextTower = arrdata[i + 1]; + let stepAngle = (nextTower.lineHeading - item.lineHeading) / 2; + if (stepAngle > 90) { + stepAngle = 180 - stepAngle; + } else if (stepAngle < -90) { + stepAngle = stepAngle + 180; + } + degree = item.lineHeading + stepAngle; + } + item.degree = degree; + // } + + const hpr = new Cesium.HeadingPitchRoll( + Cesium.Math.toRadians(degree), + 0, + 0 + ); + + // 3个悬垂串的位置 + const offsetLineZ = item.height - 3.9; + let newPoint1 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, 10.6, offsetLineZ), + hpr + ); // 左边挂线 + let newPoint2 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, 0, offsetLineZ), + hpr + ); // 中间线 + let newPoint3 = mars3d.PointUtil.getPositionByHprAndOffset( + position, + new Cesium.Cartesian3(0, -10.6, offsetLineZ), + hpr + ); // 右边挂线 + + // polylinesTB.push(newPoint2); // 图标显示的点 + + drawWireTowerModel(graphicLayer, position, degree, item.scale, item); + drawWireTowerJYZModel(newPoint1, degree, graphicLayer); // 3个悬垂串模型 + drawWireTowerJYZModel(newPoint2, degree, graphicLayer); + drawWireTowerJYZModel(newPoint3, degree, graphicLayer); + + // 计算路线点 + const jyzHeight = -5; + newPoint1 = mars3d.PointUtil.addPositionsHeight(newPoint1, jyzHeight); + newPoint2 = mars3d.PointUtil.addPositionsHeight(newPoint2, jyzHeight); + newPoint3 = mars3d.PointUtil.addPositionsHeight(newPoint3, jyzHeight); + + if (i === 0) { + polylines1.push(newPoint1); + polylines2.push(newPoint2); + polylines3.push(newPoint3); + } else { + const angularityFactor = -5000; + const num = 50; + let positions = mars3d.PolyUtil.getLinkedPointList( + polylines1[polylines1.length - 1], + newPoint1, + angularityFactor, + num + ); // 计算曲线点 + polylines1 = polylines1.concat(positions); + + positions = mars3d.PolyUtil.getLinkedPointList( + polylines2[polylines2.length - 1], + newPoint2, + angularityFactor, + num + ); // 计算曲线点 + polylines2 = polylines2.concat(positions); + + positions = mars3d.PolyUtil.getLinkedPointList( + polylines3[polylines3.length - 1], + newPoint3, + angularityFactor, + num + ); // 计算曲线点 + polylines3 = polylines3.concat(positions); + } + } + + // 绘制路线 + drawGuideLine(polylines1, "#0000ff", graphicLayer); + drawGuideLine(polylines2, "#cccccc", graphicLayer); + drawGuideLine(polylines3, "#ff0000", graphicLayer); + + polylines1 = mars3d.LngLatArray.toArray(polylines1); + polylines2 = mars3d.LngLatArray.toArray(polylines2); + polylines3 = mars3d.LngLatArray.toArray(polylines3); +} + +// 绘制电线塔模型 +function drawWireTowerModel(graphicLayer, position, degree, scale, item) { + const item1 = { + alt: 488.28, + heading: -2.2333, + headingStr: "-2°14′", + height: 52, + lat: item.baiduLat, + lon: item.baiduLon, + }; + const html = mars3d.Util.getTemplateHtml({ + title: "塔杆", + template: [ + { field: "index", name: "杆塔序号" }, + { field: "type", name: "杆塔型号" }, + { field: "degree", name: "方向" }, + { field: "height", name: "杆塔高度" }, + { field: "alt", name: "海拔高度" }, + ], + attr: item, + }); + + const graphic = new mars3d.graphic.ModelPrimitive({ + position, + style: { + url: "https://data.mars3d.cn/gltf/mars/tower/tower-500kV.glb", + heading: degree, + scale: scale, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 0, + 4000.0 + ), + }, + popup: html, + }); + graphicLayer.addGraphic(graphic); +} + +function drawWireTowerJYZModel(position, degree, graphicLayer) { + const graphic2 = new mars3d.graphic.ModelPrimitive({ + position, + style: { + url: "https://data.mars3d.cn/gltf/mars/tower/tower-jyz.glb", + heading: degree, + pitch: 90, // 模型本身不是竖直,需要加pitch纠正 + scale: 1, + distanceDisplayCondition: new Cesium.DistanceDisplayCondition( + 0, + 4000.0 + ), + }, + }); + graphicLayer.addGraphic(graphic2); +} + +function drawGuideLine(positions, color, graphicLayer) { + const graphic = new mars3d.graphic.PolylinePrimitive({ + positions, + style: { + width: 4, + color, + }, + }); + graphicLayer.addGraphic(graphic); +} + +async function getElevationByLngLat(lng, lat) { + // 方案1: 优先使用第三方 API(最可靠,不依赖地形服务) + let elevation = await getElevationByAPI(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案2: 尝试使用 mars3d 工具方法 + elevation = await getElevationByMars3dUtil(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案3: 尝试使用地形采样 + elevation = await getElevationByTerrain(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 方案4: 尝试使用 pickPosition + elevation = await getElevationByPickPosition(lng, lat); + if (elevation > 0) { + return elevation; + } + + // 所有方法都失败,返回0 + console.warn( + `所有方法都无法获取坐标(${lng}, ${lat})的海拔高度,返回默认值0` + ); + return 0; +} + +async function getElevationByAPI(lng, lat) { + try { + // 使用 OpenElevation API(免费,无需API密钥) + const response = await fetch( + `https://api.open-elevation.com/api/v1/lookup?locations=${lat},${lng}` + ); + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + const data = await response.json(); + if (data.results && data.results.length > 0) { + const elevation = data.results[0].elevation; + console.log(`API获取海拔成功: ${elevation}米 (${lng}, ${lat})`); + return elevation; + } + return 0; + } catch (error) { + console.warn("OpenElevation API 获取海拔失败:", error); + // 尝试备用API + return await getElevationByBackupAPI(lng, lat); + } +} + +async function getElevationByMars3dUtil(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const mars3d = window.mars3d; + const Cesium = window.mars3d.Cesium; + + // 尝试使用 mars3d 的工具方法 + if (mars3d.PointUtil && mars3d.PointUtil.getTerrainHeight) { + const height = await mars3d.PointUtil.getTerrainHeight( + map.scene, + lng, + lat + ); + if (height !== undefined && height !== null) { + console.log( + `mars3d工具获取海拔成功: ${height}米 (${lng}, ${lat})` + ); + return height; + } + } + + return 0; + } catch (error) { + console.warn("mars3d工具获取海拔失败:", error); + return 0; + } +} + +async function getElevationByTerrain(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const Cesium = window.mars3d.Cesium; + const cartographic = Cesium.Cartographic.fromDegrees(lng, lat); + const terrainProvider = map.scene.terrainProvider; + + if (!terrainProvider) { + console.warn("地形提供者未加载"); + return 0; + } + + // 等待地形提供者准备就绪 + if (terrainProvider.readyPromise) { + await terrainProvider.readyPromise; + } + + // 使用 sampleTerrainMostDetailed + const positions = [cartographic]; + const updatedPositions = await Cesium.sampleTerrainMostDetailed( + terrainProvider, + positions + ); + + if ( + updatedPositions && + updatedPositions.length > 0 && + updatedPositions[0].height !== undefined && + updatedPositions[0].height !== null + ) { + const elevation = updatedPositions[0].height; + console.log( + `地形采样获取海拔成功: ${elevation}米 (${lng}, ${lat})` + ); + return elevation; + } + + return 0; + } catch (error) { + console.warn("地形采样获取海拔失败:", error); + return 0; + } +} + +async function getElevationByPickPosition(lng, lat) { + try { + if (!map || !map.scene) { + console.warn("地图未初始化"); + return 0; + } + + const Cesium = window.mars3d.Cesium; + const cartesian = Cesium.Cartesian3.fromDegrees(lng, lat, 10000); + const cartographic = Cesium.Cartographic.fromCartesian(cartesian); + + // 使用 pickPosition 获取地形高度 + const pickedPosition = map.scene.pickPosition(cartesian); + if (pickedPosition) { + const pickedCartographic = + Cesium.Cartographic.fromCartesian(pickedPosition); + const elevation = pickedCartographic.height; + console.log( + `pickPosition获取海拔成功: ${elevation}米 (${lng}, ${lat})` + ); + return elevation; + } + + return 0; + } catch (error) { + console.warn("pickPosition获取海拔失败:", error); + return 0; + } +} + +async function getElevationByBackupAPI(lng, lat) { + try { + // 备用方案1: 使用 elevation-api.io(需要注册但免费额度较大) + // const response = await fetch( + // `https://api.elevation-api.io/api/v1/lookup?locations=${lat},${lng}` + // ); + + // 备用方案2: 使用 Google Elevation API(需要API密钥) + // const response = await fetch( + // `https://maps.googleapis.com/maps/api/elevation/json?locations=${lat},${lng}&key=YOUR_API_KEY` + // ); + + // 备用方案3: 使用 MapBox Elevation API(需要API密钥) + // const response = await fetch( + // `https://api.mapbox.com/v4/mapbox.terrain-rgb/${lng},${lat}.json?access_token=YOUR_ACCESS_TOKEN` + // ); + + // 如果以上API都不可用,返回0 + return 0; + } catch (error) { + console.warn("备用API获取海拔失败:", error); + return 0; + } +} + +document.addEventListener("DOMContentLoaded", function () { + const scrollContent = document.getElementById("scrollContent"); + const originalContent = scrollContent.querySelector(".content-wrapper"); + const cloneContent = scrollContent.querySelector(".clone-content"); + + // 克隆原始内容到克隆容器 + cloneContent.innerHTML = originalContent.innerHTML; + + // 设置滚动动画 + let scrollPosition = 0; + const scrollSpeed = 20; // 滚动速度(像素/秒) + let lastTimestamp = 0; + + function animateScroll(timestamp) { + if (!lastTimestamp) lastTimestamp = timestamp; + const deltaTime = timestamp - lastTimestamp; + lastTimestamp = timestamp; + + // 计算新的滚动位置 + scrollPosition += (scrollSpeed * deltaTime) / 1000; + + // 获取内容总高度 + const contentHeight = originalContent.scrollHeight; + + // 当滚动到克隆内容的开始时,重置位置以实现无缝衔接 + if (scrollPosition >= contentHeight) { + scrollPosition = 0; + } + + // 应用滚动 + scrollContent.scrollTop = scrollPosition; + + // 继续动画 + requestAnimationFrame(animateScroll); + } + + // 启动动画 + requestAnimationFrame(animateScroll); + + const drawer = document.querySelector(".right-drawer-box"); + const openBtn = document.querySelector(".open-drawer-box"); + const closeBtn = document.querySelector(".close-drawer-btn"); + const legendDrawer = document.querySelector(".legend-box"); + const legendOpenBtn = document.querySelector(".legend-open-drawer-btn"); + + const projectOverview = document.querySelector(".project-overview-box"); + const overviewOpenDrawerBtn = document.querySelector( + ".project-overview-open-drawer-btn" + ); + + // const closeBtn = document.querySelector(".close-drawer-btn"); + + // 点击三角按钮打开抽屉 + openBtn.addEventListener("click", function () { + drawer.classList.add("open"); + + layui.use(["tree", "jquery"], function () { + var tree = layui.tree; + var $ = layui.jquery; + + // 初始化组织树 + function initOrgTree() { + // 渲染树形结构 + tree.render({ + elem: "#orgTree", // 绑定元素 + id: "orgTree", // 自定义索引 + data: treeData, // 获取数据 + showCheckbox: false, // 是否显示复选框 + isJump: false, // 是否允许点击节点时弹出新窗口 + accordion: true, // 是否开启手风琴模式 + edit: false, // 是否开启节点的操作图标 + onlyIconControl: true, // 是否仅允许节点左侧图标控制展开收缩 + click: function (obj) { + console.log(obj.data); + // 判断是否是叶子节点(没有子节点或子节点数组为空) + if ( + !obj.data.children || + obj.data.children.length === 0 + ) { + setActiveNode(obj.elem); + nodeId = obj.data.id; + intLng = obj.data.lon; + intLat = obj.data.lat; + projectTitle = obj.data.title; + $(".center-title-box").text( + projectTitle + "作战图" + ); + $(".project-overview-content").text( + obj.data.projectOverview || "暂无" + ); + // getScrollData(nodeId); + getLegendData(nodeId); + getLocationInfo(nodeId); + } else { + } + }, + done: function () { + console.log("树准备完毕"); + expandToNodeId(nodeId); + }, + }); + } + + initOrgTree(); + setActiveNodeNew(nodeId); + + function setActiveNode(elem) { + $("#orgTree") + .find(".layui-tree-click") + .removeClass("layui-tree-click"); + $(elem).addClass("layui-tree-click"); + } + + function setActiveNodeNew(nodeId) { + $("#orgTree") + .find('[data-id="' + nodeId + '"]') + .addClass("layui-tree-click"); + } + }); + }); + + // 点击关闭按钮关闭抽屉 + closeBtn.addEventListener("click", function () { + drawer.classList.remove("open"); + }); + + // 点击抽屉外部关闭抽屉(可选) + document.addEventListener("click", function (e) { + if ( + drawer.classList.contains("open") && + !drawer.contains(e.target) && + e.target !== openBtn + ) { + drawer.classList.remove("open"); + } + }); + + legendOpenBtn.addEventListener("click", function () { + if (legendDrawer.style.visibility === "visible") { + legendDrawer.style.visibility = "hidden"; + // 修改图例的三角 + + legendOpenBtn.style.transform = "rotate(180deg)"; + } else { + legendDrawer.style.visibility = "visible"; + // 修改图例的三角 + + legendOpenBtn.style.transform = "rotate(0deg)"; + } + }); + overviewOpenDrawerBtn.addEventListener("click", function () { + if (projectOverview.style.visibility === "visible") { + projectOverview.style.visibility = "hidden"; + // 修改图例的三角 + + overviewOpenDrawerBtn.style.transform = "rotate(180deg)"; + } else { + projectOverview.style.visibility = "visible"; + // 修改图例的三角 + + overviewOpenDrawerBtn.style.transform = "rotate(0deg)"; + } + }); +});