45 return IM_COL32(86, 128, 191, 255);
47 return IM_COL32(223, 148, 84, 255);
49 return IM_COL32(210, 110, 60, 255);
51 return IM_COL32(191, 63, 63, 255);
53 return IM_COL32(127, 191, 127, 255);
55 return IM_COL32(154, 121, 191, 255);
57 return IM_COL32(165, 102, 71, 255);
59 return IM_COL32(212, 192, 121, 255);
61 return IM_COL32(175, 133, 187, 255);
63 return IM_COL32(148, 178, 182, 255);
65 return IM_COL32(242, 209, 83, 255);
67 return IM_COL32(110, 160, 140, 255);
69 return IM_COL32(70, 110, 175, 255);
71 return IM_COL32(105, 175, 105, 255);
73 return IM_COL32(175, 48, 48, 255);
75 return IM_COL32(138, 105, 175, 255);
77 return IM_COL32(207, 132, 68, 255);
79 return IM_COL32(152, 116, 163, 255);
81 return IM_COL32(97, 161, 97, 255);
83 return IM_COL32(80, 133, 80, 255);
85 return IM_COL32(210, 182, 72, 255);
87 return IM_COL32(182, 109, 44, 255);
89 return IM_COL32(129, 155, 159, 255);
91 return IM_COL32(96, 139, 122, 255);
93 return IM_COL32(127, 127, 127, 255);
121 std::shared_ptr<Simulation> simulation;
122 ImNodeEditor::Config config;
123 ImNodeEditor::EditorContext* context;
124 static constexpr uint16_t startingInputPinId = 1000;
125 static constexpr uint16_t startingOutputPinId = 2000;
126 static constexpr uint16_t startingLinkId = 3000;
130 mutable std::unordered_set<size_t> positionedNodeIds;
131 mutable std::unordered_map<size_t, ImVec2> pendingInitialPositions;
134 mutable std::unordered_map<size_t, PlotCardState> plotCards;
137 mutable ImVec2 ngBoundsMin;
138 mutable ImVec2 ngBoundsMax;
141 mutable std::vector<std::pair<ImVec2, ImVec2>> cachedNodeRects;
142 mutable std::vector<element::ElementLabel> cachedNodeLabels;
143 mutable std::vector<size_t> cachedNodeIds;
144 mutable ImVec2 cachedVpMin{};
145 mutable ImVec2 cachedVpMax{};
148 mutable std::unordered_map<size_t, ImVec2> prevNodePositions;
149 mutable std::unordered_map<size_t, ImVec2> dragStartPositions;
151 explicit NodeGraphWindow(
const std::shared_ptr<Simulation>& simulation);
162 void renderGraphContent()
const;
163 void renderElementNodes()
const;
164 static void renderElementNode(
const std::shared_ptr<element::Element>& element);
165 static void renderElementNodeConnections(
const std::shared_ptr<element::Element>& element);
166 void handleInteractions()
const;
167 void handlePinInteractions()
const;
168 void handleLinkInteractions()
const;
169 void handleNodeSelection()
const;
170 void renderNodePlotCards()
const;
171 static size_t getNodeId(
const std::shared_ptr<element::Element>& element);
173 static void applyCanvasStyle();
174 static void restoreCanvasStyle();
175 static void renderElementTooltip(
const std::shared_ptr<element::Element>& element);
177 static void drawWeightHeatmap(ImDrawList* dl, ImRect rect,
const std::vector<double>& weights,
179 static void draw2DFieldHeatmap(ImDrawList* dl, ImRect rect,
const std::vector<double>& data,
180 int rows,
int cols,
double wMin,
double wMax,
int colormap = ImPlotColormap_Deep);
181 static void drawInlineHeatmapAxes(ImDrawList* dl,
const ImRect& hmRect,
int rows,
int cols,
182 double dMin,
double dMax,
int colormap = ImPlotColormap_Deep);
183 static void renderNodeScrollingName(
const std::shared_ptr<element::Element>& element,
float minNodeSize);
184 static void renderNodeInlinePreview(
const std::shared_ptr<element::Element>& element,
float minNodeSize);
185 static void renderNodePins(
const std::shared_ptr<element::Element>& element,
float minNodeSize);
186 static void renderPlotCardMenuBar(
PlotCardState& state,
bool is2DField,
187 const std::shared_ptr<element::Element>& element,
bool isWM =
false);
188 static void renderPlotCardContent(
const std::shared_ptr<element::Element>& element,
PlotCardState& state,
189 bool isWM,
bool is2DField);
190 void renderNavigationControls(ImVec2 winPos, ImVec2 winSize)
const;
191 void renderMiniMap(ImVec2 winPos, ImVec2 winSize)
const;