修改点线面默认样式
This commit is contained in:
@ -25,7 +25,7 @@ class PolygonObject extends Base {
|
||||
* @param options.id {string} 唯一标识
|
||||
* @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 options.line {object} 边框
|
||||
@ -39,15 +39,15 @@ class PolygonObject 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.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||
this.options.positions = options.positions || []
|
||||
this.options.line = options.line || {}
|
||||
this.options.line.width = this.options.line.width || 2
|
||||
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 || 'rgba(155, 155, 124, 0.89)'
|
||||
this.options.line.color || '#ff000080'
|
||||
this.options['area-unit'] = options['area-unit'] || '平方米'
|
||||
this.entity
|
||||
this.event = new MouseEvent(this.sdk)
|
||||
@ -74,8 +74,8 @@ class PolygonObject extends Base {
|
||||
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
|
||||
@ -133,18 +133,18 @@ class PolygonObject 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
|
||||
}
|
||||
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) {
|
||||
this.heightMode = 0
|
||||
material = new Cesium.CustomColorMaterialSource({
|
||||
color: v
|
||||
color: this.options.color
|
||||
})
|
||||
}
|
||||
this.entity.polygon.material = material
|
||||
@ -154,14 +154,14 @@ class PolygonObject 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
|
||||
@ -269,25 +269,25 @@ class PolygonObject 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
|
||||
@ -299,8 +299,8 @@ class PolygonObject 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
|
||||
@ -504,7 +504,7 @@ class PolygonObject 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
|
||||
|
Reference in New Issue
Block a user