refactor(scene): group modules into role-based subfolders

Move the 30 flat modules under src/scene/ into six folders by role:
convert (entity→geometry), text (fonts/shaping), model (render models),
pick (hit-test/selection/grips/xclip), view (camera/transform/render),
cache (block + property caches). pipeline/ is unchanged.

Full path migration — all `scene::X` references become
`scene::<group>::X`, no compatibility re-exports. render.rs items that
were `pub(super)` (parent was scene) become `pub(in crate::scene)` to
keep their original scene-wide visibility.

No behavior change; build and tests are green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 11:33:46 +03:00
1 parent cd048165a9
commit 7fe7e0230d
160 files changed
+732 -715

No files matched your search

+14 -14
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
const TAU: f64 = std::f64::consts::TAU;
@@ -21,13 +21,13 @@ fn to_truck(arc: &Arc) -> TruckEntity {
let normal = (arc.normal.x, arc.normal.y, arc.normal.z);
// Compute OCS basis vectors for this entity's normal.
let (ax, ay) = crate::scene::transform::ocs_axes(normal);
let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let ccw_end = if ea >= sa { ea } else { ea + TAU };
let mid_a = sa + (ccw_end - sa) * 0.5;
// Arc centre in WCS.
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal);
let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Arc points in WCS: centre_wcs + r*cos(a)*Ax + r*sin(a)*Ay
let arc_pt = |a: f64| {
@@ -198,8 +198,8 @@ fn apply_grip(arc: &mut Arc, grip_id: usize, apply: GripApply) {
}
fn apply_transform(arc: &mut Arc, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(arc, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
@@ -227,8 +227,8 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
match grip_id {
0 => vec![GripMenuItem {
label: "Stretch",
@@ -260,7 +260,7 @@ impl crate::entities::traits::Grippable for Arc {
],
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Radius / Arc Length / Lengthen all need a follow-up prompt;
// the actual edit happens in `apply_grip_menu_value`.
}
@@ -268,9 +268,9 @@ impl crate::entities::traits::Grippable for Arc {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Radius => Some("New radius"),
A::ArcLength => Some("New arc length"),
@@ -282,10 +282,10 @@ impl crate::entities::traits::Grippable for Arc {
fn apply_grip_menu_value(
&mut self,
grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Radius if value > 0.0 => self.radius = value,
A::ArcLength if value > 0.0 && self.radius > 1e-9 => {
+5 -4
View File
@@ -12,10 +12,11 @@ use crate::entities::text_support::{
MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::{lff, transform};
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
// ── Shared helpers ────────────────────────────────────────────────────────────
+7 -7
View File
@@ -7,9 +7,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
fn to_truck(circle: &Circle) -> TruckEntity {
let cx = circle.center.x;
@@ -18,8 +18,8 @@ fn to_truck(circle: &Circle) -> TruckEntity {
let r = circle.radius;
let normal = (circle.normal.x, circle.normal.y, circle.normal.z);
let (ax, ay) = crate::scene::transform::ocs_axes(normal);
let (cwx, cwy, cwz) = crate::scene::transform::ocs_point_to_wcs((cx, cy, cz), normal);
let (ax, ay) = crate::scene::view::transform::ocs_axes(normal);
let (cwx, cwy, cwz) = crate::scene::view::transform::ocs_point_to_wcs((cx, cy, cz), normal);
// Circle points in WCS: centre_wcs ± r * Ax and centre_wcs ± r * Ay
let pt = |da: (f64, f64, f64), db: (f64, f64, f64), s: f64| {
@@ -182,8 +182,8 @@ fn apply_grip(circle: &mut Circle, grip_id: usize, apply: GripApply) {
}
fn apply_transform(circle: &mut Circle, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(circle, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
+1 -1
View File
@@ -1,6 +1,6 @@
use std::cell::Cell;
use crate::scene::object::{GripDef, GripShape, PropValue, Property};
use crate::scene::model::object::{GripDef, GripShape, PropValue, Property};
/// Linear / angular unit format pulled from the document header so the
/// per-thread properties pipeline can format values consistently without
+21 -21
View File
@@ -10,26 +10,26 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn base_props(base: &DimensionBase) -> Vec<crate::scene::object::Property> {
fn base_props(base: &DimensionBase) -> Vec<crate::scene::model::object::Property> {
vec![
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "Text".into(),
field: "text",
value: crate::scene::object::PropValue::EditText(base.text.clone()),
value: crate::scene::model::object::PropValue::EditText(base.text.clone()),
},
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "User Text".into(),
field: "user_text",
value: crate::scene::object::PropValue::EditText(
value: crate::scene::model::object::PropValue::EditText(
base.user_text.clone().unwrap_or_default(),
),
},
crate::scene::object::Property {
crate::scene::model::object::Property {
label: "Style".into(),
field: "style_name",
value: crate::scene::object::PropValue::EditText(base.style_name.clone()),
value: crate::scene::model::object::PropValue::EditText(base.style_name.clone()),
},
edit("Text X", "text_x", base.text_middle_point.x),
edit("Text Y", "text_y", base.text_middle_point.y),
@@ -135,7 +135,7 @@ fn linear_like_props(
first: acadrust::types::Vector3,
second: acadrust::types::Vector3,
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("First X", "first_x", first.x),
edit("First Y", "first_y", first.y),
@@ -152,7 +152,7 @@ fn linear_like_props(
fn radius_like_props(
center: acadrust::types::Vector3,
point: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Center X", "center_x", center.x),
edit("Center Y", "center_y", center.y),
@@ -168,7 +168,7 @@ fn angular_props(
first: acadrust::types::Vector3,
second: acadrust::types::Vector3,
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::object::Property> {
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Vertex X", "vertex_x", vertex.x),
edit("Vertex Y", "vertex_y", vertex.y),
@@ -555,7 +555,7 @@ fn scale_point(p: &mut acadrust::types::Vector3, center: Vec3, factor: f32) {
}
fn mirror_point(p: &mut acadrust::types::Vector3, p1: Vec3, p2: Vec3) {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
}
impl PropertyEditable for Dimension {
@@ -713,8 +713,8 @@ impl Grippable for Dimension {
self.base_mut().actual_measurement = self.measurement();
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let (dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -775,8 +775,8 @@ impl Grippable for Dimension {
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let (_dim_line_grip, text_grip) = match self {
Dimension::Linear(_) | Dimension::Aligned(_) => (2, 3),
Dimension::Radius(_) | Dimension::Diameter(_) => (1, 2),
@@ -827,18 +827,18 @@ impl Grippable for Dimension {
// definition. Shared dim machinery (`ArrowKind`, `DimGeom`, `append_arrow`,
// arrow blocks, colour resolution, `add_segment` / `add_polyline`,
// `normalized_or`, `entity_z`, `offset_snap_pts`) lives in
// `scene::tessellate` and is reused by Leader / MultiLeader too.
// `scene::convert::tessellate` and is reused by Leader / MultiLeader too.
use acadrust::entities::{MText, Text};
use acadrust::tables::DimStyle;
use acadrust::types::{Color as AcadColor, Vector3};
use acadrust::{CadDocument, EntityType, Handle};
use crate::scene::tess_util::aci_to_rgba;
use crate::scene::tessellate::{
use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::convert::tessellate::{
add_polyline, add_segment, append_arrow, arrow_from_block, normalized_or, ArrowKind, DimGeom,
};
use crate::scene::wire_model::{SnapHint, WireModel};
use crate::scene::model::wire_model::{SnapHint, WireModel};
pub trait DimensionTess {
fn tessellate(
@@ -1338,7 +1338,7 @@ fn resolve_pattern_by_handle(
.find(|lt| lt.handle == handle)
.map(|lt| lt.name.clone());
match name {
Some(n) => crate::scene::render::resolve_pattern(&doc.line_types, &n, scale),
Some(n) => crate::scene::view::render::resolve_pattern(&doc.line_types, &n, scale),
None => (0.0, [0.0; 8]),
}
}
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, BSplineCurve, Curve, Edge, KnotVec, Point3, Wire};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
const TAU: f64 = std::f64::consts::TAU;
@@ -218,14 +218,14 @@ fn apply_grip(ell: &mut Ellipse, grip_id: usize, apply: GripApply) {
}
fn apply_transform(ell: &mut Ellipse, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(ell, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.major_axis.x,
&mut entity.major_axis.y,
p1,
+13 -13
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro};
use crate::entities::traits::{FallbackTess, Grippable, PropertyEditable, Transformable};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::wire_model::SnapHint;
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::convert::tess_util::{arc_segments, arc_signed_span, wire_chord_tol, FallbackGeometry};
use crate::scene::model::wire_model::SnapHint;
fn properties(h: &Hatch) -> PropSection {
let pattern_type = match h.pattern_type {
@@ -89,7 +89,7 @@ fn apply_geom_prop(h: &mut Hatch, field: &str, value: &str) {
}
fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(h, t, |entity, p1, p2| {
// Delegate the mirror to acadrust's transform_hatch (via the Entity
// trait): it flips the boundary-arc direction flags, re-mirrors the
// stored angles and preserves the stored sweep — including the
@@ -97,7 +97,7 @@ fn apply_transform(h: &mut Hatch, t: &EntityTransform) {
// hand-rolled angle-swap here was only valid for ccw boundary arcs on
// an axis-aligned mirror line and went stale the moment those
// conventions were fixed upstream.
let t = crate::scene::transform::reflection_about_xy_line(p1, p2);
let t = crate::scene::view::transform::reflection_about_xy_line(p1, p2);
acadrust::entities::Entity::apply_transform(entity, &t);
});
}
@@ -282,8 +282,8 @@ impl Grippable for Hatch {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -304,7 +304,7 @@ impl Grippable for Hatch {
]
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Origin / Angle / Scale need a follow-up value — handled by
// `apply_grip_menu_value`.
}
@@ -312,9 +312,9 @@ impl Grippable for Hatch {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::HatchAngle => Some("Angle (deg)"),
A::HatchScale => Some("Scale"),
@@ -325,10 +325,10 @@ impl Grippable for Hatch {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::HatchAngle => {
self.pattern_angle = value.to_radians();
@@ -350,7 +350,7 @@ impl FallbackTess for Hatch {
// Convert a 2D OCS hatch boundary point to WCS, then subtract world_offset.
let to_wcs = |x: f64, y: f64| -> [f32; 3] {
let (wx, wy, wz) =
crate::scene::transform::ocs_point_to_wcs((x, y, self.elevation), normal);
crate::scene::view::transform::ocs_point_to_wcs((x, y, self.elevation), normal);
[(wx - ox) as f32, (wy - oy) as f32, (wz - oz) as f32]
};
let mut pts: Vec<[f32; 3]> = Vec::new();
+8 -6
View File
@@ -6,9 +6,11 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, ro_prop as ro, square_grip};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::WireModel;
use crate::scene::{block_cache, render, tessellate};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::WireModel;
use crate::scene::cache::block_cache;
use crate::scene::convert::tessellate;
use crate::scene::view::render;
fn grips(ins: &Insert) -> Vec<GripDef> {
let p = glam::DVec3::new(ins.insert_point.x, ins.insert_point.y, ins.insert_point.z);
@@ -63,7 +65,7 @@ fn apply_grip(ins: &mut Insert, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(ins: &mut Insert, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(ins, t, |entity, p1, p2| {
let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64;
let len = (dx * dx + dy * dy).sqrt();
@@ -98,7 +100,7 @@ impl crate::entities::traits::FallbackTess for Insert {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let ip = Vec3::new(
(self.insert_point.x - ox) as f32,
@@ -114,7 +116,7 @@ impl crate::entities::traits::FallbackTess for Insert {
];
(
pts,
vec![(ip, crate::scene::wire_model::SnapHint::Insertion)],
vec![(ip, crate::scene::model::wire_model::SnapHint::Insertion)],
vec![],
vec![],
)
+16 -16
View File
@@ -5,9 +5,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::TangentGeom;
// ── TruckConvertible (used for snap/grip key-vertices) ─────────────────────
@@ -428,17 +428,17 @@ fn apply_geom_prop(leader: &mut Leader, field: &str, value: &str) {
// ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(leader: &mut Leader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(leader, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.block_offset.x,
&mut entity.block_offset.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.annotation_offset.x,
&mut entity.annotation_offset.y,
p1,
@@ -465,8 +465,8 @@ impl crate::entities::traits::Grippable for Leader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len();
if grip_id == 0 {
// Arrow head — stretch only.
@@ -497,8 +497,8 @@ impl crate::entities::traits::Grippable for Leader {
}]
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -540,7 +540,7 @@ impl crate::entities::traits::Transformable for Leader {
/// Per-entity tessellation entry for `Leader`. Lives here so all leader
/// tess code stays alongside the entity definition. Cross-entity dim
/// machinery (arrow shapes, `DimGeom`) lives in `scene::tessellate` and
/// machinery (arrow shapes, `DimGeom`) lives in `scene::convert::tessellate` and
/// is reused via the dim arrow emitter so the leader matches the active
/// DIMSTYLE.
pub trait LeaderTess {
@@ -553,7 +553,7 @@ pub trait LeaderTess {
line_weight_px: f32,
world_offset: [f64; 3],
anno_scale: f32,
) -> crate::scene::wire_model::WireModel;
) -> crate::scene::model::wire_model::WireModel;
}
impl LeaderTess for Leader {
@@ -566,9 +566,9 @@ impl LeaderTess for Leader {
line_weight_px: f32,
world_offset: [f64; 3],
anno_scale: f32,
) -> crate::scene::wire_model::WireModel {
use crate::scene::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom};
use crate::scene::wire_model::WireModel;
) -> crate::scene::model::wire_model::WireModel {
use crate::scene::convert::tessellate::{append_arrow, arrow_from_block, ArrowKind, DimGeom};
use crate::scene::model::wire_model::WireModel;
let color = if selected {
WireModel::SELECTED
} else {
+15 -15
View File
@@ -6,18 +6,18 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::TangentGeom;
fn to_truck(line: &Line) -> TruckEntity {
let normal = (line.normal.x, line.normal.y, line.normal.z);
let (sx, sy, sz) = crate::scene::transform::ocs_point_to_wcs(
let (sx, sy, sz) = crate::scene::view::transform::ocs_point_to_wcs(
(line.start.x, line.start.y, line.start.z),
normal,
);
let (ex, ey, ez) =
crate::scene::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal);
crate::scene::view::transform::ocs_point_to_wcs((line.end.x, line.end.y, line.end.z), normal);
let p0 = Point3::new(sx, sy, sz);
let p1 = Point3::new(ex, ey, ez);
let kv: Vec<[f64; 3]> = vec![[p0.x, p0.y, p0.z], [p1.x, p1.y, p1.z]];
@@ -134,13 +134,13 @@ fn apply_transform(line: &mut Line, t: &EntityTransform) {
));
}
EntityTransform::Rotate { center, angle_rad } => {
crate::scene::transform::apply_standard_transform(line, *center, *angle_rad);
crate::scene::view::transform::apply_standard_transform(line, *center, *angle_rad);
}
EntityTransform::Scale { center, factor } => {
crate::scene::transform::apply_standard_scale(line, *center, *factor);
crate::scene::view::transform::apply_standard_scale(line, *center, *factor);
}
EntityTransform::Mirror { p1, p2 } => {
crate::scene::transform::mirror_xy_line(line, *p1, *p2);
crate::scene::view::transform::mirror_xy_line(line, *p1, *p2);
}
}
}
@@ -158,8 +158,8 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 2 {
vec![GripMenuItem {
label: "Stretch",
@@ -178,7 +178,7 @@ impl crate::entities::traits::Grippable for Line {
]
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Lengthen needs a follow-up distance — handled by
// `apply_grip_menu_value`.
}
@@ -186,9 +186,9 @@ impl crate::entities::traits::Grippable for Line {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::Lengthen => Some("Distance"),
_ => None,
@@ -198,10 +198,10 @@ impl crate::entities::traits::Grippable for Line {
fn apply_grip_menu_value(
&mut self,
grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if !matches!(action, A::Lengthen) {
return;
}
+13 -13
View File
@@ -6,9 +6,9 @@ use crate::entities::common::{
edit_prop as edit, parse_f64, rectangle_grip, ro_prop as ro, square_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::TangentGeom;
const TAU: f64 = std::f64::consts::TAU;
@@ -120,7 +120,7 @@ fn to_truck(pline: &LwPolyline) -> TruckEntity {
// Convert OCS (x, y, elevation) to WCS Point3.
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal)
crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
};
let to_pt = |v: &LwVertex| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -418,9 +418,9 @@ fn apply_grip(pline: &mut LwPolyline, grip_id: usize, apply: GripApply) {
}
fn apply_transform(pline: &mut LwPolyline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(pline, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.location.x, &mut v.location.y, p1, p2);
// Bulge encodes which side the arc bows to; a reflection
// reverses it or every curved segment flips to the wrong side.
v.bulge = -v.bulge;
@@ -435,14 +435,14 @@ impl TruckConvertible for LwPolyline {
}
impl crate::entities::traits::Grippable for LwPolyline {
fn grips(&self) -> Vec<crate::scene::object::GripDef> {
fn grips(&self) -> Vec<crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::object::GripApply) {
fn apply_grip(&mut self, grip_id: usize, apply: crate::scene::model::object::GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n = self.vertices.len();
if grip_id < n {
// Vertex grip.
@@ -490,8 +490,8 @@ impl crate::entities::traits::Grippable for LwPolyline {
convert,
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::Stretch => {}
@@ -546,7 +546,7 @@ impl crate::entities::traits::PropertyEditable for LwPolyline {
fn geometry_properties(
&self,
_text_style_names: &[String],
) -> crate::scene::object::PropSection {
) -> crate::scene::model::object::PropSection {
properties(self)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
+11 -11
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
// ── Face3D ────────────────────────────────────────────────────────────────────
@@ -160,14 +160,14 @@ impl PropertyEditable for Face3D {
impl Transformable for Face3D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [
&mut entity.first_corner,
&mut entity.second_corner,
&mut entity.third_corner,
&mut entity.fourth_corner,
] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
}
});
}
@@ -322,9 +322,9 @@ impl PropertyEditable for PolygonMesh {
impl Transformable for PolygonMesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -472,9 +472,9 @@ impl PropertyEditable for PolyfaceMesh {
impl Transformable for PolyfaceMesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -631,9 +631,9 @@ impl PropertyEditable for Mesh {
impl Transformable for Mesh {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut v.x, &mut v.y, p1, p2);
}
});
}
+10 -10
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
impl TruckConvertible for MLine {
fn to_truck(&self, _document: &acadrust::CadDocument) -> Option<TruckEntity> {
@@ -149,8 +149,8 @@ impl Grippable for MLine {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -167,8 +167,8 @@ impl Grippable for MLine {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -274,16 +274,16 @@ impl PropertyEditable for MLine {
impl Transformable for MLine {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.position.x,
&mut v.position.y,
p1,
p2,
);
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.start_point.x,
&mut entity.start_point.y,
p1,
+12 -12
View File
@@ -7,9 +7,9 @@ use crate::entities::text_support::{
layout_mtext, resolve_text_style, GlyphBox, MTextRenderOpts, MTextVAnchor,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
fn attachment_str(a: &AttachmentPoint) -> &'static str {
match a {
@@ -327,8 +327,8 @@ fn apply_grip(t: &mut MText, grip_id: usize, apply: GripApply) {
}
fn apply_transform(t: &mut MText, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
@@ -356,8 +356,8 @@ impl Grippable for MText {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
if grip_id == 0 {
// Insertion point
vec![
@@ -383,7 +383,7 @@ impl Grippable for MText {
}
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`; Move-with-Text is the default drag.
}
@@ -391,9 +391,9 @@ impl Grippable for MText {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::RotateText => Some("Rotation (deg)"),
_ => None,
@@ -403,10 +403,10 @@ impl Grippable for MText {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) {
self.rotation = value.to_radians();
}
+21 -21
View File
@@ -31,9 +31,9 @@ use crate::entities::common::{
center_grip, edit_prop as edit, ro_prop as ro, square_grip, triangle_grip,
};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::{SnapHint, TangentGeom};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::{SnapHint, TangentGeom};
// ── TruckConvertible ────────────────────────────────────────────────────────
@@ -840,7 +840,7 @@ fn parse_attachment(s: &str) -> TextAttachmentType {
// ── Transform ──────────────────────────────────────────────────────────────
fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(ml, t, |entity, p1, p2| {
// Reflect every point on the leader (line points, connection points,
// break-point endpoints) AND every direction vector that drives the
// text orientation. Without the direction reflection text would keep
@@ -848,16 +848,16 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
for root in &mut entity.context.leader_roots {
for line in &mut root.lines {
for p in &mut line.points {
crate::scene::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut p.x, &mut p.y, p1, p2);
}
for bp in &mut line.break_points {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x,
&mut bp.start_point.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x,
&mut bp.end_point.y,
p1,
@@ -865,7 +865,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
}
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut root.connection_point.x,
&mut root.connection_point.y,
p1,
@@ -873,13 +873,13 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
reflect_xy_direction(&mut root.direction.x, &mut root.direction.y, p1, p2);
for bp in &mut root.break_points {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.start_point.x,
&mut bp.start_point.y,
p1,
p2,
);
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut bp.end_point.x,
&mut bp.end_point.y,
p1,
@@ -887,7 +887,7 @@ fn apply_transform(ml: &mut MultiLeader, t: &EntityTransform) {
);
}
}
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut entity.context.text_location.x,
&mut entity.context.text_location.y,
p1,
@@ -916,7 +916,7 @@ fn reflect_xy_direction(dx: &mut f64, dy: &mut f64, p1: Vec3, p2: Vec3) {
let p2_rel = Vec3::new(p2.x - p1.x, p2.y - p1.y, 0.0);
let mut tip_x = *dx;
let mut tip_y = *dy;
crate::scene::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel);
crate::scene::view::transform::reflect_xy_point(&mut tip_x, &mut tip_y, zero, p2_rel);
*dx = tip_x;
*dy = tip_y;
}
@@ -936,8 +936,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
let n_vertices: usize = self
.context
.leader_roots
@@ -984,8 +984,8 @@ impl crate::entities::traits::Grippable for MultiLeader {
]
}
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
// Locate the (root, line) and vertex position owning this grip id.
let mut idx = 0usize;
let mut loc: Option<(usize, usize, acadrust::types::Vector3)> = None;
@@ -1063,7 +1063,7 @@ pub trait MultiLeaderTess {
world_offset: [f64; 3],
anno_scale: f32,
world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel>;
) -> Vec<crate::scene::model::wire_model::WireModel>;
}
impl MultiLeaderTess for MultiLeader {
@@ -1077,11 +1077,11 @@ impl MultiLeaderTess for MultiLeader {
world_offset: [f64; 3],
anno_scale: f32,
world_per_pixel: Option<f32>,
) -> Vec<crate::scene::wire_model::WireModel> {
use crate::scene::tessellate::{
) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::convert::tessellate::{
append_arrow, arrow_from_block, color_or_inherit, tessellate, ArrowKind, DimGeom,
};
use crate::scene::wire_model::{SnapHint, TangentGeom, WireModel};
use crate::scene::model::wire_model::{SnapHint, TangentGeom, WireModel};
use glam::Vec3;
let ml = self;
// line_color falls back to the entity colour when the MultiLeader's own
@@ -1110,7 +1110,7 @@ impl MultiLeaderTess for MultiLeader {
.map(|lt| lt.name.clone());
match name {
Some(n) => {
crate::scene::render::resolve_pattern(&document.line_types, &n, lt_scale)
crate::scene::view::render::resolve_pattern(&document.line_types, &n, lt_scale)
}
None => (0.0, [0.0; 8]),
}
+4 -4
View File
@@ -4,9 +4,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
fn to_truck(ole: &Ole2Frame) -> TruckEntity {
let x0 = ole.upper_left_corner.x;
@@ -184,7 +184,7 @@ impl crate::entities::traits::FallbackTess for Ole2Frame {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
// OLE objects carry a bounding rectangle in model space.
// Render a simple X-through-rectangle placeholder.
let [ox, oy, oz] = world_offset;
+6 -6
View File
@@ -5,9 +5,9 @@ use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, parse_f64, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
/// Resolve PDSIZE (negative = % of viewport, 0 = 5% default, positive = world).
/// We don't know the viewport height at tessellation time, so percentages and
@@ -93,7 +93,7 @@ fn point_glyph(cx: f64, cy: f64, z: f64, pdmode: i16, pdsize: f64) -> Vec<[f64;
fn to_truck(pt: &Point, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (pt.normal.x, pt.normal.y, pt.normal.z);
let (wx, wy, wz) = crate::scene::transform::ocs_point_to_wcs(
let (wx, wy, wz) = crate::scene::view::transform::ocs_point_to_wcs(
(pt.location.x, pt.location.y, pt.location.z),
normal,
);
@@ -175,8 +175,8 @@ fn apply_grip(pt: &mut Point, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(pt: &mut Point, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(pt, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.location.x,
&mut entity.location.y,
p1,
+22 -22
View File
@@ -4,9 +4,9 @@ use truck_modeling::{builder, Edge, Point3, Wire};
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::TangentGeom;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::TangentGeom;
// ── Polyline (old-style 3D heavy polyline) ────────────────────────────────────
@@ -69,8 +69,8 @@ impl Grippable for Polyline {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -87,8 +87,8 @@ impl Grippable for Polyline {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -148,9 +148,9 @@ impl PropertyEditable for Polyline {
impl Transformable for Polyline {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -184,7 +184,7 @@ fn tessellate_polyline2d(pl: &Polyline2D) -> TruckEntity {
let mut key_verts: Vec<[f64; 3]> = Vec::new();
let to_wcs = |x: f64, y: f64| -> (f64, f64, f64) {
crate::scene::transform::ocs_point_to_wcs((x, y, elev), normal)
crate::scene::view::transform::ocs_point_to_wcs((x, y, elev), normal)
};
let to_pt = |v: &acadrust::entities::Vertex2D| -> Point3 {
let (wx, wy, wz) = to_wcs(v.location.x, v.location.y);
@@ -338,8 +338,8 @@ impl Grippable for Polyline2D {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -356,8 +356,8 @@ impl Grippable for Polyline2D {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
let elev = self.elevation;
match action {
@@ -467,9 +467,9 @@ impl PropertyEditable for Polyline2D {
impl Transformable for Polyline2D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.location.x,
&mut v.location.y,
p1,
@@ -556,8 +556,8 @@ impl Grippable for Polyline3D {
}
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -574,8 +574,8 @@ impl Grippable for Polyline3D {
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.vertices.len();
match action {
A::AddVertex if grip_id < n => {
@@ -669,9 +669,9 @@ impl PropertyEditable for Polyline3D {
impl Transformable for Polyline3D {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for v in &mut entity.vertices {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::reflect_xy_point(
&mut v.position.x,
&mut v.position.y,
p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{RasterImage, Wipeout};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Shared geometry helpers ───────────────────────────────────────────────────
@@ -235,8 +235,8 @@ impl PropertyEditable for RasterImage {
impl Transformable for RasterImage {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
@@ -496,8 +496,8 @@ impl PropertyEditable for Wipeout {
impl Transformable for Wipeout {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
+6 -6
View File
@@ -3,8 +3,8 @@ use acadrust::entities::{Ray, XLine};
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
/// Display length used when rendering semi-infinite / infinite lines.
const DISPLAY_EXTENT: f64 = 1_000_000.0;
@@ -126,8 +126,8 @@ impl PropertyEditable for Ray {
impl Transformable for Ray {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x,
&mut entity.base_point.y,
p1,
@@ -263,8 +263,8 @@ impl PropertyEditable for XLine {
impl Transformable for XLine {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.base_point.x,
&mut entity.base_point.y,
p1,
+4 -4
View File
@@ -11,10 +11,10 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::transform;
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::view::transform;
use crate::scene::model::wire_model::SnapHint;
// ── Marker geometry ───────────────────────────────────────────────────────────
+5 -5
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> [f64; 3] {
[v.x, v.y, v.z]
@@ -147,14 +147,14 @@ impl PropertyEditable for Solid {
impl Transformable for Solid {
fn apply_transform(&mut self, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(self, t, |entity, p1, p2| {
for corner in [
&mut entity.first_corner,
&mut entity.second_corner,
&mut entity.third_corner,
&mut entity.fourth_corner,
] {
crate::scene::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut corner.x, &mut corner.y, p1, p2);
}
});
}
+3 -3
View File
@@ -11,7 +11,7 @@ use glam::Vec3;
use crate::entities::common::{center_grip, ro_prop as ro};
use crate::entities::traits::{Grippable, PropertyEditable};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
// ── shared helpers ────────────────────────────────────────────────────────────
@@ -260,8 +260,8 @@ impl PropertyEditable for Body {
// to repeat a three-arm `match entity` block at every callsite — the
// helpers below collapse those to a single call.
use crate::scene::mesh_model::MeshLodSet;
use crate::scene::solid3d_tess;
use crate::scene::model::mesh_model::MeshLodSet;
use crate::scene::convert::solid3d_tess;
use acadrust::{types::Vector3, EntityType};
/// `point_of_reference` of an ACIS-backed volume entity, if applicable.
+9 -9
View File
@@ -7,8 +7,8 @@ use truck_modeling::{
use crate::command::EntityTransform;
use crate::entities::common::{ro_prop as ro, square_grip};
use crate::entities::traits::TruckConvertible;
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
fn to_truck(spl: &Spline) -> TruckEntity {
let n = spl.control_points.len();
@@ -141,12 +141,12 @@ fn apply_grip(spline: &mut Spline, grip_id: usize, apply: GripApply) {
}
fn apply_transform(spline: &mut Spline, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| {
crate::scene::view::transform::apply_standard_entity_transform(spline, t, |entity, p1, p2| {
for cp in &mut entity.control_points {
crate::scene::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut cp.x, &mut cp.y, p1, p2);
}
for fp in &mut entity.fit_points {
crate::scene::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut fp.x, &mut fp.y, p1, p2);
}
});
}
@@ -164,8 +164,8 @@ impl crate::entities::traits::Grippable for Spline {
fn apply_grip(&mut self, grip_id: usize, apply: GripApply) {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -185,8 +185,8 @@ impl crate::entities::traits::Grippable for Spline {
},
]
}
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::object::GripMenuAction) {
use crate::scene::object::GripMenuAction as A;
fn apply_grip_menu(&mut self, grip_id: usize, action: crate::scene::model::object::GripMenuAction) {
use crate::scene::model::object::GripMenuAction as A;
let n = self.control_points.len();
let min_cv = (self.degree as usize).saturating_add(1).max(2);
match action {
+7 -7
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
layout_mtext, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::transform;
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::view::transform;
use crate::scene::model::wire_model::SnapHint;
fn v3(v: &acadrust::types::Vector3) -> Vec3 {
Vec3::new(v.x as f32, v.y as f32, v.z as f32)
@@ -335,9 +335,9 @@ pub fn tessellate_table(
entity_color: [f32; 4],
line_weight_px: f32,
world_offset: [f64; 3],
) -> Vec<crate::scene::wire_model::WireModel> {
use crate::scene::tess_util::aci_to_rgba;
use crate::scene::wire_model::WireModel;
) -> Vec<crate::scene::model::wire_model::WireModel> {
use crate::scene::convert::tess_util::aci_to_rgba;
use crate::scene::model::wire_model::WireModel;
use acadrust::types::Color;
use rustc_hash::FxHashMap as HashMap;
+15 -15
View File
@@ -7,10 +7,10 @@ use crate::entities::text_support::{
resolve_dxf_special_chars, resolve_text_style, text_local_bounds,
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::lff;
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::text::lff;
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
fn text_halign_str(a: &acadrust::entities::TextHorizontalAlignment) -> &'static str {
use acadrust::entities::TextHorizontalAlignment::*;
@@ -50,7 +50,7 @@ fn sync_text_alignment_point(t: &mut Text) {
fn to_truck(t: &Text, document: &acadrust::CadDocument) -> TruckEntity {
let normal = (t.normal.x, t.normal.y, t.normal.z);
let (wsx, wsy, wsz) = crate::scene::transform::ocs_point_to_wcs(
let (wsx, wsy, wsz) = crate::scene::view::transform::ocs_point_to_wcs(
(
t.insertion_point.x,
t.insertion_point.y,
@@ -287,15 +287,15 @@ fn apply_grip(t: &mut Text, _grip_id: usize, apply: GripApply) {
}
fn apply_transform(t: &mut Text, tr: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(t, tr, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.insertion_point.x,
&mut entity.insertion_point.y,
p1,
p2,
);
if let Some(ref mut a) = entity.alignment_point {
crate::scene::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2);
crate::scene::view::transform::reflect_xy_point(&mut a.x, &mut a.y, p1, p2);
}
let dx = (p2.x - p1.x) as f64;
let dy = (p2.y - p1.y) as f64;
@@ -320,8 +320,8 @@ impl Grippable for Text {
apply_grip(self, grip_id, apply);
}
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::object::GripMenuItem> {
use crate::scene::object::{GripMenuAction, GripMenuItem};
fn grip_menu(&self, _grip_id: usize) -> Vec<crate::scene::model::object::GripMenuItem> {
use crate::scene::model::object::{GripMenuAction, GripMenuItem};
vec![
GripMenuItem {
label: "Stretch",
@@ -338,7 +338,7 @@ impl Grippable for Text {
]
}
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::object::GripMenuAction) {
fn apply_grip_menu(&mut self, _grip_id: usize, _action: crate::scene::model::object::GripMenuAction) {
// Move-with-Text falls through to Stretch (single grip moves
// the whole text); Rotate needs a follow-up angle handled by
// `apply_grip_menu_value`.
@@ -347,9 +347,9 @@ impl Grippable for Text {
fn grip_menu_value_prompt(
&self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
) -> Option<&'static str> {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
match action {
A::RotateText => Some("Rotation (deg)"),
_ => None,
@@ -359,10 +359,10 @@ impl Grippable for Text {
fn apply_grip_menu_value(
&mut self,
_grip_id: usize,
action: crate::scene::object::GripMenuAction,
action: crate::scene::model::object::GripMenuAction,
value: f64,
) {
use crate::scene::object::GripMenuAction as A;
use crate::scene::model::object::GripMenuAction as A;
if matches!(action, A::RotateText) {
self.rotation = value.to_radians();
}
+3 -3
View File
@@ -1,9 +1,9 @@
use acadrust::types::aci_table::aci_to_rgb;
use acadrust::{CadDocument, EntityType};
use crate::scene::acad_to_truck::TextStroke;
use crate::scene::font_face::Face;
use crate::scene::lff;
use crate::scene::convert::acad_to_truck::TextStroke;
use crate::scene::text::font_face::Face;
use crate::scene::text::lff;
pub struct ResolvedTextStyle {
pub font_name: String,
+5 -4
View File
@@ -4,10 +4,11 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::{lff, transform};
use crate::scene::convert::acad_to_truck::{TextStroke, TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
// ── GDT text parser ───────────────────────────────────────────────────────────
+9 -9
View File
@@ -1,11 +1,11 @@
use acadrust::{CadDocument, EntityType};
use crate::command::EntityTransform;
use crate::scene::acad_to_truck::TruckEntity;
use crate::scene::object::{
use crate::scene::convert::acad_to_truck::TruckEntity;
use crate::scene::model::object::{
GripApply, GripDef, GripMenuAction, GripMenuItem, PropSection,
};
use crate::scene::tess_util::FallbackGeometry;
use crate::scene::convert::tess_util::FallbackGeometry;
pub trait TruckConvertible {
fn to_truck(&self, document: &CadDocument) -> Option<TruckEntity>;
@@ -192,13 +192,13 @@ macro_rules! dispatch {
macro_rules! impl_entity_basics {
($T:ty) => {
impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> {
fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(
&mut self,
grip_id: usize,
apply: $crate::scene::object::GripApply,
apply: $crate::scene::model::object::GripApply,
) {
apply_grip(self, grip_id, apply);
}
@@ -207,7 +207,7 @@ macro_rules! impl_entity_basics {
fn geometry_properties(
&self,
_text_style_names: &[String],
) -> $crate::scene::object::PropSection {
) -> $crate::scene::model::object::PropSection {
properties(self)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
@@ -229,13 +229,13 @@ macro_rules! impl_entity_basics {
macro_rules! impl_entity_basics_with_text_styles {
($T:ty) => {
impl $crate::entities::traits::Grippable for $T {
fn grips(&self) -> Vec<$crate::scene::object::GripDef> {
fn grips(&self) -> Vec<$crate::scene::model::object::GripDef> {
grips(self)
}
fn apply_grip(
&mut self,
grip_id: usize,
apply: $crate::scene::object::GripApply,
apply: $crate::scene::model::object::GripApply,
) {
apply_grip(self, grip_id, apply);
}
@@ -244,7 +244,7 @@ macro_rules! impl_entity_basics_with_text_styles {
fn geometry_properties(
&self,
text_style_names: &[String],
) -> $crate::scene::object::PropSection {
) -> $crate::scene::model::object::PropSection {
properties(self, text_style_names)
}
fn apply_geom_prop(&mut self, field: &str, value: &str) {
+4 -4
View File
@@ -10,9 +10,9 @@ use glam::Vec3;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckConvertible};
use crate::scene::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::object::{GripApply, GripDef, PropSection};
use crate::scene::wire_model::SnapHint;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
// ── Helpers ───────────────────────────────────────────────────────────────────
@@ -224,7 +224,7 @@ impl PropertyEditable for Underlay {
impl Transformable for Underlay {
fn apply_transform(&mut self, t: &EntityTransform) {
use crate::scene::transform::reflect_xy_point;
use crate::scene::view::transform::reflect_xy_point;
match t {
EntityTransform::Translate(d) => {
self.insertion_point.x += d.x as f64;
+4 -4
View File
@@ -5,7 +5,7 @@ use crate::entities::common::{
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
};
use crate::scene::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
// ── Standard scale options ────────────────────────────────────────────────
@@ -533,8 +533,8 @@ fn apply_grip(vp: &mut Viewport, grip_id: usize, apply: GripApply) {
}
fn apply_transform(vp: &mut Viewport, t: &EntityTransform) {
crate::scene::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| {
crate::scene::transform::reflect_xy_point(
crate::scene::view::transform::apply_standard_entity_transform(vp, t, |entity, p1, p2| {
crate::scene::view::transform::reflect_xy_point(
&mut entity.center.x,
&mut entity.center.y,
p1,
@@ -549,7 +549,7 @@ impl crate::entities::traits::FallbackTess for Viewport {
fn fallback_geometry(
&self,
world_offset: [f64; 3],
) -> crate::scene::tess_util::FallbackGeometry {
) -> crate::scene::convert::tess_util::FallbackGeometry {
let [ox, oy, oz] = world_offset;
let cx = (self.center.x - ox) as f32;
let cy = (self.center.y - oy) as f32;