123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- <script setup>
- /**
- * element-plus组件
- */
- import {
- ElMessage
- } from 'element-plus';
- import {
- inject
- } from "vue";
- const getMapInstance = inject("getMapInstance");
- jt3d = getMapInstance();
- </script>
- <template>
- <div class="jt-analysisSpace">
- <el-collapse v-model="activeName" accordion>
- <el-collapse-item name="光照分析">
- <template #title>
- <i class='iconfont icon-svgguangzhaofenxi' />光照分析
- </template>
- <div class="el-collapse-item__content">
- <el-button color="rgb(20 136 255)" @click="SunShine('start')">开启光照分析</el-button>
- <el-button color="rgb(255 100 100)" @click="SunShine('remove')"><span style="color: #fff;">移除光照分析</span></el-button>
- </div>
- </el-collapse-item>
- <el-collapse-item name="方量分析">
- <template #title>
- <i class='iconfont icon-svgfangliangfenxi' />方量分析
- </template>
- <div class="el-collapse-item__content">
- <el-form label-width="100rem">
- <el-form-item label="挖方填方高度:">
- <el-input v-model="cutFill.height" />
- </el-form-item>
- <el-form-item label="挖方填方精度:">
- <el-input v-model="cutFill.precision" />
- </el-form-item>
- </el-form>
- <div class="jt-btn" style="margin: 10rem;">
- <el-button color="rgb(255 100 100)" @click="CutFill('draw')"><span style="color: #fff;">绘制挖方填方区域</span></el-button>
- <el-button color="rgb(255 100 100)" @click="CutFill('remove')"><span style="color: #fff;">清除分析结果</span></el-button>
- </div>
- <el-form label-width="120rem">
- <el-form-item label="总分析面积(㎡):">
- <el-input v-model="cutFill.result.allArea" />
- </el-form-item>
- <el-form-item label="填方面积(㎡):">
- <el-input v-model="cutFill.result.fillArea" />
- </el-form-item>
- <el-form-item label="填方体积(m³):">
- <el-input v-model="cutFill.result.fillVolume" />
- </el-form-item>
- <el-form-item label="挖方面积(㎡):">
- <el-input v-model="cutFill.result.cutArea" />
- </el-form-item>
- <el-form-item label="挖方体积(m³):">
- <el-input v-model="cutFill.result.cutVolume" />
- </el-form-item>
- </el-form>
- </div>
- </el-collapse-item>
- <el-collapse-item name="剖面分析">
- <template #title>
- <i class='iconfont icon-svgpoumianfenxi' />剖面分析
- </template>
- <div class="el-collapse-item__content">
- <div style="line-height: 2em; table-layout: fixed; word-wrap: break-word; word-break: normal; text-align:justify; text-justify: inter-ideograph;color: #ffffff99;">
- 提示:单击【剖面分析】按钮触发,然后在实景三维或地形上左键单击开始,左键双击结束
- </div>
- <el-button color="rgb(20 136 255)" @click="SectionAnalysis">剖面分析</el-button>
- </div>
- </el-collapse-item>
- <el-collapse-item name="通视分析">
- <template #title>
- <i class='iconfont icon-svgtongshifenxi' />通视分析
- </template>
- <div class="el-collapse-item__content">
- <div style="line-height: 2em; table-layout: fixed; word-wrap: break-word; word-break: normal; text-align:justify; text-justify: inter-ideograph;color: #ffffff99;">
- 提示:红色代表不可视,绿色代表可视;
- </div>
- <el-button color="rgb(20 136 255)" @click="SightLine('activate')">添加通视分析</el-button>
- <el-button color="rgb(255 100 100)" @click="SightLine('deactivate')"><span style="color: #fff;">清除通视分析</span></el-button>
- </div>
- </el-collapse-item>
- <el-collapse-item name="视域分析">
- <template #title>
- <i class='iconfont icon-svgshiyufenxi' />视域分析
- </template>
- <div class="el-collapse-item__content">
- <div style="line-height: 2em; table-layout: fixed; word-wrap: break-word; word-break: normal; text-align:justify; text-justify: inter-ideograph;color: #ffffff99;">
- 提示:点击“添加视域”按钮后在场景中点击两个点添加视域,红色代表不可视,绿色代表可视;
- </div>
- <el-button color="rgb(20 136 255)" @click="ViewShed('activate')">添加视域</el-button>
- <el-button color="rgb(255 100 100)" @click="ViewShed('deactivate')"><span style="color: #fff;">清除视域</span></el-button>
- </div>
- </el-collapse-item>
- <el-collapse-item name="限高分析">
- <template #title>
- <i class='iconfont icon-svgxiangaofenxi' />限高分析
- </template>
- <div class="el-collapse-item__content">
- <el-form ref="form" label-width="100rem" label-position="right" size="mini">
- <el-form-item label="地表海拔:">
- <span>{{heightLimit.baseHeight}}</span>米 <el-button color="rgb(20 136 255)" @click="HeightLimit('pickUp')">图上选点</el-button>
- </el-form-item>
- <el-form-item label="限制高度:">
- <el-slider v-model="heightLimit.height" :min="0" :max="300" :step="1" @input="changeHeight"></el-slider>
- </el-form-item>
- <el-form-item label="当前高度:">
- {{heightLimit.height}}米
- </el-form-item>
- </el-form>
- <div class="jt-btn" style="margin-bottom: 10rem;">
- <el-button color="rgb(20 136 255)" @click="HeightLimit('activate')">绘制限高区域</el-button>
- <el-button color="rgb(255 100 100)" @click="HeightLimit('deactivate')"><span style="color: #fff;">清除限高分析</span></el-button>
- </div>
- </div>
- </el-collapse-item>
- <!-- <el-collapse-item name="剖切展示">
- <template #title>
- <i class='iconfont icon-svgpouqiezhanshi' />剖切展示
- </template>
- <div class="el-collapse-item__content">
- <div style="line-height: 2em; table-layout: fixed; word-wrap: break-word; word-break: normal; text-align:justify; text-justify: inter-ideograph;color: #ffffff60;">
- 目前仅支持凸多边形,如果绘制的是凹多边形,可能裁剪结果不正确
- </div>
- <el-button color="rgb(20 136 255)" @click="Cutting('activate')">添加剖切多边形</el-button>
- </div>
- </el-collapse-item> -->
- <!-- <el-collapse-item name="视频融合">
- <template #title>
- <i class='iconfont icon-svgshipinronghe' />视频融合
- </template>
- <div class="el-collapse-item__content">
- <div style="line-height: 2em; table-layout: fixed; word-wrap: break-word; word-break: normal; text-align:justify; text-justify: inter-ideograph;color: #ffffff60;">
- 请先打开【牟平中心城实景三维】
- </div>
- <el-button color="rgb(20 136 255)" @click="PolygonHierarchy">视频融合</el-button>
- </div>
- </el-collapse-item> -->
- </el-collapse>
- </div>
- </template>
- <script>
- let jt3d = undefined;
- export default {
- props: {},
- watch: {},
- /* 数据 */
- data() {
- return {
- activeName: "光照分析",
- // 限高分析
- heightLimit: {
- height: 20,
- baseHeight: 0,
- },
- //方量分析
- cutFill: {
- height: 10, //挖方填方高度
- precision: 1256, //挖方填方精度
- result: { //挖方填方结果
- allArea: "",
- cutArea: "",
- cutVolume: "",
- fillArea: "",
- fillVolume: "",
- },
- },
- }
- },
- /* 方法 */
- methods: {
- /**
- * 光照分析
- */
- SunShine(type) {
- let _self = this;
- switch (type) {
- case "start":
- jt3d.statusBar.show = false;
- jt3d.SpatialAnalysis.SunshineShadow.start();
- break;
- case "remove":
- jt3d.statusBar.show = true;
- jt3d.SpatialAnalysis.SunshineShadow.remove();
- break;
- }
- },
- /**
- * 方量分析
- */
- CutFill(type) {
- let _self = this;
- //功能初始化
- _self.init();
- switch (type) {
- case "draw":
- jt3d.DrawTools.draw('polygon', {
- isEdit: false,
- onComplete(cartesian3d, points) {
- //清除绘制
- jt3d.DrawTools.Clear();
- let pointsArray = [];
- points.forEach((coordinate, index) => {
- pointsArray.push([
- coordinate.lng,
- coordinate.lat,
- coordinate.height
- ]);
- });
- jt3d.SpatialAnalysis.CutFill.createPolygonGeo(pointsArray, {
- height: _self.height,
- precision: _self.precision,
- }).then(res => {
- _self.cutFill.result = res;
- });
- }
- });
- break;
- case "remove":
- jt3d.SpatialAnalysis.CutFill.remove();
- this.cutFill.result = {
- allArea: "",
- cutArea: "",
- cutVolume: "",
- fillArea: "",
- fillVolume: "",
- }
- //还原左键单击事件
- this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
- break;
- }
- },
- /**
- * 视频融合
- */
- PolygonHierarchy() {
- let videoElement = document.getElementById('trailer');
- var videopolygon = jt3d._viewer.entities.add({
- polygon: {
- height: 0.1,
- hierarchy: new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights([121.600444, 37.398272, 37.95, 121.600443, 37.398272, 33, 121.600443, 37.398341, 33, 121.600444, 37.398341, 37.95])),
- material: videoElement,
- perPositionHeight: true,
- }
- });
- let flyToEntity = jt3d.LocateUtil.flyToEntity(videopolygon, {
- heading: 90, //方向
- pitch: -32, //倾斜角度
- range: 72
- });
- flyToEntity.then(function(vehicleEntity) {
- jt3d._viewer.trackedEntity = vehicleEntity; //获取或设置摄像机当前正在跟踪的Entity实例。
- vehicleEntity.viewFrom = new Cesium.Cartesian3(0, 1, 0.3);
- });
- },
- /**
- * 剖切分析
- */
- Cutting(type) {
- let _self = this;
- //功能初始化
- _self.init();
- switch (type) {
- case "activate":
- if (window["my3dtiles"]) {
- jt3d.DrawTools.draw('polygon', {
- isEdit: false,
- onComplete(cartesian3d, points) {
- //清除绘制
- jt3d.DrawTools.Clear();
-
- let pointsArray = [];
- points.forEach((coordinate, index) => {
- pointsArray.push([
- coordinate.lng,
- coordinate.lat,
- coordinate.height
- ]);
- });
-
- jt3d.SpatialAnalysis.Cutting.addTiles(window["my3dtiles"], pointsArray);
-
- }
- });
- } else {
- ElMessage.error("请先勾选3D模型");
- }
- break;
- case "deactivate":
- //还原左键单击事件
- this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
- break;
- }
- },
- /**
- * 限高分析
- */
- HeightLimit(type) {
- let _self = this;
- //功能初始化
- _self.init();
- switch (type) {
- case "pickUp": //图上选点,获取地表高度
- jt3d.CommonTools._sketchViewModel.sketchTools('point', {
- onComplete(cPoint, gPoint) {
- _self.heightLimit.baseHeight = Number(gPoint.height.toFixed(2));
- },
- onError(message) {
-
- }
- });
- break;
- case "activate":
- jt3d.DrawTools.draw('polygon', {
- isEdit: false,
- onComplete(cartesian3d, points) {
- //清除绘制
- // jt3d.DrawTools._entities.remove(jt3d.DrawTools._drawEntity.polygon);
- jt3d.DrawTools.Clear();
- let pointsArray = [];
- points.forEach((coordinate, index) => {
- pointsArray.push([
- coordinate.lng,
- coordinate.lat,
- coordinate.height
- ]);
- });
- jt3d.SpatialAnalysis.HeightLimit.addPrimitive(pointsArray, {
- height: _self.heightLimit.height,
- baseHeight: _self.heightLimit.baseHeight,
- });
- }
- });
- break;
- case "deactivate":
- jt3d.SpatialAnalysis.HeightLimit.removePrimitive();
- jt3d.CommonTools._sketchViewModel.sketchClear();
- //还原左键单击事件
- this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
- break;
- }
- },
- changeHeight(val) {
- jt3d.SpatialAnalysis.HeightLimit.changeHeight(val);
- },
- /**
- * 通视分析
- * @param {Object} type
- */
- SightLine(type) {
- let _self = this;
- //功能初始化
- _self.init();
- switch (type) {
- case "activate":
- jt3d.SpatialAnalysis.SightLine.startSightLine();
- break;
- case "deactivate":
- jt3d.SpatialAnalysis.SightLine.clearAll();
- //还原左键单击事件
- this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
- break;
- }
- },
- /**
- * 视域分析
- */
- ViewShed(type) {
- let _self = this;
- //功能初始化
- _self.init();
- switch (type) {
- case "activate":
- jt3d.SpatialAnalysis.ViewShed.createViewshed(10);
- break;
- case "deactivate":
- jt3d.SpatialAnalysis.ViewShed.clearAll();
- //还原左键单击事件
- this.$parent.$parent.$refs.refMap3d.clickEntity(jt3d);
- break;
- }
- },
- /**
- * 剖面分析
- */
- SectionAnalysis() {
- let _self = this;
- //功能初始化
- _self.init();
- jt3d.DrawTools.draw('polyline', {
- isEdit: false,
- onComplete(cartesian3d, points) {
- let pointsArray = [];
- points.forEach((coordinate, index) => {
- pointsArray.push([
- coordinate.lng,
- coordinate.lat,
- coordinate.height
- ]);
- });
- let ProfileAnalysis = jt3d.SpatialAnalysis.Profile.startProfileAnalysis(pointsArray, jt3d.DrawTools._drawEntity.polyline);
- ProfileAnalysis.then(function(result) {
- _self.$parent.$parent.$refs.refDrawerSectionAnalysis.drawerVisible = true;
- _self.$parent.$parent.initEchartsData(result);
- });
- }
- });
- },
- /**
- * 功能初始化
- */
- init() {
- //移除左键单击事件
- if (jt3d.handlerLeftClick) {
- jt3d.handlerLeftClick.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK); //移除事件
- }
- jt3d.DrawTools.Clear();
- jt3d.CommonTools._sketchViewModel.sketchClear();
- jt3d.SpatialAnalysis.CutFill.remove(); //清除方量分析
- jt3d.SpatialAnalysis.Profile.removeProfileAnalysis(); //移除剖面分析
- jt3d.SpatialAnalysis.SightLine.clearAll(); //清除通视分析
- jt3d.SpatialAnalysis.ViewShed.clearAll(); //清除视域分析
- jt3d.SpatialAnalysis.HeightLimit.removePrimitive(); //清除限高分析
- }
- },
- mounted() {
- }
- };
- </script>
- <style lang="scss" scoped>
- .jt-analysisSpace {
- position: relative;
- .iconfont {
- padding: 0 10rem;
- }
- .el-collapse {
- --el-collapse-border-color: rgb(0 44 126 / 0%);
- --el-collapse-header-text-color: #ffffff;
- --el-collapse-header-font-size: 13rem;
- --el-collapse-content-bg-color: rgb(0 44 126 / 0%);
- --el-collapse-content-font-size: 13rem;
- --el-collapse-content-text-color: rgb(216 240 255);
- --el-collapse-header-height: 40rem;
- --el-collapse-header-bg-color: rgb(30 130 255);
- --el-fill-color-blank: rgb(0 44 126 / 68%);
- --el-text-color-regular: rgb(216 240 255);
- --el-border-color: rgb(35 135 255);
- .el-collapse-item__content {
- padding: 10rem;
- // padding-bottom: 0rem;
- }
- }
- }
- ::v-deep .el-collapse-item__content {
- padding: 10rem;
- // padding-bottom: 0rem;
- overflow-y: hidden;
- }
- ::v-deep .el-collapse-item__header {
- background: url(@/assets/images/bg_collapse_title.png) no-repeat;
- background-size: 350rem 40rem;
- // background-color: rgb(22 90 190);
- // background-color: rgb(5 45 100 /60%);
- background-color: rgb(30 130 255);
- border-bottom: 0;
- }
- </style>
|