From 3358221da9b8cce5c4ab9ee8cf27a8967e968479 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Tue, 19 Aug 2025 13:58:12 +0800
Subject: [PATCH 01/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E6=9C=AC?=
=?UTF-8?q?=E6=A1=86=E7=9A=84=E4=BC=A0=E5=85=A5=E5=92=8C=E5=9B=9E=E8=B0=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/TextBox/index.js | 27 +++++++++++++++++++++++++--
src/YJEarth/index.js | 1 +
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js
index b97613b..44ddb84 100644
--- a/src/Obj/Base/TextBox/index.js
+++ b/src/Obj/Base/TextBox/index.js
@@ -4,15 +4,31 @@
import Base from "../index";
import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
class TextBox extends Base {
- constructor(sdk, options = {}) {
+ /**
+ * @constructor
+ * @param sdk
+ * @description 文本框
+ * @param options {object} 属性
+ * @param options.id=id
+ * @param options.positions=[]位置
+ * @param options.text=文本框内容
+ * @param options.show=true {boolean}是否显示
+ * @param Dialog {object} 弹框对象
+ * @param Dialog.confirmCallBack {function} 弹框确认时的回调
+ * */
+ constructor(sdk, options = {}, callback = null) {
// this.sdk = { ...sdk }
// this.options = { ...options }
super(sdk, options)
+ this.options.positions = options.positions || []
+ this.options.text = options.text || ''
+ this.options.show = (options.show || options.show === false) ? options.show : true
this.clickTextDom = undefined
this.handler = undefined
this.textDom = undefined
this.create(this)
this.sdk.addIncetance(this.options.id, this)
+ this.callback = callback
}
async create(that) {
@@ -24,11 +40,13 @@ class TextBox extends Base {
// 创建textarea元素
var textarea = document.createElement('textarea');
textarea.className = 'textarea'
+ textarea.value = that.options.text;
// 设置textarea的属性,例如行数和列数
textarea.rows = 6;
textarea.style.resize = 'none'
// 将textarea添加到div中
dom.appendChild(textarea);
+ (!that.options.show) && (dom.style.display = 'none')
// 将div添加到body中
// document.body.appendChild(dom);
@@ -48,7 +66,8 @@ class TextBox extends Base {
}
}
viewer.scene.postRender.addEventListener(that.handler);
- that.textDom = dom
+ that.textDom = dom;
+
}
async setHandeler(data) {
let that = this
@@ -81,6 +100,10 @@ class TextBox extends Base {
that.sdk.viewer.scene.postRender.addEventListener(that.handler);
}
}
+ async getwords(words) {
+ this.options.text = words
+ this.callback(this.options)
+ }
async returnFun() {
return this.handler
}
diff --git a/src/YJEarth/index.js b/src/YJEarth/index.js
index 27a1dad..0f5df67 100644
--- a/src/YJEarth/index.js
+++ b/src/YJEarth/index.js
@@ -485,6 +485,7 @@ class YJEarth {
_this.clickTextDom.removeEventListener('mousedown', mousedown);
document.removeEventListener('mousemove', mousemove);
document.removeEventListener('mouseup', mouseup);
+ _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
_this.clickTextDom.style['pointer-events'] = 'none'
_this.clickTextDom = undefined
From a4cd365c8329bd728ef37d0198528c92b806f567 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Tue, 19 Aug 2025 13:59:18 +0800
Subject: [PATCH 02/23] =?UTF-8?q?=E5=A4=87=E6=B3=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/TextBox/index.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js
index 44ddb84..24dce56 100644
--- a/src/Obj/Base/TextBox/index.js
+++ b/src/Obj/Base/TextBox/index.js
@@ -13,6 +13,7 @@ class TextBox extends Base {
* @param options.positions=[]位置
* @param options.text=文本框内容
* @param options.show=true {boolean}是否显示
+ * @param callback=方法回调
* @param Dialog {object} 弹框对象
* @param Dialog.confirmCallBack {function} 弹框确认时的回调
* */
From e51357efa7d531e7aa2127562abbf0f58a224353 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Tue, 19 Aug 2025 14:08:14 +0800
Subject: [PATCH 03/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9position?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/TextBox/index.js | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/Obj/Base/TextBox/index.js b/src/Obj/Base/TextBox/index.js
index 24dce56..5e5697b 100644
--- a/src/Obj/Base/TextBox/index.js
+++ b/src/Obj/Base/TextBox/index.js
@@ -10,7 +10,7 @@ class TextBox extends Base {
* @description 文本框
* @param options {object} 属性
* @param options.id=id
- * @param options.positions=[]位置
+ * @param options.position=[]位置
* @param options.text=文本框内容
* @param options.show=true {boolean}是否显示
* @param callback=方法回调
@@ -21,7 +21,7 @@ class TextBox extends Base {
// this.sdk = { ...sdk }
// this.options = { ...options }
super(sdk, options)
- this.options.positions = options.positions || []
+ this.options.position = options.position || []
this.options.text = options.text || ''
this.options.show = (options.show || options.show === false) ? options.show : true
this.clickTextDom = undefined
@@ -53,7 +53,7 @@ class TextBox extends Base {
// 配置CSS样式和内容结构
viewer.cesiumWidget.container.appendChild(dom);
- let posi = Cesium.Cartesian3.fromDegrees(that.options.positions.lng, that.options.positions.lat, that.options.positions.alt)
+ let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt)
that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
@@ -80,7 +80,7 @@ class TextBox extends Base {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var longitude = Cesium.Math.toDegrees(cartographic.longitude);
var latitude = Cesium.Math.toDegrees(cartographic.latitude);
- that.positions = {
+ that.position = {
lng: longitude,
lat: latitude,
alt: cartographic.height
@@ -115,11 +115,11 @@ class TextBox extends Base {
this.options.show = v
this.textDom && (this.textDom.style.display = v ? 'block' : 'none');
}
- get positions() {
- return this.options.positions
+ get position() {
+ return this.options.position
}
- set positions(v) {
- this.options.positions = v
+ set position(v) {
+ this.options.position = v
}
async flyTo(options = {}) {
setActiveViewer(0)
@@ -142,8 +142,8 @@ class TextBox extends Base {
if (this.options.position) {
position = { ...this.options.position }
}
- else if (this.options.positions) {
- position = { ...this.options.positions[0] }
+ else if (this.options.position) {
+ position = { ...this.options.position[0] }
}
else if (this.options.center) {
position = { ...this.options.center }
@@ -178,9 +178,9 @@ class TextBox extends Base {
else {
let positionArray = []
let a = Cesium.Cartesian3.fromDegrees(
- this.positions.lng,
- this.positions.lat,
- this.positions.alt
+ this.position.lng,
+ this.position.lat,
+ this.position.alt
)
positionArray.push(a.x, a.y, a.z)
From 8eb1bd98cc5b601384ba24e16909ca1285cf3516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Tue, 19 Aug 2025 17:22:19 +0800
Subject: [PATCH 04/23] =?UTF-8?q?=E4=B8=89=E7=82=B9=E7=9F=A9=E5=BD=A2?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawThreeRect.js | 318 ++++++++++++++++++++++++++++++++++++++
src/In/index.js | 6 +-
2 files changed, 323 insertions(+), 1 deletion(-)
create mode 100644 src/Draw/drawThreeRect.js
diff --git a/src/Draw/drawThreeRect.js b/src/Draw/drawThreeRect.js
new file mode 100644
index 0000000..a6fa819
--- /dev/null
+++ b/src/Draw/drawThreeRect.js
@@ -0,0 +1,318 @@
+import MouseTip from '../MouseTip'
+import MouseEvent from '../Event'
+import Draw from './draw'
+
+/**
+ * @extends Draw*/
+class DrawThreeRect extends Draw {
+ /**
+ * @constructor
+ * @param [options] {object} 三点矩形属性
+ * @param [options.color=rgba(185,14,14,0.58)] {object} 线属性
+
+ * */
+ constructor(sdk, options = {}) {
+ super(sdk, options)
+ this.polygonHasCreated = false
+ this.rectObject = []
+ }
+
+ static create_polygon(that, viewer = that.viewer) {
+ that.polygonHasCreated = true
+ let id = that.randomString()
+ viewer.entities.add(
+ new Cesium.Entity({
+ id: id,
+ polygon: {
+ classificationType: Cesium.ClassificationType.BOTH,
+ hierarchy: new Cesium.CallbackProperty((e) => {
+ return new Cesium.PolygonHierarchy(that.positions)
+ }),
+ material: Cesium.Color.fromCssColorString(that.color),
+ zIndex: 99999999
+ },
+ polyline: {
+ positions: new Cesium.CallbackProperty((e) => {
+ // return that.positions.concat(that.positions[0])
+ return that.positionsLine
+ }),
+ width: 2,
+ material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5),
+ clampToGround: true,
+ zIndex: 99999999
+ },
+ })
+ )
+ return id
+ }
+ computedLastPoint(arr) {
+ const start = arr[0];
+ const end = arr[1];
+ // 计算点到线的距离
+ const directionVector = Cesium.Cartesian3.subtract(end, start, new Cesium.Cartesian3());
+ const pointToStart = Cesium.Cartesian3.subtract(arr[2], start, new Cesium.Cartesian3());
+ const projectionLength = Cesium.Cartesian3.dot(pointToStart, directionVector) / Cesium.Cartesian3.magnitudeSquared(directionVector);
+ const projectionVector = Cesium.Cartesian3.multiplyByScalar(directionVector, projectionLength, new Cesium.Cartesian3());
+ const projectionPoint = Cesium.Cartesian3.add(start, projectionVector, new Cesium.Cartesian3());
+ const distance = Cesium.Cartesian3.distance(arr[2], projectionPoint)
+
+ const perp = Cesium.Cartesian3.subtract(arr[2], projectionPoint, new Cesium.Cartesian3());
+ Cesium.Cartesian3.normalize(perp, perp);
+ // 生成偏移向量
+ const offset = Cesium.Cartesian3.multiplyByScalar(perp, distance, new Cesium.Cartesian3());
+ let threePoint = Cesium.Cartesian3.add(end, offset, new Cesium.Cartesian3())
+ let lastPoint = Cesium.Cartesian3.add(start, offset, new Cesium.Cartesian3())
+ return [{ ...threePoint }, { ...lastPoint }]
+ }
+ /**
+ * @desc 开始动态绘制面
+ * @method start
+ * @param cb {function} 回调函数
+ * @memberOf DrawPolygon
+ * @example draw.start((err,positions)=>{
+ *
+ * })
+ * */
+ start(cb) {
+ if (YJ.Measure.GetMeasureStatus()) {
+ cb('上一次测量未结束')
+ } else {
+ this.polygonHasCreated = false
+ super.start()
+ YJ.Measure.SetMeasureStatus(true)
+ let into
+ this.tip = new MouseTip('左键确定,右键结束;CTRL+右键撤销', this.sdk)
+ this.event = new MouseEvent(this.sdk)
+ let cnt = 0
+ this.positions = []
+ this.positionsLine = []
+ this.points_ids = [] //存放左键点击时临时添加的point的id
+ let cache_positions = []
+ let cache_84_position = []
+ this.event.mouse_left((movement, cartesian) => {
+ if (into === '2D') {
+ return
+ }
+ into = '3D'
+ cnt++
+ this.positions = cache_positions.concat({ ...cartesian })
+ this.tip.setPosition(
+ cartesian,
+ movement.position.x,
+ movement.position.y
+ )
+ if (!this.polygonHasCreated) {
+ let polyline_id = DrawThreeRect.create_polygon(this)
+ this.points_ids.push(polyline_id)
+ }
+ cache_positions.push(cartesian)
+ cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
+ this.points_ids.push(this.create_point(cartesian))
+ if (cnt == 3) {
+ this.end()
+ cb(null, this.rectObject)
+ }
+ })
+ this.event.mouse_right((movement, cartesian) => {
+ if (into === '2D') {
+ return
+ }
+ // let positions = []
+ // console.log(cache_positions)
+ // cache_positions.forEach((item) => {
+ // let p = this.cartesian3Towgs84(item)
+ // console.log(item)
+ // positions.push(p)
+ // })
+ this.end()
+ cb('取消', '')
+ })
+ this.event.mouse_move((movement, cartesian) => {
+ if (into === '2D') {
+ return
+ }
+
+ // this.positions = cache_positions.concat({ ...cartesian })
+ this.tip.setPosition(
+ cartesian,
+ movement.endPosition.x,
+ movement.endPosition.y
+ )
+
+ if (cnt == 2) {
+ let arr = JSON.parse(JSON.stringify(cache_positions))
+ let arr1 = arr.concat({ ...cartesian })
+ let pointArr = this.computedLastPoint(arr1)
+ arr = arr.concat(pointArr)
+ this.positions = arr
+ let arr_84 = arr.map(item => {
+ return this.cartesian3Towgs84(item, this.viewer)
+ })
+ this.rectObject = arr_84
+ }
+ })
+ this.event.mouse_right_keyboard_ctrl((movement, cartesian) => {
+ if (into === '2D') {
+ return
+ }
+ if (this.points_ids.length > 1) {
+ this.remove_entity(this.points_ids.pop()) //移除point
+ cache_positions.pop()
+ cache_84_position.pop()
+ }
+ })
+
+ this.event.gesture_pinck_start_keyboard_ctrl(() => {
+ if (into === '2D') {
+ return
+ }
+ if (this.points_ids.length > 1) {
+ this.remove_entity(this.points_ids.pop()) //移除point
+ cache_positions.pop()
+ cache_84_position.pop()
+ this.positions = cache_positions.concat(cartesian)
+ }
+ })
+
+ this.event.gesture_pinck_start((movement, cartesian) => {
+ if (into === '2D') {
+ return
+ }
+ let startTime = new Date()
+ this.event.gesture_pinck_end(() => {
+ let endTime = new Date()
+ if (endTime - startTime >= 500) {
+ cb(null, cache_84_position)
+ this.end()
+ }
+ else {
+ this.tip.setPosition(
+ cartesian,
+ (movement.position1.x + movement.position2.x) / 2,
+ (movement.position1.y + movement.position2.y) / 2
+ )
+ if (!this.polygonHasCreated) {
+ let polyline_id = DrawThreeRect.create_polygon(this)
+ this.points_ids.push(polyline_id)
+ }
+ cache_positions.push(cartesian)
+ cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
+ this.points_ids.push(this.create_point(cartesian))
+ this.positions = cache_positions.concat(cartesian)
+ }
+ })
+ })
+
+ if (!this._is2D && this._sdk2D) {
+ this.event2D = new MouseEvent(this._sdk2D)
+ this.event2D.mouse_left((movement, cartesian) => {
+ if (into === '3D') {
+ return
+ }
+ into = '2D'
+ cnt++
+ this.positions = cache_positions.concat({ ...cartesian })
+ this.tip.setPosition(
+ cartesian,
+ movement.position.x + this.viewer.canvas.width,
+ movement.position.y
+ )
+ if (!this.polygonHasCreated) {
+ let polyline_id = DrawThreeRect.create_polygon(this, this._sdk2D.viewer)
+ this.points_ids.push(polyline_id)
+ }
+ cache_positions.push(cartesian)
+ cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
+ this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
+ if (cnt == 3) {
+ this.end()
+ cb(null, this.rectObject)
+ }
+ })
+ this.event2D.mouse_right((movement, cartesian) => {
+ if (into === '3D') {
+ return
+ }
+ this.end()
+ cb('取消', '')
+ })
+ this.event2D.mouse_move((movement, cartesian) => {
+ if (into === '3D') {
+ return
+ }
+ // this.positions = cache_positions.concat({ ...cartesian })
+ this.tip.setPosition(
+ cartesian,
+ movement.endPosition.x + this.viewer.canvas.width,
+ movement.endPosition.y
+ )
+
+ if (cnt == 2) {
+ let arr = JSON.parse(JSON.stringify(cache_positions))
+ let arr1 = arr.concat({ ...cartesian })
+ let pointArr = this.computedLastPoint(arr1)
+ arr = arr.concat(pointArr)
+ this.positions = arr
+ let arr_84 = arr.map(item => {
+ return this.cartesian3Towgs84(item, this.viewer)
+ })
+ this.rectObject = arr_84
+ }
+ })
+ this.event2D.mouse_right_keyboard_ctrl((movement, cartesian) => {
+ if (into === '3D') {
+ return
+ }
+ if (this.points_ids.length > 1) {
+ this.remove_entity(this.points_ids.pop()) //移除point
+ cache_positions.pop()
+ cache_84_position.pop()
+ }
+ })
+
+ this.event2D.gesture_pinck_start_keyboard_ctrl(() => {
+ if (into === '3D') {
+ return
+ }
+ if (this.points_ids.length > 1) {
+ this.remove_entity(this.points_ids.pop()) //移除point
+ cache_positions.pop()
+ cache_84_position.pop()
+ this.positions = cache_positions.concat(cartesian)
+ }
+ })
+
+ this.event2D.gesture_pinck_start((movement, cartesian) => {
+ if (into === '3D') {
+ return
+ }
+ let startTime = new Date()
+ this.event2D.gesture_pinck_end(() => {
+ let endTime = new Date()
+ if (endTime - startTime >= 500) {
+ cb(null, cache_84_position)
+ this.end()
+ }
+ else {
+ this.tip.setPosition(
+ cartesian,
+ ((movement.position1.x + movement.position2.x) / 2) + this.viewer.canvas.width,
+ (movement.position1.y + movement.position2.y) / 2
+ )
+ if (!this.polygonHasCreated) {
+ let polyline_id = DrawThreeRect.create_polygon(this, this._sdk2D.viewer)
+ this.points_ids.push(polyline_id)
+ }
+ cache_positions.push(cartesian)
+ cache_84_position.push(this.cartesian3Towgs84(cartesian, this.viewer))
+ this.points_ids.push(this.create_point(cartesian, this._sdk2D.viewer))
+ this.positions = cache_positions.concat(cartesian)
+ }
+ })
+ })
+ }
+ }
+ }
+}
+
+export default DrawThreeRect
diff --git a/src/In/index.js b/src/In/index.js
index 3fae21c..ebfff60 100644
--- a/src/In/index.js
+++ b/src/In/index.js
@@ -100,6 +100,7 @@ import MeasureAngle from '../Measure/MeasureAngle'
import MeasureAzimuth from '../Measure/MeasureAzimuth'
import DrawPolyline from '../Draw/drawPolyline'
import DrawPolygon from '../Draw/drawPolygon'
+import DrawThreeRect from '../Draw/drawThreeRect'
import DrawPoint from '../Draw/drawPoint'
import DrawCircle from '../Draw/drawCircle'
import DrawElliptic from '../Draw/drawElliptic'
@@ -187,6 +188,7 @@ import FlowLine from '../Obj/Base/FlowLine'
import Sunshine from '../Global/efflect/Sunshine'
// import Road2 from '../Obj/Base/RoadObject'
import TextBox from '../Obj/Base/TextBox'
+import BatchModel from '../Obj/Base/BatchModel'
const YJEarthismeasuring = Symbol('测量状态')
const screenRecord = Symbol('录屏对象')
@@ -260,7 +262,8 @@ if (!window.YJ) {
Dialog,
FlowLine,
// Road2,
- TextBox
+ TextBox,
+ BatchModel
},
YJEarth,
Tools,
@@ -378,6 +381,7 @@ if (!window.YJ) {
DrawAssemble,
DrawSector,
DrawTakeOff,
+ DrawThreeRect
},
// 分析
Analysis: {
From e342fa1d80f6e71426c8fbf770666c62463ceccf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Tue, 19 Aug 2025 17:28:32 +0800
Subject: [PATCH 05/23] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BE=B9=E6=A1=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Draw/drawThreeRect.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Draw/drawThreeRect.js b/src/Draw/drawThreeRect.js
index a6fa819..f77600c 100644
--- a/src/Draw/drawThreeRect.js
+++ b/src/Draw/drawThreeRect.js
@@ -33,8 +33,7 @@ class DrawThreeRect extends Draw {
},
polyline: {
positions: new Cesium.CallbackProperty((e) => {
- // return that.positions.concat(that.positions[0])
- return that.positionsLine
+ return that.positions.concat(that.positions[0])
}),
width: 2,
material: Cesium.Color.fromCssColorString('#c1c505').withAlpha(0.5),
From 4d35b2952688dd55c212321c2e4e51835a86ca0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Wed, 20 Aug 2025 15:11:25 +0800
Subject: [PATCH 06/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=A8=A1=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/BatchModel/_element.js | 23 +
src/Obj/Base/BatchModel/eventBinding.js | 92 ++++
src/Obj/Base/BatchModel/index.js | 611 ++++++++++++++++++++++++
3 files changed, 726 insertions(+)
create mode 100644 src/Obj/Base/BatchModel/_element.js
create mode 100644 src/Obj/Base/BatchModel/eventBinding.js
create mode 100644 src/Obj/Base/BatchModel/index.js
diff --git a/src/Obj/Base/BatchModel/_element.js b/src/Obj/Base/BatchModel/_element.js
new file mode 100644
index 0000000..da8c30f
--- /dev/null
+++ b/src/Obj/Base/BatchModel/_element.js
@@ -0,0 +1,23 @@
+function html() {
+ return `
+
+
+
+ `
+}
+
+export { html }
diff --git a/src/Obj/Base/BatchModel/eventBinding.js b/src/Obj/Base/BatchModel/eventBinding.js
new file mode 100644
index 0000000..ccbf026
--- /dev/null
+++ b/src/Obj/Base/BatchModel/eventBinding.js
@@ -0,0 +1,92 @@
+class eventBinding {
+ constructor() {
+ this.element = {}
+ }
+ static event = {}
+
+ getEvent(name) {
+ return eventBinding.event[name]
+ }
+
+ getEventAll() {
+ return eventBinding.event
+ }
+
+ setEvent(name, event) {
+ eventBinding.event[name] = event
+ }
+
+ on(that, elements) {
+ for (let i = 0; i < elements.length; i++) {
+ let Event = []
+ let isEvent = false
+ let removeName = []
+ if (!elements[i] || !elements[i].attributes) {
+ continue;
+ }
+ for (let m of elements[i].attributes) {
+ switch (m.name) {
+ case '@model': {
+ isEvent = true
+ if (elements[i].type == 'checkbox') {
+ Event.push((e) => { that[m.value] = e.target.checked })
+ elements[i].checked = that[m.value]
+ }
+ else {
+ Event.push((e) => {
+ let value = e.target.value
+ if (e.target.type == 'number') {
+ value = Number(value)
+ }
+ that[m.value] = value
+ })
+ if (elements[i].nodeName == 'IMG') {
+ elements[i].src = that[m.value]
+ }
+ else {
+ elements[i].value = that[m.value]
+ }
+ }
+ if (this.element[m.value]) {
+ this.element[m.value].push(elements[i])
+ }
+ else {
+ this.element[m.value] = [elements[i]]
+ }
+ removeName.push(m.name)
+ break;
+ }
+ case '@click': {
+ elements[i].addEventListener('click', (e) => {
+ if (typeof (that.Dialog[m.value]) === 'function') {
+ that.Dialog[m.value](e)
+ }
+ });
+ removeName.push(m.name)
+ // elements[i].attributes.removeNamedItem(m.name)
+ break;
+ }
+ }
+ // elements[i].attributes[m] = undefined
+ }
+ for (let n = 0; n < removeName.length; n++) {
+ elements[i].attributes.removeNamedItem(removeName[n])
+ }
+
+ if (isEvent) {
+ let ventType = 'input'
+ if (elements[i].tagName != 'INPUT' || elements[i].type == 'checkbox') {
+ ventType = 'change'
+ }
+ elements[i].addEventListener(ventType, (e) => {
+ for (let t = 0; t < Event.length; t++) {
+ Event[t](e)
+ }
+ });
+ }
+ }
+ }
+}
+
+const EventBinding = new eventBinding();
+export default EventBinding;
\ No newline at end of file
diff --git a/src/Obj/Base/BatchModel/index.js b/src/Obj/Base/BatchModel/index.js
new file mode 100644
index 0000000..61673bd
--- /dev/null
+++ b/src/Obj/Base/BatchModel/index.js
@@ -0,0 +1,611 @@
+/**
+ * @description 批量模型
+ */
+import Dialog from '../../Element/Dialog';
+import { html } from "./_element";
+import EventBinding from '../../Element/Dialog/eventBinding';
+import Base from "../index";
+import { syncData } from '../../../Global/MultiViewportMode'
+import Model from '../BaseSource/BaseModel/Model'
+import { legp } from '../../Element/datalist'
+
+import DrawPolyline from '../../../Draw/drawPolyline'
+import DrawPolygon from '../../../Draw/drawPolygon'
+import DrawThreeRect from '../../../Draw/drawThreeRect'
+import DrawPoint from '../../../Draw/drawPoint'
+import { setActiveViewer, closeRotateAround, closeViewFollow } from '../../../Global/global'
+
+import { setSplitDirection, syncSplitData, setActiveId } from '../../../Global/SplitScreen'
+
+class BatchModel extends Base {
+ /**
+ * @constructor
+ * @param sdk
+ * @description 批量模型
+ * @param options {object} 批量模型属性
+ * @param options.name=未命名对象 {string} 名称
+ * @param options.type=polygon {string} 线类型(line,polygon)
+ * @param options.url=polygon {string} 线类型(line,polygon,point)
+ * @param options.spacing= {number} 间距
+ * @param options.show=true {boolean}
+ * @param Dialog {object} 弹框对象
+ * @param Dialog.confirmCallBack {function} 弹框确认时的回调
+ * */
+ constructor(sdk, options = {}, callback = null, _Dialog = {}) {
+ super(sdk, options);
+ this.viewer = this.sdk.viewer
+ this.options.name = options.name || '批量模型'
+ this.options.type = options.type || '面'
+ this.options.url = options.url || ''
+ this.options.spacing = options.spacing || 50
+ this.options.positions = options.positions || []
+ this.options.show = (options.show || options.show === false) ? options.show : true
+ this.callback = callback
+ this.Dialog = _Dialog
+ this._EventBinding = new EventBinding()
+ this._elms = {};
+ this.pointArr = []
+ this.sdk.addIncetance(this.options.id, this)
+ // BatchModel.computeDis(this)
+ if (this.options.positions.length > 0) {
+ BatchModel.computeDis(this)
+ } else {
+ this.edit(true)
+ }
+ }
+
+ // 计算距离
+ static computeDis(that) {
+ let fromDegreesArray = []
+ let arr
+ let posiArr = []
+ let array = []
+ if (that.options.type == '面') {
+ that.options.positions.forEach(item => {
+ fromDegreesArray.push(item.lng, item.lat)
+ })
+ // arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
+ arr = that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
+ array[0] = arr
+ array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
+ arr.forEach((item, index) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(
+ item // Cartesian3对象 {x, y, z}
+ );
+ const longitude = Cesium.Math.toDegrees(cartographic.longitude);
+ const latitude = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ posiArr.push({
+ lng: longitude,
+ lat: latitude,
+ alt: height
+ })
+ })
+ } else if (that.options.type == '线') {
+ that.options.positions.forEach(item => {
+ fromDegreesArray.push(item.lng, item.lat)
+ })
+ array = that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
+ arr = array[0]
+ that.pointArr = arr
+ arr.forEach((item, index) => {
+ const cartographic = Cesium.Cartographic.fromCartesian(
+ item // Cartesian3对象 {x, y, z}
+ );
+ const longitude = Cesium.Math.toDegrees(cartographic.longitude);
+ const latitude = Cesium.Math.toDegrees(cartographic.latitude);
+ const height = cartographic.height;
+ posiArr.push({
+ lng: longitude,
+ lat: latitude,
+ alt: height
+ })
+ })
+ } else if (that.options.type == '点') {
+ posiArr = [that.options.positions]
+ that.pointArr = posiArr
+ }
+
+ posiArr.forEach((item, index) => {
+ let model = new Model(that.sdk, {
+ id: 'model' + index,
+ show: that.options.show,
+ url: that.options.url,
+ position: item,
+ rotate: { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) }
+ })
+ that.pointArr.push(model)
+ })
+ }
+ linePoint(polygonPositions, spacing) {
+ let boundaryPoints = [];
+ let boundaryAngle = [];
+ for (let i = 0; i < polygonPositions.length - 1; i++) {
+
+ const start = polygonPositions[i];
+ const end = polygonPositions[(i + 1) % polygonPositions.length];
+ const segmentLength = Cesium.Cartesian3.distance(start, end);
+ const segments = Math.ceil(segmentLength / spacing);
+
+ for (let j = 0; j <= segments; j++) {
+ const ratio = j / segments;
+ const point = Cesium.Cartesian3.lerp(
+ start, end, ratio, new Cesium.Cartesian3()
+ );
+ boundaryPoints.push(point);
+ if (j != segments || i == polygonPositions.length - 2) {
+ boundaryAngle.push(this.calculateRoadAngle(start, end))
+ }
+ }
+ }
+ return [[...new Set(boundaryPoints
+ .map(p => `${p.x},${p.y},${p.z}`))]
+ .map(str => {
+ const [x, y, z] = str.split(',').map(Number);
+ return new Cesium.Cartesian3(x, y, z);
+ }), boundaryAngle];
+ }
+ calculateRoadAngle(startPoint, endPoint) {
+ const normal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(startPoint);
+ const enuMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(startPoint, undefined, normal);
+ const inverseMatrix = Cesium.Matrix4.inverse(enuMatrix, new Cesium.Matrix4());
+
+ const localEnd = Cesium.Matrix4.multiplyByPoint(inverseMatrix, endPoint, new Cesium.Cartesian3());
+ const horizontalVec = new Cesium.Cartesian2(localEnd.x, localEnd.y);
+ Cesium.Cartesian2.normalize(horizontalVec, horizontalVec);
+
+ const north = new Cesium.Cartesian2(1, 0);
+
+ let angle = Cesium.Cartesian2.angleBetween(north, horizontalVec);
+ angle = Cesium.Math.toDegrees(angle)
+ const cross = Cesium.Cartesian2.cross(north, horizontalVec, new Cesium.Cartesian2());
+ // return cross < 0 ? angle : - angle;
+ return cross < 0 ? -angle : angle;
+ }
+ generateInterpolatedPoints(polygonPositions, spacing) {
+ // 1. 边界点插值
+ const boundaryPoints = [];
+
+ for (let i = 0; i < polygonPositions.length; i++) {
+
+ const start = polygonPositions[i];
+ const end = polygonPositions[(i + 1) % polygonPositions.length];
+ const segmentLength = Cesium.Cartesian3.distance(start, end);
+ const segments = Math.ceil(segmentLength / spacing);
+
+ for (let j = 0; j <= segments; j++) {
+ const ratio = j / segments;
+ const point = Cesium.Cartesian3.lerp(
+ start, end, ratio, new Cesium.Cartesian3()
+ );
+ boundaryPoints.push(point);
+ }
+ }
+
+ // 2. 内部网格生成
+ const extent = this.computePolygonExtent(polygonPositions);
+ let result = this.createGridFromBBox(extent, this.options.spacing)
+ // const extent = Cesium.Rectangle.fromCartesianArray(polygonPositions);
+
+ const gridPoints = [];
+ // const polygon = new Cesium.PolygonHierarchy(polygonPositions);
+ var polygon = []
+ this.options.positions.forEach(item => {
+ polygon.push([item.lng, item.lat])
+ })
+ polygon.push(polygon[0])
+ for (let x = extent.west; x <= extent.east; x += result.lonStep) {
+ for (let y = extent.south; y <= extent.north; y += result.latStep) {
+ const position = Cesium.Cartesian3.fromDegrees(x, y);
+ const point = turf.point([x, y]);
+ const polygonTurf = turf.polygon([polygon]);
+ const isInside = turf.booleanPointInPolygon(point, polygonTurf);
+ isInside && gridPoints.push(position)
+ }
+ }
+
+ // 3. 合并结果并去重
+ // return [...new Set([...boundaryPoints, ...gridPoints]
+ return [...new Set([...gridPoints]
+ .map(p => `${p.x},${p.y},${p.z}`))]
+ .map(str => {
+ const [x, y, z] = str.split(',').map(Number);
+ return new Cesium.Cartesian3(x, y, z);
+ });
+ }
+
+ createGridFromBBox(bbox, spacing) {
+ const earthRadius = 6378137; // WGS84椭球体长半轴
+ // 计算经度方向网格数
+ const lonDistance = Cesium.Cartesian3.distance(
+ Cesium.Cartesian3.fromDegrees(bbox.west, (bbox.south + bbox.north) / 2, 0),
+ Cesium.Cartesian3.fromDegrees(bbox.east, (bbox.south + bbox.north) / 2, 0)
+ );
+ const lonCount = Math.ceil(lonDistance / spacing);
+
+ // 计算纬度方向网格数
+ const latDistance = Cesium.Cartesian3.distance(
+ Cesium.Cartesian3.fromDegrees((bbox.west + bbox.east) / 2, bbox.south, 0),
+ Cesium.Cartesian3.fromDegrees((bbox.west + bbox.east) / 2, bbox.north, 0)
+ );
+ const latCount = Math.ceil(latDistance / spacing);
+ // 生成网格线
+ const lonStep = (bbox.east - bbox.west) / lonCount;
+ const latStep = (bbox.north - bbox.south) / latCount;
+ return { lonStep, latStep }
+ }
+
+ computePolygonExtent(positions) {
+ // 计算多边形经纬度范围
+ const cartographics = positions.map(p =>
+ Cesium.Cartographic.fromCartesian(p));
+ const lons = cartographics.map(c => Cesium.Math.toDegrees(c.longitude));
+ const lats = cartographics.map(c => Cesium.Math.toDegrees(c.latitude));
+ return {
+ west: Math.min(...lons),
+ east: Math.max(...lons),
+ south: Math.min(...lats),
+ north: Math.max(...lats)
+ };
+ }
+ computedArea(polygonPositions, spacing) {
+ let dis12 = Cesium.Cartesian3.distance(polygonPositions[0], polygonPositions[1]);
+ let dis23 = Cesium.Cartesian3.distance(polygonPositions[1], polygonPositions[2]);
+ let vec12 = Cesium.Cartesian3.subtract(polygonPositions[1], polygonPositions[0], new Cesium.Cartesian3());
+ let vec23 = Cesium.Cartesian3.subtract(polygonPositions[2], polygonPositions[1], new Cesium.Cartesian3());
+
+ let num12 = Math.ceil(dis12 / spacing);
+ let num23 = Math.ceil(dis23 / spacing);
+
+ let line1 = []
+ for (let i = 0; i < num12; i++) {
+ line1.push(this.calculatePointB(polygonPositions[0], polygonPositions[1], i * spacing))
+ }
+ let line2 = []
+ for (let i = 0; i < num12; i++) {
+ line2.push(this.calculatePointB(polygonPositions[3], polygonPositions[2], i * spacing))
+ }
+
+ let allPoints = []
+ for (let i = 0; i < line1.length; i++) {
+ for (let j = 0; j < num23; j++) {
+ allPoints.push(this.calculatePointB(line1[i], line2[i], j * spacing))
+ }
+ }
+ return allPoints
+ }
+ calculatePointB(pointA, pointC, distance) {
+ // 将输入坐标转换为Cartesian3类型
+ // const pointA = Cesium.Cartesian3.fromDegrees(a.longitude, a.latitude, a.height);
+ // const pointC = Cesium.Cartesian3.fromDegrees(c.longitude, c.latitude, c.height);
+
+ // 计算向量AC
+ const vectorAC = Cesium.Cartesian3.subtract(pointC, pointA, new Cesium.Cartesian3());
+
+ // 计算向量AC的长度
+ const lengthAC = Cesium.Cartesian3.magnitude(vectorAC);
+
+ // 归一化向量AC
+ const unitVector = Cesium.Cartesian3.normalize(vectorAC, new Cesium.Cartesian3());
+
+ // 计算点B坐标
+ const scaledVector = Cesium.Cartesian3.multiplyByScalar(unitVector, distance, new Cesium.Cartesian3());
+ const pointB = Cesium.Cartesian3.add(pointA, scaledVector, new Cesium.Cartesian3());
+
+ // 转换回经纬度
+ // const cartographic = Cesium.Cartographic.fromCartesian(pointB);
+ // return {
+ // longitude: Cesium.Math.toDegrees(cartographic.longitude),
+ // latitude: Cesium.Math.toDegrees(cartographic.latitude),
+ // height: cartographic.height
+ // };
+ return pointB
+ }
+ get show() {
+ return this.options.show
+ }
+
+ set show(v) {
+ this.options.show = v
+ for (let i = 0; i < this.pointArr.length; i++) {
+ this.pointArr[i].show = v
+ }
+ }
+ get type() {
+ return this.options.type
+ }
+
+ set type(v) {
+ this.options.type = v
+ this._elms.type &&
+ this._elms.type.forEach(item => {
+ item.value = v
+ })
+ }
+ get spacing() {
+ return this.options.spacing
+ }
+
+ set spacing(v) {
+ this.options.spacing = v
+ }
+ /**
+ * @description 编辑框
+ * @param state=false {boolean} 状态: true打开, false关闭
+ */
+ async edit(state = false) {
+ let _this = this
+ this.originalOptions = this.deepCopyObj(this.options)
+
+ // let elms = this.sdk.viewer._container.getElementsByClassName('YJ-custom-base-dialog')
+ // for (let i = elms.length - 1; i >= 0; i--) {
+ // this.sdk.viewer._container.removeChild(elms[i])
+ // }
+
+ if (this._DialogObject && this._DialogObject.close) {
+ this._DialogObject.close()
+ this._DialogObject = null
+ }
+
+ if (state) {
+ this._DialogObject = await new Dialog(this.sdk, this.originalOptions, {
+ title: '默认模型参数设置', left: '180px', top: '100px',
+ confirmCallBack: (options) => {
+ this.name = this.name.trim()
+ if (!this.name) {
+ // this.name = '未命名对象'
+ this.name = '飞线'
+ }
+
+ let Draw
+ switch (this.options.type) {
+ case '点':
+ Draw = new DrawPoint(this.sdk)
+ break;
+ case '线':
+ Draw = new DrawPolyline(this.sdk)
+ break;
+ case '面':
+ Draw = new DrawThreeRect(this.sdk)
+ break;
+ default:
+ break;
+ }
+ Draw && Draw.start((a, positions) => {
+ this.options.positions = positions
+ this.callback(this.options)
+ this.options.positions.length && BatchModel.computeDis(this)
+ })
+
+ this.originalOptions = this.deepCopyObj(this.options)
+ this._DialogObject.close()
+ this.Dialog.confirmCallBack && this.Dialog.confirmCallBack(this.originalOptions)
+ syncData(this.sdk, this.options.id)
+ syncSplitData(this.sdk, this.options.id)
+ },
+ // resetCallBack: () => {
+ // this.reset()
+ // console.log('22222')
+ // this.Dialog.resetCallBack && this.Dialog.resetCallBack()
+ // },
+ // removeCallBack: () => {
+ // console.log('33333')
+ // this.Dialog.removeCallBack && this.Dialog.removeCallBack()
+ // },
+ closeCallBack: () => {
+ this.reset()
+ // this.entity.style = new Cesium.Cesium3DTileStyle({
+ // color: "color('rgba(255,255,255," + this.newData.transparency + ")')",
+ // show: true,
+ // });
+ this.Dialog.closeCallBack && this.Dialog.closeCallBack()
+ },
+ addFootElm: [
+ {
+ tagName: 'button',
+ className: 'flipe-over-y',
+ innerHTML: '重置',
+ event: [
+ 'click',
+ () => {
+ this.reset()
+ }
+ ]
+ }
+ ]
+ // showCallBack: (show) => {
+ // this.show = show
+ // this.Dialog.showCallBack && this.Dialog.showCallBack()
+ // }
+ }, true)
+ this._DialogObject._element.body.className = this._DialogObject._element.body.className + ' flow-line-surface'
+ let contentElm = document.createElement('div');
+ contentElm.innerHTML = html()
+ this._DialogObject.contentAppChild(contentElm)
+ // 颜色组件
+ // let waterColorPicker = new YJColorPicker({
+ // el: contentElm.getElementsByClassName("flowLine-color")[0],
+ // size: 'mini',//颜色box类型
+ // alpha: true,//是否开启透明度
+ // defaultColor: this.color,
+ // disabled: false,//是否禁止打开颜色选择器
+ // openPickerAni: 'opacity',//打开颜色选择器动画
+ // sure: (color) => {
+ // this.color = color
+ // },//点击确认按钮事件回调
+ // clear: () => {
+ // this.color = 'rgba(255,255,255,1)'
+ // },//点击清空按钮事件回调
+ // })
+
+ let all_elm = contentElm.getElementsByTagName("*")
+ this._EventBinding.on(this, all_elm)
+ this._elms = this._EventBinding.element
+
+ let nameData = [
+ {
+ name: '点',
+ value: '点',
+ },
+ {
+ name: '线',
+ value: '线',
+ },
+ {
+ name: '面',
+ value: '面',
+ }
+ ]
+
+ let nameDataLegpObject = legp(
+ this._DialogObject._element.content.getElementsByClassName(
+ 'add-type-box'
+ )[0],
+ '.add-type'
+ )
+ if (nameDataLegpObject) {
+ nameDataLegpObject.legp_search(nameData)
+ let nameDataLegpElm = this._DialogObject._element.content
+ .getElementsByClassName('add-type')[0]
+ .getElementsByTagName('input')[0]
+ this._elms.type = [nameDataLegpElm]
+ nameDataLegpElm.value = this.options.type
+ for (let i = 0; i < nameData.length; i++) {
+ if (nameData[i].value === nameDataLegpElm.value) {
+ nameDataLegpObject.legp_searchActive(nameData[i].value)
+ break
+ }
+ }
+ nameDataLegpElm.addEventListener('input', () => {
+ for (let i = 0; i < nameData.length; i++) {
+ if (nameData[i].value === nameDataLegpElm.value) {
+ this.type = nameData[i].value
+ break
+ }
+ }
+ })
+ }
+ // this._elms.color = [waterColorPicker]
+ } else {
+ // if (this._element_style) {
+ // document.getElementsByTagName('head')[0].removeChild(this._element_style)
+ // this._element_style = null
+ // }
+ // if (this._DialogObject && this._DialogObject.remove) {
+ // this._DialogObject.remove()
+ // this._DialogObject = null
+ // }
+ }
+ }
+ drawArea() {
+
+ }
+
+ reset() {
+ this.name = this.originalOptions.name
+ this.type = this.originalOptions.type
+ this.spacing = this.originalOptions.spacing
+ this.show = this.originalOptions.show
+ }
+
+ /**
+ * 飞到对应实体
+ */
+ async flyTo(options = {}) {
+ setActiveViewer(0)
+ closeRotateAround(this.sdk)
+ closeViewFollow(this.sdk)
+
+ if (this.options.customView && this.options.customView.relativePosition && this.options.customView.orientation) {
+ let orientation = {
+ heading: Cesium.Math.toRadians(this.options.customView.orientation.heading || 0.0),
+ pitch: Cesium.Math.toRadians(this.options.customView.orientation.pitch || -60.0),
+ roll: Cesium.Math.toRadians(this.options.customView.orientation.roll || 0.0)
+ }
+
+ let lng = this.options.customView.relativePosition.lng
+ let lat = this.options.customView.relativePosition.lat
+ let alt = this.options.customView.relativePosition.alt
+ let destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
+
+ let position = { lng: 0, lat: 0 }
+ if (this.options.position) {
+ position = { ...this.options.position }
+ }
+ else if (this.options.positions) {
+ position = { ...this.options.positions[0] }
+ }
+ else if (this.options.center) {
+ position = { ...this.options.center }
+ }
+ else if (this.options.start) {
+ position = { ...this.options.start }
+ }
+ else {
+ if (this.options.hasOwnProperty('lng')) {
+ position.lng = this.options.lng
+ }
+ if (this.options.hasOwnProperty('lat')) {
+ position.lat = this.options.lat
+ }
+ if (this.options.hasOwnProperty('alt')) {
+ position.alt = this.options.alt
+ }
+ }
+ // 如果没有高度值,则获取紧贴高度计算
+ // if (!position.hasOwnProperty('alt')) {
+ // position.alt = await this.getClampToHeight(position)
+ // }
+ lng = this.options.customView.relativePosition.lng + position.lng
+ lat = this.options.customView.relativePosition.lat + position.lat
+ alt = this.options.customView.relativePosition.alt + position.alt
+ destination = Cesium.Cartesian3.fromDegrees(lng, lat, alt)
+ this.sdk.viewer.camera.flyTo({
+ destination: destination,
+ orientation: orientation
+ })
+ }
+ else {
+ let positionArray = []
+ for (let i = 0; i < this.options.positions.length; i++) {
+ let a = Cesium.Cartesian3.fromDegrees(
+ this.options.positions[i].lng,
+ this.options.positions[i].lat,
+ this.options.positions[i].alt
+ )
+ positionArray.push(a.x, a.y, a.z)
+ }
+ let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray)
+ this.viewer.camera.flyToBoundingSphere(BoundingSphere, {
+ offset: {
+ heading: Cesium.Math.toRadians(0.0),
+ pitch: Cesium.Math.toRadians(-20.0),
+ roll: Cesium.Math.toRadians(0.0)
+ }
+ })
+ }
+ }
+ /**
+ * 删除
+ */
+ async remove() {
+ for (let i = 0; i < this.pointArr.length; i++) {
+ this.pointArr[i].remove()
+ }
+
+ this.pointArr = []
+ this.positions = []
+ this.entity = null
+
+ if (this._DialogObject && !this._DialogObject.isDestroy) {
+ this._DialogObject.close()
+ this._DialogObject = null
+ }
+ await this.sdk.removeIncetance(this.options.id)
+ await syncData(this.sdk, this.options.id)
+ }
+
+ flicker() { }
+}
+
+export default BatchModel
From 3d0493e0dd28f5abb01803f1b1f2fd94649f2795 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Wed, 20 Aug 2025 17:52:51 +0800
Subject: [PATCH 07/23] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=A8=A1=E5=9E=8B=20?=
=?UTF-8?q?=E9=AB=98=E5=BA=A6=E4=BC=98=E5=8C=96=20=E5=AE=9A=E4=BD=8D=20?=
=?UTF-8?q?=E9=87=8D=E5=8A=A0=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/BatchModel/_element.js | 1 +
src/Obj/Base/BatchModel/index.js | 102 ++++++++++++++++++++--------
2 files changed, 73 insertions(+), 30 deletions(-)
diff --git a/src/Obj/Base/BatchModel/_element.js b/src/Obj/Base/BatchModel/_element.js
index da8c30f..afe7ff8 100644
--- a/src/Obj/Base/BatchModel/_element.js
+++ b/src/Obj/Base/BatchModel/_element.js
@@ -11,6 +11,7 @@ function html() {
间距
+ 米
diff --git a/src/Obj/Base/BatchModel/index.js b/src/Obj/Base/BatchModel/index.js
index 61673bd..84045dd 100644
--- a/src/Obj/Base/BatchModel/index.js
+++ b/src/Obj/Base/BatchModel/index.js
@@ -47,7 +47,7 @@ class BatchModel extends Base {
this.pointArr = []
this.sdk.addIncetance(this.options.id, this)
// BatchModel.computeDis(this)
- if (this.options.positions.length > 0) {
+ if (this.options.positions.length > 0 || this.options.positions.lng) {
BatchModel.computeDis(this)
} else {
this.edit(true)
@@ -55,7 +55,7 @@ class BatchModel extends Base {
}
// 计算距离
- static computeDis(that) {
+ static async computeDis(that) {
let fromDegreesArray = []
let arr
let posiArr = []
@@ -65,7 +65,7 @@ class BatchModel extends Base {
fromDegreesArray.push(item.lng, item.lat)
})
// arr = that.generateInterpolatedPoints(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
- arr = that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
+ arr = await that.computedArea(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
array[0] = arr
array[1] = that.calculateRoadAngle(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[0], Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)[3])
arr.forEach((item, index) => {
@@ -85,7 +85,7 @@ class BatchModel extends Base {
that.options.positions.forEach(item => {
fromDegreesArray.push(item.lng, item.lat)
})
- array = that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
+ array = await that.linePoint(Cesium.Cartesian3.fromDegreesArray(fromDegreesArray), that.options.spacing)
arr = array[0]
that.pointArr = arr
arr.forEach((item, index) => {
@@ -102,22 +102,23 @@ class BatchModel extends Base {
})
})
} else if (that.options.type == '点') {
- posiArr = [that.options.positions]
+ let height = await that.getClampToHeight({ lng: that.options.positions.lng, lat: that.options.positions.lat })
+ posiArr = [{ lng: that.options.positions.lng, lat: that.options.positions.lat, alt: height }]
+ // posiArr = [that.options.positions]
that.pointArr = posiArr
}
-
posiArr.forEach((item, index) => {
let model = new Model(that.sdk, {
id: 'model' + index,
show: that.options.show,
url: that.options.url,
position: item,
- rotate: { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) }
+ rotate: that.options.type == '点' ? undefined : { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) }
})
that.pointArr.push(model)
})
}
- linePoint(polygonPositions, spacing) {
+ async linePoint(polygonPositions, spacing) {
let boundaryPoints = [];
let boundaryAngle = [];
for (let i = 0; i < polygonPositions.length - 1; i++) {
@@ -129,9 +130,20 @@ class BatchModel extends Base {
for (let j = 0; j <= segments; j++) {
const ratio = j / segments;
- const point = Cesium.Cartesian3.lerp(
+ let point = Cesium.Cartesian3.lerp(
start, end, ratio, new Cesium.Cartesian3()
);
+
+ const cartographic = Cesium.Cartographic.fromCartesian(
+ point // Cartesian3对象 {x, y, z}
+ );
+ const longitude = Cesium.Math.toDegrees(cartographic.longitude);
+ const latitude = Cesium.Math.toDegrees(cartographic.latitude);
+
+
+ let height = await this.getClampToHeight({ lng: longitude, lat: latitude })
+ point = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
+
boundaryPoints.push(point);
if (j != segments || i == polygonPositions.length - 2) {
boundaryAngle.push(this.calculateRoadAngle(start, end))
@@ -248,7 +260,7 @@ class BatchModel extends Base {
north: Math.max(...lats)
};
}
- computedArea(polygonPositions, spacing) {
+ async computedArea(polygonPositions, spacing) {
let dis12 = Cesium.Cartesian3.distance(polygonPositions[0], polygonPositions[1]);
let dis23 = Cesium.Cartesian3.distance(polygonPositions[1], polygonPositions[2]);
let vec12 = Cesium.Cartesian3.subtract(polygonPositions[1], polygonPositions[0], new Cesium.Cartesian3());
@@ -259,22 +271,22 @@ class BatchModel extends Base {
let line1 = []
for (let i = 0; i < num12; i++) {
- line1.push(this.calculatePointB(polygonPositions[0], polygonPositions[1], i * spacing))
+ line1.push(await this.calculatePointB(polygonPositions[0], polygonPositions[1], i * spacing))
}
let line2 = []
for (let i = 0; i < num12; i++) {
- line2.push(this.calculatePointB(polygonPositions[3], polygonPositions[2], i * spacing))
+ line2.push(await this.calculatePointB(polygonPositions[3], polygonPositions[2], i * spacing))
}
let allPoints = []
for (let i = 0; i < line1.length; i++) {
for (let j = 0; j < num23; j++) {
- allPoints.push(this.calculatePointB(line1[i], line2[i], j * spacing))
+ allPoints.push(await this.calculatePointB(line1[i], line2[i], j * spacing))
}
}
return allPoints
}
- calculatePointB(pointA, pointC, distance) {
+ async calculatePointB(pointA, pointC, distance) {
// 将输入坐标转换为Cartesian3类型
// const pointA = Cesium.Cartesian3.fromDegrees(a.longitude, a.latitude, a.height);
// const pointC = Cesium.Cartesian3.fromDegrees(c.longitude, c.latitude, c.height);
@@ -292,6 +304,16 @@ class BatchModel extends Base {
const scaledVector = Cesium.Cartesian3.multiplyByScalar(unitVector, distance, new Cesium.Cartesian3());
const pointB = Cesium.Cartesian3.add(pointA, scaledVector, new Cesium.Cartesian3());
+
+ const cartographic = Cesium.Cartographic.fromCartesian(
+ pointB // Cartesian3对象 {x, y, z}
+ );
+ const longitude = Cesium.Math.toDegrees(cartographic.longitude);
+ const latitude = Cesium.Math.toDegrees(cartographic.latitude);
+
+
+ let height = await this.getClampToHeight({ lng: longitude, lat: latitude })
+ let point = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
// 转换回经纬度
// const cartographic = Cesium.Cartographic.fromCartesian(pointB);
// return {
@@ -299,7 +321,8 @@ class BatchModel extends Base {
// latitude: Cesium.Math.toDegrees(cartographic.latitude),
// height: cartographic.height
// };
- return pointB
+ // return pointB
+ return point
}
get show() {
return this.options.show
@@ -328,6 +351,10 @@ class BatchModel extends Base {
set spacing(v) {
this.options.spacing = v
+ this._elms.spacing &&
+ this._elms.spacing.forEach(item => {
+ item.value = v
+ })
}
/**
* @description 编辑框
@@ -373,8 +400,8 @@ class BatchModel extends Base {
}
Draw && Draw.start((a, positions) => {
this.options.positions = positions
- this.callback(this.options)
- this.options.positions.length && BatchModel.computeDis(this)
+ this.callback(this.options);
+ (this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
})
this.originalOptions = this.deepCopyObj(this.options)
@@ -506,6 +533,7 @@ class BatchModel extends Base {
this.type = this.originalOptions.type
this.spacing = this.originalOptions.spacing
this.show = this.originalOptions.show
+ this.options.spacing = this.originalOptions.spacing
}
/**
@@ -567,22 +595,36 @@ class BatchModel extends Base {
}
else {
let positionArray = []
- for (let i = 0; i < this.options.positions.length; i++) {
- let a = Cesium.Cartesian3.fromDegrees(
- this.options.positions[i].lng,
- this.options.positions[i].lat,
- this.options.positions[i].alt
- )
- positionArray.push(a.x, a.y, a.z)
- }
- let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray)
- this.viewer.camera.flyToBoundingSphere(BoundingSphere, {
- offset: {
+ if (this.options.positions.length > 0) {
+ for (let i = 0; i < this.options.positions.length; i++) {
+ let a = Cesium.Cartesian3.fromDegrees(
+ this.options.positions[i].lng,
+ this.options.positions[i].lat,
+ this.options.positions[i].alt
+ )
+ positionArray.push(a.x, a.y, a.z)
+ }
+ let BoundingSphere = Cesium.BoundingSphere.fromVertices(positionArray)
+ this.viewer.camera.flyToBoundingSphere(BoundingSphere, {
+ offset: {
+ heading: Cesium.Math.toRadians(0.0),
+ pitch: Cesium.Math.toRadians(-20.0),
+ roll: Cesium.Math.toRadians(0.0)
+ }
+ })
+ } else if (this.options.positions.lng) {
+ let orientation = {
heading: Cesium.Math.toRadians(0.0),
- pitch: Cesium.Math.toRadians(-20.0),
+ pitch: Cesium.Math.toRadians(-60.0),
roll: Cesium.Math.toRadians(0.0)
}
- })
+ this.sdk.viewer.camera.flyTo({
+ destination: Cesium.Cartesian3.fromDegrees(this.options.positions.lng, this.options.positions.lat, this.options.positions.alt + 100),
+ // orientation: orientation
+ })
+
+ }
+
}
}
/**
From 4f57ac3d9e7183a0a8bfbbf28610562d91976509 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Thu, 21 Aug 2025 16:03:25 +0800
Subject: [PATCH 08/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BE=93=E5=85=A5?=
=?UTF-8?q?=E6=A1=86=E8=B6=85=E5=87=BA=E6=9C=80=E5=A4=A7=E5=80=BC=E9=97=AE?=
=?UTF-8?q?=E9=A2=98=E5=92=8C=E8=BF=9B=E5=BA=A6=E6=9D=A1=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=E9=80=9F=E5=BA=A6=E4=BC=9A=E8=B7=B3=E8=B7=83=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/efflect/Sunshine/index.js | 4 +++
src/Global/efflect/Sunshine/timeLIne.js | 39 ++++++++++++-------------
2 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/src/Global/efflect/Sunshine/index.js b/src/Global/efflect/Sunshine/index.js
index f1b1a59..12119d5 100644
--- a/src/Global/efflect/Sunshine/index.js
+++ b/src/Global/efflect/Sunshine/index.js
@@ -80,6 +80,10 @@ export default class Sunshine {
}
set speed(v) {
this.options.speed = v
+ this._elms.speed &&
+ this._elms.speed.forEach(item => {
+ item.value = v
+ })
this.viewer.clock.multiplier = this.options.speed;
this.timeLine.setSpeed(v)
}
diff --git a/src/Global/efflect/Sunshine/timeLIne.js b/src/Global/efflect/Sunshine/timeLIne.js
index f6155e9..d7deb47 100644
--- a/src/Global/efflect/Sunshine/timeLIne.js
+++ b/src/Global/efflect/Sunshine/timeLIne.js
@@ -9,7 +9,7 @@ export default class TimeLine {
this.timelineCon = document.getElementsByClassName('timeline-container')[0];
this.speed = speed;
this.animationId;
- this.startTime = Date.now();
+ this.startTime = performance.now();
this.manualPosition = null;
this.isDragging = false;
this.pauseed = false;
@@ -28,9 +28,7 @@ export default class TimeLine {
document.getElementsByClassName('time-marks')[0].appendChild(label)
}
}
-
-
- that.startTime = Date.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed);
+ that.startTime = performance.now() - ((that.manualPosition || 0) * 86400 * 1000 / that.speed);
that.timeline.addEventListener('mousedown', (e) => {
if (e.srcElement.className === 'handle') {
@@ -57,21 +55,22 @@ export default class TimeLine {
document.getElementById('timePause').addEventListener('click', function () {
that.pauseed = !that.pauseed;
if (that.pauseed) {//暂停
+ that.pausedTime = performance.now(); // 记录暂停时刻
document.getElementById('timePause').textContent = '播放';
that.animationId && cancelAnimationFrame(that.animationId);
- that.pausedTime = Date.now(); // 记录暂停时刻
that.sdk.viewer.clock.shouldAnimate = false
} else {//播放
+ let now = performance.now()
+ const pausedDuration = now - that.pausedTime;
document.getElementById('timePause').textContent = '暂停';
that.manualPosition = null
- const pausedDuration = Date.now() - that.pausedTime;
that.startTime += pausedDuration; // 补偿暂停期间的时间差
if (that.changeDate) {//切换日期后让时间从0开始
if (that.changeDateGrag) {
that.changeDateGrag = undefined
} else {
- that.startTime = Date.now()
+ that.startTime = now
}
that.changeDate = undefined
}
@@ -88,14 +87,14 @@ export default class TimeLine {
that.isDragging = false;
if (that.manualPosition !== null) {
// that.sdk.viewer.clock.shouldAnimate = true
- that.startTime = Date.now() - (that.manualPosition * 86400 * 1000 / that.speed);
+ that.startTime = performance.now() - (that.manualPosition * 86400 * 1000 / that.speed);
that.manualPosition = null;
that.changeDate && (that.changeDateGrag = true)
if (!that.pauseed) {
that.update()
func(that.time)
} else {
- that.pausedTime = Date.now(); // 记录暂停时刻
+ that.pausedTime = performance.now(); // 记录暂停时刻
func(that.currentTime.textContent)
}
@@ -113,9 +112,9 @@ export default class TimeLine {
update() {
if (this.manualPosition !== null) return;
if (this.changeDate) {//切换日期后让时间从0开始
- this.startTime = Date.now()
+ this.startTime = performance.now()
}
- let elapsed = (Date.now() - this.startTime) * this.speed;
+ let elapsed = (performance.now() - this.startTime) * this.speed;
// if (this.elapsed) {
// elapsed = elapsed + this.elapsed
// this.elapsed = undefined
@@ -133,23 +132,23 @@ export default class TimeLine {
}
}
setSpeed(v) {
+ let now = performance.now()
if (!this.pauseed) {
const currentProgress = this.manualPosition ??
- (Date.now() - this.startTime) * this.speed / (86400 * 1000);
+ (performance.now() - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
- this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
+ this.startTime = performance.now() - (currentProgress * 86400 * 1000 / this.speed);
} else {
- let pausedDuration = Date.now() - this.pausedTime;
+ let pausedDuration = now - this.pausedTime;
this.startTime += pausedDuration; // 补偿暂停期间的时间差
-
const currentProgress = this.manualPosition ??
- (Date.now() - this.startTime) * this.speed / (86400 * 1000);
+ (now - this.startTime) * this.speed / (86400 * 1000);
this.speed = v;
- this.startTime = Date.now() - (currentProgress * 86400 * 1000 / this.speed);
+ this.startTime = now - (currentProgress * 86400 * 1000 / this.speed);
- this.pausedTime = Date.now(); // 记录切换speed暂停时刻
- this.speed = v;
+ this.pausedTime = now; // 记录切换speed暂停时刻
+ // this.speed = v;
}
this.manualPosition = null;
@@ -158,7 +157,7 @@ export default class TimeLine {
}
updateTime() {
this.manualPosition = null;
- this.startTime = Date.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
+ this.startTime = performance.now() - ((this.manualPosition || 0) * 86400 * 1000 / this.speed);
this.pauseed && (this.changeDate = true)
this.changeDateGrag = undefined
this.update();
From dd1c7acde1229c2ab220d0808bc4b9eb00904a29 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 21 Aug 2025 16:36:38 +0800
Subject: [PATCH 09/23] =?UTF-8?q?=E9=BC=A0=E6=A0=87=E5=8F=B3=E9=94=AE?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E6=9C=AC=E6=A1=86=E9=A1=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Global/mouseRightMenu/index.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Global/mouseRightMenu/index.js b/src/Global/mouseRightMenu/index.js
index 0fd350e..8b9a223 100644
--- a/src/Global/mouseRightMenu/index.js
+++ b/src/Global/mouseRightMenu/index.js
@@ -121,6 +121,9 @@ function MouseRightMenu(sdk, status, callBack) {
+
${addedMenu}
`
_element.appendChild(menuElm)
@@ -175,6 +178,7 @@ function MouseRightMenu(sdk, status, callBack) {
break
case '文本框':
object.position = position
+ key = 'textBox'
break
}
eventListener[sdk.div_id].callBack(key, object)
From 71988d88332620ae09278ddc13eb9b2dde7374d3 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Thu, 21 Aug 2025 16:36:50 +0800
Subject: [PATCH 10/23] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B4=B4=E5=9C=B0?=
=?UTF-8?q?=E8=B7=9D=E7=A6=BB=E6=B5=8B=E9=87=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Measure/MeasureDistance/index.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Measure/MeasureDistance/index.js b/src/Measure/MeasureDistance/index.js
index 7bb3749..52755af 100644
--- a/src/Measure/MeasureDistance/index.js
+++ b/src/Measure/MeasureDistance/index.js
@@ -91,7 +91,7 @@ class MeasureDistance extends Measure {
//暂时固定取20个点
- if (d > 20) {//大于20m时,固定取20个点
+ if (d > 2) {//大于20m时,固定取20个点
meters = d / 20
await start(meters)
} else if (d < 1) {
@@ -106,8 +106,8 @@ class MeasureDistance extends Measure {
async sampleHeight(p1, index) {
- let p2 = await this.sampleHeightMostDetailed([p1])
- p1.alt = p2[0].height
+ let height = await this.getClampToHeight(p1, [...this.sdk.viewer.entities.values])
+ p1.alt = height
return {position: p1, index}
}
From ea80fe325c94d9082afdd27465047fb13c069544 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=8F=E5=A4=A7=E8=83=86?= <1101282782@qq.com>
Date: Thu, 21 Aug 2025 17:00:34 +0800
Subject: [PATCH 11/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=B9=E9=87=8F?=
=?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=BB=98=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/BatchModel/index.js | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/src/Obj/Base/BatchModel/index.js b/src/Obj/Base/BatchModel/index.js
index 84045dd..af82c3a 100644
--- a/src/Obj/Base/BatchModel/index.js
+++ b/src/Obj/Base/BatchModel/index.js
@@ -107,16 +107,22 @@ class BatchModel extends Base {
// posiArr = [that.options.positions]
that.pointArr = posiArr
}
- posiArr.forEach((item, index) => {
- let model = new Model(that.sdk, {
- id: 'model' + index,
- show: that.options.show,
- url: that.options.url,
- position: item,
- rotate: that.options.type == '点' ? undefined : { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) }
- })
- that.pointArr.push(model)
- })
+ let params = {
+ type: that.options.type,
+ positions: posiArr,
+ rotate: that.options.type == '点' ? undefined : array[1]
+ }
+ that.callback(params)
+ // posiArr.forEach((item, index) => {
+ // let model = new Model(that.sdk, {
+ // id: 'model' + index,
+ // show: that.options.show,
+ // url: that.options.url,
+ // position: item,
+ // rotate: that.options.type == '点' ? undefined : { x: 0, y: 0, z: array[1] && (array[1][index] || array[1]) }
+ // })
+ // that.pointArr.push(model)
+ // })
}
async linePoint(polygonPositions, spacing) {
let boundaryPoints = [];
@@ -399,8 +405,8 @@ class BatchModel extends Base {
break;
}
Draw && Draw.start((a, positions) => {
- this.options.positions = positions
- this.callback(this.options);
+ this.options.positions = positions;
+ // this.callback(this.options);
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
})
From 0f518ef6cbf9f94e1f5e2ae3e97c02e743e0ac80 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 22 Aug 2025 10:14:12 +0800
Subject: [PATCH 12/23] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E5=9B=BE=E7=89=87=E8=AE=BE=E7=BD=AE=E4=B8=8A=E4=BC=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Element/richText.js | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/Obj/Element/richText.js b/src/Obj/Element/richText.js
index 072a599..c63614c 100644
--- a/src/Obj/Element/richText.js
+++ b/src/Obj/Element/richText.js
@@ -56,8 +56,8 @@ class richText {
MENU_CONF: {
uploadImage: {
fieldName: 'file',
- maxFileSize: 50 * 1024 * 1024,
- base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64
+ // maxFileSize: 50 * 1024 * 1024,
+ // base64LimitSize: 50 * 1024 * 1024, // 50M 以下插入 base64
server: this.uploadImageServer,
// // 上传之前触发
// onBeforeUpload(file) { // TS 语法
@@ -95,18 +95,18 @@ class richText {
// console.log(`${file.name} 上传出错`, err, res)
// },
- // // 自定义上传
- // async customUpload(file, insertFn) { // TS 语法
- // // async customUpload(file, insertFn) { // JS 语法
- // // file 即选中的文件
- // // 自己实现上传,并得到图片 url alt href
- // // 最后插入图片
- // console.log(file, insertFn)
- // insertFn(url, file.name)
- // }
+ // 自定义上传
+ async customUpload(file, insertFn) { // TS 语法
+ // async customUpload(file, insertFn) { // JS 语法
+ // file 即选中的文件
+ // 自己实现上传,并得到图片 url alt href
+ // 最后插入图片
+ let url = await _this.upload(file)
+ insertFn((_this.host = _this.host || getHost()) + '/' + url)
+ }
},
uploadVideo: {
- maxFileSize: 500 * 1024 * 1024,
+ // maxFileSize: 500 * 1024 * 1024,
server: this.uploadVideoServer,
allowedFileTypes: ['video/mp4', 'video/mp3', 'video/ogg', 'video/webm', 'video/avi'],
// 自定义上传
From 8025a298a2af08ad62464469553968bf8a651245 Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 22 Aug 2025 14:23:06 +0800
Subject: [PATCH 13/23] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BA=BF=E6=AE=B5?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE=E8=83=8C=E6=99=AF=E4=BF=AE=E6=94=B9=E6=97=A0?=
=?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E6=8F=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/Obj/Base/PolylineObject/index.js | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/Obj/Base/PolylineObject/index.js b/src/Obj/Base/PolylineObject/index.js
index e184417..df4e412 100644
--- a/src/Obj/Base/PolylineObject/index.js
+++ b/src/Obj/Base/PolylineObject/index.js
@@ -825,7 +825,6 @@ class PolylineObject extends Base {
set labelLineColor(v) {
this.options.label.lineColor = v
this.label.lineColor = v
- let _this = this
if (this._elms.labelLineColor) {
this._elms.labelLineColor.forEach((item, i) => {
let lineColorPicker = new YJColorPicker({
@@ -840,6 +839,29 @@ class PolylineObject extends Base {
}, //点击确认按钮事件回调
clear: () => {
this.labelLineColor = 'rgba(0,255,255,0.5)'
+ } //点击清空按钮事件回调
+ })
+ this._elms.labelLineColor[i] = lineColorPicker
+ })
+ }
+ }
+
+ get labelBackgroundColorStart() {
+ return this.options.label.backgroundColor[0]
+ }
+ set labelBackgroundColorStart(v) {
+ this.options.label.backgroundColor[0] = v
+ this.label.backgroundColor = [v, this.label.backgroundColor[1]]
+ if (this._elms.labelBackgroundColorStart) {
+ this._elms.labelBackgroundColorStart.forEach((item, i) => {
+ let labelBackgroundColorStartPicker = new YJColorPicker({
+ el: item.el,
+ size: 'mini', //颜色box类型
+ alpha: true, //是否开启透明度
+ defaultColor: this.labelBackgroundColorStart,
+ disabled: false, //是否禁止打开颜色选择器
+ openPickerAni: 'opacity', //打开颜色选择器动画
+ sure: color => {
this.labelBackgroundColorStart = color
}, //点击确认按钮事件回调
clear: () => {
@@ -848,7 +870,7 @@ class PolylineObject extends Base {
})
this._elms.labelBackgroundColorStart[
i
- ] = _this.labelBackgroundColorStartPicker
+ ] = labelBackgroundColorStartPicker
})
}
}
From 80869050e1a00eeeaa01fc26540aa98c033b3fbe Mon Sep 17 00:00:00 2001
From: zh <972939975@qq.com>
Date: Fri, 22 Aug 2025 14:26:14 +0800
Subject: [PATCH 14/23] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E5=AD=97=E4=BD=93?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../fonts/PangMenZhengDaoBiaoTiTi-1.ttf | Bin 1915800 -> 1028572 bytes
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/static/custom/fonts/PangMenZhengDaoBiaoTiTi-1.ttf b/static/custom/fonts/PangMenZhengDaoBiaoTiTi-1.ttf
index 61d491d8c20b2da92309223fc23066ae338b7a7c..cd65b624d9d83939890b33cbcc57a239e864092f 100644
GIT binary patch
literal 1028572
zcma&P2V9d^_XnPHBZL465C|x;VuT=DR!~8vxD`;G%mhW;vo5OQKp{9l+;v+=-BoL+
zRjbvvb!(Tkt!=ff9k1Pe+wxrh=iDa&`+ML2|ML%dk`R*T-h1x3=X}rioco{vg+k%3
zSfo%YGIECW?Tx>I!sGZIe0J%bH+V>><+rg4kE16Q3KleYNNoJ13p1EPJMVk^dzp1o
z`P9;xKXz7V=MPXQs-{*>oICc)XI~lcZ&wtW50;J_Q(h4o%f>6TUDn`x$>Z=1mot9b
z@%xwY_s-)c&73p;L`xw49e>YPOq^mZuMH>-QD{D#iob_UDxWje=c3|c{5=mpA2PXo
z(wK&BnmY>ZgVz-b<*unyX3U&C`_1zT?Kfo##igMNS4HuYnXp+|grm_abc!HFXGM%6
zQIVm@QS?zLoD5zDWs=dHkYv;+sPtxhq9Y+GL2tCbrgy}j_2O^xyRGkd;|IO)fX)0Z
zNE@k}40{dBDzf%w;k^PMpU=!PR8$xY4a#p?iVd*_yswxx?eMe|
zzu3HK%PX=vb;~svLJf;M<&Im7&v=(Ui)B8Y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