1 // Copyright (C) 2009 Ben Asselstine
2 //
3 //  This program is free software; you can redistribute it and/or modify
4 //  it under the terms of the GNU General Public License as published by
5 //  the Free Software Foundation; either version 3 of the License, or
6 //  (at your option) any later version.
7 //
8 //  This program is distributed in the hope that it will be useful,
9 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 //  GNU Library General Public License for more details.
12 //
13 //  You should have received a copy of the GNU General Public License
14 //  along with this program; if not, write to the Free Software
15 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 //  02110-1301, USA.
17 
18 #pragma once
19 #ifndef ROADPATH_CALCULATOR_H
20 #define ROADPATH_CALCULATOR_H
21 
22 #include <gtkmm.h>
23 #include "vector.h"
24 
25 class Path;
26 class Stack;
27 class PathCalculator;
28 
29 //! An object that calculates shortest paths on a weighted grid.
30 /**
31  */
32 class RoadPathCalculator
33 {
34  public:
35 
36      //! Default constructor.
37      RoadPathCalculator(Vector<int> starting_point, bool fly = false);
38 
39      //! Copy constructor.
40      RoadPathCalculator(const RoadPathCalculator&);
41 
42      //! Destructor.
43      ~RoadPathCalculator();
44 
45      // Get Methods
46      Vector<int> getPos() const;
47 
48      // Methods that operate on the class data and modify the class.
49 
50      //! Return a calculated path from the starting point to the given position.
51      Path* calculate(Vector<int> dest);
52      Path* calculate(Vector<int> dest, guint &moves);
53      guint32 calculate_moves(Vector<int> dest);
54 
55      void regenerate();
56 
57  private:
58 
59      // DATA
60 
61      //! The stack with the movement characteristics to make the road with.
62      Stack *stack;
63 
64      //! The path calculator that does the hard work.
65      PathCalculator *path_calculator;
66 
67 };
68 
69 #endif
70