feat: complex linetype text elements and ellipse quadrant snaps

Complex linetypes now render embedded text elements (e.g. GAS_LINE's
"GAS" labels): the LtSegment::Text variant is parsed from LIN files,
scaled along with shape/dash segments, and tessellated via
cxf::tessellate_text_ex aligned to the linetype direction.

Full ellipses gain four Quadrant snap hints at ±major/±minor axis
endpoints in addition to the existing Center snap, matching AutoCAD
snap behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-27 02:34:51 +03:00
commit 392f4503d8
4 changed files with 131 additions and 14 deletions

View file

@ -71,9 +71,24 @@ fn to_truck(ell: &Ellipse) -> TruckEntity {
let edge_upper = Edge::new(&v_pos, &v_neg, Curve::BSplineCurve(spl_u));
let edge_lower = Edge::new(&v_neg, &v_pos, Curve::BSplineCurve(spl_l));
let wire: Wire = [edge_upper, edge_lower].into_iter().collect();
// Quadrant points at ±major and ±minor axis endpoints.
let q = |lx: f64, lz: f64| {
Vec3::new(
(cx + lx * u.x as f64 + lz * v_axis.x as f64) as f32,
(cy + lx * u.y as f64 + lz * v_axis.y as f64) as f32,
cz as f32,
)
};
let snap_pts = vec![
(center_v3, SnapHint::Center),
(q(r_major, 0.0), SnapHint::Quadrant),
(q(-r_major, 0.0), SnapHint::Quadrant),
(q(0.0, r_minor), SnapHint::Quadrant),
(q(0.0, -r_minor), SnapHint::Quadrant),
];
TruckEntity {
object: TruckObject::Contour(wire),
snap_pts: vec![(center_v3, SnapHint::Center)],
snap_pts,
tangent_geoms: vec![],
key_vertices: vec![],
}

View file

@ -22,7 +22,7 @@ pub mod shape;
pub mod solid;
pub mod spline;
pub mod text;
mod text_support;
pub(crate) mod text_support;
pub mod table;
pub mod tolerance;
pub mod traits;