|
|
|
|
@ -611,8 +611,9 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
|
|
|
|
|
// 通用样式修改函数:根据line_type_name修改现有style中的line-style
|
|
|
|
|
let update_line_style = |style: &mut String| {
|
|
|
|
|
println!("line_type_name:{line_type_name}");
|
|
|
|
|
// 只有当line_type_name需要虚线样式时才进行修改,提高性能
|
|
|
|
|
if line_type_name.contains("DASH") || line_type_name == "BORDURE" {
|
|
|
|
|
if line_type_name.contains("DASH") || line_type_name == "BORDURE" || line_type_name == "INTERROMPU" || line_type_name == "INTERROMPUx2" || line_type_name == "TRACECAD_ISO02W100" {
|
|
|
|
|
// 使用正则表达式替换line-style部分
|
|
|
|
|
if style.contains("line-style:") {
|
|
|
|
|
*style = style.replace(
|
|
|
|
|
@ -809,7 +810,6 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
line.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
line.scale(self.scale_fact.x, self.scale_fact.x);
|
|
|
|
|
|
|
|
|
|
line.x1 += self.offset.x;
|
|
|
|
|
@ -824,7 +824,7 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
if let Ok(mut ellipse) = Ellipse::try_from(polyline) {
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
ellipse.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
// TODO ellipse的粗体未实现
|
|
|
|
|
ellipse.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
|
|
|
|
|
ellipse.x += self.offset.x;
|
|
|
|
|
@ -836,7 +836,7 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
poly.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
// TODO poly的粗体未实现
|
|
|
|
|
poly.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
|
|
|
|
|
for cord in &mut poly.coordinates {
|
|
|
|
|
@ -855,6 +855,21 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
} else {
|
|
|
|
|
HexColor::from_u32(self.ent.common.color_24_bit as u32)
|
|
|
|
|
};
|
|
|
|
|
// === 获取weight ===
|
|
|
|
|
let mut lw: Option<i16> = None;
|
|
|
|
|
if lwpolyline.constant_width > 0.0 {
|
|
|
|
|
lw = Some((lwpolyline.constant_width * 100.0) as i16);
|
|
|
|
|
} else if let Some(v) = lwpolyline.vertices.get(0) {
|
|
|
|
|
let w = if v.starting_width > 0.0 {
|
|
|
|
|
v.starting_width
|
|
|
|
|
} else {
|
|
|
|
|
v.ending_width
|
|
|
|
|
};
|
|
|
|
|
if w > 0.0 {
|
|
|
|
|
lw = Some((w * 100.0) as i16);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// ===============================
|
|
|
|
|
|
|
|
|
|
match lwpolyline.vertices.len() {
|
|
|
|
|
0 | 1 => Err("Error empty LwPolyline"),
|
|
|
|
|
@ -863,6 +878,10 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
match Arc::try_from_lwpolyline_with_color(lwpolyline, color) {
|
|
|
|
|
Ok(mut arc) => {
|
|
|
|
|
arc.update_line_style(&update_line_style);
|
|
|
|
|
// 更新线条粗细
|
|
|
|
|
if let Some(w) = lw {
|
|
|
|
|
arc.update_line_weight(w);
|
|
|
|
|
}
|
|
|
|
|
arc.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
arc.x += self.offset.x;
|
|
|
|
|
arc.y -= self.offset.y;
|
|
|
|
|
@ -878,7 +897,10 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
line.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
// 更新线条粗细
|
|
|
|
|
if let Some(w) = lw {
|
|
|
|
|
line.update_line_weight(w);
|
|
|
|
|
}
|
|
|
|
|
line.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
|
|
|
|
|
line.x1 += self.offset.x;
|
|
|
|
|
@ -893,7 +915,7 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
if let Ok(mut ellipse) = Ellipse::try_from_lwpolyline_with_color(lwpolyline, color) {
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
ellipse.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
// TODO ellipse的粗体未实现
|
|
|
|
|
ellipse.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
|
|
|
|
|
ellipse.x += self.offset.x;
|
|
|
|
|
@ -928,7 +950,7 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
|
|
|
|
|
// 根据line_type_name更新线型样式
|
|
|
|
|
poly.update_line_style(&update_line_style);
|
|
|
|
|
|
|
|
|
|
// TODO poly的粗体未实现
|
|
|
|
|
poly.scale(self.scale_fact.x, self.scale_fact.y);
|
|
|
|
|
|
|
|
|
|
for cord in &mut poly.coordinates {
|
|
|
|
|
@ -941,6 +963,7 @@ impl<'a> ObjectsBuilder<'a> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
EntityType::Solid(solid) => {
|
|
|
|
|
let mut poly: Polygon = solid.into();
|
|
|
|
|
|
|
|
|
|
|