页面分离修改

This commit is contained in:
2025-09-05 18:39:00 +08:00
parent 29629b9d43
commit 9e439f5229
14 changed files with 1146 additions and 888 deletions

View File

@ -5,6 +5,7 @@ import Draw from '../../../Draw/draw'
import MouseTip from '../../../MouseTip'
import MouseEvent from '../../../Event'
import Dialog from '../../../BaseDialog';
import Tools from "../../../Tools";
import EventBinding from '../../Element/Dialog/eventBinding';
import { html } from "./_element";
import { CameraController } from '../../../Global/global'
@ -12,7 +13,7 @@ import { CameraController } from '../../../Global/global'
class Graffiti extends Draw {
/**
* @constructor
* @param sdk
* @param sdk
* @description 涂鸦
* @param options {object} 线属性
* @param options.width=10{number} 宽度
@ -23,6 +24,7 @@ class Graffiti extends Draw {
this.options.width = options.width || 1
this.options.color = options.color || '#ff0000'
this._elms = {};
this.tools = new Tools(sdk)
this._EventBinding = new EventBinding()
Graffiti.edit(this, true)
}
@ -31,7 +33,7 @@ class Graffiti extends Draw {
return this.options.color
}
set color(v) {
if(!this.options.color) {
if (!this.options.color) {
return
}
this.options.color = v
@ -69,14 +71,15 @@ class Graffiti extends Draw {
// 编辑框
static async edit(that, state) {
if (state) {
that._DialogObject = await new Dialog(that.sdk.viewer._container, {
title: '涂鸦参数',
})
await that._DialogObject.init()
let contentElm = document.createElement('div');
contentElm.innerHTML = html()
that._DialogObject.contentAppChild(contentElm)
// that._DialogObject = await new Dialog(that.sdk.viewer._container, {
// title: '涂鸦参数',
// })
// await that._DialogObject.init()
// let contentElm = document.createElement('div');
// contentElm.innerHTML = html()
// that._DialogObject.contentAppChild(contentElm)
// 颜色组件
let contentElm = document.getElementsByClassName('graffiti')[0]
let colorPicker = new YJColorPicker({
el: contentElm.getElementsByClassName("color")[0],
size: 'mini',//颜色box类型
@ -91,20 +94,20 @@ class Graffiti extends Draw {
that.color = 'rgba(255,255,255,1)'
},//点击清空按钮事件回调
})
that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
// that._DialogObject._element.body.className = that._DialogObject._element.body.className + ' graffiti'
let all_elm = contentElm.getElementsByTagName("*")
that._EventBinding.on(that, all_elm)
that._elms = that._EventBinding.element
that._elms.color = [colorPicker]
let confirmBtn = document.createElement('button');
confirmBtn.className = 'confirm';
confirmBtn.innerHTML = '确认'
that._DialogObject.footAppChild(confirmBtn)
confirmBtn.addEventListener('click', () => {
that.start()
Graffiti.edit(that, false)
});
// let confirmBtn = document.createElement('button');
// confirmBtn.className = 'confirm';
// confirmBtn.innerHTML = '确认'
// that._DialogObject.footAppChild(confirmBtn)
// confirmBtn.addEventListener('click', () => {
// that.start()
// Graffiti.edit(that, false)
// });
}
else {
if (that._DialogObject && that._DialogObject.close) {
@ -122,7 +125,7 @@ class Graffiti extends Draw {
start() {
let _this = this
if (YJ.Measure.GetMeasureStatus()) {
console.log('上一次测量未结束')
this.tools.message({ type: 'warning', text: '上一次测量未结束' })
} else {
let viewer = this.sdk.viewer
CameraController(this.sdk, false)
@ -160,7 +163,7 @@ class Graffiti extends Draw {
})
})
this.event.mouse_left_up((movement, cartesian) => {
polylineArray[polylineArray.length-1].polyline.positions = positions
polylineArray[polylineArray.length - 1].polyline.positions = positions
this.event.mouse_move((movement, cartesian) => {
this.tip.setPosition(
cartesian,
@ -221,7 +224,7 @@ class Graffiti extends Draw {
}
}
flicker() {}
flicker() { }
}
export default Graffiti

View File

@ -4,6 +4,7 @@ import Dialog from '../../../BaseDialog'
import MouseEvent from '../../../Event/index'
import MouseTip from '../../../MouseTip'
import { html, css } from './_element'
import Tools from "../../../Tools";
class RoutePlanning extends Base {
/**
@ -27,6 +28,7 @@ class RoutePlanning extends Base {
lng: null,
lat: null
}
this.tools = new Tools(sdk)
this.init()
}
@ -43,11 +45,12 @@ class RoutePlanning extends Base {
} else {
this.startEntity.show = false
}
this.startEntity.position = new Cesium.CallbackProperty(() => {
let pos = this.sdk.viewer.scene.clampToHeight(
new Cesium.Cartesian3.fromDegrees(this.startLng, this.startLat)
)
this.clickCallBack({ start: pos, end: this.endEntity.position })
return pos
}, false)
this.startEntity.billboard = {
@ -73,6 +76,7 @@ class RoutePlanning extends Base {
let pos = this.sdk.viewer.scene.clampToHeight(
new Cesium.Cartesian3.fromDegrees(this.endLng, this.endLat)
)
this.clickCallBack({ start: this.startEntity.position, end: pos })
return pos
}, false)
this.endEntity.billboard = {
@ -82,10 +86,21 @@ class RoutePlanning extends Base {
width: 32,
height: 32
}
this.edit(true)
// this.edit(true)
this.clear()
}
get onEnd() {
return this.clickCallBack
}
set onEnd(val) {
if (val && typeof val !== 'function') {
console.error('val:', val, '不是一个function')
} else {
this.clickCallBack = val
}
}
get startLng() {
return this.start.lng
}
@ -253,7 +268,7 @@ class RoutePlanning extends Base {
end: [this.endLng, this.endLat]
})
} else {
console.error('请先设置起点和终点坐标!')
this.tools.message({ type: 'warning', text: '请先设置起点和终点坐标!' })
}
})
div.appendChild(queryBtn)
@ -696,6 +711,6 @@ class RoutePlanning extends Base {
}
}
flicker() {}
flicker() { }
}
export default RoutePlanning