diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/core/model/structures/layer.i	Sun Jun 29 18:44:17 2008 +0000
@@ -0,0 +1,68 @@
+%module fife
+%{
+#include "model/structures/layer.h"
+%}
+
+%include "std_vector.i"
+
+%include "model/metamodel/modelcoords.i"
+%include "model/metamodel/grids/cellgrids.i"
+%include "util/structures/utilstructures.i"
+%include "util/base/utilbase.i"
+
+namespace FIFE {
+
+	class Map;
+	class Selection;
+	class Instance;
+	class Object;
+	class CellGrid;
+	
+	enum PathingStrategy {
+		CELL_EDGES_ONLY,
+		CELL_EDGES_AND_DIAGONALS,
+		FREEFORM
+	};	
+
+	%feature("director") LayerChangeListener;
+	class LayerChangeListener {
+	public:
+		virtual ~LayerChangeListener() {};
+		virtual void onLayerChanged(Layer* layer, std::vector<Instance*>& changedInstances) = 0;
+		virtual void onInstanceCreate(Layer* layer, Instance* instance) = 0;
+		virtual void onInstanceDelete(Layer* layer, Instance* instance) = 0;
+	};
+	
+
+	class Layer : public ResourceClass {
+		public:
+			Layer(const std::string& identifier, Map* map, CellGrid* geometry);
+			~Layer();
+
+			const std::string& getId();
+
+			CellGrid* getCellGrid() const { return m_grid; }
+
+			Map* getMap();
+			bool hasInstances() const;
+			Instance* createInstance(Object* object, const ModelCoordinate& p, const std::string& id="");
+			Instance* createInstance(Object* object, const ExactModelCoordinate& p, const std::string& id="");
+			void deleteInstance(Instance* object);
+
+			const std::vector<Instance*>& getInstances() const;
+			Instance* getInstance(const std::string& id);
+
+			void setInstancesVisible(bool vis);
+			bool cellContainsBlockingInstance(const ModelCoordinate& cellCoordinate);
+			void toggleInstancesVisible();
+			bool areInstancesVisible() const;
+
+			void setPathingStrategy(PathingStrategy strategy);
+			PathingStrategy getPathingStrategy();
+			
+			void addChangeListener(LayerChangeListener* listener);
+			void removeChangeListener(LayerChangeListener* listener);
+			bool isChanged();
+			std::vector<Instance*>& getChangedInstances();
+	};
+}