export default {
|
methods: {
|
// 获取字段
|
confirmAddress() {
|
Cesium.GeoJsonDataSource.load(this.data.urls).then(dataSource => {
|
let entity = dataSource.entities.values[0];
|
let properties = entity.properties.getValue();
|
this.fields = [];
|
for (let key in properties) {
|
this.fields.push(key);
|
}
|
}).catch(() => {
|
|
})
|
},
|
// 编辑矢量
|
editGeosjon(editType, geosjon) {
|
let type = this.data.class;
|
let value = Cesium.defaultValue(this.data[this.data.class][editType], this.data[editType])
|
if (this.polygonLabel && value === undefined) {
|
value = this.data.point[editType];
|
}
|
editType === 'size' && (editType = 'font_size');
|
editType === 'labelColor' && (editType = 'fillColor');
|
editType === 'pointHeight' && this.showModel && (editType = 'height');
|
editType === 'radiusScale' && (value /= 2);
|
|
if (editType === 'polygonLabel') {
|
editType = 'text';
|
value = this.polygonLabel ? this.data.text : '';
|
}
|
|
if (editType === 'color') {
|
if (type === 'point') {
|
editType = 'fillColor'
|
} else if (type !== 'model' && !this.effectLine) {
|
editType = 'material'
|
}
|
}
|
|
let data = {}
|
if (editType === 'pointType') {
|
if (this.pointType === 'label') {
|
data = {
|
text: this.data.text,
|
image: ''
|
}
|
} else if (this.pointType === 'billboard') {
|
data = {
|
image: this.data.image,
|
text: ''
|
}
|
} else {
|
data = {
|
text: this.data.text,
|
image: this.data.image
|
}
|
}
|
} else if (editType === 'IgnoreShelter') {
|
this.IgnoreShelter ? (data.disableDepthTestDistance = "Infinity") : (data.disableDepthTestDistance = 0);
|
} else if (editType === 'fontStyle') {
|
this.fontStyle.includes("bold") ? data.bold = true : data.bold = false;
|
this.fontStyle.includes("italic") ? data.italic = true : data.italic = false;
|
} else {
|
data[editType] = value
|
}
|
geosjon.updataGeosjon && geosjon.updataGeosjon(data);
|
},
|
// 还原
|
restore(vector) {
|
vector.restoreGeosjon && vector.restoreGeosjon()
|
}
|
}
|
}
|