forked from 1b-agent/opencadstudio-upstream
PDF underlays: attach prompts and definitions, display adjustments and clipping, Properties, snapping, PDFCLIP and PDFIMPORT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc9d5edbff
commit
0c50013ca7
50 files changed
+2770
-325
No files matched your search
@@ -611,7 +611,7 @@ fn tessellate_entity_inner(
|
||||
match e {
|
||||
EntityType::Viewport(_) | EntityType::Insert(_) => {}
|
||||
_ => {
|
||||
let ab = entity_aabb(e);
|
||||
let ab = entity_aabb_in(document, e);
|
||||
if ab != WireModel::UNBOUNDED_AABB {
|
||||
if let Some(view) = view_aabb {
|
||||
if cache::block_cache::aabb_disjoint_xy(ab, view) {
|
||||
@@ -736,7 +736,7 @@ fn tessellate_entity_inner(
|
||||
bg_color,
|
||||
false,
|
||||
);
|
||||
let ab = entity_aabb(e);
|
||||
let ab = entity_aabb_in(document, e);
|
||||
for w in &mut wires {
|
||||
set_wire_aabb(w, ab);
|
||||
}
|
||||
@@ -990,7 +990,7 @@ fn tessellate_entity_inner(
|
||||
)
|
||||
.wires;
|
||||
if !wires.is_empty() {
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
for wire in &mut wires {
|
||||
if !wire.points.is_empty() || !wire.fill_tris.is_empty() {
|
||||
set_wire_aabb(wire, aabb);
|
||||
@@ -1002,7 +1002,7 @@ fn tessellate_entity_inner(
|
||||
}
|
||||
|
||||
if let EntityType::Dimension(dim) = e {
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
use crate::entities::dimension::DimensionTess;
|
||||
let mut wires = dim.tessellate(
|
||||
document,
|
||||
@@ -1032,7 +1032,7 @@ fn tessellate_entity_inner(
|
||||
}
|
||||
|
||||
if let EntityType::MultiLeader(ml) = e {
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
use crate::entities::multileader::MultiLeaderTess;
|
||||
let mut wires = ml.tessellate(
|
||||
document,
|
||||
@@ -1099,7 +1099,7 @@ fn tessellate_entity_inner(
|
||||
)
|
||||
.wires;
|
||||
if !wires.is_empty() {
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
for wire in &mut wires {
|
||||
if !wire.points.is_empty() || !wire.fill_tris.is_empty() {
|
||||
set_wire_aabb(wire, aabb);
|
||||
@@ -1150,7 +1150,7 @@ fn tessellate_entity_inner(
|
||||
);
|
||||
}
|
||||
if !wires.is_empty() {
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
for wire in &mut wires {
|
||||
wire.aci = aci;
|
||||
if !wire.points.is_empty() || !wire.fill_tris.is_empty() {
|
||||
@@ -1245,7 +1245,7 @@ fn tessellate_entity_inner(
|
||||
return wires;
|
||||
}
|
||||
|
||||
let aabb = entity_aabb(e);
|
||||
let aabb = entity_aabb_in(document, e);
|
||||
|
||||
// TEXT / MTEXT / ATTDEF / ATTRIB / Tolerance all render as SDF glyph quads
|
||||
// (crisp at every zoom), so there is no text LOD ladder — they fall through
|
||||
@@ -1753,6 +1753,30 @@ pub(crate) fn entity_bounds(e: &acadrust::EntityType) -> ([f64; 3], [f64; 3]) {
|
||||
)
|
||||
}
|
||||
|
||||
/// [`entity_bounds`] with the document, for entities whose extent is not
|
||||
/// stored on the entity: an underlay spans its page (or its clip).
|
||||
pub(crate) fn entity_bounds_in(
|
||||
document: &acadrust::CadDocument,
|
||||
e: &acadrust::EntityType,
|
||||
) -> ([f64; 3], [f64; 3]) {
|
||||
if let acadrust::EntityType::Underlay(underlay) = e {
|
||||
if let Some(bounds) = crate::entities::underlay::world_bounds(underlay, document) {
|
||||
return bounds;
|
||||
}
|
||||
}
|
||||
entity_bounds(e)
|
||||
}
|
||||
|
||||
/// [`entity_aabb`] with the document (see [`entity_bounds_in`]).
|
||||
pub(crate) fn entity_aabb_in(document: &acadrust::CadDocument, e: &acadrust::EntityType) -> [f32; 4] {
|
||||
if let acadrust::EntityType::Underlay(underlay) = e {
|
||||
if let Some((min, max)) = crate::entities::underlay::world_bounds(underlay, document) {
|
||||
return [min[0] as f32, min[1] as f32, max[0] as f32, max[1] as f32];
|
||||
}
|
||||
}
|
||||
entity_aabb(e)
|
||||
}
|
||||
|
||||
pub(crate) fn entity_aabb(e: &acadrust::EntityType) -> [f32; 4] {
|
||||
let (min, max) = entity_bounds(e);
|
||||
let min_x = min[0] as f32;
|
||||
|
||||
Reference in new issue
Block a user