cesium 融合方法使用

// 融合方法
import { simpleMap, thereDmap, anyingMap } from "./Mapeffects";
import { addModel, delModel } from "./Modeleffects";
import { Weather } from "./environment";
import {
  setflyTo,
  emergencyAlarm,
  makeRotundity,
  Polyline,
  moveModelToPosition,
  invertedTriangle,
  nightVision,
  makeContour,
  addmarked,
  guanbi,
} from "./Animationeffects";
import "./cesiumbowenyuan.js";
import MeasureDistance from "./cesiumceju.js";
import { isTranslucent } from "cesium";
// 融合方法,地图创建并添加报警效果,并标示报警源和视角拉近
function fusionalarm(that, mapName, baojing) {
  simpleMap(that, mapName);
  setflyTo(
    that.viewer,
    baojing.longitude,
    baojing.latitude,
    baojing.height,
    3,
    0,
    -45,
    0
  );
  emergencyAlarm(that.viewer);
  makeRotundity(that.viewer, baojing.longitude, baojing.latitude, 50, "圆形");
  that.viewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(
      baojing.longitude,
      baojing.latitude
    ),
    name: "波纹圆",
    ellipse: {
      semiMinorAxis: 1000.0,
      semiMajorAxis: 1000.0,
      material: new Cesium.CircleRippleMaterialProperty({
        color: new Cesium.Color(1, 0, 0, 0.5), // 设置红色和透明度
        speed: 12.0,
        count: 4,
        gradient: 0.2,
      }),
    },
  });
}

// 融合方法,创建地图帮添加模型并平缓的移动到当前位置并显示历史轨迹
function fusionModelMovement(
  that,
  mapName,
  old,
  news,
  name,
  color,
  pointcolor,
  issetflyTo,
  isdelmod
) {
  if (issetflyTo) {
    simpleMap(that, mapName);
    setflyTo(
      that.viewer,
      old.longitude,
      old.latitude,
      old.height,
      3,
      0,
      -45,
      0
    );
  }
  Polyline(
    that.viewer,
    old.longitude,
    old.latitude,
    old.height,
    news.longitude,
    news.latitude,
    news.height,
    name,
    color,
    pointcolor
  );
  let startPosition = Cesium.Cartesian3.fromDegrees(
    old.longitude,
    old.latitude,
    old.height
  );
  let endPosition = Cesium.Cartesian3.fromDegrees(
    news.longitude,
    news.latitude,
    news.height
  );
  moveModelToPosition(that.viewer, startPosition, endPosition, isdelmod);
}

// 融合方法,设备模型创建并添加锥形旋转
function modelCreation(that, mapName, model) {
  simpleMap(that, mapName);
  setflyTo(
    that.viewer,
    model.longitude,
    model.latitude,
    model.height,
    3,
    0,
    -45,
    0
  );
  addModel(
    that.viewer,
    model.longitude,
    model.latitude,
    model.height,
    model.name,
    model.url,
    model.scale,
    10,
    2000,
    -90,
    -45,
    0
  );
  invertedTriangle(
    that.viewer,
    model.longitude,
    model.latitude,
    model.height + 60,
    model.name + "yuanzhui"
  );
}

// 融合方法,cesium添加夜视效果并添加轮廓显示效果
function nightVisionall(that, mapName, model) {
  simpleMap(that, mapName);
  setflyTo(
    that.viewer,
    model.longitude,
    model.latitude,
    model.height,
    3,
    0,
    -45,
    0
  );
  thereDmap(that.viewer);
  nightVision(that.viewer);
  makeContour(that.viewer);
}

// 融合方法,cesium创建世界并添加雨雪雾等天气 并添加视角跳转和3D世界图
function rainSnow(that, mapName, model) {
  simpleMap(that, mapName);
  // anyingMap(that.viewer)
  setflyTo(
    that.viewer,
    model.longitude,
    model.latitude,
    model.height,
    3,
    0,
    -45,
    0
  );
  thereDmap(that.viewer);
  Weather(that.viewer, true, true, false);
}

// 融合方法,cesium 地图创建并添加测距效果
function ranging(that, mapName, ismap, isranging, istrue) {
  if (ismap) {
    simpleMap(that, mapName);
  }

  // 实例化MeasureDistance类
  if (isranging) {
    const measureDistance = new MeasureDistance(that.viewer, "jijiui");
    // 激活测距功能
    measureDistance.activate();
  }
  if (istrue) {
    let lengthents = [];
    let entities = that.viewer.entities.values;
    entities.forEach(function (entity) {
      // 检查实体的名称是否与指定的名称匹配
      if (entity.name === "jijiui") {
        // 根据名称删除实体
        lengthents.push(entity);
        // that.viewer.entities.remove(entity);
      }
    });
    for (let index = 0; index < lengthents.length; index++) {
      that.viewer.entities.remove(lengthents[index]);
    }
  }
}

// 融合方法,cesium 地图获取经纬度
function getpostion(that, isleft) {
  if (isleft) {
    addmarked(that.viewer);
  }
}

export {
  fusionalarm,
  fusionModelMovement,
  modelCreation,
  nightVisionall,
  rainSnow,
  ranging,
  getpostion,
};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【资源说明】 基于cesium的3dtilset模型视频投放源码+使用说明(无需任何修改,直接引入即可).zip 在项目中引入Cesium.js ##### 然后引入 cesium-videoshed.js 即可 <a href="http://zhangticcc.gitee.io/webgis/"><img alt="" height="100%" src="https://img-blog.csdnimg.cn/20201202172350462.gif" width="90%" ></a>  ``` // 初始化 let viewer = new Cesium.Viewer("viewerContainer") // 参数 let viewModel = { verticalAngle: 90, horizontalAngle: 120, distance: 10 }; let videoShed3DArr = []; // 创建 let create = () => { let videoShed3D = new Cesium.VideoShed3D(viewer, { type: 'Video', url: "src/cs.mp4", alpha: 1, debugFrustum: true, horizontalAngle: Number(viewModel.horizontalAngle), verticalAngle: Number(viewModel.verticalAngle), distance: Number(viewModel.distance), }); videoShed3DArr.push(videoShed3D) } // 销毁 let destroy = () => { videoShed3DArr.forEach(video => video.destroy()) } ``` 【备注】 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用!有问题请及时沟通交流。 2、适用人群:计算机相关专业(如计科、信息安全、数据科学与大数据技术、人工智能、通信、物联网、自动化、电子信息等)在校学生、专业老师或者企业员工下载使用。 3、用途:项目具有较高的学习借鉴价值,不仅适用于小白学习入门进阶。也可作为毕设项目、课程设计、大作业、初期项目立项演示等。 4、如果基础还行,或热爱钻研,亦可在此项目代码基础上进行修改添加,实现其他不同功能。 欢迎下载,沟通交流,互相学习,共同进步!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值