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 let car = undefined
that.event.mouse_left(async (movement, cartesian) => { that.event.mouse_left(async (movement, cartesian) => {
try { try {
that.tip.setText('左键点击确定终点位置,右键点击取消绘制!') that.tip.set_text('左键点击确定终点位置,右键点击取消绘制!')
if (!that.entityHasCreated) { if (!that.entityHasCreated) {
Profile.create_polyline(that) Profile.create_polyline(that)
} }

View File

@ -1644,6 +1644,7 @@ class AssembleObject extends Base {
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
setTimeout(() => {
this this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
@ -1656,6 +1657,7 @@ class AssembleObject extends Base {
height height
] ]
}) })
}, 200);
setTimeout(() => { setTimeout(() => {

View File

@ -1757,6 +1757,7 @@ class AttackArrowObject extends Base {
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
setTimeout(() => {
this this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
@ -1769,6 +1770,7 @@ class AttackArrowObject extends Base {
height height
] ]
}) })
}, 200);
setTimeout(() => { setTimeout(() => {
this.event.mouse_left(leftEvent) this.event.mouse_left(leftEvent)

View File

@ -466,7 +466,6 @@ class Model extends BaseModel {
return this.options.name return this.options.name
} }
set name(v) { set name(v) {
console.log(v, 'vvvvvvvvv')
this.options.name = v this.options.name = v
this.options.label.text = v this.options.label.text = v
this.label && (this.label.text = v) this.label && (this.label.text = v)
@ -506,14 +505,14 @@ class Model extends BaseModel {
set lng(v) { set lng(v) {
this.options.position = { this.options.position = {
lng: v, lng: Number(Number(v).toFixed(8)),
lat: this.options.position.lat, lat: this.options.position.lat,
alt: this.options.position.alt 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.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.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
this._elms.lng && this._elms.lng.forEach((item) => { 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) { set lat(v) {
this.options.position = { this.options.position = {
lng: this.options.position.lng, lng: this.options.position.lng,
lat: v, lat: Number(Number(v).toFixed(8)),
alt: this.options.position.alt 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.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.label && (this.label.position = [this.options.position.lng, this.options.position.lat, this.options.position.alt])
this._elms.lat && this._elms.lat.forEach((item) => { 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 = { this.options.position = {
lng: this.options.position.lng, lng: this.options.position.lng,
lat: this.options.position.lat, 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.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.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) => { 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) { 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.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) => { 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) { 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.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) => { 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) { 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.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) => { 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能够让初始加载变得模糊 progressiveResolutionHeightFraction: 0.5, // 数值偏于0能够让初始加载变得模糊
dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快 dynamicScreenSpaceErrorDensity: 0.1, // 数值加大,能让周边加载变快
dynamicScreenSpaceErrorFactor: 1, dynamicScreenSpaceErrorFactor: 1,
dynamicScreenSpaceError: true // 有了这个后,会在真正的全屏加载完之后才清晰化房屋 dynamicScreenSpaceError: true, // 有了这个后,会在真正的全屏加载完之后才清晰化房屋
backFaceCulling: false, // 开启后,会剔除掉模型的背面,提升性能体验
} }
let tileset let tileset
if (Number(Cesium.VERSION.split('.')[1]) >= 107) { if (Number(Cesium.VERSION.split('.')[1]) >= 107) {

View File

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

View File

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

View File

@ -1575,6 +1575,7 @@ class EllipseObject extends Base {
}) })
setTimeout(() => {
that.getClampToHeight({ that.getClampToHeight({
lng: that.center.lng, lng: that.center.lng,
lat: that.center.lat lat: that.center.lat
@ -1585,6 +1586,7 @@ class EllipseObject extends Base {
height height
]) ])
}) })
}, 200);
createNodePoints(positions[0], 'semiMajorAxis') createNodePoints(positions[0], 'semiMajorAxis')
createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis') createNodePoints(positions[(length - 2) / 4], 'semiMinorAxis')
createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis') createNodePoints(positions[(length - 2) / 2], 'semiMajorAxis')

View File

@ -1686,6 +1686,7 @@ class PincerArrowObject extends Base {
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...this.sdk.viewer.entities.values] let objectsToExclude = [...this.sdk.viewer.entities.values]
setTimeout(() => {
this this
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
@ -1698,6 +1699,7 @@ class PincerArrowObject extends Base {
height height
] ]
}) })
}, 200);
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {

View File

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

View File

@ -1597,6 +1597,7 @@ class SectorObject extends Base {
that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer) that.cartesian3Towgs84(positions[positions.length - 4], that.sdk.viewer)
] ]
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...that.sdk.viewer.entities.values]
setTimeout(() => {
that that
.getClampToHeight({ .getClampToHeight({
lng: that.options.center.lng, lng: that.options.center.lng,
@ -1609,6 +1610,7 @@ class SectorObject extends Base {
height height
] ]
}) })
}, 200);
setTimeout(() => { setTimeout(() => {
createNodePoints(positions[1], 'sector-start') createNodePoints(positions[1], 'sector-start')
createNodePoints(positions[positions.length - 4], 'sector-end') createNodePoints(positions[positions.length - 4], 'sector-end')

View File

@ -2191,6 +2191,7 @@ class StraightArrowObject extends Base {
let polygon = turf.polygon(points) let polygon = turf.polygon(points)
let centroid = turf.pointOnFeature(polygon) let centroid = turf.pointOnFeature(polygon)
let objectsToExclude = [...that.sdk.viewer.entities.values] let objectsToExclude = [...that.sdk.viewer.entities.values]
setTimeout(() => {
that that
.getClampToHeight({ .getClampToHeight({
lng: centroid.geometry.coordinates[0], lng: centroid.geometry.coordinates[0],
@ -2203,6 +2204,7 @@ class StraightArrowObject extends Base {
height height
] ]
}) })
}, 200);
createNodePoints() createNodePoints()
}, 200); }, 200);
async function createNodePoints() { async function createNodePoints() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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