|
@@ -46,11 +46,21 @@ import {
|
|
|
mercator2lonLat,
|
|
|
undergroundMode,
|
|
|
} from "@/utils/MapHelper/MapHelper.js";
|
|
|
+import {
|
|
|
+ point,
|
|
|
+ buffer,
|
|
|
+ bboxPolygon,
|
|
|
+ square,
|
|
|
+ destination,
|
|
|
+ polygon,
|
|
|
+ booleanPointInPolygon,
|
|
|
+} from "@turf/turf";
|
|
|
let polygonids = [];
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- form: { FLOORH: 3, AddFLOOR: 1, BuildingHeight: 0 },
|
|
|
+ form: { FLOORH: 3, BuildingHeight: 0 },
|
|
|
+ loutiInfo: null,
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -83,260 +93,322 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
async init() {
|
|
|
+ debugger;
|
|
|
+
|
|
|
let that = this;
|
|
|
+ var pt = point([that.info.xyz.lng, that.info.xyz.lat]);
|
|
|
this.info.layerDataList.forEach((element) => {
|
|
|
- let FLOORH = element.data.find((c) => c.label == "FLOORH");
|
|
|
- if (FLOORH && FLOORH.value) {
|
|
|
- that.form.FLOORH = FLOORH.value;
|
|
|
+ let ps = [];
|
|
|
+ element.geometry.points.forEach((points) => {
|
|
|
+ ps.push([points.x, points.y]);
|
|
|
+ });
|
|
|
+ var poly = polygon([ps]);
|
|
|
+ let isInclude = booleanPointInPolygon(pt, poly);
|
|
|
+ if (isInclude) {
|
|
|
+ debugger;
|
|
|
+ that.loutiInfo = element;
|
|
|
+ let FLOORH = element.data.find((c) => c.label == "FLOORH");
|
|
|
+ if (FLOORH && FLOORH.value) {
|
|
|
+ that.form.FLOORH = Number(FLOORH.value);
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
that.removeEntities();
|
|
|
- if (that.info.layerDataList.length == 0) {
|
|
|
+ debugger;
|
|
|
+ if (!that.loutiInfo) {
|
|
|
that.$message({
|
|
|
message: "未查询到模型数据,请重试加载模型",
|
|
|
type: "warning",
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- for (
|
|
|
- let layerDataListindex = 0;
|
|
|
- layerDataListindex < that.info.layerDataList.length;
|
|
|
- layerDataListindex++
|
|
|
- ) {
|
|
|
- const element = that.info.layerDataList[layerDataListindex];
|
|
|
|
|
|
- //基础高度(地形高度)加入地形后可删除
|
|
|
- let jcgd = 0;
|
|
|
- let bm = element.data.find((c) => c.label == "LANDNO");
|
|
|
- if (bm && bm.value) {
|
|
|
- //获取模型信息
|
|
|
- let queryBySQLParameters = {
|
|
|
- getFeatureMode: "SQL",
|
|
|
- datasetNames: [that.info.Minfo.dataSourceName + ":项目范围"],
|
|
|
- queryParameter: {
|
|
|
- attributeFilter: " DKBM = '" + bm.value + "'",
|
|
|
- },
|
|
|
- hasGeometry: true,
|
|
|
- };
|
|
|
- let e = await mapQuery(
|
|
|
- that.info.Minfo.dataurl + "/featureResults.json?returnContent=true",
|
|
|
- queryBySQLParameters
|
|
|
- );
|
|
|
+ const element = that.loutiInfo;
|
|
|
|
|
|
- debugger;
|
|
|
- if (e && e.totalCount > 0) {
|
|
|
- e.features.forEach((feature) => {
|
|
|
- feature.fieldNames.forEach((fieldName, i) => {
|
|
|
- if (
|
|
|
- fieldName == "BASEH" &&
|
|
|
- Number(feature.fieldValues[i]) > jcgd
|
|
|
- ) {
|
|
|
- jcgd = Number(feature.fieldValues[i]);
|
|
|
- }
|
|
|
- });
|
|
|
+ //基础高度(地形高度)加入地形后可删除
|
|
|
+ let jcgd = 0;
|
|
|
+ let bm = element.data.find((c) => c.label == "LANDNO");
|
|
|
+ if (bm && bm.value) {
|
|
|
+ //获取模型信息
|
|
|
+ let queryBySQLParameters = {
|
|
|
+ getFeatureMode: "SQL",
|
|
|
+ datasetNames: [that.info.Minfo.dataSourceName + ":项目范围"],
|
|
|
+ queryParameter: {
|
|
|
+ attributeFilter: " DKBM = '" + bm.value + "'",
|
|
|
+ },
|
|
|
+ hasGeometry: true,
|
|
|
+ };
|
|
|
+ let e = await mapQuery(
|
|
|
+ that.info.Minfo.dataurl + "/featureResults.json?returnContent=true",
|
|
|
+ queryBySQLParameters
|
|
|
+ );
|
|
|
+
|
|
|
+ debugger;
|
|
|
+ if (e && e.totalCount > 0) {
|
|
|
+ e.features.forEach((feature) => {
|
|
|
+ feature.fieldNames.forEach((fieldName, i) => {
|
|
|
+ if (
|
|
|
+ fieldName == "BASEH" &&
|
|
|
+ Number(feature.fieldValues[i]) > jcgd
|
|
|
+ ) {
|
|
|
+ jcgd = Number(feature.fieldValues[i]);
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
- } else {
|
|
|
- that.$message({
|
|
|
- message: "未找到模型基础高度,默认高程为0",
|
|
|
- type: "warning",
|
|
|
});
|
|
|
}
|
|
|
+ } else {
|
|
|
+ that.$message({
|
|
|
+ message: "未找到模型基础高度,默认高程为0",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- let HEIGHT = element.data.find((c) => c.label == "HEIGHT");
|
|
|
- if (HEIGHT && HEIGHT.value) {
|
|
|
- HEIGHT = HEIGHT.value;
|
|
|
- }
|
|
|
- that.form.BuildingHeight = HEIGHT;
|
|
|
+ let HEIGHT = element.data.find((c) => c.label == "HEIGHT");
|
|
|
+ if (HEIGHT && HEIGHT.value) {
|
|
|
+ HEIGHT = HEIGHT.value;
|
|
|
+ }
|
|
|
+ that.form.BuildingHeight = HEIGHT;
|
|
|
+
|
|
|
+ //顶部高度,底部高度
|
|
|
+ let maxH = jcgd,
|
|
|
+ minH = jcgd;
|
|
|
+ for (
|
|
|
+ let FLOORindex = 1;
|
|
|
+ FLOORindex <= Math.ceil(that.form.BuildingHeight / that.form.FLOORH);
|
|
|
+ FLOORindex++
|
|
|
+ ) {
|
|
|
+ debugger;
|
|
|
+ maxH += that.form.FLOORH;
|
|
|
+ minH = maxH - that.form.FLOORH;
|
|
|
+ console.log("maxH:" + maxH + "----minH:" + minH);
|
|
|
let ps = [];
|
|
|
- //顶部高度,底部高度
|
|
|
- let maxH = jcgd,
|
|
|
- minH = jcgd;
|
|
|
- for (
|
|
|
- let FLOORindex = 1;
|
|
|
- FLOORindex <= Math.ceil(that.form.BuildingHeight / that.form.FLOORH);
|
|
|
- FLOORindex++
|
|
|
- ) {
|
|
|
- debugger;
|
|
|
- maxH += that.form.FLOORH;
|
|
|
- minH = maxH - that.form.FLOORH;
|
|
|
- console.log("maxH:" + maxH + "----minH:" + minH);
|
|
|
- for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
- const point = element.geometry.points[index];
|
|
|
- ps.push(point.x);
|
|
|
- ps.push(point.y);
|
|
|
- // ps.push(minH);
|
|
|
- }
|
|
|
- // let id = uuidv4();
|
|
|
+ for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
+ const point = element.geometry.points[index];
|
|
|
+ ps.push(point.x);
|
|
|
+ ps.push(point.y);
|
|
|
+ // ps.push(minH);
|
|
|
+ }
|
|
|
+ // let id = uuidv4();
|
|
|
|
|
|
- // 定义多边形的顶点(经纬度)
|
|
|
- var polygonHierarchy = new Cesium.PolygonHierarchy(
|
|
|
- Cesium.Cartesian3.fromDegreesArray(ps)
|
|
|
- );
|
|
|
+ // 定义多边形的顶点(经纬度)
|
|
|
+ var polygonHierarchy = new Cesium.PolygonHierarchy(
|
|
|
+ Cesium.Cartesian3.fromDegreesArray(ps)
|
|
|
+ );
|
|
|
|
|
|
- // 创建带有高度的多边形
|
|
|
- var extrudedPolygon = new Cesium.GeometryInstance({
|
|
|
- geometry: new Cesium.PolygonGeometry({
|
|
|
- polygonHierarchy: polygonHierarchy,
|
|
|
- height: minH, // 多边形底面的高度
|
|
|
- extrudedHeight: maxH, // 拉伸到的高度
|
|
|
- }),
|
|
|
- attributes: {
|
|
|
- color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
- Cesium.Color.BLUE.withAlpha(0.1)
|
|
|
- ),
|
|
|
- },
|
|
|
- });
|
|
|
+ // 创建带有高度的多边形
|
|
|
+ var extrudedPolygon = new Cesium.GeometryInstance({
|
|
|
+ geometry: new Cesium.PolygonGeometry({
|
|
|
+ polygonHierarchy: polygonHierarchy,
|
|
|
+ height: minH, // 多边形底面的高度
|
|
|
+ extrudedHeight: maxH, // 拉伸到的高度
|
|
|
+ }),
|
|
|
+ attributes: {
|
|
|
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
+ Cesium.Color.CHARTREUSE.withAlpha(0.1)
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- // 添加到场景中
|
|
|
- let Primitive = new Cesium.Primitive({
|
|
|
- geometryInstances: [extrudedPolygon],
|
|
|
- appearance: new Cesium.PerInstanceColorAppearance({
|
|
|
- flat: true,
|
|
|
- }),
|
|
|
- });
|
|
|
- viewer.scene.primitives.add(Primitive);
|
|
|
- polygonids.push(Primitive);
|
|
|
- // viewer.entities.add({
|
|
|
- // id: id,
|
|
|
- // polygon: {
|
|
|
- // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
- // extrudedHeight: Number(maxH),
|
|
|
- // perPositionHeight: true,
|
|
|
- // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
- // outline: true,
|
|
|
- // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
- // outlineWidth: 1.0,
|
|
|
- // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
- // },
|
|
|
- // });
|
|
|
+ // 添加到场景中
|
|
|
+ let Primitive = new Cesium.Primitive({
|
|
|
+ geometryInstances: [extrudedPolygon],
|
|
|
+ appearance: new Cesium.PerInstanceColorAppearance({
|
|
|
+ flat: true,
|
|
|
+ }),
|
|
|
+ shadows: Cesium.ShadowMode.ENABLED, // 开启阴影
|
|
|
+ });
|
|
|
+ viewer.scene.primitives.add(Primitive);
|
|
|
+ polygonids.push(Primitive);
|
|
|
+ // 创建多边形的边界线
|
|
|
+
|
|
|
+ let pss = [];
|
|
|
+ for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
+ const point = element.geometry.points[index];
|
|
|
+ pss.push(point.x);
|
|
|
+ pss.push(point.y);
|
|
|
+ pss.push(maxH);
|
|
|
}
|
|
|
+ var boundaryPolyline = new Cesium.GeometryInstance({
|
|
|
+ geometry: new Cesium.PolylineGeometry({
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArrayHeights(pss), // 注意这里需要处理高度为0的情况,因为边界线通常在地表
|
|
|
+ width: 1, // 边界线的宽度
|
|
|
+ }),
|
|
|
+ attributes: {
|
|
|
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
+ Cesium.Color.CHARTREUSE.withAlpha(0.8)
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ });
|
|
|
+ let boundaryPolylinePrimitive = new Cesium.Primitive({
|
|
|
+ geometryInstances: [boundaryPolyline],
|
|
|
+ appearance: new Cesium.PolylineColorAppearance({
|
|
|
+ edgeWidth: 1,
|
|
|
+ // vertexFormat: Cesium.PolylineVertexFormat.POSITION_AND_COLOR,
|
|
|
+ vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ viewer.scene.primitives.add(boundaryPolylinePrimitive);
|
|
|
+ polygonids.push(boundaryPolylinePrimitive);
|
|
|
+ // viewer.entities.add({
|
|
|
+ // id: id,
|
|
|
+ // polygon: {
|
|
|
+ // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
+ // extrudedHeight: Number(maxH),
|
|
|
+ // perPositionHeight: true,
|
|
|
+ // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
+ // outline: true,
|
|
|
+ // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
+ // outlineWidth: 1.0,
|
|
|
+ // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
}
|
|
|
},
|
|
|
async onSubmit() {
|
|
|
- debugger;
|
|
|
let that = this;
|
|
|
that.removeEntities();
|
|
|
- if (that.info.layerDataList.length == 0) {
|
|
|
+ if (!that.loutiInfo) {
|
|
|
that.$message({
|
|
|
message: "未查询到模型数据,请重试加载模型",
|
|
|
type: "warning",
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- for (
|
|
|
- let layerDataListindex = 0;
|
|
|
- layerDataListindex < that.info.layerDataList.length;
|
|
|
- layerDataListindex++
|
|
|
- ) {
|
|
|
- const element = that.info.layerDataList[layerDataListindex];
|
|
|
+ const element = that.loutiInfo;
|
|
|
+ //基础高度(地形高度)加入地形后可删除
|
|
|
+ let jcgd = 0;
|
|
|
+ //地块编码
|
|
|
+ let bm = element.data.find((c) => c.label == "LANDNO");
|
|
|
+ if (bm && bm.value) {
|
|
|
+ //获取模型信息
|
|
|
+ let queryBySQLParameters = {
|
|
|
+ getFeatureMode: "SQL",
|
|
|
+ datasetNames: [that.info.Minfo.dataSourceName + ":项目范围"],
|
|
|
+ queryParameter: {
|
|
|
+ attributeFilter: " DKBM = '" + bm.value + "'",
|
|
|
+ },
|
|
|
+ hasGeometry: true,
|
|
|
+ };
|
|
|
+ let e = await mapQuery(
|
|
|
+ that.info.Minfo.dataurl + "/featureResults.json?returnContent=true",
|
|
|
+ queryBySQLParameters
|
|
|
+ );
|
|
|
|
|
|
- //基础高度(地形高度)加入地形后可删除
|
|
|
- let jcgd = 0;
|
|
|
- let bm = element.data.find((c) => c.label == "LANDNO");
|
|
|
- if (bm && bm.value) {
|
|
|
- //获取模型信息
|
|
|
- let queryBySQLParameters = {
|
|
|
- getFeatureMode: "SQL",
|
|
|
- datasetNames: [that.info.Minfo.dataSourceName + ":项目范围"],
|
|
|
- queryParameter: {
|
|
|
- attributeFilter: " DKBM = '" + bm.value + "'",
|
|
|
- },
|
|
|
- hasGeometry: true,
|
|
|
- };
|
|
|
- let e = await mapQuery(
|
|
|
- that.info.Minfo.dataurl + "/featureResults.json?returnContent=true",
|
|
|
- queryBySQLParameters
|
|
|
- );
|
|
|
-
|
|
|
- debugger;
|
|
|
- if (e && e.totalCount > 0) {
|
|
|
- e.features.forEach((feature) => {
|
|
|
- feature.fieldNames.forEach((fieldName, i) => {
|
|
|
- if (
|
|
|
- fieldName == "BASEH" &&
|
|
|
- Number(feature.fieldValues[i]) > jcgd
|
|
|
- ) {
|
|
|
- jcgd = Number(feature.fieldValues[i]);
|
|
|
- }
|
|
|
- });
|
|
|
+ debugger;
|
|
|
+ if (e && e.totalCount > 0) {
|
|
|
+ e.features.forEach((feature) => {
|
|
|
+ feature.fieldNames.forEach((fieldName, i) => {
|
|
|
+ if (
|
|
|
+ fieldName == "BASEH" &&
|
|
|
+ Number(feature.fieldValues[i]) > jcgd
|
|
|
+ ) {
|
|
|
+ jcgd = Number(feature.fieldValues[i]);
|
|
|
+ }
|
|
|
});
|
|
|
- }
|
|
|
- } else {
|
|
|
- that.$message({
|
|
|
- message: "未找到模型基础高度,默认高程为0",
|
|
|
- type: "warning",
|
|
|
});
|
|
|
}
|
|
|
+ } else {
|
|
|
+ that.$message({
|
|
|
+ message: "未找到模型基础高度,默认高程为0",
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
- let HEIGHT = element.data.find((c) => c.label == "HEIGHT");
|
|
|
- if (HEIGHT && HEIGHT.value) {
|
|
|
- HEIGHT = HEIGHT.value;
|
|
|
- }
|
|
|
- // that.form.BuildingHeight = HEIGHT;
|
|
|
+ //顶部高度,底部高度
|
|
|
+ let maxH = jcgd,
|
|
|
+ minH = jcgd;
|
|
|
+ for (
|
|
|
+ let FLOORindex = 1;
|
|
|
+ FLOORindex <= Math.ceil(that.form.BuildingHeight / that.form.FLOORH);
|
|
|
+ FLOORindex++
|
|
|
+ ) {
|
|
|
+ debugger;
|
|
|
+ maxH += that.form.FLOORH;
|
|
|
+ minH = maxH - that.form.FLOORH;
|
|
|
+ console.log("maxH:" + maxH + "----minH:" + minH);
|
|
|
let ps = [];
|
|
|
- //顶部高度,底部高度
|
|
|
- let maxH = jcgd,
|
|
|
- minH = jcgd;
|
|
|
- for (
|
|
|
- let FLOORindex = 1;
|
|
|
- FLOORindex <= Math.ceil(that.form.BuildingHeight / that.form.FLOORH);
|
|
|
- FLOORindex++
|
|
|
- ) {
|
|
|
- maxH += that.form.FLOORH;
|
|
|
- minH = maxH - that.form.FLOORH;
|
|
|
- console.log("maxH:" + maxH + "----minH:" + minH);
|
|
|
- for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
- const point = element.geometry.points[index];
|
|
|
- ps.push(point.x);
|
|
|
- ps.push(point.y);
|
|
|
- // ps.push(minH);
|
|
|
- }
|
|
|
- // let id = uuidv4();
|
|
|
+ for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
+ const point = element.geometry.points[index];
|
|
|
+ ps.push(point.x);
|
|
|
+ ps.push(point.y);
|
|
|
+ // ps.push(minH);
|
|
|
+ }
|
|
|
+ // let id = uuidv4();
|
|
|
|
|
|
- // 定义多边形的顶点(经纬度)
|
|
|
- var polygonHierarchy = new Cesium.PolygonHierarchy(
|
|
|
- Cesium.Cartesian3.fromDegreesArray(ps)
|
|
|
- );
|
|
|
+ // 定义多边形的顶点(经纬度)
|
|
|
+ var polygonHierarchy = new Cesium.PolygonHierarchy(
|
|
|
+ Cesium.Cartesian3.fromDegreesArray(ps)
|
|
|
+ );
|
|
|
|
|
|
- // 创建带有高度的多边形
|
|
|
- var extrudedPolygon = new Cesium.GeometryInstance({
|
|
|
- geometry: new Cesium.PolygonGeometry({
|
|
|
- polygonHierarchy: polygonHierarchy,
|
|
|
- height: minH, // 多边形底面的高度
|
|
|
- extrudedHeight: maxH, // 拉伸到的高度
|
|
|
- }),
|
|
|
- attributes: {
|
|
|
- color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
- Cesium.Color.BLUE.withAlpha(0.1)
|
|
|
- ),
|
|
|
- },
|
|
|
- });
|
|
|
+ // 创建带有高度的多边形
|
|
|
+ var extrudedPolygon = new Cesium.GeometryInstance({
|
|
|
+ geometry: new Cesium.PolygonGeometry({
|
|
|
+ polygonHierarchy: polygonHierarchy,
|
|
|
+ height: minH, // 多边形底面的高度
|
|
|
+ extrudedHeight: maxH, // 拉伸到的高度
|
|
|
+ }),
|
|
|
+ attributes: {
|
|
|
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
+ Cesium.Color.CHARTREUSE.withAlpha(0.1)
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
- // 添加到场景中
|
|
|
- let Primitive = new Cesium.Primitive({
|
|
|
- geometryInstances: [extrudedPolygon],
|
|
|
- appearance: new Cesium.PerInstanceColorAppearance({
|
|
|
- flat: true,
|
|
|
- }),
|
|
|
- });
|
|
|
- viewer.scene.primitives.add(Primitive);
|
|
|
- polygonids.push(Primitive);
|
|
|
- // viewer.entities.add({
|
|
|
- // id: id,
|
|
|
- // polygon: {
|
|
|
- // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
- // extrudedHeight: Number(maxH),
|
|
|
- // perPositionHeight: true,
|
|
|
- // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
- // outline: true,
|
|
|
- // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
- // outlineWidth: 1.0,
|
|
|
- // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
- // },
|
|
|
- // });
|
|
|
+ // 添加到场景中
|
|
|
+ let Primitive = new Cesium.Primitive({
|
|
|
+ geometryInstances: [extrudedPolygon],
|
|
|
+ appearance: new Cesium.PerInstanceColorAppearance({
|
|
|
+ flat: true,
|
|
|
+ }),
|
|
|
+ shadows: Cesium.ShadowMode.ENABLED, // 开启阴影
|
|
|
+ });
|
|
|
+ viewer.scene.primitives.add(Primitive);
|
|
|
+ polygonids.push(Primitive);
|
|
|
+
|
|
|
+ // 创建多边形的边界线
|
|
|
+
|
|
|
+ let pss = [];
|
|
|
+ for (let index = 0; index < element.geometry.points.length; index++) {
|
|
|
+ const point = element.geometry.points[index];
|
|
|
+ pss.push(point.x);
|
|
|
+ pss.push(point.y);
|
|
|
+ pss.push(maxH);
|
|
|
}
|
|
|
+ var boundaryPolyline = new Cesium.GeometryInstance({
|
|
|
+ geometry: new Cesium.PolylineGeometry({
|
|
|
+ positions: Cesium.Cartesian3.fromDegreesArrayHeights(pss), // 注意这里需要处理高度为0的情况,因为边界线通常在地表
|
|
|
+ width: 1, // 边界线的宽度
|
|
|
+ }),
|
|
|
+ attributes: {
|
|
|
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
|
+ Cesium.Color.CHARTREUSE.withAlpha(0.8)
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ });
|
|
|
+ let boundaryPolylinePrimitive = new Cesium.Primitive({
|
|
|
+ geometryInstances: [boundaryPolyline],
|
|
|
+ appearance: new Cesium.PolylineColorAppearance({
|
|
|
+ edgeWidth: 1,
|
|
|
+ // vertexFormat: Cesium.PolylineVertexFormat.POSITION_AND_COLOR,
|
|
|
+ vertexFormat: Cesium.PolylineColorAppearance.VERTEX_FORMAT,
|
|
|
+ }),
|
|
|
+ });
|
|
|
+ viewer.scene.primitives.add(boundaryPolylinePrimitive);
|
|
|
+ polygonids.push(boundaryPolylinePrimitive);
|
|
|
+ // viewer.entities.add({
|
|
|
+ // id: id,
|
|
|
+ // polygon: {
|
|
|
+ // hierarchy: Cesium.Cartesian3.fromDegreesArrayHeights(ps),
|
|
|
+ // extrudedHeight: Number(maxH),
|
|
|
+ // perPositionHeight: true,
|
|
|
+ // material: Cesium.Color.CHARTREUSE.withAlpha(0.1),
|
|
|
+ // outline: true,
|
|
|
+ // outlineColor: Cesium.Color.MEDIUMSPRINGGREEN,
|
|
|
+ // outlineWidth: 1.0,
|
|
|
+ // shadows: Cesium.ShadowMode.ENABLED,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
}
|
|
|
},
|
|
|
removeEntities() {
|