Skip to content

Commit

Permalink
Document public modules
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGrupp committed Feb 19, 2025
1 parent 05d331f commit 95a5cab
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Main application state and options.
use std::collections::{BTreeMap, HashMap};
use std::path::absolute;
use std::vec::Vec;
Expand Down Expand Up @@ -47,6 +49,7 @@ pub enum ActiveTool {
Measure,
}

/// Contains all configurable options of the application.
#[derive(Debug, Default, Serialize, Deserialize)]
pub struct AppOptions {
pub version: String,
Expand Down Expand Up @@ -85,6 +88,7 @@ pub struct SessionData {
pub grid_lenses: HashMap<String, egui::Pos2>,
}

/// Main application state, implements the `eframe::App` trait.
#[derive(Default)]
pub struct AppState {
pub options: AppOptions,
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
//! Library target of the `maps` app.
//!
//! The public components listed here can be reused in external applications.
//!
//! Note that public API is not the main focus of this app crate.
//! But feel free to use parts of it as you see fit.
pub mod app;
mod app_impl;
mod draw_order;
Expand Down
2 changes: 2 additions & 0 deletions src/map_pose.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Pose utilities for map alignment.
use std::path::PathBuf;

use eframe::emath;
Expand Down
2 changes: 2 additions & 0 deletions src/meta.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Map metadata.
use eframe::emath;
use log::debug;
use serde::{Deserialize, Serialize};
Expand Down
7 changes: 5 additions & 2 deletions src/value_colormap.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
//! Color map implementations.
use image::Rgba;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use strum_macros::Display;

/// Color mapping from cell values to RGBA colors.
/// Trait for color mapping from cell values to RGBA colors.
pub trait ValueColorMap {
fn map(&self, value: u8) -> Rgba<u8>;
}
Expand All @@ -27,7 +29,8 @@ pub enum ColorMap {
}

impl ColorMap {
/// Gives access to the corresponding color map implementation.
/// Gives access to the corresponding color map trait implementations
/// that are implemented in this module.
pub fn get(&self) -> &dyn ValueColorMap {
match self {
ColorMap::RvizMap => &*RVIZ_MAP,
Expand Down
2 changes: 1 addition & 1 deletion src/value_interpretation.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Value thresholding options.
//! Mostly follows ROS: wiki.ros.org/map_server#Value_Interpretation
//!
//!
//! Since the nav map_server slightly deviates from that documentation,
//! it's also possible to mimic its behavior.
Expand Down

0 comments on commit 95a5cab

Please sign in to comment.