管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-06-28 5178a8e85f1a544cbd255f01fae1905e40112228
1
已修改7个文件
301 ■■■■■ 文件已修改
ExportMap/UE.html 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/ConvertUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/LasUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/OsgbUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/SGUtils.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/TerraUtils.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/XYZUtils.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/UE.html
@@ -61,11 +61,14 @@
    // 坐标转化
    function transform() {
      var coordinate = { x: 117.038112825, y: 39.382696649 }
      var coordinate = {
        "x": 117.04046434254622,
        "y": 39.722702758997606,
        "z": 0
      }
      var Wgs84ToLocal = map.transformWGS84ToLocal(coordinate.x, coordinate.y)
      console.log('Wgs84ToLocal', Wgs84ToLocal)
      var LocalToWGS84 = map.transformLocalToWGS84(Wgs84ToLocal.x, coordinate.y)
      var LocalToWGS84 = map.transformLocalToWGS84(Wgs84ToLocal.x, Wgs84ToLocal.y)
      console.log('LocalToWGS84', LocalToWGS84)
    }
@@ -79,131 +82,223 @@
    // 飞行
    function flyTo() {
      var x = 117.038112825, y = 39.382696649, z = 5000;
      const v = {
        z: 0,
        pitch: -8.675049781799316,
        roll: 0,
        yaw: 60.92010498046875,
        distance: 120112.3671875,
        time: 3
      };
      var x = 116.48915493897739; y = 39.81061022857503; z = 5000;
      var LocalToWGS84 = transToWGS84ToLocal(x, y)
      var roll = 0, pitch = 0, yaw = 0, distance = 1000;
      var callBack = function () { console.log("flyTo"); }
      var time = 3; // 3s
      map.flyTo(x, y, z, roll, pitch, yaw, distance, callBack, time);
      map.flyTo(LocalToWGS84.x, LocalToWGS84.y, v.z, v.roll, v.pitch, v.yaw, v.distance, callBack, time);
    }
    function transToWGS84ToLocal(x, y) {
      return map.transformWGS84ToLocal(x, y)
    }
    // 切换镜头
    function setView() {
      var x = 117.038112825, y = 39.382696649, z = 5000;
      var roll = 0, pitch = 0, yaw = 0, distance = 1000;
      map.setView(x, y, z, roll, pitch, yaw, distance);
      const v = {
        x: -567870.625,
        y: -964962.4375,
        z: 0,
        pitch: -8.675049781799316,
        roll: 0,
        yaw: 120.92010498046875,
        distance: 120112.3671875,
        time: 3
      };
      map.setView(v.x, v.y, v.z, v.roll, v.pitch, v.yaw, v.distance);
    }
    // 时间特效
    var timeFlag = true;
    function setTime() {
      // morning-早晨,noon-中午,evening-傍晚,night-夜晚,darkWorld-暗色场景,12
      map.setTime("evening");
      if (timeFlag) {
        map.setTime("evening");
      } else {
        map.setTime("noon");
      }
      timeFlag = !timeFlag
    }
    // 文字标签
    var labelFlag = true;
    var label_val = null;
    function createLabel() {
      var options = {
        id: 1, // 唯一标识,不可重复,可不填
        x: 1000, // x轴ue4坐标
        y: 1000, // y轴ue4坐标
        z: 0, // z轴ue4坐标
        size: { width: 480, height: 180 }, // label的大小
        text: '测试文字', // 显示的文字
        scale: 0.5, // 缩放
        type: 'Type1', // 类型 Default,Type1,Type2
        backgroundColor: "#ffffff", // 背景色支持rgba
        fillColor: "#00ff00", // 文字颜色
        visibility: true // 默认是否显示
      };
      var x = 116.48915493897739; y = 39.81061022857503; z = 5000;
      var LocalToWGS84 = transToWGS84ToLocal(x, y)
      if (labelFlag) {
        var options = {
          id: 1, // 唯一标识,不可重复,可不填
          x: LocalToWGS84.x, // x轴ue4坐标
          y: LocalToWGS84.y, // y轴ue4坐标
          z: 0, // z轴ue4坐标
          size: { width: 100, height: 100 }, // label的大小
          text: '测试文字', // 显示的文字
          scale: 0.5, // 缩放
          type: 'Type1', // 类型 Default,Type1,Type2
          backgroundColor: "#ffffff", // 背景色支持rgba
          fillColor: "#00ff00", // 文字颜色
          visibility: true // 默认是否显示
        };
      var lbl = map.createLabel(options);
      // lbl.show(true); // 显示
        label_val = map.createLabel(options);
      } else {
        label_val.removeFromMap();
        label_val = null;
      }
      labelFlag = !labelFlag;
    }
    // POI点
    var poiFlag = true;
    var poi_val = null;
    function createBillboard() {
      var param = {
        x: 1000, // x轴ue4坐标
        y: 1000, // y轴ue4坐标
        z: 0, // z轴ue4坐标
        image: "123.png", // 图片地址
        scale: 0.5, // 缩放比例
        clickedScale: 0.7, // 点击后比例
        visibility: true, // 默认是否显示
        alertWindow: { // 可选,点击弹窗
          url: "http://192.168.20.89:12306/popupThree.html", // 弹窗地址
          size: new TUVector2(180, 90), // 弹窗大小
          offset: new TUVector2(90, -90) // 弹窗位置,右:x正,下:y正
      var x = 116.48815493897739; y = 39.81061022857503; z = 5000;
      var LocalToWGS84 = transToWGS84ToLocal(x, y)
      if (poiFlag) {
        var param = {
          x: LocalToWGS84.x, // x轴ue4坐标
          y: LocalToWGS84.y, // y轴ue4坐标
          z: 0, // z轴ue4坐标
          image: "123.png", // 图片地址
          scale: 0.5, // 缩放比例
          clickedScale: 0.7, // 点击后比例
          visibility: true, // 默认是否显示
          alertWindow: { // 可选,点击弹窗
            url: "http://192.168.20.89:12306/popupThree.html", // 弹窗地址
            size: new TUVector2(180, 90), // 弹窗大小
            offset: new TUVector2(-45, -110) // 弹窗位置,右:x正,下:y正
          }
        }
        poi_val = map.createBillboard(param);
        poi_val.show(true); // 显示
      } else {
        poi_val.removeFromMap();
        poi_val = null;
      }
      poiFlag = !poiFlag;
      var poi = map.createBillboard(param);
      poi.show(true); // 显示
      // poi.show(false); // 隐藏
      // poi.removeFromMap(); //  移除
    }
    // 3DPOI点
    var thPoiFlag = true;
    var poi_3d_val = null
    function create3DBillboard() {
      var testPoints = [{ "x": 10000, "y": 10000, "z": 4000 }];
      var points = [];
      testPoints.forEach(function (item) {
        points.push({
          x: item.x,
          y: item.y,
          z: item.z,
          image: "123.png",
          text: "",
          scale: 120,
          clickedScale: 1,
          flash: false,
          canClick: true
      if (thPoiFlag) {
        var testPoints = [{ x: 116.49255493897739, y: 39.81451022857503, z: 4000 }];
        var points = [];
        testPoints.forEach(function (item) {
          var LocalToWGS84 = transToWGS84ToLocal(item.x, item.y)
          points.push({
            x: LocalToWGS84.x,
            y: LocalToWGS84.y,
            z: item.z,
            image: "123.png",
            text: "",
            scale: 80,
            clickedScale: 1,
            flash: false,
            canClick: true
          });
        });
      });
      var pois = map.create3DBillboard(points);
      pois.forEach(function (poi) {
        poi.show(true);
        // poi.show(false); // 隐藏
        // poi.removeFromMap(); // 移除
      });
        poi_3d_val = map.create3DBillboard(points);
        poi_3d_val.forEach(function (poi) {
          poi.show(true);
        });
      } else {
        poi_3d_val.forEach(function (poi) {
          poi.removeFromMap();
        });
        poi_3d_val = null
      }
      thPoiFlag = !thPoiFlag;
    }
    // 添加区域
    // 添加区域\
    var areaFlag = true;
    var area_val = null;
    function createAreaData() {
      var obj = map.createAreaData({
        id: "fdfdfdfdfd",
        data: [
          new TUVector3(0, 0, 0),
          new TUVector3(10000, 0, 0),
          new TUVector3(10000, 10000, 0),
          new TUVector3(0, 10000, 0)
      if (areaFlag) {
        var val = [
          { x: 116.48855493897739, y: 39.81251022857503, z: 4000 },
          { x: 116.48505493897739, y: 39.81651022857503, z: 4000 },
          { x: 116.48905493897739, y: 39.81851022857503, z: 4000 },
          { x: 116.49255493897739, y: 39.81451022857503, z: 4000 },
          { x: 116.48855493897739, y: 39.81251022857503, z: 4000 },
        ]
      });
      // obj.removeFromMap(); // 移除
        var data = [];
        for (var i in val) {
          var item = transToWGS84ToLocal(val[i].x, val[i].y)
          data.push(
            new TUVector3(item.x, item.y, 0),
          )
        }
        area_val = map.createAreaData({
          id: "fdfdfdfdfd",
          data: data
        });
      } else {
        area_val.removeFromMap();
        area_val = null;
      }
      areaFlag = !areaFlag;
    }
    // 围栏
    var boundflag = true;
    var bound_val = null
    function createAreaBoundary() {
      var param = {
        type: 0, // 0上浮横格,1实色,2箭头,3三角
        height: 5000, // 默认5000
        color: "#ff0000", // 默认白色
        brightness: 10, // 默认10
        data: [ // 围栏点位数组
          new TUVector3(0, 0, 0),
          new TUVector3(100000, 0, 0),
          new TUVector3(100000, 100000, 0),
          new TUVector3(0, 100000, 0),
          new TUVector3(0, 0, 0)
      if (boundflag) {
        var val = [
          { x: 116.48855493897739, y: 39.81251022857503, z: 4000 },
          { x: 116.48505493897739, y: 39.81651022857503, z: 4000 },
          { x: 116.48905493897739, y: 39.81851022857503, z: 4000 },
          { x: 116.49255493897739, y: 39.81451022857503, z: 4000 },
          { x: 116.48855493897739, y: 39.81251022857503, z: 4000 },
        ]
      };
      var bound = map.createAreaBoundary(param);
        var data = [];
        for (var i in val) {
          var item = transToWGS84ToLocal(val[i].x, val[i].y)
          data.push(
            new TUVector3(item.x, item.y, 0),
          )
        }
        var param = {
          type: 0, // 0上浮横格,1实色,2箭头,3三角
          height: 5000, // 默认5000
          color: "#ff0000", // 默认白色
          brightness: 10, // 默认10
          data: data
        };
        bound_val = map.createAreaBoundary(param);
      map.focusOn(new TUVector3(739, 303, 1040), new TURotator(0, -73, 147), 107737);
      // bound.removeFromMap(); // 移除
      } else {
        bound_val.removeFromMap();
        bound_val = null;
      }
      boundflag = !boundflag;
    }
    // 拾取坐标
@@ -222,7 +317,15 @@
    // 清除
    function objclear() {
      map.clearAllCovering();
      map.setTime("noon"); // map.resetTime();
      map.setTime("noon");
      boundflag = true;
      bound_val = null
      areaFlag = true;
      area_val = null;
      thPoiFlag = true;
      poi_3d_val = null;
      poiFlag = true;
      poi_val = null;
    }
  </script>
ExportMap/cs/ConvertUtils.cs
@@ -126,7 +126,7 @@
        /// </summary>
        private static int InsertToDB(SysMeta meta, XYZArgs args, string path)
        {
            if (PubDBHelper.IsPublish(meta.id)) return 0;
            if (PubDBHelper.IsPublish(meta.id)) return 1;
            SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path);
ExportMap/cs/LasUtils.cs
@@ -108,7 +108,7 @@
        /// </summary>
        private static int InsertToDB(SysMeta meta, XYZArgs args, string path)
        {
            if (PubDBHelper.IsPublish(meta.id)) return 0;
            if (PubDBHelper.IsPublish(meta.id)) return 1;
            SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(path), path);
ExportMap/cs/OsgbUtils.cs
@@ -141,7 +141,7 @@
        /// </summary>
        private static int InsertToDB(SysMeta meta, XYZArgs args, string path)
        {
            if (PubDBHelper.IsPublish(meta.id)) return 0;
            if (PubDBHelper.IsPublish(meta.id)) return 1;
            SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path);
ExportMap/cs/SGUtils.cs
@@ -70,7 +70,7 @@
            if (list.Count == 0) return null;
            //err = LinkFiles(list);
            //if (!string.IsNullOrEmpty(err)) return 0;
            //if (!string.IsNullOrEmpty(err)) return 1;
            Tools.SetIsModel(args, list);
            MoveFiles(list);
@@ -173,7 +173,7 @@
        /// </summary>
        private static int InsertToDB(SysMeta meta, XYZArgs args)
        {
            if (PubDBHelper.IsPublish(meta.id)) return 0;
            if (PubDBHelper.IsPublish(meta.id)) return 1;
            SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta, meta.verid), meta.id + "\\" + meta.name);
ExportMap/cs/TerraUtils.cs
@@ -122,10 +122,7 @@
            }
            finally
            {
                if (!string.IsNullOrEmpty(tifFile) && File.Exists(tifFile))
                {
                    File.Delete(tifFile);
                }
                //if (!string.IsNullOrEmpty(tifFile) && File.Exists(tifFile)) File.Delete(tifFile);
            }
        }
@@ -159,10 +156,7 @@
            }
            finally
            {
                if (!string.IsNullOrEmpty(txtFile) && File.Exists(txtFile))
                {
                    File.Delete(txtFile);
                }
                if (!string.IsNullOrEmpty(txtFile) && File.Exists(txtFile)) File.Delete(txtFile);
            }
        }
@@ -251,7 +245,7 @@
        /// </summary>
        private static int InsertToDB(List<SysMeta> metas, XYZArgs args)
        {
            if (PubDBHelper.IsPublish(args.dircode, "DEM")) return 0;
            if (PubDBHelper.IsPublish(args.dircode, "DEM")) return 1;
            SysMeta meta = metas[0];
            meta.type = "DEM";
ExportMap/cs/XYZUtils.cs
@@ -162,7 +162,7 @@
        /// </summary>
        private static int InsertToDB(List<SysMeta> metas, XYZArgs args, string path)
        {
            if (PubDBHelper.IsPublish(args.dircode)) return 0;
            if (PubDBHelper.IsPublish(args.dircode)) return 1;
            SysMeta meta = metas[0];
            meta.type = "DOM";