OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
pagedworldspacewidget.hpp
Go to the documentation of this file.
1 #ifndef OPENCS_VIEW_PAGEDWORLDSPACEWIDGET_H
2 #define OPENCS_VIEW_PAGEDWORLDSPACEWIDGET_H
3 
4 #include <map>
5 
6 #include "../../model/world/cellselection.hpp"
7 
8 #include "worldspacewidget.hpp"
9 #include "cell.hpp"
10 
11 namespace CSVWidget
12 {
13  class SceneToolToggle;
14  class SceneToolToggle2;
15 }
16 
17 namespace CSVRender
18 {
19  class TextOverlay;
20  class OverlayMask;
21 
23  {
24  Q_OBJECT
25 
28  std::map<CSMWorld::CellCoordinates, Cell *> mCells;
29  std::string mWorldspace;
32 
33  private:
34 
35  std::pair<int, int> getCoordinatesFromId(const std::string& record) const;
36 
40  bool adjustCells();
41 
42  virtual void referenceableDataChanged (const QModelIndex& topLeft,
43  const QModelIndex& bottomRight);
44 
45  virtual void referenceableAboutToBeRemoved (const QModelIndex& parent, int start, int end);
46 
47  virtual void referenceableAdded (const QModelIndex& index, int start, int end);
48 
49  virtual void referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
50 
51  virtual void referenceAboutToBeRemoved (const QModelIndex& parent, int start, int end);
52 
53  virtual void referenceAdded (const QModelIndex& index, int start, int end);
54 
55  virtual void pathgridDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
56 
57  virtual void pathgridAboutToBeRemoved (const QModelIndex& parent, int start, int end);
58 
59  virtual void pathgridAdded (const QModelIndex& parent, int start, int end);
60 
61  virtual std::string getStartupInstruction();
62 
64  void addCellToScene (const CSMWorld::CellCoordinates& coordinates);
65 
69  void removeCellFromScene (const CSMWorld::CellCoordinates& coordinates);
70 
72  void addCellSelection (int x, int y);
73 
75  void moveCellSelection (int x, int y);
76 
77  void addCellToSceneFromCamera (int offsetX, int offsetY);
78 
79  public:
80 
81  PagedWorldspaceWidget (QWidget *parent, CSMDoc::Document& document);
85 
86  virtual ~PagedWorldspaceWidget();
87 
89  void useViewHint (const std::string& hint);
90 
91  void setCellSelection(const CSMWorld::CellSelection& selection);
92 
94 
96  virtual bool handleDrop (const std::vector<CSMWorld::UniversalId>& data,
97  DropType type);
98 
99  virtual dropRequirments getDropRequirements(DropType type) const;
100 
104  CSVWidget::SceneToolbar *parent);
105 
106  virtual unsigned int getVisibilityMask() const;
107 
109  virtual void clearSelection (int elementMask);
110 
112  virtual void invertSelection (int elementMask);
113 
115  virtual void selectAll (int elementMask);
116 
117  // Select everything that references the same ID as at least one of the elements
118  // already selected
119  //
121  virtual void selectAllWithSameParentId (int elementMask);
122 
123  virtual std::string getCellId (const osg::Vec3f& point) const;
124 
125  virtual Cell* getCell(const osg::Vec3d& point) const;
126 
127  virtual std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask)
128  const;
129 
130  virtual std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask)
131  const;
132 
133  virtual void setSubMode (int subMode, unsigned int elementMask);
134 
136  virtual void reset (unsigned int elementMask);
137 
138  protected:
139 
141 
143 
144  virtual void handleInteractionPress (const WorldspaceHitResult& hit, InteractionType type);
145 
146  signals:
147 
148  void cellSelectionChanged (const CSMWorld::CellSelection& selection);
149 
150  private slots:
151 
152  virtual void cellDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
153 
154  virtual void cellRemoved (const QModelIndex& parent, int start, int end);
155 
156  virtual void cellAdded (const QModelIndex& index, int start, int end);
157 
158  void loadCameraCell();
159 
160  void loadEastCell();
161 
162  void loadNorthCell();
163 
164  void loadWestCell();
165 
166  void loadSouthCell();
167 
168  };
169 }
170 
171 #endif
std::string mWorldspace
Definition: pagedworldspacewidget.hpp:29
virtual void selectAllWithSameParentId(int elementMask)
Definition: pagedworldspacewidget.cpp:641
Definition: worldspacewidget.hpp:48
static const struct @2 signals[]
InteractionType
Definition: worldspacewidget.hpp:89
void addCellSelection(int x, int y)
Definition: pagedworldspacewidget.cpp:401
virtual std::vector< osg::ref_ptr< TagBase > > getSelection(unsigned int elementMask) const
Definition: pagedworldspacewidget.cpp:676
Selection of cells in a paged worldspace.
Definition: cellselection.hpp:15
Mode selector tool.
Definition: scenetoolmode.hpp:18
void loadEastCell()
Definition: pagedworldspacewidget.cpp:770
virtual void addVisibilitySelectorButtons(CSVWidget::SceneToolToggle2 *tool)
Definition: pagedworldspacewidget.cpp:120
virtual dropRequirments getDropRequirements(DropType type) const
Definition: pagedworldspacewidget.cpp:589
CSVWidget::SceneToolToggle2 * mControlElements
Definition: pagedworldspacewidget.hpp:30
virtual void cellDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: pagedworldspacewidget.cpp:742
void loadWestCell()
Definition: pagedworldspacewidget.cpp:780
virtual std::string getStartupInstruction()
Definition: pagedworldspacewidget.cpp:354
virtual void invertSelection(int elementMask)
Definition: pagedworldspacewidget.cpp:623
void moveCellSelection(int x, int y)
Definition: pagedworldspacewidget.cpp:417
virtual unsigned int getVisibilityMask() const
Definition: pagedworldspacewidget.cpp:609
virtual bool handleDrop(const std::vector< CSMWorld::UniversalId > &data, DropType type)
Definition: pagedworldspacewidget.cpp:560
PagedWorldspaceWidget(QWidget *parent, CSMDoc::Document &document)
Definition: pagedworldspacewidget.cpp:460
void cellSelectionChanged(const CSMWorld::CellSelection &selection)
bool adjustCells()
Definition: pagedworldspacewidget.cpp:24
virtual void referenceAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: pagedworldspacewidget.cpp:260
virtual void addEditModeSelectorButtons(CSVWidget::SceneToolMode *tool)
Definition: pagedworldspacewidget.cpp:128
void loadSouthCell()
Definition: pagedworldspacewidget.cpp:785
Definition: worldspacewidget.hpp:40
virtual void referenceableDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: pagedworldspacewidget.cpp:215
void addCellToSceneFromCamera(int offsetX, int offsetY)
Definition: pagedworldspacewidget.cpp:439
virtual void pathgridDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: pagedworldspacewidget.cpp:278
void removeCellFromScene(const CSMWorld::CellCoordinates &coordinates)
Definition: pagedworldspacewidget.cpp:389
virtual Cell * getCell(const osg::Vec3d &point) const
Definition: pagedworldspacewidget.cpp:661
virtual void cellRemoved(const QModelIndex &parent, int start, int end)
Definition: pagedworldspacewidget.cpp:750
CSMWorld::CellSelection mSelection
Definition: pagedworldspacewidget.hpp:27
virtual void pathgridAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: pagedworldspacewidget.cpp:310
Definition: pagedworldspacewidget.hpp:22
virtual void pathgridAdded(const QModelIndex &parent, int start, int end)
Definition: pagedworldspacewidget.cpp:332
virtual std::string getCellId(const osg::Vec3f &point) const
Definition: pagedworldspacewidget.cpp:650
const CSMWorld::CellSelection & getCellSelection() const
Definition: pagedworldspacewidget.cpp:546
void addCellToScene(const CSMWorld::CellCoordinates &coordinates)
Definition: pagedworldspacewidget.cpp:370
virtual void setSubMode(int subMode, unsigned int elementMask)
Definition: pagedworldspacewidget.cpp:710
Definition: cellcoordinates.hpp:12
void setCellSelection(const CSMWorld::CellSelection &selection)
Definition: pagedworldspacewidget.cpp:536
virtual void referenceableAdded(const QModelIndex &index, int start, int end)
Definition: pagedworldspacewidget.cpp:233
Definition: document.hpp:57
Multi-Toggle tool.
Definition: scenetooltoggle2.hpp:19
virtual void referenceAdded(const QModelIndex &index, int start, int end)
Definition: pagedworldspacewidget.cpp:269
DropType
Definition: worldspacewidget.hpp:73
void loadNorthCell()
Definition: pagedworldspacewidget.cpp:775
Definition: cell.hpp:42
virtual void referenceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: pagedworldspacewidget.cpp:251
dropRequirments
Definition: worldspacewidget.hpp:81
virtual void reset(unsigned int elementMask)
Erase all overrides and restore the visual representation to its true state.
Definition: pagedworldspacewidget.cpp:717
std::map< CSMWorld::CellCoordinates, Cell * > mCells
Definition: pagedworldspacewidget.hpp:28
virtual void referenceableAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: pagedworldspacewidget.cpp:224
virtual void cellAdded(const QModelIndex &index, int start, int end)
Definition: pagedworldspacewidget.cpp:757
Definition: scenetoolbar.hpp:12
void loadCameraCell()
Definition: pagedworldspacewidget.cpp:765
virtual void clearSelection(int elementMask)
Definition: pagedworldspacewidget.cpp:614
CSMDoc::Document & mDocument
Definition: pagedworldspacewidget.hpp:26
virtual CSVWidget::SceneToolToggle2 * makeControlVisibilitySelector(CSVWidget::SceneToolbar *parent)
Definition: pagedworldspacewidget.cpp:724
void useViewHint(const std::string &hint)
Decodes the the hint string to set of cell that are rendered.
Definition: pagedworldspacewidget.cpp:500
bool mDisplayCellCoord
Definition: pagedworldspacewidget.hpp:31
virtual ~PagedWorldspaceWidget()
Definition: pagedworldspacewidget.cpp:491
std::pair< int, int > getCoordinatesFromId(const std::string &record) const
Definition: pagedworldspacewidget.cpp:551
virtual void handleInteractionPress(const WorldspaceHitResult &hit, InteractionType type)
Definition: pagedworldspacewidget.cpp:148
virtual std::vector< osg::ref_ptr< TagBase > > getEdited(unsigned int elementMask) const
Definition: pagedworldspacewidget.cpp:693
virtual void selectAll(int elementMask)
Definition: pagedworldspacewidget.cpp:632