Merge branch 'develop' of http://xny.yj-3d.com:3000/zh/sdk4.0 into develop

This commit is contained in:
zh
2025-08-22 17:50:51 +08:00
4 changed files with 60 additions and 21 deletions

View File

@ -122,6 +122,7 @@ class CurvelineObject extends Base {
this.operate = {} this.operate = {}
this.nodePoints = [] this.nodePoints = []
this.unitNum = 0 this.unitNum = 0
this.inputSpeed = (options.speed && Math.pow(options.speed, -1) * 100) || 10
this.Dialog = _Dialog this.Dialog = _Dialog
if (!this.options.positions || this.options.positions.length < 2) { if (!this.options.positions || this.options.positions.length < 2) {
this._error = '线段最少需要两个坐标!' this._error = '线段最少需要两个坐标!'
@ -151,7 +152,10 @@ class CurvelineObject extends Base {
set color(v) { set color(v) {
this.options.color = v || '#ff0000' this.options.color = v || '#ff0000'
// this.entity.polyline.material = this.getMaterial(v, this.options.type) // this.entity.polyline.material = this.getMaterial(v, this.options.type)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
if (this._elms.color) { if (this._elms.color) {
this._elms.color.forEach((item, i) => { this._elms.color.forEach((item, i) => {
let colorPicker = new YJColorPicker({ let colorPicker = new YJColorPicker({
@ -177,9 +181,13 @@ class CurvelineObject extends Base {
} }
set speed(v) { set speed(v) {
// this.options.speed = v this.options.speed = v
this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 // this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) this.inputSpeed = v !== 0 ? Math.pow(v, -1) * 100 : 0
let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get dashSize() { get dashSize() {
return this.options.dashSize return this.options.dashSize
@ -187,7 +195,10 @@ class CurvelineObject extends Base {
set dashSize(v) { set dashSize(v) {
this.options.dashSize = v this.options.dashSize = v
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get rotate() { get rotate() {
@ -212,7 +223,10 @@ class CurvelineObject extends Base {
set space(v) { set space(v) {
this.options.space = v this.options.space = v
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get length() { get length() {
@ -446,13 +460,15 @@ class CurvelineObject extends Base {
break break
} }
} }
let params = { ...this.options }
params.speed = this.inputSpeed
this.entity && this.entity &&
this.entity.polyline && this.entity.polyline &&
(this.entity.polyline.material = this.getMaterial( (this.entity.polyline.material = this.getMaterial(
this.options.color, this.options.color,
this.options.type, this.options.type,
this.entity, this.entity,
this.options params
)) ))
} }
get noseToTail() { get noseToTail() {
@ -1332,18 +1348,21 @@ class CurvelineObject extends Base {
positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray), positions: Cesium.Cartesian3.fromDegreesArrayHeights(fromDegreesArray),
width: that.options.width, width: that.options.width,
clampToGround: ground, clampToGround: ground,
material: that.getMaterial(that.options.color, that.options.type), // material: that.getMaterial(that.options.color, that.options.type),
zIndex: that.sdk._entityZIndex zIndex: that.sdk._entityZIndex
} }
}) })
that.entity.polyline.oriWidth = that.options.width that.entity.polyline.oriWidth = that.options.width
that.judgeLine(that.entity, that.options) that.judgeLine(that.entity, that.options)
let params = { ...that.options }
params.speed = that.inputSpeed
that.entity.polyline.material = that.getMaterial( that.entity.polyline.material = that.getMaterial(
that.options.color, that.options.color,
that.options.type, that.options.type,
that.entity, that.entity,
that.options params
) )
that.sdk._entityZIndex++ that.sdk._entityZIndex++

View File

@ -125,6 +125,7 @@ class PolylineObject extends Base {
this.operate = {} this.operate = {}
this.nodePoints = [] this.nodePoints = []
this.unitNum = 0 this.unitNum = 0
this.inputSpeed = (options.speed && Math.pow(options.speed, -1) * 100) || 10
this.Dialog = _Dialog this.Dialog = _Dialog
if (!this.options.positions || this.options.positions.length < 2) { if (!this.options.positions || this.options.positions.length < 2) {
this._error = '线段最少需要两个坐标!' this._error = '线段最少需要两个坐标!'
@ -153,7 +154,10 @@ class PolylineObject extends Base {
} }
set color(v) { set color(v) {
this.options.color = v || '#ff0000' this.options.color = v || '#ff0000'
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
if (this._elms.color) { if (this._elms.color) {
this._elms.color.forEach((item, i) => { this._elms.color.forEach((item, i) => {
let colorPicker = new YJColorPicker({ let colorPicker = new YJColorPicker({
@ -180,9 +184,13 @@ class PolylineObject extends Base {
} }
set speed(v) { set speed(v) {
// this.options.speed = v this.options.speed = v
this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0 this.inputSpeed = v !== 0 ? Math.pow(v, -1) * 100 : 0
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.options.speed = v !== 0 ? Math.pow(v, -1) * 100 : 0
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get dashSize() { get dashSize() {
return this.options.dashSize return this.options.dashSize
@ -190,7 +198,10 @@ class PolylineObject extends Base {
set dashSize(v) { set dashSize(v) {
this.options.dashSize = v this.options.dashSize = v
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get rotate() { get rotate() {
@ -206,7 +217,10 @@ class PolylineObject extends Base {
}) })
this.options.rotate = v this.options.rotate = v
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get space() { get space() {
@ -215,7 +229,10 @@ class PolylineObject extends Base {
set space(v) { set space(v) {
this.options.space = v this.options.space = v
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options) let params = { ...this.options }
params.speed = this.inputSpeed
// this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, this.options)
this.entity.polyline.material = this.getMaterial(this.options.color, this.options.type, this.entity, params)
} }
get length() { get length() {
@ -458,13 +475,15 @@ class PolylineObject extends Base {
break break
} }
} }
let params = { ...this.options }
params.speed = this.inputSpeed
this.entity && this.entity &&
this.entity.polyline && this.entity.polyline &&
(this.entity.polyline.material = this.getMaterial( (this.entity.polyline.material = this.getMaterial(
this.options.color, this.options.color,
this.options.type, this.options.type,
this.entity, this.entity,
this.options params
)) ))
} }
get noseToTail() { get noseToTail() {
@ -1371,11 +1390,13 @@ class PolylineObject extends Base {
that.entity.polyline.oriWidth = that.options.width that.entity.polyline.oriWidth = that.options.width
that.judgeLine(that.entity, that.options) that.judgeLine(that.entity, that.options)
let params = { ...that.options }
params.speed = that.inputSpeed
that.entity.polyline.material = that.getMaterial( that.entity.polyline.material = that.getMaterial(
that.options.color, that.options.color,
that.options.type, that.options.type,
that.entity, that.entity,
that.options params
) )
that.sdk._entityZIndex++ that.sdk._entityZIndex++
PolylineObject.createLabel(that) PolylineObject.createLabel(that)

View File

@ -53,7 +53,7 @@ class TextBox extends Base {
// 配置CSS样式和内容结构 // 配置CSS样式和内容结构
viewer.cesiumWidget.container.appendChild(dom); viewer.cesiumWidget.container.appendChild(dom);
let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng, that.options.position.lat, that.options.position.alt) let posi = Cesium.Cartesian3.fromDegrees(that.options.position.lng.toFixed(4), that.options.position.lat.toFixed(4), that.options.position.alt.toFixed(4))
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(
@ -85,7 +85,7 @@ class TextBox extends Base {
lat: latitude, lat: latitude,
alt: cartographic.height alt: cartographic.height
} }
let posi = Cesium.Cartesian3.fromDegrees(longitude, latitude, cartographic.height) let posi = Cesium.Cartesian3.fromDegrees(longitude.toFixed(4), latitude.toFixed(4), cartographic.height.toFixed(4))
that.handler = function () { that.handler = function () {
const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates( const position = Cesium.SceneTransforms.wgs84ToWindowCoordinates(

View File

@ -598,7 +598,6 @@ class Tools {
if (entity) { if (entity) {
arr[type + ''] ? (entity.polyline.width = entity.polyline.oriWidth + arr[type + '']) : (entity.polyline.width = entity.polyline.oriWidth) arr[type + ''] ? (entity.polyline.width = entity.polyline.oriWidth + arr[type + '']) : (entity.polyline.width = entity.polyline.oriWidth)
} }
switch (Number(type)) { switch (Number(type)) {
case 1: //虚线 case 1: //虚线