diff --git a/opossum/src/nodes/node_group/mod.rs b/opossum/src/nodes/node_group/mod.rs index 43d663fe91c292c881757cbbe8c6575ed5608978..167b190e2f8c2cea59476fb005e1adcfcea30d94 100644 --- a/opossum/src/nodes/node_group/mod.rs +++ b/opossum/src/nodes/node_group/mod.rs @@ -368,13 +368,13 @@ impl NodeGroup { } /// Returns the dot-file header of this [`NodeGroup`] graph. fn add_dot_header(&self, rankdir: &str) -> String { - let mut dot_string = String::from("digraph {\n\tfontsize = 8;\n"); + let mut dot_string = String::from("digraph {\n\tfontsize = 10;\n"); dot_string.push_str("\tcompound = true;\n"); dot_string.push_str(&format!("\trankdir = \"{rankdir}\";\n")); dot_string.push_str(&format!("\tlabel=\"{}\"\n", self.node_attr.name())); dot_string.push_str("\tfontname=\"Courier-monospace\"\n"); - dot_string.push_str("\tnode [fontname=\"Courier-monospace\" fontsize = 8]\n"); - dot_string.push_str("\tedge [fontname=\"Courier-monospace\"]\n\n"); + dot_string.push_str("\tnode [fontname=\"Courier-monospace\" fontsize = 10]\n"); + dot_string.push_str("\tedge [fontname=\"Courier-monospace\" fontsize = 10]\n\n"); dot_string } /// Export the optic graph, including ports, into the `dot` format to be used in combination with diff --git a/opossum/src/nodes/node_group/optic_graph.rs b/opossum/src/nodes/node_group/optic_graph.rs index 9ef535516632cb88589f372cf48228b1ce68a404..79dbc6e64c6c98dce95a4891cc4e83f175c9250f 100644 --- a/opossum/src/nodes/node_group/optic_graph.rs +++ b/opossum/src/nodes/node_group/optic_graph.rs @@ -11,7 +11,7 @@ use crate::{ optic_ref::OpticRef, optic_senery_rsc::SceneryResources, port_map::PortMap, - properties::Proptype, + properties::{proptype::format_quantity, Proptype}, rays::Rays, }; use log::warn; @@ -34,7 +34,7 @@ use std::{ collections::BTreeMap, rc::Rc, }; -use uom::si::f64::Length; +use uom::si::{f64::Length, length::meter}; use uuid::Uuid; /// Data structure representing an optical graph @@ -681,10 +681,12 @@ impl OpticGraph { .edge_endpoints(edge_idx) .ok_or_else(|| OpossumError::Other("could not get edge_endpoints".into()))?; + let dist = self.distance_from_predecessor(end_nodes.1, light.target_port())?; + let src_edge_str = self.create_node_edge_str(end_nodes.0, light.src_port())?; let target_edge_str = self.create_node_edge_str(end_nodes.1, light.target_port())?; - dot_string.push_str(&format!(" {src_edge_str} -> {target_edge_str} \n")); + dot_string.push_str(&format!(" {src_edge_str} -> {target_edge_str} [label=\"{}\"]\n", format_quantity(meter, dist))); } dot_string.push_str("}\n"); Ok(dot_string) diff --git a/opossum/src/properties/proptype.rs b/opossum/src/properties/proptype.rs index 911e742762be7e7ad8613ff150e085c81a9b2a25..deadbe64f37c91f6b790c6d9e582339f5468a403 100644 --- a/opossum/src/properties/proptype.rs +++ b/opossum/src/properties/proptype.rs @@ -266,7 +266,7 @@ pub fn format_value_with_prefix(value: f64) -> String { format!("{:8.3} {prefix}", value / f64::powi(10.0, exponent)) } -fn format_quantity<D, U, V, N>(_: N, q: Quantity<D, U, V>) -> String +pub fn format_quantity<D, U, V, N>(_: N, q: Quantity<D, U, V>) -> String where D: Dimension + ?Sized, U: Units<V> + ?Sized,