OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cell.hpp
Go to the documentation of this file.
1 #ifndef OPENCS_VIEW_CELL_H
2 #define OPENCS_VIEW_CELL_H
3 
4 #include <string>
5 #include <map>
6 #include <memory>
7 
8 #include <boost/shared_ptr.hpp>
9 
10 #include <osg/ref_ptr>
11 
12 #ifndef Q_MOC_RUN
14 #endif
15 
16 #include "object.hpp"
17 #include "cellarrow.hpp"
18 #include "cellmarker.hpp"
19 #include "cellborder.hpp"
20 
21 class QModelIndex;
22 
23 namespace osg
24 {
25  class Group;
26  class Geometry;
27  class Geode;
28 }
29 
30 namespace CSMWorld
31 {
32  class Data;
33  class CellCoordinates;
34 }
35 
36 namespace CSVRender
37 {
38  class CellWater;
39  class Pathgrid;
40  class TagBase;
41 
42  class Cell
43  {
45  std::string mId;
46  osg::ref_ptr<osg::Group> mCellNode;
47  std::map<std::string, Object *> mObjects;
48  std::auto_ptr<Terrain::TerrainGrid> mTerrain;
50  std::auto_ptr<CellArrow> mCellArrows[4];
51  std::auto_ptr<CellMarker> mCellMarker;
52  std::auto_ptr<CellBorder> mCellBorder;
53  std::auto_ptr<CellWater> mCellWater;
54  std::auto_ptr<Pathgrid> mPathgrid;
55  bool mDeleted;
56  int mSubMode;
57  unsigned int mSubModeElementMask;
58 
62  bool removeObject (const std::string& id);
63 
64  // Remove object and return iterator to next object.
65  std::map<std::string, Object *>::iterator removeObject (
66  std::map<std::string, Object *>::iterator iter);
67 
71  bool addObjects (int start, int end);
72 
73  public:
74 
75  enum Selection
76  {
80  };
81 
82  public:
83 
86  Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::string& id,
87  bool deleted = false);
88 
89  ~Cell();
90 
92  Pathgrid* getPathgrid() const;
93 
96  bool referenceableDataChanged (const QModelIndex& topLeft,
97  const QModelIndex& bottomRight);
98 
101  bool referenceableAboutToBeRemoved (const QModelIndex& parent, int start, int end);
102 
105  bool referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
106 
109  bool referenceAboutToBeRemoved (const QModelIndex& parent, int start, int end);
110 
113  bool referenceAdded (const QModelIndex& parent, int start, int end);
114 
115  void pathgridModified();
116 
117  void pathgridRemoved();
118 
119  void setSelection (int elementMask, Selection mode);
120 
121  // Select everything that references the same ID as at least one of the elements
122  // already selected
123  void selectAllWithSameParentId (int elementMask);
124 
125  void setCellArrows (int mask);
126 
128  void setCellMarker();
129 
132 
133  bool isDeleted() const;
134 
135  std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask) const;
136 
137  std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask) const;
138 
139  void setSubMode (int subMode, unsigned int elementMask);
140 
143  void reset (unsigned int elementMask);
144  };
145 }
146 
147 #endif
std::auto_ptr< CellBorder > mCellBorder
Definition: cell.hpp:52
bool addObjects(int start, int end)
Definition: cell.cpp:44
bool referenceableAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: cell.cpp:146
Definition: cell.hpp:79
void setCellArrows(int mask)
Definition: cell.cpp:345
bool referenceableDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: cell.cpp:133
std::string mId
Definition: cell.hpp:45
CSMWorld::CellCoordinates mCoordinates
Definition: cell.hpp:49
void pathgridModified()
Definition: cell.cpp:271
bool referenceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: cell.cpp:162
osg::ref_ptr< osg::Group > mCellNode
Definition: cell.hpp:46
Cell(CSMWorld::Data &data, osg::Group *rootNode, const std::string &id, bool deleted=false)
Definition: cell.cpp:73
bool removeObject(const std::string &id)
Definition: cell.cpp:24
void selectAllWithSameParentId(int elementMask)
Definition: cell.cpp:323
std::vector< osg::ref_ptr< TagBase > > getEdited(unsigned int elementMask) const
Definition: cell.cpp:407
bool referenceAdded(const QModelIndex &parent, int start, int end)
Definition: cell.cpp:260
unsigned int mSubModeElementMask
Definition: cell.hpp:57
void setSubMode(int subMode, unsigned int elementMask)
Definition: cell.cpp:420
bool mDeleted
Definition: cell.hpp:55
void setSelection(int elementMask, Selection mode)
Definition: cell.cpp:281
Definition: cell.hpp:77
Definition: cell.hpp:78
std::auto_ptr< Terrain::TerrainGrid > mTerrain
Definition: cell.hpp:48
Definition: pathgrid.hpp:50
Selection
Definition: cell.hpp:75
void setCellMarker()
Set marker for this cell.
Definition: cell.cpp:363
Definition: data.hpp:77
CSMWorld::Data & mData
Definition: cell.hpp:44
bool isDeleted() const
Definition: cell.cpp:386
Definition: cellcoordinates.hpp:12
bool referenceAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: cell.cpp:236
int mSubMode
Definition: cell.hpp:56
std::auto_ptr< CellMarker > mCellMarker
Definition: cell.hpp:51
std::auto_ptr< CellArrow > mCellArrows[4]
Definition: cell.hpp:50
Pathgrid * getPathgrid() const
Definition: cell.cpp:128
Definition: cell.hpp:42
std::vector< osg::ref_ptr< TagBase > > getSelection(unsigned int elementMask) const
Definition: cell.cpp:391
CSMWorld::CellCoordinates getCoordinates() const
Returns 0, 0 in case of an unpaged cell.
Definition: cell.cpp:381
std::auto_ptr< Pathgrid > mPathgrid
Definition: cell.hpp:54
void pathgridRemoved()
Definition: cell.cpp:276
~Cell()
Definition: cell.cpp:119
void reset(unsigned int elementMask)
Definition: cell.cpp:431
std::auto_ptr< CellWater > mCellWater
Definition: cell.hpp:53
std::map< std::string, Object * > mObjects
Definition: cell.hpp:47