2014-06-29 12:18:46 +00:00
|
|
|
#ifndef OPENCS_VIEW_CELL_H
|
|
|
|
#define OPENCS_VIEW_CELL_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
2014-11-05 18:45:32 +00:00
|
|
|
#include <memory>
|
2014-06-29 12:18:46 +00:00
|
|
|
|
2014-11-30 19:44:12 +00:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2015-03-25 22:35:10 +00:00
|
|
|
#include <osg/ref_ptr>
|
2014-06-29 12:18:46 +00:00
|
|
|
|
2015-01-27 20:07:26 +00:00
|
|
|
#ifndef Q_MOC_RUN
|
2014-10-08 15:17:31 +00:00
|
|
|
#include <components/terrain/terraingrid.hpp>
|
2015-01-27 20:07:26 +00:00
|
|
|
#endif
|
2014-10-08 15:17:31 +00:00
|
|
|
|
2014-06-29 12:18:46 +00:00
|
|
|
#include "object.hpp"
|
2015-10-12 12:12:01 +00:00
|
|
|
#include "cellarrow.hpp"
|
2016-02-07 18:52:18 +00:00
|
|
|
#include "cellmarker.hpp"
|
2016-03-02 20:02:06 +00:00
|
|
|
#include "cellborder.hpp"
|
2014-06-29 12:18:46 +00:00
|
|
|
|
|
|
|
class QModelIndex;
|
|
|
|
|
2015-03-25 22:35:10 +00:00
|
|
|
namespace osg
|
2014-06-29 12:18:46 +00:00
|
|
|
{
|
2015-03-25 22:35:10 +00:00
|
|
|
class Group;
|
2014-06-29 12:18:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class Data;
|
2015-10-12 12:12:01 +00:00
|
|
|
class CellCoordinates;
|
2014-06-29 12:18:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace CSVRender
|
|
|
|
{
|
2016-01-25 13:55:02 +00:00
|
|
|
class TagBase;
|
|
|
|
|
2014-06-29 12:18:46 +00:00
|
|
|
class Cell
|
|
|
|
{
|
|
|
|
CSMWorld::Data& mData;
|
|
|
|
std::string mId;
|
2015-03-25 22:35:10 +00:00
|
|
|
osg::ref_ptr<osg::Group> mCellNode;
|
2014-06-29 12:18:46 +00:00
|
|
|
std::map<std::string, Object *> mObjects;
|
2014-10-08 15:17:31 +00:00
|
|
|
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
|
2015-10-12 12:31:55 +00:00
|
|
|
CSMWorld::CellCoordinates mCoordinates;
|
2015-10-12 12:12:01 +00:00
|
|
|
std::auto_ptr<CellArrow> mCellArrows[4];
|
2016-02-07 18:52:18 +00:00
|
|
|
std::auto_ptr<CellMarker> mCellMarker;
|
2016-03-02 20:02:06 +00:00
|
|
|
std::auto_ptr<CellBorder> mCellBorder;
|
2015-10-15 12:46:08 +00:00
|
|
|
bool mDeleted;
|
2016-03-01 14:48:34 +00:00
|
|
|
int mSubMode;
|
|
|
|
unsigned int mSubModeElementMask;
|
2014-06-29 12:18:46 +00:00
|
|
|
|
|
|
|
/// Ignored if cell does not have an object with the given ID.
|
|
|
|
///
|
|
|
|
/// \return Was the object deleted?
|
|
|
|
bool removeObject (const std::string& id);
|
|
|
|
|
2016-01-25 15:12:20 +00:00
|
|
|
// Remove object and return iterator to next object.
|
|
|
|
std::map<std::string, Object *>::iterator removeObject (
|
|
|
|
std::map<std::string, Object *>::iterator iter);
|
|
|
|
|
2014-06-29 12:18:46 +00:00
|
|
|
/// Add objects from reference table that are within this cell.
|
|
|
|
///
|
|
|
|
/// \return Have any objects been added?
|
|
|
|
bool addObjects (int start, int end);
|
|
|
|
|
2015-09-29 11:48:04 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum Selection
|
|
|
|
{
|
|
|
|
Selection_Clear,
|
|
|
|
Selection_All,
|
|
|
|
Selection_Invert
|
|
|
|
};
|
|
|
|
|
2014-06-29 12:18:46 +00:00
|
|
|
public:
|
|
|
|
|
2015-10-15 12:46:08 +00:00
|
|
|
/// \note Deleted covers both cells that are deleted and cells that don't exist in
|
|
|
|
/// the first place.
|
|
|
|
Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::string& id,
|
|
|
|
bool deleted = false);
|
2014-06-29 12:18:46 +00:00
|
|
|
|
|
|
|
~Cell();
|
|
|
|
|
|
|
|
/// \return Did this call result in a modification of the visual representation of
|
|
|
|
/// this cell?
|
|
|
|
bool referenceableDataChanged (const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight);
|
|
|
|
|
|
|
|
/// \return Did this call result in a modification of the visual representation of
|
|
|
|
/// this cell?
|
|
|
|
bool referenceableAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
|
|
|
|
|
|
|
/// \return Did this call result in a modification of the visual representation of
|
|
|
|
/// this cell?
|
|
|
|
bool referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
|
|
|
|
|
|
|
/// \return Did this call result in a modification of the visual representation of
|
|
|
|
/// this cell?
|
|
|
|
bool referenceAboutToBeRemoved (const QModelIndex& parent, int start, int end);
|
|
|
|
|
|
|
|
/// \return Did this call result in a modification of the visual representation of
|
|
|
|
/// this cell?
|
|
|
|
bool referenceAdded (const QModelIndex& parent, int start, int end);
|
2015-09-29 11:48:04 +00:00
|
|
|
|
|
|
|
void setSelection (int elementMask, Selection mode);
|
2015-10-12 12:12:01 +00:00
|
|
|
|
2016-01-26 10:31:37 +00:00
|
|
|
// Select everything that references the same ID as at least one of the elements
|
|
|
|
// already selected
|
|
|
|
void selectAllWithSameParentId (int elementMask);
|
|
|
|
|
2015-10-12 12:12:01 +00:00
|
|
|
void setCellArrows (int mask);
|
|
|
|
|
2016-02-07 18:52:18 +00:00
|
|
|
/// \brief Set marker for this cell.
|
|
|
|
void setCellMarker();
|
|
|
|
|
2015-10-12 12:12:01 +00:00
|
|
|
/// Returns 0, 0 in case of an unpaged cell.
|
|
|
|
CSMWorld::CellCoordinates getCoordinates() const;
|
2015-10-15 12:46:08 +00:00
|
|
|
|
|
|
|
bool isDeleted() const;
|
2016-01-25 13:55:02 +00:00
|
|
|
|
|
|
|
std::vector<osg::ref_ptr<TagBase> > getSelection (unsigned int elementMask) const;
|
2016-02-16 15:02:29 +00:00
|
|
|
|
|
|
|
std::vector<osg::ref_ptr<TagBase> > getEdited (unsigned int elementMask) const;
|
2016-03-01 14:48:34 +00:00
|
|
|
|
|
|
|
void setSubMode (int subMode, unsigned int elementMask);
|
2016-03-04 14:19:26 +00:00
|
|
|
|
|
|
|
/// Erase all overrides and restore the visual representation of the cell to its
|
|
|
|
/// true state.
|
|
|
|
void reset (unsigned int elementMask);
|
2014-06-29 12:18:46 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|