Compare commits

...

12 Commits

Author SHA1 Message Date
8f41d5907a 修改 2025-08-27 00:54:13 +08:00
9866588986 修改 2025-08-26 22:04:26 +08:00
5ab4a3b925 修改 2025-08-26 21:58:11 +08:00
zh
2604512f47 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-26 21:54:59 +08:00
zh
0bb1e5bd54 判断 2025-08-26 21:54:47 +08:00
5d6679d919 Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-26 21:54:27 +08:00
41c132e506 修改 2025-08-26 21:54:24 +08:00
zh
09f760b10a Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-26 21:03:40 +08:00
zh
b0619e1b31 油耗显隐重置 2025-08-26 21:03:15 +08:00
43a4fca804 修改 2025-08-26 19:59:57 +08:00
53e692f6ca Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop 2025-08-26 19:10:00 +08:00
dd1855002f 修改同步 2025-08-26 19:09:53 +08:00
5 changed files with 94 additions and 75 deletions

View File

@ -46,7 +46,7 @@ class BatchModel extends Base {
this._EventBinding = new EventBinding()
this._elms = {};
this.pointArr = []
this.sdk.addIncetance(this.options.id, this)
// this.sdk.addIncetance(this.options.id, this)
let tools = new Tools(sdk)
// BatchModel.computeDis(this)
// if (this.options.positions.length > 0 || this.options.positions.lng) {
@ -58,6 +58,7 @@ class BatchModel extends Base {
// BatchModel.computeDis(this)
let Draw
console.log('kkkkk')
switch (options.type) {
case '点':
Draw = new DrawPoint(this.sdk)
@ -73,34 +74,37 @@ class BatchModel extends Base {
}
Draw && Draw.start((a, positions) => {
this.options.positions = positions;
console.log('uuuuuu')
//判断范围是否过大
if (options.type == '面') {
let posi = positions.map(v => {
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
})
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
let num1 = dis1 / this.options.spacing
let num2 = dis2 / this.options.spacing
if (num1 * num2 > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return;
}
} else if (options.type == '线') {
let posi = positions.map(v => {
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
})
let dis = 0
for (let i = 0; i < posi.length - 2; i++) {
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
}
if (dis / this.options.spacing > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return;
if (positions.length != 0 || positions.lng) {
if (options.type == '面') {
let posi = positions.map(v => {
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
})
let dis1 = Cesium.Cartesian3.distance(posi[0], posi[1])
let dis2 = Cesium.Cartesian3.distance(posi[1], posi[2])
let num1 = dis1 / this.options.spacing
let num2 = dis2 / this.options.spacing
if (num1 * num2 > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return;
}
} else if (options.type == '线') {
let posi = positions.map(v => {
return Cesium.Cartesian3.fromDegrees(v.lng, v.lat)
})
let dis = 0
for (let i = 0; i < posi.length - 2; i++) {
dis += Cesium.Cartesian3.distance(posi[i], posi[i + 1])
}
if (dis / this.options.spacing > 100) {
tools.message({ type: 'warning', text: '数量大于100请重新绘制' })
return;
}
}
// this.callback(this.options);
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
}
// this.callback(this.options);
(this.options.positions.length || this.options.positions.lng) && BatchModel.computeDis(this)
})
} else {
@ -115,51 +119,59 @@ class BatchModel extends Base {
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 = 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) => {
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
if (that.options.positions.length != 0) {
that.options.positions.forEach(item => {
fromDegreesArray.push(item.lng, item.lat)
})
})
// arr = that.generateInterpolatedPoints(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) => {
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 = await 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
if (that.options.positions.length != 0) {
that.options.positions.forEach(item => {
fromDegreesArray.push(item.lng, item.lat)
})
})
array = await 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 == '点') {
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
if (that.options.positions.lng) {
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
}
}
let params = {
type: that.options.type,

View File

@ -33,7 +33,7 @@ class TextBox extends Base {
this.callback = callback
// syncData(this.sdk, this.options.id)
syncData(this.sdk, this.options.id)
}
@ -134,15 +134,17 @@ class TextBox extends Base {
}
async getwords(words) {
this.options.text = words
this.callback(this.options)
let { sdkP } = getSdk()
if (this.sdk === sdkP && sdkP) {//三维
this.callback(this.options)
syncData(this.sdk, this.options.id)
}
else if (sdkP) {//二维
sdkP.entityMap.get(this.options.id).text = words
sdkP.entityMap.get(this.options.id).twoToThree(this.options.position)
} else if (!sdkP) {
this.callback(this.options)
syncData(this.sdk, this.options.id)
}
}
@ -283,6 +285,7 @@ class TextBox extends Base {
this.sdk.viewer.cesiumWidget.container.removeChild(this.textDom);
}
await this.sdk.removeIncetance(this.options.id)
syncData(this.sdk, this.options.id)
}
flicker() { }

View File

@ -187,7 +187,7 @@ function html() {
<div class="col">
<span class="label">油耗</span>
<div class="input-number input-number-unit-6" style="width: 170px;">
<input class="input" type="number" title="" min="1" max="99999999" @model="unitFuelConsumption">
<input class="input" type="number" title="" min="0" max="99999999" @model="unitFuelConsumption">
<span class="unit">L/100km</span>
<span class="arrow"></span>
</div>

View File

@ -2324,7 +2324,7 @@ class TrajectoryMotion extends Base {
this.model && (this.model.show = false)
}
this.labelShow = this.originalOptions.label.show
this.fuelLabelShow = this.originalOptions.fuelShow
this.fuelShow = this.originalOptions.fuelShow
this.labelColor = this.originalOptions.label.color
this.labelFontSize = this.originalOptions.label.fontSize
this.labelFontFamily = this.originalOptions.label.fontFamily

View File

@ -441,10 +441,14 @@ class YJEarth {
textList[i].querySelector('textarea').focus()
_this.isLeftClick = true
_this.entityMap.get(_this.clickTextDom.id).isClick(movement.position, _this.clickTextDom.id)
_this.blurFun = () => {
_this.entityMap.get(_this.clickTextDom.id).isClick((movement && movement.position) || null, _this.clickTextDom.id)
// let { sdkP } = getSdk()
// if (_this == sdkP && sdkP) {//二维
// _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
// } else if (!sdkP) {
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
// }
_this.clickTextDom.querySelector('textarea').removeEventListener('blur', _this.blurFun)
}
_this.clickTextDom.querySelector('textarea').addEventListener('blur', _this.blurFun)
break;
@ -468,7 +472,7 @@ class YJEarth {
click = true
}
mousemove = function (e) {
if (!click) {
if (!click || !_this.clickTextDom) {
return
}
let width = _this.clickTextDom.clientWidth * 1
@ -501,7 +505,7 @@ class YJEarth {
_this.clickTextDom.removeEventListener('mousedown', mousedown);
_this.viewer._element.removeEventListener('mousemove', mousemove);
_this.viewer._element.removeEventListener('mouseup', mouseup);
_this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
// _this.entityMap.get(_this.clickTextDom.id).getwords(_this.clickTextDom.getElementsByTagName('textarea')[0].value)
_this.clickTextDom.style['pointer-events'] = 'none'
_this.clickTextDom = undefined