forked from 1b-agent/opencadstudio-upstream
DWF/DGN underlays: clipping, layers, text, 3D DGN, colours and zoom extents
- PDFOSNAP, DWFOSNAP and DGNOSNAP are separate; UOSNAP sets them all and reads 2 while they differ. Enable Snap switches the selected kind's. - DWFCLIP / DGNCLIP clip their own kind with the kind's prompts and message; CLIP routes DWF and DGN underlays there; Enter at a corner asks again. - The right-edge underlay tools show for DWF and DGN too (import is PDF only). - Underlay layers: DGN levels (V8 level table, "Default" listed as "0"; V7 used levels named from the level name table), hidden through the layer override data with the DGN placeholder string first; a plotted DWF has none. - V8 colour read from its colour word (by level, index, or a true colour drawn as its nearest index); 3D V8 elements drawn in plan (lines, line strings, ellipses and arcs by their orientation, text); a model's extent includes its text. - DWF 6 TrueType text (font, height, rotation from the font opcode) and DWFx glyph runs are drawn; the default W2D colour map is the measured one. - Contrast pulls lightness towards a per-kind pivot as measured (PDF 0.5, DWF 0.243, DGN 0.65). - Zoom extents includes raster images and underlays whose frames are hidden. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1cbe89ef62
commit
56ecf786f1
41 files changed
+593
-147
No files matched your search
@@ -1,17 +1,20 @@
|
||||
//! The right-edge PDF underlay and xref tools: their state comes from the
|
||||
//! The right-edge underlay and xref tools: their state comes from the
|
||||
//! selection, their buttons edit it.
|
||||
|
||||
use super::*;
|
||||
use codec::entities::{Underlay, UnderlayDisplayFlags, UnderlayType};
|
||||
use codec::entities::{Underlay, UnderlayDisplayFlags};
|
||||
use crate::ui::ribbon::UnderlayContext;
|
||||
|
||||
impl OpenCADStudio {
|
||||
/// The selected PDF underlays, or nothing when anything else is selected.
|
||||
/// The selected underlays when they are all of one kind, or nothing
|
||||
/// when anything else (or another kind) is selected.
|
||||
fn selected_pdf_underlays(&self, i: usize) -> Vec<(codec::Handle, Underlay)> {
|
||||
let mut out = Vec::new();
|
||||
let mut out: Vec<(codec::Handle, Underlay)> = Vec::new();
|
||||
for (handle, entity) in self.tabs[i].scene.selected_entities() {
|
||||
match entity {
|
||||
codec::EntityType::Underlay(u) if u.underlay_type == UnderlayType::Pdf => {
|
||||
codec::EntityType::Underlay(u)
|
||||
if out.first().is_none_or(|(_, first)| first.underlay_type == u.underlay_type) =>
|
||||
{
|
||||
out.push((handle, u.clone()));
|
||||
}
|
||||
_ => return Vec::new(),
|
||||
@@ -51,9 +54,10 @@ impl OpenCADStudio {
|
||||
} else {
|
||||
self.selected_pdf_underlays(i).first().map(|(_, u)| {
|
||||
UnderlayContext {
|
||||
kind: u.underlay_type,
|
||||
monochrome: u.flags.contains(UnderlayDisplayFlags::MONOCHROME),
|
||||
shown: u.flags.contains(UnderlayDisplayFlags::ON),
|
||||
snap: crate::scene::model::pdf_vector::pdf_osnap(),
|
||||
snap: crate::scene::model::pdf_vector::underlay_osnap(u.underlay_type),
|
||||
}
|
||||
})
|
||||
};
|
||||
@@ -106,9 +110,14 @@ impl OpenCADStudio {
|
||||
.is_some_and(|(_, u)| u.flags.contains(UnderlayDisplayFlags::ON));
|
||||
self.edit_selected_underlays(i, "PDFUNDERLAY", |u| u.set_on(on));
|
||||
}
|
||||
// Enable Snap switches PDFOSNAP, DWFOSNAP or DGNOSNAP.
|
||||
"_PDFULSNAP" => {
|
||||
let on = !crate::scene::model::pdf_vector::pdf_osnap();
|
||||
crate::scene::model::pdf_vector::set_pdf_osnap(on);
|
||||
let Some((_, underlay)) = self.selected_pdf_underlays(i).into_iter().next() else {
|
||||
return Some(Task::none());
|
||||
};
|
||||
let kind = underlay.underlay_type;
|
||||
let on = !crate::scene::model::pdf_vector::underlay_osnap(kind);
|
||||
crate::scene::model::pdf_vector::set_underlay_osnap(kind, on);
|
||||
self.tabs[i].scene.reseed_underlays();
|
||||
self.sync_underlay_tab();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user