forked from 1b-agent/opencadstudio-upstream
Point clouds: POINTCLOUDCOLORMAP dialog, out-of-range colouring
POINTCLOUDCOLORMAP asks for a cloud (or None for the drawing's default schemes) and opens the Point Cloud Color Map dialog: intensity and elevation tabs with the scheme list, New / Delete / Rename, number of colours (2-25, resampled along the scheme), blend between the ends, reverse, gradient or bands, the colorized range, the out-of-range choice and, for elevation, the cloud's extents or a fixed range with its band height. OK / Apply write the drawing's colour map (created under ACAD_POINTCLOUD_COLORMAP_DICT when missing) and the cloud's colouring in one undo step; Make stylization current sets the tab's stylization. Values outside a scheme's range take the end colours, the scan colours or are hidden. Automation action pc_colormap edits the dialog. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7761652a9f
commit
2eaae1ecab
32 files changed
+1449
-21
No files matched your search
@@ -86,3 +86,80 @@ impl CadCommand for PointCloudStylizeCommand {
|
||||
}
|
||||
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POINTCLOUDSTYLIZE"] });
|
||||
|
||||
// POINTCLOUDCOLORMAP — the Point Cloud Color Map dialog.
|
||||
//
|
||||
// Select point cloud or [None] <None>:
|
||||
//
|
||||
// A picked cloud opens the dialog for it; None (or Enter) for the
|
||||
// drawing's default schemes.
|
||||
pub struct PointCloudColorMapCommand {
|
||||
picked: Option<codec::EntityType>,
|
||||
}
|
||||
|
||||
impl PointCloudColorMapCommand {
|
||||
pub fn new() -> Self {
|
||||
Self { picked: None }
|
||||
}
|
||||
}
|
||||
|
||||
impl CadCommand for PointCloudColorMapCommand {
|
||||
fn name(&self) -> &'static str {
|
||||
"POINTCLOUDCOLORMAP"
|
||||
}
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
"Select point cloud or [None] <None>:".to_string()
|
||||
}
|
||||
|
||||
fn options(&self) -> Vec<CmdOption> {
|
||||
vec![CmdOption::new("None", "N")]
|
||||
}
|
||||
|
||||
fn input_kind(&self) -> InputKind {
|
||||
InputKind::Point
|
||||
}
|
||||
|
||||
fn point_step_accepts_keywords(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn needs_entity_pick(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn inject_before_entity_pick(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn inject_picked_entity(&mut self, entity: codec::EntityType) {
|
||||
self.picked = Some(entity);
|
||||
}
|
||||
|
||||
fn on_entity_pick(&mut self, handle: Handle, _pt: glam::DVec3) -> CmdResult {
|
||||
match self.picked.take() {
|
||||
Some(entity) if crate::scene::is_point_cloud(&entity) => {
|
||||
CmdResult::Dispatch(format!("_PCCOLORMAP {:X}", handle.value()))
|
||||
}
|
||||
// Anything else: the prompt again.
|
||||
_ => CmdResult::NeedPoint,
|
||||
}
|
||||
}
|
||||
|
||||
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
|
||||
match text.trim().to_ascii_uppercase().as_str() {
|
||||
"" | "N" | "NONE" => Some(CmdResult::Dispatch("_PCCOLORMAP".to_string())),
|
||||
_ => Some(CmdResult::ReportError("Invalid option keyword.".to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
fn on_point(&mut self, _pt: glam::DVec3) -> CmdResult {
|
||||
CmdResult::NeedPoint
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
CmdResult::Dispatch("_PCCOLORMAP".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
inventory::submit!(crate::command::CommandRegistration { names: &["POINTCLOUDCOLORMAP"] });
|
||||
Reference in new issue
Block a user