From 29629b9d43150e83e6a57ef644cdbac3174daa6a Mon Sep 17 00:00:00 2001 From: zh <972939975@qq.com> Date: Mon, 1 Sep 2025 16:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Obj/Analysis/CircleViewShed/index.js | 17 +++++-- src/Obj/Analysis/Profile/index.js | 46 ++++++++++++++--- src/Obj/Analysis/Submerge/index.js | 64 ++++++++++++++++++------ src/Obj/Analysis/Visibility/index.js | 10 ++-- static/custom/css/index.css | 11 +++- 5 files changed, 117 insertions(+), 31 deletions(-) diff --git a/src/Obj/Analysis/CircleViewShed/index.js b/src/Obj/Analysis/CircleViewShed/index.js index 6ed2c77..461b29c 100644 --- a/src/Obj/Analysis/CircleViewShed/index.js +++ b/src/Obj/Analysis/CircleViewShed/index.js @@ -35,9 +35,20 @@ class CircleViewShed extends Tools { this.Dialog = _Dialog this._EventBinding = new EventBinding() this.html = null + let tools = new Tools(sdk) YJ.Analysis.AnalysesResults.push(this) - CircleViewShed.edit(this) - // CircleViewShed.create(this) + // CircleViewShed.edit(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() { @@ -87,7 +98,7 @@ class CircleViewShed extends Tools { let Draw = new YJ.Draw.DrawCircle(that.sdk) Draw.start(async (a, options) => { // that.center = options.center - if(!options) { + if (!options) { return } that.radius = options.radius diff --git a/src/Obj/Analysis/Profile/index.js b/src/Obj/Analysis/Profile/index.js index 8073339..acc7f1f 100644 --- a/src/Obj/Analysis/Profile/index.js +++ b/src/Obj/Analysis/Profile/index.js @@ -6,7 +6,7 @@ import { html } from "./_element"; class Profile extends Draw { /** * @constructor 剖面分析 - * @param sdk + * @param sdk **/ constructor(sdk, _Dialog = {}) { window.addEventListener("resize", () => { @@ -48,7 +48,7 @@ class Profile extends Draw { }) Profile.interPoints(that).then((points) => { 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) { that.entityHasCreated = true let id = that.randomString() @@ -104,6 +106,16 @@ class Profile extends Draw { ) 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 } + 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) { if (that._DialogObject && that._DialogObject.close) { @@ -218,7 +252,7 @@ class Profile extends Draw { outlineWidth: 3, 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); option = { tooltip: { @@ -383,7 +417,7 @@ class Profile extends Draw { }; } else { - const ele = that._DialogObject._element.content.getElementsByClassName("profile-echarts")[0]; + const ele = document.getElementsByClassName("profile-echarts")[0]; that.echartsObject = echarts.init(ele); option = { tooltip: { @@ -634,4 +668,4 @@ class Profile extends Draw { // } // return positions_Inter; // } -export default Profile; \ No newline at end of file +export default Profile; diff --git a/src/Obj/Analysis/Submerge/index.js b/src/Obj/Analysis/Submerge/index.js index 1ed1486..770098d 100644 --- a/src/Obj/Analysis/Submerge/index.js +++ b/src/Obj/Analysis/Submerge/index.js @@ -2,11 +2,11 @@ import Dialog from '../../../BaseDialog'; import { html } from "./_element"; import DrawPolygon from "../../../Draw/drawPolygon" import Tools from "../../../Tools"; -import { closeRotateAround, closeViewFollow} from '../../../Global/global' +import { closeRotateAround, closeViewFollow } from '../../../Global/global' class Submerge extends Tools { /** * @constructor - * @param sdk + * @param sdk * @description 淹没效果 * */ constructor(sdk, options = {}, _Dialog = {}) { @@ -26,8 +26,9 @@ class Submerge extends Tools { this.status = true this.area = 0 this._elms = {}; + this.tools = new Tools(this.sdk) YJ.Analysis.AnalysesResults.push(this) - Submerge.EditBox(this) + // Submerge.EditBox(this) // Submerge.create(this) } @@ -35,16 +36,13 @@ class Submerge extends Tools { that.Draw.start((a, positions) => { if (!positions || positions.length < 3) { let _error = '至少需要三个坐标!' - console.warn(_error) - window.ELEMENT && - window.ELEMENT.Message({ - message: _error, - type: 'warning', - duration: 1500 - }) + this.tools.message({ + message: _error, + type: 'warning', + }); return } - that.destroy() + Submerge.destroy() if (!positions || positions.length == 0) { that.positions = [] that._positions = [] @@ -95,6 +93,9 @@ class Submerge extends Tools { // Submerge.EditBox(that) }) } + draw() { + Submerge.create(this) + } static async EditBox(that) { if (that._DialogObject && that._DialogObject.close) { @@ -104,7 +105,7 @@ class Submerge extends Tools { that._DialogObject = await new Dialog(that.sdk.viewer._container, { title: '淹没分析', left: '180px', top: '100px', closeCallBack: () => { - that.destroy() + Submerge.destroy() 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() { if (this.TweenAnimate) { TWEEN.remove(this.TweenAnimate) @@ -369,7 +403,7 @@ class Submerge extends Tools { return } closeRotateAround(this.sdk) - closeViewFollow(this.sdk) + closeViewFollow(this.sdk) let positionArray = [] for (let i = 0; i < this.positions.length; i++) { @@ -386,7 +420,7 @@ class Submerge extends Tools { }) } - destroy() { + static destroy() { if (this.TweenAnimate) { TWEEN.remove(this.TweenAnimate) } @@ -401,7 +435,7 @@ class Submerge extends Tools { let isEvent = false let removeName = [] if (!elements[i] || !elements[i].attributes) { - continue; + continue; } for (let m of elements[i].attributes) { switch (m.name) { diff --git a/src/Obj/Analysis/Visibility/index.js b/src/Obj/Analysis/Visibility/index.js index 0f115ce..94bd6ac 100644 --- a/src/Obj/Analysis/Visibility/index.js +++ b/src/Obj/Analysis/Visibility/index.js @@ -28,7 +28,8 @@ class VisibilityAnalysis extends Tools { this.Dialog = _Dialog this._EventBinding = new EventBinding() YJ.Analysis.AnalysesResults.push(this) - VisibilityAnalysis.edit(this) + // VisibilityAnalysis.edit(this) + VisibilityAnalysis.create(this) } get viewPointHeight() { @@ -64,8 +65,7 @@ class VisibilityAnalysis extends Tools { if (!that.resultObject.viewPoint) { let pos84 = that.cartesian3Towgs84(cartesian, that.viewer) let positions - if(that.sdk.viewer.terrainProvider.availability) - { + if (that.sdk.viewer.terrainProvider.availability) { positions = await Cesium.sampleTerrainMostDetailed( that.sdk.viewer.terrainProvider, [Cesium.Cartographic.fromDegrees(pos84.lng, pos84.lat)] @@ -288,7 +288,7 @@ class VisibilityAnalysis extends Tools { // that.resultObject.entities.push(_poly2); // } // } - // } + // } // }, 1000); // } @@ -356,4 +356,4 @@ class VisibilityAnalysis extends Tools { } } -export default VisibilityAnalysis; \ No newline at end of file +export default VisibilityAnalysis; diff --git a/static/custom/css/index.css b/static/custom/css/index.css index fae933a..a1ffab6 100644 --- a/static/custom/css/index.css +++ b/static/custom/css/index.css @@ -755,10 +755,17 @@ } .YJ-custom-base-dialog>.content input[type=number] { - padding: 0 16px 0 10px; + /* padding: 0 16px 0 10px; font-weight: 700; 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,