Show total volume as text on each well
This commit is contained in:
parent
50052fc88d
commit
31066dd6f6
|
|
@ -176,18 +176,24 @@ fn calculate_shading_for_wells(
|
|||
cache.get_or_calculate_destination(transfer)
|
||||
}
|
||||
};
|
||||
let volume = if let plate_tool_lib::transfer_volume::TransferVolume::Single(x) =
|
||||
transfer.volume
|
||||
{
|
||||
x
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
if let Some(wells) = cache_result {
|
||||
for well in wells.iter().filter(|x| x.row <= rows && x.col <= columns) {
|
||||
|
||||
let volume = match &transfer.volume {
|
||||
plate_tool_lib::transfer_volume::TransferVolume::Single(x) => *x,
|
||||
plate_tool_lib::transfer_volume::TransferVolume::WellMap(wm) => {
|
||||
match plate_type {
|
||||
plate_tool_lib::plate::PlateType::Source => wm.source_only[well],
|
||||
plate_tool_lib::plate::PlateType::Destination => wm.destination_only[well],
|
||||
}
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
if let Some(Some(mut x)) = well_infos.get_mut(
|
||||
(well.row - 1) as usize * columns as usize + (well.col - 1) as usize,
|
||||
) {
|
||||
// Well info already existed.
|
||||
x.volume += volume;
|
||||
|
||||
x.color = if display_options.show_volume_heatmap {
|
||||
|
|
@ -196,6 +202,7 @@ fn calculate_shading_for_wells(
|
|||
PALETTE.get_ordered(transfer.id, ordered_ids)
|
||||
};
|
||||
} else {
|
||||
// Well info does not already exist, we need to make it.
|
||||
if let Some(mut wi) = well_infos.get_mut(
|
||||
(well.row - 1) as usize * columns as usize + (well.col - 1) as usize,
|
||||
) {
|
||||
|
|
@ -325,8 +332,15 @@ fn add_plate_sub(
|
|||
};
|
||||
let well_infos = {
|
||||
// Get non-active transfer info
|
||||
let mut well_infos =
|
||||
calculate_shading_for_wells(rows, columns, transfers, plate_type, ordered_ids, cache, display_options);
|
||||
let mut well_infos = calculate_shading_for_wells(
|
||||
rows,
|
||||
columns,
|
||||
transfers,
|
||||
plate_type,
|
||||
ordered_ids,
|
||||
cache,
|
||||
display_options,
|
||||
);
|
||||
|
||||
// Get wells in the current transfer to tack on to well_infos separately
|
||||
let current_transfer_wells: Option<Box<[(usize, usize)]>> = {
|
||||
|
|
@ -406,6 +420,20 @@ fn add_plate_sub(
|
|||
}
|
||||
}
|
||||
|
||||
// Draw volume text
|
||||
|
||||
if let Some(well_info) =
|
||||
well_infos[(c_row - 1) as usize * columns as usize + (c_column - 1) as usize]
|
||||
{
|
||||
painter.text(
|
||||
center,
|
||||
egui::Align2::CENTER_CENTER,
|
||||
format!("{:.1}", well_info.volume),
|
||||
egui::FontId::proportional(radius * 0.6),
|
||||
egui::Color32::BLACK,
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw stroke on top
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue