This commit is contained in:
zh
2025-09-01 16:26:25 +08:00
parent 6fa99df21c
commit 29629b9d43
5 changed files with 117 additions and 31 deletions

View File

@ -35,9 +35,20 @@ class CircleViewShed extends Tools {
this.Dialog = _Dialog this.Dialog = _Dialog
this._EventBinding = new EventBinding() this._EventBinding = new EventBinding()
this.html = null this.html = null
let tools = new Tools(sdk)
YJ.Analysis.AnalysesResults.push(this) YJ.Analysis.AnalysesResults.push(this)
CircleViewShed.edit(this) // CircleViewShed.edit(this)
// CircleViewShed.create(this) let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
tools.message({ type: 'warning', text: '未加载地形数据!' })
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
return
}
CircleViewShed.create(this)
} }
get viewPointHeight() { get viewPointHeight() {
@ -87,7 +98,7 @@ class CircleViewShed extends Tools {
let Draw = new YJ.Draw.DrawCircle(that.sdk) let Draw = new YJ.Draw.DrawCircle(that.sdk)
Draw.start(async (a, options) => { Draw.start(async (a, options) => {
// that.center = options.center // that.center = options.center
if(!options) { if (!options) {
return return
} }
that.radius = options.radius that.radius = options.radius

View File

@ -6,7 +6,7 @@ import { html } from "./_element";
class Profile extends Draw { class Profile extends Draw {
/** /**
* @constructor 剖面分析 * @constructor 剖面分析
* @param sdk * @param sdk
**/ **/
constructor(sdk, _Dialog = {}) { constructor(sdk, _Dialog = {}) {
window.addEventListener("resize", () => { window.addEventListener("resize", () => {
@ -48,7 +48,7 @@ class Profile extends Draw {
}) })
Profile.interPoints(that).then((points) => { Profile.interPoints(that).then((points) => {
if (this._currentId && this._currentId === id) { if (this._currentId && this._currentId === id) {
that._DialogObject ? Profile.initEcharts(that, points) : Profile.edit(that, points) that.clickCallBack(points)
} }
}) })
} }
@ -84,7 +84,9 @@ class Profile extends Draw {
}) })
} }
} }
reDraw() {
Profile.create(this)
}
static create_polyline(that) { static create_polyline(that) {
that.entityHasCreated = true that.entityHasCreated = true
let id = that.randomString() let id = that.randomString()
@ -104,6 +106,16 @@ class Profile extends Draw {
) )
return id return id
} }
get onEnd() {
return this.clickCallBack
}
set onEnd(val) {
if (val && typeof val !== 'function') {
console.error('val:', val, '不是一个function')
} else {
this.clickCallBack = val
}
}
/** /**
* 线段插值点 * 线段插值点
@ -159,6 +171,28 @@ class Profile extends Draw {
} }
return positions_Inter return positions_Inter
} }
formatter(xy, tipData) {
const pointOption = {
show: true,
pixelSize: 10,
color: Cesium.Color.GREEN,
outlineColor: Cesium.Color.SKYBLUE,
outlineWidth: 3,
disableDepthTestDistance: Number.POSITIVE_INFINITY
}
if (!this.tipEntity) {
this.tipEntity = this.sdk.viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(xy[0], xy[1], Number(tipData[1])),
point: pointOption
})
} else {
this.tipEntity.position = Cesium.Cartesian3.fromDegrees(
xy[0],
xy[1],
Number(tipData[1])
)
}
}
static async edit(that, points) { static async edit(that, points) {
if (that._DialogObject && that._DialogObject.close) { if (that._DialogObject && that._DialogObject.close) {
@ -218,7 +252,7 @@ class Profile extends Draw {
outlineWidth: 3, outlineWidth: 3,
disableDepthTestDistance: Number.POSITIVE_INFINITY disableDepthTestDistance: Number.POSITIVE_INFINITY
}; };
const ele = that._DialogObject._element.content.getElementsByClassName("profile-echarts")[0]; const ele = document.getElementsByClassName("profile-echarts")[0];
that.echartsObject = echarts.init(ele); that.echartsObject = echarts.init(ele);
option = { option = {
tooltip: { tooltip: {
@ -383,7 +417,7 @@ class Profile extends Draw {
}; };
} }
else { else {
const ele = that._DialogObject._element.content.getElementsByClassName("profile-echarts")[0]; const ele = document.getElementsByClassName("profile-echarts")[0];
that.echartsObject = echarts.init(ele); that.echartsObject = echarts.init(ele);
option = { option = {
tooltip: { tooltip: {
@ -634,4 +668,4 @@ class Profile extends Draw {
// } // }
// return positions_Inter; // return positions_Inter;
// } // }
export default Profile; export default Profile;

View File

@ -2,11 +2,11 @@ import Dialog from '../../../BaseDialog';
import { html } from "./_element"; import { html } from "./_element";
import DrawPolygon from "../../../Draw/drawPolygon" import DrawPolygon from "../../../Draw/drawPolygon"
import Tools from "../../../Tools"; import Tools from "../../../Tools";
import { closeRotateAround, closeViewFollow} from '../../../Global/global' import { closeRotateAround, closeViewFollow } from '../../../Global/global'
class Submerge extends Tools { class Submerge extends Tools {
/** /**
* @constructor * @constructor
* @param sdk * @param sdk
* @description 淹没效果 * @description 淹没效果
* */ * */
constructor(sdk, options = {}, _Dialog = {}) { constructor(sdk, options = {}, _Dialog = {}) {
@ -26,8 +26,9 @@ class Submerge extends Tools {
this.status = true this.status = true
this.area = 0 this.area = 0
this._elms = {}; this._elms = {};
this.tools = new Tools(this.sdk)
YJ.Analysis.AnalysesResults.push(this) YJ.Analysis.AnalysesResults.push(this)
Submerge.EditBox(this) // Submerge.EditBox(this)
// Submerge.create(this) // Submerge.create(this)
} }
@ -35,16 +36,13 @@ class Submerge extends Tools {
that.Draw.start((a, positions) => { that.Draw.start((a, positions) => {
if (!positions || positions.length < 3) { if (!positions || positions.length < 3) {
let _error = '至少需要三个坐标!' let _error = '至少需要三个坐标!'
console.warn(_error) this.tools.message({
window.ELEMENT && message: _error,
window.ELEMENT.Message({ type: 'warning',
message: _error, });
type: 'warning',
duration: 1500
})
return return
} }
that.destroy() Submerge.destroy()
if (!positions || positions.length == 0) { if (!positions || positions.length == 0) {
that.positions = [] that.positions = []
that._positions = [] that._positions = []
@ -95,6 +93,9 @@ class Submerge extends Tools {
// Submerge.EditBox(that) // Submerge.EditBox(that)
}) })
} }
draw() {
Submerge.create(this)
}
static async EditBox(that) { static async EditBox(that) {
if (that._DialogObject && that._DialogObject.close) { if (that._DialogObject && that._DialogObject.close) {
@ -104,7 +105,7 @@ class Submerge extends Tools {
that._DialogObject = await new Dialog(that.sdk.viewer._container, { that._DialogObject = await new Dialog(that.sdk.viewer._container, {
title: '淹没分析', left: '180px', top: '100px', title: '淹没分析', left: '180px', top: '100px',
closeCallBack: () => { closeCallBack: () => {
that.destroy() Submerge.destroy()
that.Dialog.closeCallBack && that.Dialog.closeCallBack() that.Dialog.closeCallBack && that.Dialog.closeCallBack()
}, },
}) })
@ -315,6 +316,39 @@ class Submerge extends Tools {
}) })
} }
get waterVolume() {
return this.options.waterVolume
}
set waterVolume(val) {
this.options.waterVolume = val
}
get minWaterLevel() {
return this.options.minWaterLevel
}
set minWaterLevel(val) {
this.options.minWaterLevel = val
}
get maxWaterLevel() {
return this.options.maxWaterLevel
}
set maxWaterLevel(val) {
this.options.maxWaterLevel = val
}
get risingSpeed() {
return this.options.risingSpeed
}
set risingSpeed(val) {
this.options.risingSpeed = val
}
get area() {
return this.area
}
set area(val) {
this.area = val
}
move() { move() {
if (this.TweenAnimate) { if (this.TweenAnimate) {
TWEEN.remove(this.TweenAnimate) TWEEN.remove(this.TweenAnimate)
@ -369,7 +403,7 @@ class Submerge extends Tools {
return return
} }
closeRotateAround(this.sdk) closeRotateAround(this.sdk)
closeViewFollow(this.sdk) closeViewFollow(this.sdk)
let positionArray = [] let positionArray = []
for (let i = 0; i < this.positions.length; i++) { for (let i = 0; i < this.positions.length; i++) {
@ -386,7 +420,7 @@ class Submerge extends Tools {
}) })
} }
destroy() { static destroy() {
if (this.TweenAnimate) { if (this.TweenAnimate) {
TWEEN.remove(this.TweenAnimate) TWEEN.remove(this.TweenAnimate)
} }
@ -401,7 +435,7 @@ class Submerge extends Tools {
let isEvent = false let isEvent = false
let removeName = [] let removeName = []
if (!elements[i] || !elements[i].attributes) { if (!elements[i] || !elements[i].attributes) {
continue; continue;
} }
for (let m of elements[i].attributes) { for (let m of elements[i].attributes) {
switch (m.name) { switch (m.name) {

View File

@ -28,7 +28,8 @@ class VisibilityAnalysis extends Tools {
this.Dialog = _Dialog this.Dialog = _Dialog
this._EventBinding = new EventBinding() this._EventBinding = new EventBinding()
YJ.Analysis.AnalysesResults.push(this) YJ.Analysis.AnalysesResults.push(this)
VisibilityAnalysis.edit(this) // VisibilityAnalysis.edit(this)
VisibilityAnalysis.create(this)
} }
get viewPointHeight() { get viewPointHeight() {
@ -64,8 +65,7 @@ class VisibilityAnalysis extends Tools {
if (!that.resultObject.viewPoint) { if (!that.resultObject.viewPoint) {
let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) let pos84 = that.cartesian3Towgs84(cartesian, that.viewer)
let positions let positions
if(that.sdk.viewer.terrainProvider.availability) if (that.sdk.viewer.terrainProvider.availability) {
{
positions = await Cesium.sampleTerrainMostDetailed( positions = await Cesium.sampleTerrainMostDetailed(
that.sdk.viewer.terrainProvider, that.sdk.viewer.terrainProvider,
[Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)]
@ -288,7 +288,7 @@ class VisibilityAnalysis extends Tools {
// that.resultObject.entities.push(_poly2); // that.resultObject.entities.push(_poly2);
// } // }
// } // }
// } // }
// }, 1000); // }, 1000);
// } // }
@ -356,4 +356,4 @@ class VisibilityAnalysis extends Tools {
} }
} }
export default VisibilityAnalysis; export default VisibilityAnalysis;

View File

@ -755,10 +755,17 @@
} }
.YJ-custom-base-dialog>.content input[type=number] { .YJ-custom-base-dialog>.content input[type=number] {
padding: 0 16px 0 10px; /* padding: 0 16px 0 10px;
font-weight: 700; font-weight: 700;
font-family: 'D-Din-Bold'; font-family: 'D-Din-Bold';
font-size: 18px; font-size: 18px; */
font-size: 12px;
font-weight: 400;
letter-spacing: 0px;
line-height: 24px;
color: rgba(204, 204, 204, 1);
text-align: left;
vertical-align: top;
} }
.YJ-custom-base-dialog>.content input[type=number]::-webkit-outer-spin-button, .YJ-custom-base-dialog>.content input[type=number]::-webkit-outer-spin-button,