This commit is contained in:
2025-12-10 17:28:33 +08:00
33 changed files with 483 additions and 188 deletions

View File

@ -38,19 +38,14 @@ class CircleViewShed extends Tools {
this.tools = new Tools(sdk)
YJ.Analysis.AnalysesResults.push(this)
// CircleViewShed.edit(this)
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.tools.message({ type: 'warning', text: '未加载地形数据!' })
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
return
}
// CircleViewShed.create(this)
}
draw() {
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
return '未加载地形数据!'
}
CircleViewShed.create(this)
}
@ -115,13 +110,7 @@ class CircleViewShed extends Tools {
static create(that) {
let terrainAvailability = that.viewer.terrainProvider.availability;
if (!terrainAvailability) {
that.tools.message({ type: 'warning', text: '未加载地形数据!' })
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
return
return '未加载地形数据!'
}
let count = 0
if (!YJ.Measure.GetMeasureStatus()) {
@ -129,10 +118,20 @@ class CircleViewShed extends Tools {
that._DialogObject.close()
that._DialogObject = null
}
let Draw = new YJ.Draw.DrawCircle(that.sdk)
let Draw = new YJ.Draw.DrawCircle(that.sdk, {
tipText: '左键单击确定中心点位置右键单击取消区域绘制CTRL+右键单击撤销'
})
Draw.start(async (a, options) => {
// that.center = options.center
if (!options) {
switch (a) {
case 0:
Draw.tipText = '左键单击确定中心点位置右键单击取消区域绘制CTRL+右键单击撤销'
break;
case 1:
Draw.tipText = '左键单击确定圆形视域半径,完成圆形视域分析!'
break;
}
return
}
that.radius = options.radius
@ -152,47 +151,47 @@ class CircleViewShed extends Tools {
}
}
static async edit(that) {
if (that._DialogObject && that._DialogObject.close) {
that._DialogObject.close()
that._DialogObject = null
}
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
title: '圆形视域分析',
left: '180px',
top: '100px',
closeCallBack: () => {
that.Dialog.closeCallBack && that.Dialog.closeCallBack()
YJ.Measure.SetMeasureStatus(false)
}
})
await that._DialogObject.init()
that._DialogObject._element.body.className =
that._DialogObject._element.body.className + ' circle-view-shed'
let contentElm = document.createElement('div')
contentElm.innerHTML = html()
that._DialogObject.contentAppChild(contentElm)
// static async edit(that) {
// if (that._DialogObject && that._DialogObject.close) {
// that._DialogObject.close()
// that._DialogObject = null
// }
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
// title: '圆形视域分析',
// left: '180px',
// top: '100px',
// closeCallBack: () => {
// that.Dialog.closeCallBack && that.Dialog.closeCallBack()
// YJ.Measure.SetMeasureStatus(false)
// }
// })
// await that._DialogObject.init()
// that._DialogObject._element.body.className =
// that._DialogObject._element.body.className + ' circle-view-shed'
// let contentElm = document.createElement('div')
// contentElm.innerHTML = html()
// that._DialogObject.contentAppChild(contentElm)
let drawElm = document.createElement('button')
drawElm.innerHTML = '绘制'
drawElm.addEventListener('click', () => {
let terrainAvailability = that.viewer.terrainProvider.availability;
if (!terrainAvailability) {
window.ELEMENT && window.ELEMENT.Message({
message: '未加载地形数据!',
type: 'warning',
duration: 1500
});
return
}
CircleViewShed.create(that)
})
that._DialogObject.footAppChild(drawElm)
// let drawElm = document.createElement('button')
// drawElm.innerHTML = '绘制'
// drawElm.addEventListener('click', () => {
// let terrainAvailability = that.viewer.terrainProvider.availability;
// if (!terrainAvailability) {
// window.ELEMENT && window.ELEMENT.Message({
// message: '未加载地形数据!',
// type: 'warning',
// duration: 1500
// });
// return
// }
// CircleViewShed.create(that)
// })
// that._DialogObject.footAppChild(drawElm)
let all_elm = contentElm.getElementsByTagName('*')
that._EventBinding.on(that, all_elm)
that._elms = that._EventBinding.element
}
// let all_elm = contentElm.getElementsByTagName('*')
// that._EventBinding.on(that, all_elm)
// that._elms = that._EventBinding.element
// }
analyse() {
// this.destroy()

View File

@ -12,7 +12,7 @@ class ContourAnalysis {
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.error = '未加载地形数据!'
this.tools.message({ type: 'warning', text: this.error })
// this.tools.message({ type: 'warning', text: this.error })
return
}
this.positions = options.positions

View File

@ -28,7 +28,7 @@ class CutFillAnalysis {
}
this.entities = []
this.tools = new Tools(this.sdk)
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
YJ.Analysis.AnalysesResults.push(this)
// CutFillAnalysis.EditBox(this)
}
@ -37,11 +37,12 @@ class CutFillAnalysis {
this.clean()
this.Draw.start((a, positions) => {
if (!positions || positions.length < 3) {
let _error = '最少需要三个坐标!'
this.tools.message({
text: _error,
type: 'warning',
});
if (a >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
}
return
}
let fromDegreesArray = []

View File

@ -26,7 +26,7 @@ class Profile extends Draw {
console.warn('上一次测量未结束')
} else {
YJ.Measure.SetMeasureStatus(true)
that.tip = new MouseTip('左键确定,右键取消', that.sdk)
that.tip = new MouseTip('左键点击确定起点位置,右键点击取消绘制!', that.sdk)
that.event = new MouseEvent(that.sdk)
that.positions = []
that.points_ids = [] //存放左键点击时临时添加的point的id
@ -35,6 +35,7 @@ class Profile extends Draw {
let car = undefined
that.event.mouse_left(async (movement, cartesian) => {
try {
that.tip.setText('左键点击确定终点位置,右键点击取消绘制!')
if (!that.entityHasCreated) {
Profile.create_polyline(that)
}

View File

@ -10,20 +10,18 @@ class SlopeAspect extends Tools {
constructor(sdk) {
super(sdk)
this.viewer = sdk.viewer;
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.error = '未加载地形数据!'
return
}
this.event
this.result = []; //存储创建的坡度分析结果primitive集合
this.handler = undefined;
this.toolTip = "";
this.tools = new Tools(sdk)
let terrainAvailability = this.viewer.terrainProvider.availability;
if (!terrainAvailability) {
this.error = '未加载地形数据!'
this.tools.message({ type: 'warning', text: this.error })
return
}
YJ.Analysis.AnalysesResults.push(this)
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点' })
// this.createNew4Distance()
this.createNew4Num(50)
}
@ -36,8 +34,13 @@ class SlopeAspect extends Tools {
const $this = this;
const viewer = this.viewer;
this.Draw.start((e, positions) => {
if (!positions || positions.length <= 2) {
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
if (!positions || positions.length < 3) {
if (e >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
}
return
}
let boundary = [];
@ -66,8 +69,13 @@ class SlopeAspect extends Tools {
createNew4Num(n) {
let num = n
this.Draw.start((e, positions) => {
if (!positions || positions.length <= 2) {
this.tools.message({ type: 'warning', text: '至少拥有三个坐标位置!' })
if (!positions || positions.length < 3) {
if (e >= 3) {
this.Draw.tipText = '左键单击确定控制点位置,右键单击结束坡度分析! CTRL+右键单击撤销'
}
else {
this.Draw.tipText = '左键单击确定控制点位置,右键单击取消坡度分析! CTRL+右键单击撤销上一个控制点'
}
return
}
let boundary = [];

View File

@ -21,7 +21,7 @@ class Submerge extends Tools {
this.currentWaterLaver
this.color = '#00d9ff66'
this.Dialog = _Dialog
this.Draw = new DrawPolygon(this.sdk)
this.Draw = new DrawPolygon(this.sdk, { tipText: '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点' })
this.positions
this.status = true
this.area = 0
@ -36,23 +36,15 @@ class Submerge extends Tools {
static create(that, func) {
that.Draw.start((a, positions) => {
if (!positions || positions.length < 3) {
let _error = '至少需要三个坐标!'
that.tools.message({
text: _error,
type: 'warning',
});
if (a >= 3) {
that.Draw.tipText = '左键单击确定控制点位置,右键单击结束范围绘制! CTRL+右键单击撤销'
}
else {
that.Draw.tipText = '左键单击确定控制点位置,右键单击取消范围绘制! CTRL+右键单击撤销上一个控制点'
}
return
}
that.destroy()
if (!positions || positions.length == 0) {
that.positions = []
that._positions = []
that.options.minWaterLevel = 0
that.options.maxWaterLevel = 0
that.options.waterVolume = 0
that.area = 0
return
}
let fromDegreesArray = []
that.positions = positions
that._positions = positions