comparison engine/core/model/structures/layer.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/structures/layer.h"
4 %}
5
6 %include "std_vector.i"
7
8 %include "model/metamodel/modelcoords.i"
9 %include "model/metamodel/grids/cellgrids.i"
10 %include "util/structures/utilstructures.i"
11 %include "util/base/utilbase.i"
12
13 namespace FIFE {
14
15 class Map;
16 class Selection;
17 class Instance;
18 class Object;
19 class CellGrid;
20
21 enum PathingStrategy {
22 CELL_EDGES_ONLY,
23 CELL_EDGES_AND_DIAGONALS,
24 FREEFORM
25 };
26
27 %feature("director") LayerChangeListener;
28 class LayerChangeListener {
29 public:
30 virtual ~LayerChangeListener() {};
31 virtual void onLayerChanged(Layer* layer, std::vector<Instance*>& changedInstances) = 0;
32 virtual void onInstanceCreate(Layer* layer, Instance* instance) = 0;
33 virtual void onInstanceDelete(Layer* layer, Instance* instance) = 0;
34 };
35
36
37 class Layer : public ResourceClass {
38 public:
39 Layer(const std::string& identifier, Map* map, CellGrid* geometry);
40 ~Layer();
41
42 const std::string& getId();
43
44 CellGrid* getCellGrid() const { return m_grid; }
45
46 Map* getMap();
47 bool hasInstances() const;
48 Instance* createInstance(Object* object, const ModelCoordinate& p, const std::string& id="");
49 Instance* createInstance(Object* object, const ExactModelCoordinate& p, const std::string& id="");
50 void deleteInstance(Instance* object);
51
52 const std::vector<Instance*>& getInstances() const;
53 Instance* getInstance(const std::string& id);
54
55 void setInstancesVisible(bool vis);
56 bool cellContainsBlockingInstance(const ModelCoordinate& cellCoordinate);
57 void toggleInstancesVisible();
58 bool areInstancesVisible() const;
59
60 void setPathingStrategy(PathingStrategy strategy);
61 PathingStrategy getPathingStrategy();
62
63 void addChangeListener(LayerChangeListener* listener);
64 void removeChangeListener(LayerChangeListener* listener);
65 bool isChanged();
66 std::vector<Instance*>& getChangedInstances();
67 };
68 }