修改点线面默认样式
This commit is contained in:
@ -23,7 +23,7 @@ class CircleObject extends Base {
|
||||
* @param options.id {string} 标注id
|
||||
* @param options.name {string} 名称
|
||||
* @param options.show=true {boolean} 显示/隐藏
|
||||
* @param options.color="#36c4ff" {string} 颜色
|
||||
* @param options.color="#ff000080" {string} 颜色
|
||||
* @param options.center {object} 位置
|
||||
* @param options.center.lng {object} 经度
|
||||
* @param options.center.lat {object} 纬度
|
||||
@ -31,21 +31,21 @@ class CircleObject extends Base {
|
||||
* @param options.radius=10 {object}半径
|
||||
* @param options.line {object} 边框
|
||||
* @param options.line.width=2 {string} 边框宽
|
||||
* @param options.line.color="rgba(155, 155, 124, 0.89)" {string} 边框颜色
|
||||
* @param options.line.color="#ff000080" {string} 边框颜色
|
||||
* @param options.label {object} 标注
|
||||
* @param options.heightMode=2{number} 高度模式(0:海拔高度;1:相对地表;2:依附模式)
|
||||
*/
|
||||
constructor(sdk, options = {}) {
|
||||
super(sdk, options);
|
||||
this.options.name = options.name || '未命名对象'
|
||||
this.options.color = options.color || "#36c4ff"
|
||||
this.options.color = options.color || "#ff000080"
|
||||
this.options.heightMode = (options.heightMode || options.heightMode == 0) ? options.heightMode : 2
|
||||
this.options.radius = (options.radius || options.radius === 0) ? options.radius : 10
|
||||
this.options.show = (options.show || options.show === false) ? options.show : true
|
||||
this.options.center = options.center || {}
|
||||
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'] || '平方米'
|
||||
options.label = options.label || {}
|
||||
this._elms = {};
|
||||
@ -58,8 +58,8 @@ class CircleObject 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,
|
||||
@ -216,14 +216,14 @@ class CircleObject 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
|
||||
@ -233,14 +233,14 @@ class CircleObject 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
|
||||
@ -252,25 +252,25 @@ class CircleObject 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
|
||||
@ -282,8 +282,8 @@ class CircleObject 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
|
||||
})
|
||||
@ -478,7 +478,7 @@ class CircleObject 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