From 5e47738f99e307bab1c8a5ee9ecd96d8c7f4a968 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Sat, 08 Jan 2022 10:43:01 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/school-web
---
src/components/mobilemap/index.vue | 268 +++++++++++++++++++++++++++++++----------------------
1 files changed, 155 insertions(+), 113 deletions(-)
diff --git a/src/components/mobilemap/index.vue b/src/components/mobilemap/index.vue
index b0d0d2f..3edfe80 100644
--- a/src/components/mobilemap/index.vue
+++ b/src/components/mobilemap/index.vue
@@ -18,9 +18,11 @@
<!-- 大弹窗 -->
<mobilePopupOur :style="[bigPopup]" v-if="mBigPopup"></mobilePopupOur>
<!-- 测试-跳转位置 -->
- <mobileGoTo></mobileGoTo>
+ <!-- <mobileGoTo></mobileGoTo> -->
<!-- 实景窗口 -->
<mobilePanorama></mobilePanorama>
+ <!-- 盖住左下角 -->
+ <div class="cover_mobileMap">智慧社区</div>
</div>
</template>
<script>
@@ -192,11 +194,10 @@
url: "https://webmap-tile.sf-express.com/MapTileService/rt?fetchtype=static&x={x}&y={y}&z={z}&project=sfmap&pic_size=256&pic_type=png8&data_name=361100&data_format=merged-dat&data_type=normal", // 行政区划
}
);
- viewer.addBaseLayer(baselayer, {
- iconUrl: "examples/images/icon/img.png",
- name: "影像",
- });
-
+ // viewer.addBaseLayer(baselayer, {
+ // iconUrl: "examples/images/icon/img.png",
+ // name: "影像",
+ // });
// eslint-disable-next-line camelcase
// const baselayer_shaded = DC.ImageryLayerFactory.createArcGisImageryLayer({
// url: "http://services.arcgisonline.com/arcgis/rest/services/World_Shaded_Relief/MapServer",
@@ -240,6 +241,7 @@
viewer.on(that.DC.SceneEventType.CAMERA_CHANGED, (e) => {
//相机移动最后参数
//控制高度
+ let isSet = that.dimension == "3D" ? false : true;
const height = Math.ceil(viewer.camera.positionCartographic.height);
let conBack = (height) => {
viewer.camera.setView({
@@ -265,11 +267,11 @@
// if (height > 2000) {
// conBack(2000);
// }
- if (height < 500) {
- conBack(500);
+ if (height < 0 && isSet) {
+ conBack(0);
}
- if (height > 6000) {
- conBack(6000);
+ if (height > 4000 && isSet) {
+ conBack(4000);
}
});
@@ -319,12 +321,10 @@
//精细模型↓
const tilesetLayer = new that.DC.TilesetLayer("tilesetLayer");
viewer.addLayer(tilesetLayer);
- const tileset = new that.DC.Tileset(
- "http://data.mars3d.cn/3dtiles/max-shihua/tileset.json",
- {
- luminanceAtZenith: 0.5,
- }
- );
+ const tileset = new that.DC.Tileset("/mx/tileset.json", {
+ luminanceAtZenith: 0.5,
+ });
+
tilesetLayer.addOverlay(tileset);
// tilesetLayer.show = false;
@@ -367,9 +367,10 @@
e.position,
[e.wgs84Position.lng, e.wgs84Position.lat],
{
- name: e.layer._bid,
- address: e.layer.type,
- introduce: e.layer._id,
+ name: e.overlay.attr.name,
+ address: e.layer._id,
+ introduce: e.overlay.attr.id,
+ data: e,
}
);
//高亮
@@ -421,45 +422,52 @@
// );
// }
// });
- tilesetLayer["changesilhouetteBlue"] = () => {
- silhouetteBlue.selected = [];
- };
- tilesetLayer.show = false;
+ // tilesetLayer["changesilhouetteBlue"] = () => {
+ // silhouetteBlue.selected = [];
+ // };
+ // tilesetLayer.show = false;
//精细模型↑
// 2.5D贴图↓
let usetowpointfive = () => {
var provider =
- new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
- url: "http://www.tdtfz.com/OneMapServer/rest/services/fzsw2019/MapServer/WMTS/tile/1.0.0/fzsw2019/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}",
- layer: "fzsw2019",
- style: "default",
- tileMatrixSetID: "default028mm",
- format: "image/jpgpng",
- tilingScheme: new that.DC.Namespace.Cesium.GeographicTilingScheme(),
- maximumLevel: 19,
- tileMatrixLabels: [
- "0",
- "1",
- "2",
- "3",
- "4",
- "5",
- "6",
- "7",
- "8",
- "9",
- "10",
- "11",
- "12",
- "13",
- "14",
- "15",
- "16",
- "17",
- "18",
- "19",
- ],
+ // new that.DC.Namespace.Cesium.WebMapTileServiceImageryProvider({
+ // url: "http://www.tdtfz.com/OneMapServer/rest/services/fzsw2019/MapServer/WMTS/tile/1.0.0/fzsw2019/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}",
+ // layer: "fzsw2019",
+ // style: "default",
+ // tileMatrixSetID: "default028mm",
+ // format: "image/jpgpng",
+ // tilingScheme: new that.DC.Namespace.Cesium.GeographicTilingScheme(),
+ // maximumLevel: 19,
+ // tileMatrixLabels: [
+ // "0",
+ // "1",
+ // "2",
+ // "3",
+ // "4",
+ // "5",
+ // "6",
+ // "7",
+ // "8",
+ // "9",
+ // "10",
+ // "11",
+ // "12",
+ // "13",
+ // "14",
+ // "15",
+ // "16",
+ // "17",
+ // "18",
+ // "19",
+ // ],
+ // });
+ // new that.DC.Namespace.Cesium.ArcGisMapServerImageryProvider({
+ // url: "http://arcgis.jxpskj.com:6080/arcgis/rest/services/PingXiang25DMapDN/MapServer",
+ // });
+ new that.DC.Namespace.Cesium.UrlTemplateImageryProvider({
+ url: "/wp/{z}/{x}/{y}.png",
+ fileExtension: "png",
});
return viewer.imageryLayers.addImageryProvider(provider);
};
@@ -467,52 +475,51 @@
const newLayer = usetowpointfive();
// 2.5D贴图↑
let startPoint;
- if (false) {
+ if (true) {
startPoint = () => {
- viewer.flyTo(tileset);
- // that.$store.dispatch("mapFlyTo", {
- // //飞入
- // lntLat: [115.87988885, 28.72502592, 2100],
- // // lntLat: [115.87186406, 28.74449337, 1200],
- // // lntLat: [121.50492752204283, 31.21567802276832, 2530],
- // heading: 0,
- // pitch: -45,
- // roll: 0,
- // noOpen: true,
- // });
+ let doit2 = (int, h) => {
+ viewer.camera.setView({
+ // Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
+ // fromDegrees()方法,将经纬度和高程转换为世界坐标
+ destination: that.DC.Namespace.Cesium.Cartesian3.fromDegrees(
+ // 114.0351,
+ // 27.6314,
+ // 200.0
+ int[0],
+ int[1],
+ int[2]
+ ),
+ orientation: {
+ // 指向
+ heading: that.DC.Namespace.Cesium.Math.toRadians(h[0]),
+ // 视角
+ pitch: that.DC.Namespace.Cesium.Math.toRadians(h[1]),
+ roll: h[2],
+ },
+ });
+ };
+ that.dimension == "2.5D"
+ ? doit2(
+ [114.03928791, 27.62954732, 360.0],
+ [
+ that.dimensionData.heading,
+ that.dimensionData.pitch,
+ that.dimensionData.roll,
+ ]
+ )
+ : // : doit([116.39038494750986, 39.902393222208644, 330.0]);
+ // doit("建模");
+ doit2([114.0351, 27.6314, 300.0], [108, -26.46, 0.0]);
};
- setTimeout((res) => {
- //转圈
- that.$store.dispatch("mapFlyTo", {
- lntLat: [111.25036579, 34.83767277, 11443175.85],
- heading: 0,
- pitch: -90,
- roll: 0,
- noOpen: true,
- fn: function () {
- // viewer.flyTo(tileset);
- // viewer.flyTo(provider);
- //飞入起始点
- // that.$store.dispatch("mapFlyTo", {
- // lntLat: [115.87186406, 28.74449337, 1200],
- // heading: 0,
- // pitch: -45,
- // roll: 0,
- // noOpen: true,
- // });
-
- startPoint();
- },
- });
- // viewer.flyTo(tileset);
- }, 2500);
} else {
startPoint = (val) => {
// viewer.zoomToPosition(
// new DC.Position(115.86798885, 28.72502592, 2100, 0, -45)
// );
let doit = (int) => {
- if (val == 1) {
+ if (int == "建模") {
+ viewer.flyTo(tileset);
+ } else if (val == 1) {
viewer.camera.setView({
// Cesium的坐标是以地心为原点,一向指向南美洲,一向指向亚洲,一向指向北极州
// fromDegrees()方法,将经纬度和高程转换为世界坐标
@@ -537,6 +544,7 @@
},
});
} else {
+ // console.log(123456);
that.$store.dispatch("mapFlyTo", {
lntLat: [+int[0] + 0.012, int[1], int[2]],
// 指向
@@ -548,11 +556,14 @@
});
}
};
+ // [116.36618337, 27.95911915, 2000.0]
that.dimension == "2.5D"
- ? doit([116.36618337, 27.95911915, 2000.0])
- : doit([117.08513731, 31.64790556, 600.0]);
+ ? doit([114.03928791, 27.62954732, 360.0])
+ : // : doit([116.39038494750986, 39.902393222208644, 330.0]);
+ doit("建模");
+ // doit(114.03925, 27.6265, 360.0);
};
- startPoint(1);
+ // startPoint(1);
}
//传递默认位置
that.$store.commit("MSET_MORENWEIZHI", startPoint);
@@ -571,29 +582,29 @@
//瀑布流↓
const wallLayer = new that.DC.VectorLayer("wallLayer");
- viewer.addLayer(wallLayer);
- var arr = that.wallArr;
- arr.forEach((item) => {
- item = item.join(",");
- });
- arr = arr.join(";");
- const wall = new that.DC.Wall(arr);
- wall.setStyle({
- material: new that.DC.WallTrailMaterialProperty({
- color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
- // color: that.DC.Color.DEEPSKYBLUE,
- speed: 4,
- }),
- });
- wallLayer.addOverlay(wall);
+ // viewer.addLayer(wallLayer);
+ // var arr = that.wallArr;
+ // arr.forEach((item) => {
+ // item = item.join(",");
+ // });
+ // arr = arr.join(";");
+ // const wall = new that.DC.Wall(arr);
+ // wall.setStyle({
+ // material: new that.DC.WallTrailMaterialProperty({
+ // color: that.DC.Namespace.Cesium.Color.fromBytes(0, 142, 255, 150),
+ // // color: that.DC.Color.DEEPSKYBLUE,
+ // speed: 4,
+ // }),
+ // });
+ // wallLayer.addOverlay(wall);
- viewer.use(new that.DC.Measure());
+ // viewer.use(new that.DC.Measure());
//瀑布流↑
// 传入store
that.$store.commit("MSET_MODEOLS", {
tilesetLayer: tilesetLayer,
- tileset: tileset,
+ // tileset: tileset,
newLayer: newLayer,
wallLayer: wallLayer,
usetowpointfive: usetowpointfive,
@@ -614,7 +625,38 @@
viewer.zoomController.enable = true;
viewer.locationBar.enable = false;
viewer.distanceLegend.enable = false;
- if (true) {
+ //判断默认维度
+ //原本默认是2.5d 改为3d默认时做出改变
+ if (that.dimension == "2.5D") {
+ that.$store.commit("MSET_DIMENSION", "2.5D"); //切换2.5D设置
+ } else if (that.dimension == "3D") {
+ // setTimeout((res) => {
+ // that.$store.dispatch("mapFlyTo", {
+ // lntLat: [111.25036579, 34.83767277, 11443175.85],
+ // heading: 0,
+ // pitch: -90,
+ // roll: 0,
+ // noOpen: true,
+ // fn: function () {
+ // viewer.flyTo(tileset);
+ // viewer.flyTo(provider);
+ //飞入起始点
+ // that.$store.dispatch("mapFlyTo", {
+ // lntLat: [115.87186406, 28.74449337, 1200],
+ // heading: 0,
+ // pitch: -45,
+ // roll: 0,
+ // noOpen: true,
+ // });
+
+ // startPoint();
+ that.$store.commit("MSET_DIMENSION", "3D"); //切换3D设置
+ // },
+ // });
+ // }, 2000);
+ }
+ if (false) {
+ //镜头改变示例
// viewer.scene.screenSpaceCameraController.enableZoom = false; //控制视角缩放
// viewer.scene.screenSpaceCameraController.enableTilt = false; //控制视角旋转
// viewer.scene.screenSpaceCameraController.minimumZoomDistance = 200; //最小缩放
@@ -656,7 +698,7 @@
};
</script>
-<style lang='scss' scope>
+<style lang="scss" scope>
#mobile-viewer-container {
width: 100%;
height: 100%;
--
Gitblit v1.9.3