From a4ed52db1e3b68bef16bc052725326138be6c62b Mon Sep 17 00:00:00 2001 From: csawatzky Date: Tue, 16 Jun 2026 12:40:07 -0600 Subject: [PATCH] also displaying the inventory control type next to "Bin Fill" in the inventory summary and added a fallback to display the inventory in the bin using the basic grain fill when there are no nodes to be able to render the heatmaps, also adjusted the brightness and colour of the basic grain fill --- src/bin/3dView/Scene/Bin3dView.tsx | 46 +++++++++++-------- .../Systems/Inventory/GrainCableFill.tsx | 15 +++--- .../Systems/Inventory/GrainFillFlat.tsx | 11 ++--- src/bin/bin3dVisualizer.tsx | 2 - src/bin/binSummary/BinSummary.tsx | 23 +++++++++- 5 files changed, 61 insertions(+), 36 deletions(-) diff --git a/src/bin/3dView/Scene/Bin3dView.tsx b/src/bin/3dView/Scene/Bin3dView.tsx index d14297d..0d15558 100644 --- a/src/bin/3dView/Scene/Bin3dView.tsx +++ b/src/bin/3dView/Scene/Bin3dView.tsx @@ -6,7 +6,7 @@ import { Bin } from "models"; import BinShell from "../BinParts/BinShell"; import GrainFillFlat from "../Systems/Inventory/GrainFillFlat"; import BinCables from "../Systems/Cables/BinCables"; -import { Vector3 } from "three"; +// import { Vector3 } from "three"; import { useMemo } from "react"; import { BuildCableData, CableData } from "../Data/BuildCableData"; import { BuildNodeData, NodeData } from "../Data/BuildNodeData"; @@ -14,10 +14,10 @@ import { pond } from "protobuf-ts/pond"; import GrainCableFill from "../Systems/Inventory/GrainCableFill"; import TempHeatMap from "../Systems/Heatmap/TempHeatMap"; import NodePointCloud from "../Systems/Heatmap/NodePointCloud"; -import { Box } from "@mui/material"; +// import { Box } from "@mui/material"; import MoistureHeatMap from "../Systems/Heatmap/MoistureHeatmap"; import { grainYBoundsFromFillPercent } from "../utils/grainFillBounds"; -import { RadiansToDegrees } from "common/TrigFunctions"; +// import { RadiansToDegrees } from "common/TrigFunctions"; // import { GrainCable } from "models/GrainCable" // Fallback dimensions used when a bin has no advanced dimensions configured. @@ -40,6 +40,10 @@ interface Props { */ fillPercent?: number nodeClick?: (node: NodeData, cable: CableData) => void + /** + * When true, renders the basic fill and suppresses the heatmaps. + * Heatmaps already simulate the grain level so showing both is redundant. + */ showGrain?: boolean showTempHeatmap?: boolean showMoistureHeatmap?: boolean @@ -108,25 +112,30 @@ export default function Bin3dView(props: Props) { const resetCameraFn = React.useRef<(() => void) | null>(null); const grainInventory = () => { + const grainColour = "#fff300"; + //note that adjusting the opacity is how to adjust the brightness, less makes it dimmer if (isCableInventory) { return ( ) } else if (fillPercent) { return ( ) } @@ -155,8 +164,6 @@ export default function Bin3dView(props: Props) { renderOrder={4} /> - {showGrain && grainInventory()} - } {/* note that the heatmaps internally use render order 1,2, and 3 for the three separate coloured meshes */} - {showTempHeatmap && ( - 0 + ? - )} - {showMoistureHeatmap && ( - - )} + : showMoistureHeatmap && nodeData.length > 0 + ? + : grainInventory() + } diff --git a/src/bin/3dView/Systems/Inventory/GrainCableFill.tsx b/src/bin/3dView/Systems/Inventory/GrainCableFill.tsx index 3cb8cd7..f7b769b 100644 --- a/src/bin/3dView/Systems/Inventory/GrainCableFill.tsx +++ b/src/bin/3dView/Systems/Inventory/GrainCableFill.tsx @@ -16,6 +16,7 @@ interface Props { * If undefined and no top nodes exist, nothing is rendered. */ fallbackFillPercent?: number; + colour?: string } // Tuning knobs @@ -59,13 +60,13 @@ export default function GrainCableFill(props: Props) { hopperHeight = 0, nodes, fallbackFillPercent, - grainOpacity + grainOpacity, + colour } = props; const binRadius = diameter / 2; // Slightly inset to avoid z-fighting with the shell const grainRadius = binRadius * 0.98; - const grainColour = "#fff302"; // --- Collect top nodes (non-excluded, inGrain) --- const topNodes = useMemo(() => @@ -256,7 +257,7 @@ export default function GrainCableFill(props: Props) { }} position={new Vector3(0, -(sidewallHeight / 2 + hopperHeight) + hopperFillHeight / 2, 0)} rotation={new Euler(Math.PI, 0, 0)} - colour={grainColour} + colour={colour} roughness={1} metalness={0} opacity={grainOpacity} @@ -276,7 +277,7 @@ export default function GrainCableFill(props: Props) { openEnded: false }} position={new Vector3(0, -sidewallHeight / 2 + cylinderFillHeight / 2, 0)} - colour={grainColour} + colour={colour} roughness={1} metalness={0} opacity={grainOpacity} @@ -296,7 +297,7 @@ export default function GrainCableFill(props: Props) { {surfaceGeometry && ( {/* Hopper fill */} @@ -98,7 +97,7 @@ export default function GrainFillFlat(props: Props) { }} position={hopperPosition} rotation={hopperRotation} - colour={grainColour} + colour={colour} roughness={1} metalness={0} opacity={grainOpacity} @@ -119,7 +118,7 @@ export default function GrainFillFlat(props: Props) { openEnded: false }} position={cylinderPosition} - colour={grainColour} + colour={colour} roughness={1} metalness={0} opacity={grainOpacity} diff --git a/src/bin/bin3dVisualizer.tsx b/src/bin/bin3dVisualizer.tsx index 06bc722..9bdfd0c 100644 --- a/src/bin/bin3dVisualizer.tsx +++ b/src/bin/bin3dVisualizer.tsx @@ -414,8 +414,6 @@ export default function bin3dVisualizer(props: Props){ showMoistureHeatmap={showMoistureHeatmap} showTemp={showTemp && showLabels} showMoisture={showMoisture && showLabels} - // showGrain={showFill} - // showHotspots={showHotspots} xOffset={isMobile ? undefined : -120} /> {isMobile ? mobileHUD() : desktopHUD()} diff --git a/src/bin/binSummary/BinSummary.tsx b/src/bin/binSummary/BinSummary.tsx index 293a720..dcab089 100644 --- a/src/bin/binSummary/BinSummary.tsx +++ b/src/bin/binSummary/BinSummary.tsx @@ -71,6 +71,25 @@ export default function BinSummary(props: Props){ // } // },[devices]) + const inventoryControl = () => { + switch (bin.inventoryControl()) { + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_MANUAL: + return "Manual" + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_AUTOMATIC: + return "Auto Cable" + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_AUTOMATIC_LIDAR: + return "Auto Lidar" + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_HYBRID_CABLE: + return "Hybrid Cable" + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_HYBRID_LIDAR: + return "Hybrid Lidar" + case pond.BinInventoryControl.BIN_INVENTORY_CONTROL_LIBRACART: + return "Libra Cart" + default: + return "Not Set" + } + } + const activity = (reading: string) => { //if the device hasnt checked in in 6 hours = missing 12 hours = inactive within 6 hours = live let status = "Live" @@ -139,7 +158,7 @@ export default function BinSummary(props: Props){ {/* Fill row */} - Bin fill + Bin fill ({inventoryControl()}) {bin.inventoryControl() === pond.BinInventoryControl.BIN_INVENTORY_CONTROL_MANUAL @@ -210,7 +229,7 @@ export default function BinSummary(props: Props){ {/* Bin Fill */} - Bin Fill + Bin Fill ({inventoryControl()}) {/* hidden measuring span, renders off-screen */}