|
@@ -76,16 +76,16 @@ import { moveHandler, pickPoint } from "@/utils/MapHelper/help.js";
|
|
|
let pos = {};
|
|
|
let box = null;
|
|
|
let startClip = false;
|
|
|
-let boxPosition = {};
|
|
|
-let layers = null;
|
|
|
+let boxPosition = null;
|
|
|
+let layers = [];
|
|
|
export default {
|
|
|
name: "ClippingPlanes",
|
|
|
props: {},
|
|
|
data() {
|
|
|
return {
|
|
|
form: {
|
|
|
- width: 100,
|
|
|
- height: 100,
|
|
|
+ width: 5,
|
|
|
+ height: 5,
|
|
|
heading: 0,
|
|
|
pitch: 0,
|
|
|
roll: 0,
|
|
@@ -99,9 +99,12 @@ export default {
|
|
|
|
|
|
beforeDestroy() {},
|
|
|
mounted() {
|
|
|
- layers = store.state.tempLatData[0][0];
|
|
|
- viewer.flyTo(layers);
|
|
|
- this.addEntity();
|
|
|
+ if (store.state.tempLatData) {
|
|
|
+ layers = store.state.tempLatData[0];
|
|
|
+ console.log(layers, "llll");
|
|
|
+ viewer.flyTo(layers[0]);
|
|
|
+ this.addEntity();
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -127,7 +130,7 @@ export default {
|
|
|
this.analysis();
|
|
|
},
|
|
|
changehpr(pos) {
|
|
|
- if (!box) return;
|
|
|
+ if (!box || !boxPosition) return;
|
|
|
var hpr = new Cesium.HeadingPitchRoll(
|
|
|
Cesium.Math.toRadians(this.form.heading),
|
|
|
Cesium.Math.toRadians(this.form.pitch),
|
|
@@ -174,7 +177,7 @@ export default {
|
|
|
position: Cesium.Cartesian3.fromDegrees(0, 0, 0),
|
|
|
show: false,
|
|
|
box: {
|
|
|
- dimensions: new Cesium.Cartesian3(5, 5, 0.1),
|
|
|
+ dimensions: new Cesium.Cartesian3(5, 5, 0.001),
|
|
|
fill: false,
|
|
|
outline: true,
|
|
|
outlineColor: Cesium.Color.RED,
|
|
@@ -185,35 +188,39 @@ export default {
|
|
|
this.changehpr();
|
|
|
},
|
|
|
setBox() {
|
|
|
- if (!box) return;
|
|
|
+ if (!box || !boxPosition) return;
|
|
|
box.box.dimensions = new Cesium.Cartesian3(
|
|
|
this.form.width,
|
|
|
this.form.height,
|
|
|
- 0.1
|
|
|
+ 0.001
|
|
|
);
|
|
|
box.position = boxPosition;
|
|
|
},
|
|
|
|
|
|
updateClip() {
|
|
|
- console.log(layers, "llll");
|
|
|
// layers.setCustomClipPlane(pos[0], pos[1], pos[2]);
|
|
|
- layers.setCustomClipCross({
|
|
|
- position: pos,
|
|
|
- dimensions: new Cesium.Cartesian3(
|
|
|
- this.form.width,
|
|
|
- this.form.height,
|
|
|
- this.form.extrudeDistance
|
|
|
- ),
|
|
|
- heading: this.form.heading,
|
|
|
- pitch: this.form.pitch,
|
|
|
- roll: this.form.roll,
|
|
|
- extrudeDistance: this.form.extrudeDistance,
|
|
|
+ layers.forEach((li) => {
|
|
|
+ li.setCustomClipCross({
|
|
|
+ position: pos,
|
|
|
+ dimensions: new Cesium.Cartesian3(
|
|
|
+ this.form.width,
|
|
|
+ this.form.height,
|
|
|
+ this.form.extrudeDistance
|
|
|
+ ),
|
|
|
+ heading: this.form.heading,
|
|
|
+ pitch: this.form.pitch,
|
|
|
+ roll: this.form.roll,
|
|
|
+ extrudeDistance: this.form.extrudeDistance,
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
clear() {
|
|
|
if (box) box.show = false;
|
|
|
- // layers.clearCustomClipBox();
|
|
|
- layers.clearCustomClipBox();
|
|
|
+
|
|
|
+ layers.forEach((li) => {
|
|
|
+ li.clearCustomClipBox();
|
|
|
+ });
|
|
|
+
|
|
|
// viewer.entities.removeAll();
|
|
|
},
|
|
|
},
|