修改tip提示语

This commit is contained in:
zh
2025-12-10 14:59:18 +08:00
parent 5b200529b5
commit 44d9ace1c7
30 changed files with 448 additions and 172 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

@ -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) {
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

View File

@ -488,14 +488,6 @@ class BaseTileset extends BaseSource {
* */
set rotationEditing(status) {
if (!this.tileset.root.transform) {
if (window.ELEMENT) {
window.ELEMENT.Message.closeAll();
window.ELEMENT.Message({
message: '该模型不支持移动和旋转!',
type: 'warning',
duration: 1500
});
}
console.warn('该模型不支持移动和旋转!')
return
}
@ -534,14 +526,6 @@ class BaseTileset extends BaseSource {
return
}
if (!this.tileset.root.transform) {
if (window.ELEMENT) {
window.ELEMENT.Message.closeAll();
window.ELEMENT.Message({
message: '该模型不支持移动和旋转!',
type: 'warning',
duration: 1500
});
}
console.warn('该模型不支持移动和旋转!')
return
}

View File

@ -125,13 +125,14 @@ class Graffiti extends Draw {
start() {
let _this = this
if (YJ.Measure.GetMeasureStatus()) {
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
this._error = '上一次测量未结束'
} else {
this._error = null
let viewer = this.sdk.viewer
CameraController(this.sdk, false)
super.start()
YJ.Measure.SetMeasureStatus(true)
this.tip = new MouseTip('长按左键,拖动鼠标进行涂鸦,右键结束涂鸦', this.sdk)
this.tip = new MouseTip('左键按下开始,松开完成,右键单击完成绘制', this.sdk)
this.event = new MouseEvent(this.sdk)
this.positions = []
this.points_ids = [] //存放左键点击时临时添加的point的id

View File

@ -1500,7 +1500,7 @@ class PolygonObject extends Base {
fromDegreesArray = []
this.heightMode = this.heightMode
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1700,19 +1700,20 @@ class PolygonObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
nodeEdit(cb = () => { }) {
this.positionEditing = false
setTimeout(() => {
let previous = [...this.options.positions]
if (YJ.Measure.GetMeasureStatus()) {
cb('上一次测量未结束')
} else {
YJ.Measure.SetMeasureStatus(true)
this.picking = false
this.tip = new MouseTip('请选择一个顶点,右键取消', this.sdk)
this.tip = new MouseTip('左键单击选择控制点,右键单击取消编辑', this.sdk)
this.event = new MouseEvent(this.sdk)
this.nodePoints = []
let _this = this
@ -1848,7 +1849,7 @@ class PolygonObject extends Base {
selectPoint = pick.id
this.nodePoints.splice(pick.id.index, 1)
this.sdk.viewer.entities.remove(pick.id)
this.tip.set_text('左键开始右键结束CTRL+右键撤销')
this.tip.set_text('左键单击确定控制点位置,右键单击结束编辑! CTRL+右键单击撤销上一个控制点')
originalPosition = this.cartesian3Towgs84(
selectPoint.position.getValue(),
this.sdk.viewer
@ -1863,6 +1864,51 @@ class PolygonObject extends Base {
if (added) {
this.options.positions.splice(selectPoint.index, 1)
}
if (this.options.positions.length < 3) {
this.options.positions = [...previous]
let positions = this.options.positions
let fromDegreesArray = []
for (let i = 0; i < positions.length; i++) {
fromDegreesArray.push(positions[i].lng, positions[i].lat)
}
this.positions = Cesium.Cartesian3.fromDegreesArray(
fromDegreesArray
)
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
this.previous = {
positions: [...this.positions]
}
let objectsToExclude = [...this.sdk.viewer.entities.values]
let positions2 = [[]]
for (let i = 0; i < this.options.positions.length; i++) {
positions2[0].push([
this.options.positions[i].lng,
this.options.positions[i].lat
])
}
positions2[0].push([
this.options.positions[0].lng,
this.options.positions[0].lat
])
let polygon = turf.polygon(positions2)
let centroid = turf.centroid(polygon)
this
.getClampToHeight({
lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1]
}, objectsToExclude)
.then(height => {
this.label.position = [
centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1],
height
]
})
this.areaByMeter = this.computeArea(this.options.positions)
this.areaChangeCallBack && this.areaChangeCallBack()
}
cb(null, this.options.positions)
}
@ -2018,6 +2064,9 @@ class PolygonObject extends Base {
}
}
this.nodePoints.pop()
if(this.options.positions.length < 3) {
this.tip.set_text('左键单击确定控制点位置,右键单击取消编辑! CTRL+右键单击撤销上一个控制点')
}
}
})

View File

@ -595,7 +595,7 @@ class StandText extends Base {
selectPoint = pick.id
this.nodePoints.splice(pick.id.index, 1)
this.sdk.viewer.entities.remove(pick.id)
this.tip.set_text('左键开始右键结束CTRL+右键撤销')
this.tip.set_text('左键单击确认顶点位置,右键单击结束CTRL+右键撤销')
originalPosition = this.cartesian3Towgs84(cartesian, this.sdk.viewer)
this.entity.wall.positions = new Cesium.CallbackProperty(function () {
return Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
@ -615,6 +615,15 @@ class StandText extends Base {
if(isAdd) {
this.options.positions.splice(selectPoint.index, 1)
}
if (!that.options.positions || that.options.positions.length < 2) {
console.warn('最少需要两个坐标!')
window.ELEMENT && window.ELEMENT.Message({
message: '最少需要两个坐标!',
type: 'warning',
duration: 1500
});
that.options.positions = [...previous]
}
cb(null, this.options.positions)
}
let positions = this.options.positions