@@ -22,32 +22,41 @@ namespace graph_based {
2222class GraphBased : public State {
2323 public:
2424 // Constructor
25- GraphBased (sf::RenderWindow* window,
26- std::stack<std::unique_ptr<State>>& states,
27- std::shared_ptr<LoggerPanel> logger_panel);
25+ GraphBased (std::shared_ptr<LoggerPanel> logger_panel);
2826
2927 // Destructor
3028 virtual ~GraphBased ();
3129
3230 // Override Functions
3331 void endState () override ;
34- void updateKeybinds ( ) override ;
35- void update ( const float & dt ) override ;
36- void render ( ) override ;
32+ void update ( const float & dt, const ImVec2& mousePos ) override ;
33+ void renderConfig ( ) override ;
34+ void renderScene (sf::RenderTexture& render_texture ) override ;
3735
3836 // virtual functions
3937 virtual void clearObstacles ();
4038 virtual void renderGui ();
4139 // render planner specific parameters
4240 virtual void renderParametersGui () = 0;
43- virtual void renderNodes () = 0;
41+ virtual void renderNodes (sf::RenderTexture& render_texture ) = 0;
4442 virtual void updateNodes () = 0;
4543 virtual void initAlgorithm () = 0;
46- virtual void solveConcurrently (
47- std::shared_ptr<Node> nodeStart, std::shared_ptr<Node> nodeEnd,
48- std::shared_ptr<MessageQueue<bool >> message_queue) = 0;
44+ // pure virtual function need to be implemented by graph-based planners
45+ virtual void updatePlanner (bool & solved, Node& node_start,
46+ Node& node_end) = 0;
47+
48+ void solveConcurrently (std::shared_ptr<Node> nodeStart,
49+ std::shared_ptr<Node> nodeEnd,
50+ std::shared_ptr<MessageQueue<bool >> message_queue);
51+ void updateKeyTime (const float & dt);
52+ const bool getKeyTime ();
4953
5054 protected:
55+ // initialization Functions
56+ void initColors ();
57+ void initVariables ();
58+ void initNodes (bool reset = true , bool reset_neighbours_only = false );
59+
5160 // colors
5261 sf::Color BGN_COL, FONT_COL, IDLE_COL, HOVER_COL, ACTIVE_COL, START_COL,
5362 END_COL, VISITED_COL, FRONTIER_COL, OBST_COL, PATH_COL;
@@ -57,8 +66,11 @@ class GraphBased : public State {
5766 float keyTimeMax_;
5867
5968 // Map Variables
69+ int no_of_grid_rows_;
70+ int no_of_grid_cols_;
6071 int gridSize_;
6172 int slider_grid_size_;
73+ sf::Vector2f init_grid_xy_;
6274 // 0 = 4 connected grid, 1 = 8 connected grid
6375 int grid_connectivity_;
6476 unsigned int mapWidth_;
@@ -82,14 +94,6 @@ class GraphBased : public State {
8294 // threads
8395 std::thread t_;
8496 bool thread_joined_;
85-
86- // initialization Functions
87- void initColors ();
88- void initVariables ();
89- void initNodes (bool reset = true , bool reset_neighbours_only = false );
90-
91- void updateKeyTime (const float & dt);
92- const bool getKeyTime ();
9397};
9498
9599} // namespace graph_based
0 commit comments