polygon 加outline最多只能是1px,定义宽度得用polyline
env_draw_polygon(options = {}) {
let e = options.e;
console.log('draw_polygon----3333', options);
let defaultLocalName = options.defaultLocalName;
let polygon_point_arr = e.gps;
this.init();
let colorMaterial;
let color = options.e.color;
console.log('111polygon_point_arr1', polygon_point_arr);
colorMaterial = Cesium.Color.fromBytes(color.r, color.g, color.b, 200);
if (defaultLocalName == e.classId) {
colorMaterial = Cesium.Color.RED.withAlpha(0.9);
}
let centerGps = e.centerGps;
if (polygon_point_arr.length >= 3) {
let cartesianArr = [];
polygon_point_arr.map(item => {
cartesianArr.push(this.transformWGS84ToCartesian(item, 0));
});
// console.log(' e.id ---', cartesianArr);
let MassifEntity = new Cesium.Entity({ id: e.id, idInfo: e.id ,classId:e.classId});
MassifEntity.rgbColor=color
MassifEntity.polygon = {
hierarchy: new Cesium.CallbackProperty(() => {
return new Cesium.PolygonHierarchy(cartesianArr);
}, false),
extrudedHeight: 0, // 多边体的高度(多边形拉伸高度)
// height: 10, // 多边形离地高度
// material: Cesium.Color.RED.withAlpha(0.5),
// Cesium.Color.fromCssColorString('#ffff00')
material: Cesium.Color.RED.withAlpha(0.01),
// outlineColor: colorMaterial,
// outlineColor: Cesium.Color.RED,
// outline: true,
outlineWidth: 3,
};
MassifEntity.polyline = {
positions:cartesianArr,
width: MassifEntity.polygon.outlineWidth,
material: colorMaterial,
}
MassifEntity.position = this.transformWGS84ToCartesian(centerGps, 0);
MassifEntity.label = {
text: this.getTextEnvMap(e),
show: false,
showBackground: true,
font: '14px monospace',
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
pixelOffset: new Cesium.Cartesian2(-20, -30), //left top
};
this._drawMassifLayer.entities.add(MassifEntity);
}
}