0.2.0
Loading...
Searching...
No Matches
NodeEditorApplication.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
16#include <array>
17#include <vector>
18
19#include <application.h>
20#include <imgui.h>
21#include <implot.h>
22
25
26namespace NAV
27{
28class Node;
29class Pin;
30
31namespace gui
32{
34class NodeEditorApplication : public Application
35{
36 public:
40 ~NodeEditorApplication() override = default;
49
51 using Application::Application;
52
53 // static Node* SpawnInputActionNode();
54
55 // static Node* SpawnLessNode();
56
57 // static Node* SpawnGroupBox();
58
60 void OnStart() override;
61
63 void OnStop() override;
64
69 bool OnQuitRequest() override;
70
73 void OnFrame(float deltaTime) override;
74
85 static void ShowRenameNodeRequest(Node*& renameNode);
88 static void ShowRenamePinRequest(Pin*& renamePin);
89
92
94 static inline bool _showQueueSizeOnPins = false;
95
97 static inline std::array<ImTextureID, 2> m_InstinctLogo{ nullptr, nullptr };
98
100 static inline std::array<ImTextureID, 2> m_InsLogo{ nullptr, nullptr };
101
103 static inline ImTextureID m_RoseFigure = nullptr;
104
106 static inline ImPlotStyle imPlotReferenceStyle;
107
108 inline static float leftPaneWidth = 350.0F;
109 inline static float rightPaneWidth = 850.0F;
110 inline static float menuBarHeight = 20;
111 constexpr static float SPLITTER_THICKNESS = 4.0F;
112
114 static float defaultFontRatio();
116 static float windowFontRatio();
118 static float monoFontRatio();
120 static float headerFontRatio();
121
122 private:
123 constexpr static float BOTTOM_VIEW_COLLAPSED_MIN_HEIGHT = 23.0F;
124 constexpr static float BOTTOM_VIEW_UNCOLLAPSED_MIN_HEIGHT = 200.0F;
125
127 enum class BottomViewTabItem
128 {
129 None,
130 LogOutput,
131 };
132
133 BottomViewTabItem bottomViewSelectedTab = BottomViewTabItem::None;
134 inline static float bottomViewHeight = BOTTOM_VIEW_COLLAPSED_MIN_HEIGHT;
135
137 ImTextureID m_HeaderBackground = nullptr;
138
140 enum Colors : size_t
141 {
142 COLOR_GROUP_HEADER_TEXT,
143 COLOR_GROUP_HEADER_BG,
144 COLOR_GROUP_OUTER_BORDER,
145 };
147 std::vector<ImVec4> m_colors = {
148 { 1.0, 1.0, 1.0, 1.0 }, // GROUP_HEADER_TEXT
149 { 1.0, 1.0, 1.0, 0.25 }, // GROUP_HEADER_BG
150 { 1.0, 1.0, 1.0, 0.25 }, // GROUP_OUTER_BORDER
151 };
153 std::vector<const char*> m_colorsNames = {
154 "GroupHeaderText", // GROUP_HEADER_TEXT
155 "GroupHeaderBg", // GROUP_HEADER_BG
156 "GroupOuterBorder", // GROUP_OUTER_BORDER
157 };
158
160 GlobalActions globalAction = GlobalActions::None; // TODO: Move to the GlobalAction.cpp as a global variable
161
164 friend void windows::ShowFontSizeEditor(bool* show);
165};
166
167} // namespace gui
168} // namespace NAV
Font size chooser window.
Global Gui Actions.
GlobalActions
Possible Global Actions to perform in the GUI.
Definition GlobalActions.hpp:18
@ None
None.
Definition GlobalActions.hpp:19
Abstract parent class for all nodes.
Definition Node.hpp:86
Pins in the GUI for information exchange.
Definition Pin.hpp:43
Application class providing all relevant GUI callbacks.
Definition NodeEditorApplication.hpp:35
static ImPlotStyle imPlotReferenceStyle
Default style of the ImPlot library to compare changes against.
Definition NodeEditorApplication.hpp:106
static float defaultFontRatio()
Ratio to multiply for default GUI elements.
static std::array< ImTextureID, 2 > m_InstinctLogo
Pointer to the texture for the instinct logo.
Definition NodeEditorApplication.hpp:97
static float leftPaneWidth
Width of the left pane.
Definition NodeEditorApplication.hpp:108
static constexpr float SPLITTER_THICKNESS
Thickness of the splitter between left and right pane.
Definition NodeEditorApplication.hpp:111
NodeEditorApplication & operator=(const NodeEditorApplication &)=delete
Copy assignment operator.
static float windowFontRatio()
Ratio to multiply for GUI window elements.
bool OnQuitRequest() override
Called when the user request the application to close.
static float headerFontRatio()
Ratio to multiply for node header elements.
static ImTextureID m_RoseFigure
Pointer to the texture for the rose figure (ImuSimulator node)
Definition NodeEditorApplication.hpp:103
static std::array< ImTextureID, 2 > m_InsLogo
Pointer to the texture for the INS logo.
Definition NodeEditorApplication.hpp:100
void OnStart() override
Called when the application is started.
static void ShowRenameNodeRequest(Node *&renameNode)
Shows a PopupModal where the user can rename the node.
static float monoFontRatio()
Ratio to multiply for log output GUI elements.
NodeEditorApplication(NodeEditorApplication &&)=delete
Move constructor.
void ShowSaveAsRequested()
Shows a PopupModel where the user can select a path to save his flow to.
NodeEditorApplication(const NodeEditorApplication &)=delete
Copy constructor.
friend void windows::ShowFontSizeEditor(bool *show)
Shows a window for choosing the font size.
static bool _showQueueSizeOnPins
Shows the queue size on the pins (every frame the queue mutex will be locked)
Definition NodeEditorApplication.hpp:94
void ShowLoadRequested()
Shows a PopupModel loading a new flow.
static void ShowRenamePinRequest(Pin *&renamePin)
Shows a PopupModal where the user can rename the pin.
void ShowQuitRequested()
Shows a PopupModal asking the user if he wants to quit with unsaved changes.
void OnStop() override
Called when the application is stopped.
NodeEditorApplication()=delete
Default constructor.
void ShowClearNodesRequested()
Shows a PopupModel to clear the current flow.
void OnFrame(float deltaTime) override
Called on every frame.
static float rightPaneWidth
Width of the right pane.
Definition NodeEditorApplication.hpp:109
~NodeEditorApplication() override=default
Destructor.
NodeEditorApplication & operator=(NodeEditorApplication &&)=delete
Move assignment operator.
int frameCountNavigate
Frame counter to block the navigate to content function till nodes are correctly loaded.
Definition NodeEditorApplication.hpp:91
static float menuBarHeight
Height of the menu bar on top.
Definition NodeEditorApplication.hpp:110