refactor: deduplicate entity type name mapping

Make scene::properties::entity_type_name the single source of truth.
entity_type_label in helpers.rs now delegates to it instead of
maintaining a separate match list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-24 01:44:33 +03:00
commit 3ec7bf7065
2 changed files with 2 additions and 47 deletions

View file

@ -153,52 +153,7 @@ pub(super) fn next_group_auto_name(scene: &crate::scene::Scene) -> String {
// ── Entity type labels ───────────────────────────────────────────────────── // ── Entity type labels ─────────────────────────────────────────────────────
pub(super) fn entity_type_label(entity: &acadrust::EntityType) -> String { pub(super) fn entity_type_label(entity: &acadrust::EntityType) -> String {
use acadrust::EntityType::*; crate::scene::properties::entity_type_name(entity).to_string()
match entity {
Point(_) => "Point",
Line(_) => "Line",
Circle(_) => "Circle",
Arc(_) => "Arc",
Ellipse(_) => "Ellipse",
Spline(_) => "Spline",
LwPolyline(_) => "Polyline",
Polyline(_) => "Polyline",
Polyline2D(_) => "Polyline2D",
Polyline3D(_) => "Polyline3D",
PolyfaceMesh(_) => "PolyfaceMesh",
PolygonMesh(_) => "PolygonMesh",
Text(_) => "Text",
MText(_) => "MText",
Dimension(_) => "Dimension",
Leader(_) => "Leader",
MultiLeader(_) => "MultiLeader",
Tolerance(_) => "Tolerance",
Insert(_) => "Block Reference",
Block(_) => "Block",
BlockEnd(_) => "Block End",
Hatch(_) => "Hatch",
Solid(_) => "Solid",
Face3D(_) => "3D Face",
Solid3D(_) => "3D Solid",
Region(_) => "Region",
Body(_) => "Body",
Mesh(_) => "Mesh",
Ray(_) => "Ray",
XLine(_) => "XLine",
MLine(_) => "MLine",
Viewport(_) => "Viewport",
RasterImage(_) => "Raster Image",
Wipeout(_) => "Wipeout",
Underlay(_) => "Underlay",
Shape(_) => "Shape",
Table(_) => "Table",
AttributeDefinition(_) => "Attribute Definition",
AttributeEntity(_) => "Attribute",
Ole2Frame(_) => "OLE Frame",
Seqend(_) => "Seqend",
Unknown(_) => "Unknown",
}
.to_string()
} }
pub(super) fn entity_type_key(entity: &acadrust::EntityType) -> String { pub(super) fn entity_type_key(entity: &acadrust::EntityType) -> String {

View file

@ -67,7 +67,7 @@ pub fn fallback_properties(_handle: Handle, entity: &EntityType) -> PropSection
} }
} }
fn entity_type_name(e: &EntityType) -> &'static str { pub fn entity_type_name(e: &EntityType) -> &'static str {
match e { match e {
EntityType::Point(_) => "Point", EntityType::Point(_) => "Point",
EntityType::Line(_) => "Line", EntityType::Line(_) => "Line",