fix: entity_type_label/key in helpers.rs cover all EntityType variants

The Properties panel header was still showing "Entity" for unrecognized
types because helpers.rs had its own incomplete match. Both functions now
enumerate every acadrust EntityType variant explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-24 01:43:13 +03:00
commit 2ee1c8e196

View file

@ -155,38 +155,96 @@ pub(super) fn next_group_auto_name(scene: &crate::scene::Scene) -> String {
pub(super) fn entity_type_label(entity: &acadrust::EntityType) -> String { pub(super) fn entity_type_label(entity: &acadrust::EntityType) -> String {
use acadrust::EntityType::*; use acadrust::EntityType::*;
match entity { match entity {
Point(_) => "Point",
Line(_) => "Line", Line(_) => "Line",
Circle(_) => "Circle", Circle(_) => "Circle",
Arc(_) => "Arc", Arc(_) => "Arc",
Ellipse(_) => "Ellipse", Ellipse(_) => "Ellipse",
Spline(_) => "Spline", Spline(_) => "Spline",
LwPolyline(_) => "Polyline", LwPolyline(_) => "Polyline",
Polyline(_) => "Polyline",
Polyline2D(_) => "Polyline2D",
Polyline3D(_) => "Polyline3D",
PolyfaceMesh(_) => "PolyfaceMesh",
PolygonMesh(_) => "PolygonMesh",
Text(_) => "Text", Text(_) => "Text",
MText(_) => "MText", MText(_) => "MText",
Dimension(_) => "Dimension", Dimension(_) => "Dimension",
Leader(_) => "Leader",
MultiLeader(_) => "MultiLeader",
Tolerance(_) => "Tolerance",
Insert(_) => "Block Reference", Insert(_) => "Block Reference",
Point(_) => "Point", Block(_) => "Block",
BlockEnd(_) => "Block End",
Hatch(_) => "Hatch", Hatch(_) => "Hatch",
_ => "Entity", 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() .to_string()
} }
pub(super) fn entity_type_key(entity: &acadrust::EntityType) -> String { pub(super) fn entity_type_key(entity: &acadrust::EntityType) -> String {
use acadrust::EntityType::*;
match entity { match entity {
acadrust::EntityType::LwPolyline(_) => "pline", Point(_) => "point",
acadrust::EntityType::Circle(_) => "circle", Line(_) => "line",
acadrust::EntityType::Line(_) => "line", Circle(_) => "circle",
acadrust::EntityType::Arc(_) => "arc", Arc(_) => "arc",
acadrust::EntityType::Ellipse(_) => "ellipse", Ellipse(_) => "ellipse",
acadrust::EntityType::Spline(_) => "spline", Spline(_) => "spline",
acadrust::EntityType::Text(_) => "text", LwPolyline(_) | Polyline(_) => "pline",
acadrust::EntityType::MText(_) => "mtext", Polyline2D(_) => "pline2d",
acadrust::EntityType::Dimension(_) => "dimension", Polyline3D(_) => "pline3d",
acadrust::EntityType::Insert(_) => "insert", PolyfaceMesh(_) => "polyface",
acadrust::EntityType::Point(_) => "point", PolygonMesh(_) => "polymesh",
acadrust::EntityType::Hatch(_) => "hatch", Text(_) => "text",
_ => "entity", MText(_) => "mtext",
Dimension(_) => "dimension",
Leader(_) => "leader",
MultiLeader(_) => "multileader",
Tolerance(_) => "tolerance",
Insert(_) => "insert",
Block(_) => "block",
BlockEnd(_) => "blockend",
Hatch(_) => "hatch",
Solid(_) => "solid",
Face3D(_) => "face3d",
Solid3D(_) => "solid3d",
Region(_) => "region",
Body(_) => "body",
Mesh(_) => "mesh",
Ray(_) => "ray",
XLine(_) => "xline",
MLine(_) => "mline",
Viewport(_) => "viewport",
RasterImage(_) => "rasterimage",
Wipeout(_) => "wipeout",
Underlay(_) => "underlay",
Shape(_) => "shape",
Table(_) => "table",
AttributeDefinition(_) => "attdef",
AttributeEntity(_) => "attrib",
Ole2Frame(_) => "ole2frame",
Seqend(_) => "seqend",
Unknown(_) => "unknown",
} }
.to_string() .to_string()
} }