This commit is contained in:
zh
2025-12-17 18:06:13 +08:00
parent 61f93a81f2
commit 27543a3eae
18 changed files with 146 additions and 117 deletions

View File

@ -35,7 +35,7 @@ class Profile extends Draw {
let car = undefined
that.event.mouse_left(async (movement, cartesian) => {
try {
that.tip.setText('左键点击确定终点位置,右键点击取消绘制!')
that.tip.set_text('左键点击确定终点位置,右键点击取消绘制!')
if (!that.entityHasCreated) {
Profile.create_polyline(that)
}

View File

@ -1397,7 +1397,7 @@ class AssembleObject extends Base {
this.previous = null
this.positionEditing = false
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1510,7 +1510,7 @@ class AssembleObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
@ -1644,18 +1644,20 @@ class AssembleObject extends Base {
let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values]
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
]
})
setTimeout(() => {
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
]
})
}, 200);
setTimeout(() => {

View File

@ -1416,7 +1416,7 @@ class AttackArrowObject extends Base {
}
this.positionEditing = false
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1530,7 +1530,7 @@ class AttackArrowObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
@ -1757,18 +1757,20 @@ class AttackArrowObject extends Base {
let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values]
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
]
})
setTimeout(() => {
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
]
})
}, 200);
setTimeout(() => {
this.event.mouse_left(leftEvent)

View File

@ -466,7 +466,6 @@ class Model extends BaseModel {
return this.options.name
}
set name(v) {
console.log(v, 'vvvvvvvvv')
this.options.name = v
this.options.label.text = v
this.label && (this.label.text = v)
@ -506,14 +505,14 @@ class Model extends BaseModel {
set lng(v) {
this.options.position = {
lng: v,
lng: Number(Number(v).toFixed(8)),
lat: this.options.position.lat,
alt: this.options.position.alt
}
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
this._elms.lng && this._elms.lng.forEach((item) => {
item.value = v
item.value = this.options.position.lng
})
}
@ -524,13 +523,13 @@ class Model extends BaseModel {
set lat(v) {
this.options.position = {
lng: this.options.position.lng,
lat: v,
lat: Number(Number(v).toFixed(8)),
alt: this.options.position.alt
}
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
this._elms.lat && this._elms.lat.forEach((item) => {
item.value = v
item.value = this.options.position.lat
})
}
@ -542,12 +541,12 @@ class Model extends BaseModel {
this.options.position = {
lng: this.options.position.lng,
lat: this.options.position.lat,
alt: v
alt: Number(Number(v).toFixed(2))
}
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this.label && (this.label.position = [Number(this.options.position.lng), Number(this.options.position.lat), Number(this.options.position.alt)])
this._elms.alt && this._elms.alt.forEach((item) => {
item.value = v
item.value = this.options.position.alt
})
}
@ -593,10 +592,10 @@ class Model extends BaseModel {
}
set rotateX(v) {
this.options.rotate.x = v
this.options.rotate.x = Number(Number(v).toFixed(2))
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this._elms.rotateX && this._elms.rotateX.forEach((item) => {
item.value = v
item.value = this.options.rotate.x
})
}
@ -605,10 +604,10 @@ class Model extends BaseModel {
}
set rotateY(v) {
this.options.rotate.y = v
this.options.rotate.y = Number(Number(v).toFixed(2))
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this._elms.rotateY && this._elms.rotateY.forEach((item) => {
item.value = v
item.value = this.options.rotate.y
})
}
@ -617,10 +616,10 @@ class Model extends BaseModel {
}
set rotateZ(v) {
this.options.rotate.z = v
this.options.rotate.z = Number(Number(v).toFixed(2))
this.updateModel(this.options.position.lng, this.options.position.lat, this.options.position.alt, this.options.rotate.x, this.options.rotate.y, this.options.rotate.z, this.options.scale)
this._elms.rotateZ && this._elms.rotateZ.forEach((item) => {
item.value = v
item.value = this.options.rotate.z
})
}

View File

@ -127,7 +127,8 @@ class BaseTileset extends BaseSource {
progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
dynamicScreenSpaceErrorFactor: 1,
dynamicScreenSpaceError: true // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
dynamicScreenSpaceError: true, // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
backFaceCulling: false, // 开启后,会剔除掉模型的背面,提升性能体验
}
let tileset
if (Number(Cesium.VERSION.split('.')[1]) >= 107) {

View File

@ -72,6 +72,9 @@ class BatchModel extends Base {
break;
}
Draw && Draw.start((a, positions) => {
if(!positions) {
return
}
this.options.positions = positions;
//判断范围是否过大
if (options.type == '面') {
@ -156,8 +159,8 @@ class BatchModel extends Base {
})
})
} 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 }]
// 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: that.options.positions.alt }]
// posiArr = [that.options.positions]
that.pointArr = posiArr
}

View File

@ -1509,7 +1509,7 @@ class CircleObject extends Base {
height
]
})
}, 50);
}, 200);
setTimeout(() => {
this.event.mouse_left((movement, cartesian) => {

View File

@ -545,7 +545,7 @@ class EllipseObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
@ -1344,7 +1344,7 @@ class EllipseObject extends Base {
center: this.deepCopyObj(this.options.center)
}
this.positionEditing = false
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1571,20 +1571,22 @@ class EllipseObject extends Base {
that.heightMode = that.heightMode
cb('', {...this.options.center})
cb('', { ...this.options.center })
})
that.getClampToHeight({
lng: that.center.lng,
lat: that.center.lat
}, objectsToExclude).then(height => {
that.label && (that.label.position = [
that.center.lng,
that.center.lat,
height
])
})
setTimeout(() => {
that.getClampToHeight({
lng: that.center.lng,
lat: that.center.lat
}, objectsToExclude).then(height => {
that.label && (that.label.position = [
that.center.lng,
that.center.lat,
height
])
})
}, 200);
createNodePoints(positions[0], 'semiMajorAxis')
createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis')
createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis')
@ -1611,7 +1613,7 @@ class EllipseObject extends Base {
}
}
closeNodeEdit() {
closeNodeEdit() {
YJ.Measure.SetMeasureStatus(false)
this.event && this.event.destroy()
this.tip && this.tip.destroy()

View File

@ -1432,7 +1432,7 @@ class PincerArrowObject extends Base {
}
this.positionEditing = false
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1546,7 +1546,7 @@ class PincerArrowObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
@ -1686,18 +1686,20 @@ class PincerArrowObject extends Base {
let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values]
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
]
})
setTimeout(() => {
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
]
})
}, 200);
createNodePoints()
}, 200);
async function createNodePoints() {

View File

@ -1731,6 +1731,7 @@ class PolygonObject extends Base {
let added = false
let leftEvent = async (movement, cartesian) => {
let objectsToExclude = [...this.sdk.viewer.entities.values]
if (selectPoint) {
this.options.positions[selectPoint.index] = this.cartesian3Towgs84(
cartesian,
@ -1739,7 +1740,7 @@ class PolygonObject extends Base {
originalPosition = this.options.positions[selectPoint.index]
added = true
let potHeight = await this.getClampToHeight(
this.options.positions[selectPoint.index]
this.options.positions[selectPoint.index], objectsToExclude
)
let entity = this.sdk.viewer.entities.add({
name: 'node-secondary-edit-point',
@ -1773,7 +1774,6 @@ class PolygonObject extends Base {
)
newpositions = Cesium.Cartesian3.fromDegreesArray(fromDegreesArray)
let objectsToExclude = [...this.sdk.viewer.entities.values]
if (this.options.positions.length < 3) {
this
.getClampToHeight({
@ -1966,7 +1966,8 @@ class PolygonObject extends Base {
])
let polygon = turf.polygon(positions)
let centroid = turf.centroid(polygon)
this
setTimeout(() => {
this
.getClampToHeight({
lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1]
@ -1978,6 +1979,7 @@ class PolygonObject extends Base {
height
]
})
}, 200);
}
setTimeout(() => {

View File

@ -1440,7 +1440,7 @@ class SectorObject extends Base {
center: this.deepCopyObj(this.options.center)
}
this.positionEditing = false
if(this._positionEditingCallback) {
if (this._positionEditingCallback) {
this._positionEditingCallback()
this._positionEditingCallback = null
}
@ -1520,7 +1520,7 @@ class SectorObject extends Base {
return this._areaChangeCallBack
}
set areaChangeCallBack (cd) {
set areaChangeCallBack(cd) {
this._areaChangeCallBack = cd
}
@ -1597,18 +1597,20 @@ class SectorObject extends Base {
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
]
let objectsToExclude = [...that.sdk.viewer.entities.values]
that
.getClampToHeight({
lng: that.options.center.lng,
lat: that.options.center.lat
}, objectsToExclude)
.then(height => {
that.label.position = [
that.options.center.lng,
that.options.center.lat,
height
]
})
setTimeout(() => {
that
.getClampToHeight({
lng: that.options.center.lng,
lat: that.options.center.lat
}, objectsToExclude)
.then(height => {
that.label.position = [
that.options.center.lng,
that.options.center.lat,
height
]
})
}, 200);
setTimeout(() => {
createNodePoints(positions[1], 'sector-start')
createNodePoints(positions[positions.length - 4], 'sector-end')
@ -1681,7 +1683,7 @@ class SectorObject extends Base {
that.heightMode = that.heightMode
cb('', {...that.options.center})
cb('', { ...that.options.center })
})
}, 200);
async function createNodePoints(pos, type) {

View File

@ -1618,7 +1618,7 @@ class StraightArrowObject extends Base {
_addRr() {
if (this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value) {
this.options.attribute.vr.content.push({
name: '全景图' ,
name: '全景图',
url: this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value
})
this._DialogObject._element.content.getElementsByClassName('vr_add')[0].value = ''
@ -1631,7 +1631,7 @@ class StraightArrowObject extends Base {
addAttributeRr(vr) {
this.options.attribute.vr.content.push({
name: '全景图' ,
name: '全景图',
url: vr
})
this.attributeVr = this.options.attribute.vr.content
@ -2191,18 +2191,20 @@ class StraightArrowObject extends Base {
let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...that.sdk.viewer.entities.values]
that
.getClampToHeight({
lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1]
}, objectsToExclude)
.then(height => {
that.label.position = [
centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1],
height
]
})
setTimeout(() => {
that
.getClampToHeight({
lng: centroid.geometry.coordinates[0],
lat: centroid.geometry.coordinates[1]
}, objectsToExclude)
.then(height => {
that.label.position = [
centroid.geometry.coordinates[0],
centroid.geometry.coordinates[1],
height
]
})
}, 200);
createNodePoints()
}, 200);
async function createNodePoints() {

View File

@ -615,14 +615,14 @@ class StandText extends Base {
if(isAdd) {
this.options.positions.splice(selectPoint.index, 1)
}
if (!that.options.positions || that.options.positions.length < 2) {
if (!this.options.positions || this.options.positions.length < 2) {
console.warn('最少需要两个坐标!')
window.ELEMENT && window.ELEMENT.Message({
message: '最少需要两个坐标!',
type: 'warning',
duration: 1500
});
that.options.positions = [...previous]
this.options.positions = [...previous]
}
cb(null, this.options.positions)
}

View File

@ -642,7 +642,7 @@ class TrajectoryMotion extends Base {
set state(v) {
this.options.state = v
cancelAnimationFrame(this._requestAnimationFrameEventId)
if (this.editObj) {
if (this.options.state && this.editObj) {
this.editObj.destroy()
this.editObj = null
if (this._DialogObject && this._DialogObject._element && this._DialogObject._element.content) {
@ -1573,11 +1573,15 @@ class TrajectoryMotion extends Base {
animateUpdate
)
if (_this.options.firstPersonView) {
let targetHeading = _this.model.heading + 90 + _this.firstPersonHeadingPitch.heading
if(!_this.routeDirection) {
targetHeading = 180 - targetHeading
}
let positionCamera = { ..._this.sdk.viewer.camera._position }
_this.sdk.viewer.camera.setView({
destination: positionCamera,
orientation: {
heading: Cesium.Math.toRadians(_this.model.heading + 90 + _this.firstPersonHeadingPitch.heading),
heading: Cesium.Math.toRadians(targetHeading),
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
roll: 0
}
@ -1805,10 +1809,14 @@ class TrajectoryMotion extends Base {
if (_this.viewFollow) {
// console.log(Cesium.Math.toDegrees(_this.sdk.viewer.camera.pitch))
if (_this.options.firstPersonView) {
let targetHeading = heading + 90 + _this.firstPersonHeadingPitch.heading
if(!_this.routeDirection) {
targetHeading = 180 - targetHeading
}
_this.sdk.viewer.camera.setView({
destination: positionCamera,
orientation: {
heading: Cesium.Math.toRadians(heading + 90 + _this.firstPersonHeadingPitch.heading),
heading: Cesium.Math.toRadians(targetHeading),
pitch: Cesium.Math.toRadians(_this.firstPersonHeadingPitch.pitch),
roll: 0
}
@ -2296,6 +2304,7 @@ class TrajectoryMotion extends Base {
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].innerHTML = '开始调整'
this._DialogObject._element.content.getElementsByClassName('model-rotate-btn')[0].className = 'btn model-rotate-btn'
}
return false
}
else {
if (this.viewFollow) {
@ -2344,6 +2353,8 @@ class TrajectoryMotion extends Base {
Cesium.Matrix4.multiply(originalMatrix, rotationY, originalMatrix)
Cesium.Matrix4.multiply(originalMatrix, rotationZ, this.entity.modelMatrix)
}
return true
}
}
@ -2384,7 +2395,7 @@ class TrajectoryMotion extends Base {
// maximumScale: 100000,
}
const getAnimationsList = () => {
if (this.options.model.url === this.originalOptions.model.url) {
if (this.originalOptions && this.options.model.url === this.originalOptions.model.url) {
this.modelAnimate = this.originalOptions.model.animate
}
else {

View File

@ -1342,7 +1342,7 @@ class WallRealStereoscopic extends Base {
}
material = new Cesium.CustomMaterialSource({
image: this.getSourceRootPath() + `/img/material/${img}.png`,
image: this.getSourceRootPath() + `/img/material/${img}.jpg`,
color: this.options.color,
is2D: false,
repeats: new Cesium.CallbackProperty(() => {

View File

@ -8,7 +8,7 @@ let fontData = [
{
name: '思源黑体',
value: '思源黑体',
font: 'SourceHanSansTi',
font: 'SourceHanSansTiM',
key: '1'
},
{

View File

@ -200,7 +200,7 @@ class YJEarth {
let fontData = [
{
name: '思源黑体',
value: 'SourceHanSansTi',
value: 'SourceHanSansTiM',
url: tools.getSourceRootPath() + '/custom/fonts/SourceHanSansCN-Medium.otf',
format: 'opentype'
},

View File

@ -19,7 +19,7 @@
}
@font-face {
font-family: 'SourceHanSansTi';
font-family: 'SourceHanSansTiM';
src: url('../fonts/SourceHanSansCN-Medium.otf') format('opentype');
}
@ -528,6 +528,7 @@
overflow-y: auto;
scrollbar-gutter: stable;
width: calc(100% + 1px);
max-height: 233px;
}
.YJ-custom-base-dialog>.content .table .align-center,