comparison engine/core/model/metamodel/grids/cellgrids.i @ 0:4a0efb7baf70

* Datasets becomes the new trunk and retires after that :-)
author mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 29 Jun 2008 18:44:17 +0000
parents
children 90005975cdbb
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 %module fife
2 %{
3 #include "model/metamodel/grids/cellgrid.h"
4 #include "model/metamodel/grids/hexgrid.h"
5 #include "model/metamodel/grids/squaregrid.h"
6 %}
7
8 %include "model/metamodel/modelcoords.i"
9
10 namespace std {
11 %template(ModelCoordinateVector) vector<FIFE::ModelCoordinate>;
12 }
13
14 namespace FIFE {
15 class CellGrid {
16 public:
17 CellGrid(bool allow_diagonals=false);
18 virtual ~CellGrid();
19 void getAccessibleCoordinates(const ModelCoordinate& curpos, std::vector<ModelCoordinate>& coordinates);
20 virtual const std::string& getType() const = 0;
21 virtual const std::string& getName() const = 0;
22 virtual bool isAccessible(const ModelCoordinate& curpos, const ModelCoordinate& target) = 0;
23 virtual float getAdjacentCost(const ModelCoordinate& curpos, const ModelCoordinate& target) = 0;
24 virtual unsigned int getCellSideCount() const = 0;
25 ExactModelCoordinate toMapCoordinates(const ModelCoordinate& layer_coords);
26 virtual ExactModelCoordinate toMapCoordinates(const ExactModelCoordinate& layer_coords) = 0;
27 virtual ModelCoordinate toLayerCoordinates(const ExactModelCoordinate& map_coord) = 0;
28 virtual ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate& map_coord) = 0;
29 virtual void getVertices(std::vector<ExactModelCoordinate>& vtx, const ModelCoordinate& cell) = 0;
30 void setXShift(const double& xshift);
31 const double getXShift() const;
32 void setYShift(const double yshift);
33 const double getYShift() const;
34 void setXScale(const double scale);
35 void setYScale(const double scale);
36 const double getXScale() const;
37 const double getYScale() const;
38 void setRotation(const double rotation);
39 const double getRotation() const;
40 };
41
42 class HexGrid: public CellGrid {
43 public:
44 HexGrid(bool diagonals_accessible=false);
45 virtual ~HexGrid();
46
47 bool isAccessible(const ModelCoordinate& curpos, const ModelCoordinate& target);
48 const std::string& getType() const;
49 const std::string& getName() const;
50 float getAdjacentCost(const ModelCoordinate& curpos, const ModelCoordinate& target);
51 unsigned int getCellSideCount() const { return 6; }
52 ExactModelCoordinate toMapCoordinates(const ExactModelCoordinate& layer_coords);
53 ModelCoordinate toLayerCoordinates(const ExactModelCoordinate& map_coord);
54 ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate& map_coord);
55 void getVertices(std::vector<ExactModelCoordinate>& vtx, const ModelCoordinate& cell);
56 };
57
58 class SquareGrid: public CellGrid {
59 public:
60 SquareGrid(bool diagonals_accessible=false);
61 virtual ~SquareGrid();
62
63 const std::string& getType() const;
64 const std::string& getName() const;
65 bool isAccessible(const ModelCoordinate& curpos, const ModelCoordinate& target);
66 float getAdjacentCost(const ModelCoordinate& curpos, const ModelCoordinate& target);
67 unsigned int getCellSideCount() const { return 4; }
68 ExactModelCoordinate toMapCoordinates(const ExactModelCoordinate& layer_coords);
69 ModelCoordinate toLayerCoordinates(const ExactModelCoordinate& map_coord);
70 ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate& map_coord);
71 void getVertices(std::vector<ExactModelCoordinate>& vtx, const ModelCoordinate& cell);
72 };
73 }