修改点线面默认样式

This commit is contained in:
zh
2025-07-09 11:15:53 +08:00
parent c6aa99792f
commit ff4f823a27
29 changed files with 240 additions and 234 deletions

View File

@ -24,7 +24,7 @@ class PincerArrowObject extends Base {
* @param options {object} 属性
* @param options.show=true {boolean} 显示/隐藏
* @param options.name {string} 名称
* @param options.color="#36c4ff" {string} 颜色
* @param options.color="#ff000080" {string} 颜色
* @param options.height {number} 高度
* @param options.heightMode=2{number} 高度模式0海拔高度1相对地表2依附模式
* @param {Array.<object>} options.positions 坐标数组 [{lon,lat,alt},...]
@ -34,13 +34,13 @@ class PincerArrowObject extends Base {
constructor(sdk, options = {}, _Dialog = {}) {
super(sdk, options);
this.options.name = options.name || '未命名对象'
this.options.color = options.color || "#36c4ff"
this.options.color = options.color || "#ff000080"
this.options.show = (options.show || options.show === false) ? options.show : true
this.options.positions = options.positions || []
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
this.options.line = options.line || {}
this.options.line.width = this.options.line.width || 2
this.options.line.color = this.options.line.color || 'rgba(155, 155, 124, 0.89)'
this.options.line.width = ((this.options.line.width || this.options.line.width === 0) ? this.options.line.width : 3)
this.options.line.color = this.options.line.color || '#ff000080'
this.options['area-unit'] = options['area-unit'] || '平方米'
this.options.height = options.height
this.options.loop = options.loop || false
@ -62,8 +62,8 @@ class PincerArrowObject extends Base {
color: options.label.color || '#ffffff',
lineWidth: (options.label.lineWidth || options.label.lineWidth === 0) ? options.label.lineWidth : 4,
pixelOffset: (options.label.pixelOffset || options.label.pixelOffset === 0) ? options.label.pixelOffset : 20,
backgroundColor: options.label.backgroundColor || ['#42c6ef', '#42c6ef'],
lineColor: options.label.lineColor || '#fff000',
backgroundColor: options.label.backgroundColor || ['#00ffff80', '#00ffff80'],
lineColor: options.label.lineColor || '#00ffff80',
scaleByDistance: options.label.scaleByDistance || false,
near: (options.label.near || options.label.near === 0) ? options.label.near : 2000,
far: (options.label.far || options.label.far === 0) ? options.label.far : 100000,
@ -122,14 +122,14 @@ class PincerArrowObject extends Base {
return this.options.color
}
set color(v) {
this.options.color = v
this.options.color = v || '#ff000080'
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polygon) {
return
}
let material = Cesium.Color.fromCssColorString(v)
let material = Cesium.Color.fromCssColorString(this.options.color)
if (this.sdk.viewer.scene.mode === 2) {
material = new Cesium.CustomColorMaterialSource({
color: v
color: this.options.color
})
}
this.entity.polygon.material = material
@ -139,14 +139,14 @@ class PincerArrowObject extends Base {
el: item.el,
size: 'mini',//颜色box类型
alpha: true,//是否开启透明度
defaultColor: v,
defaultColor: this.options.color,
disabled: false,//是否禁止打开颜色选择器
openPickerAni: 'opacity',//打开颜色选择器动画
sure: (c) => {
this.color = c
},//点击确认按钮事件回调
clear: () => {
this.color = 'rgba(255,255,255,1)'
this.color = 'rgba(255,0,0,0.5)'
},//点击清空按钮事件回调
})
this._elms.color[i] = colorPicker
@ -253,25 +253,25 @@ class PincerArrowObject extends Base {
return this.options.line.color
}
set lineColor(v) {
this.options.line.color = v
this.options.line.color = v || '#ff000080'
if (!this.sdk || !this.sdk.viewer || !this.entity || !this.entity.polyline) {
return
}
this.entity.polyline.material = Cesium.Color.fromCssColorString(v)
this.entity.polyline.material = Cesium.Color.fromCssColorString(this.options.line.color)
if (this._elms.lineColor) {
this._elms.lineColor.forEach((item, i) => {
let lineColorPicker = new ewPlugins('colorpicker', {
el: item.el,
size: 'mini',//颜色box类型
alpha: true,//是否开启透明度
defaultColor: v,
defaultColor: this.options.line.color,
disabled: false,//是否禁止打开颜色选择器
openPickerAni: 'opacity',//打开颜色选择器动画
sure: (c) => {
this.lineColor = c
},//点击确认按钮事件回调
clear: () => {
this.lineColor = 'rgba(255,255,255,1)'
this.lineColor = 'rgba(255,0,0,0.5)'
},//点击清空按钮事件回调
})
this._elms.lineColor[i] = lineColorPicker
@ -283,10 +283,10 @@ class PincerArrowObject extends Base {
return this.options.line.width
}
set lineWidth(v) {
this.options.line.width = v
this.entity.polyline.width = v
this.options.line.width = ((v || v === 0) ? v : 3)
this.entity.polyline.width = this.options.line.width
this._elms.lineWidth && this._elms.lineWidth.forEach((item) => {
item.value = v
item.value = this.options.line.width
})
}
@ -479,7 +479,7 @@ class PincerArrowObject extends Base {
this.labelLineColor = color
},//点击确认按钮事件回调
clear: () => {
this.labelLineColor = 'rgba(255,255,255,1)'
this.labelLineColor = 'rgba(0,255,255,0.5)'
},//点击清空按钮事件回调
})
this._elms.labelLineColor[i] = lineColorPicker