1 #ifndef CSM_WOLRD_REGIONMAP_H
2 #define CSM_WOLRD_REGIONMAP_H
8 #include <QAbstractTableModel>
47 std::map<CellCoordinates, CellDescription>
mMap;
72 void addRegion (
const std::string& region,
unsigned int colour);
88 std::pair<CellCoordinates, CellCoordinates>
getSize()
const;
94 virtual int rowCount (
const QModelIndex& parent = QModelIndex())
const;
96 virtual int columnCount (
const QModelIndex& parent = QModelIndex())
const;
98 virtual QVariant
data (
const QModelIndex& index,
int role = Qt::DisplayRole)
const;
102 virtual Qt::ItemFlags
flags (
const QModelIndex& index)
const;
110 void regionsChanged (
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
114 void cellsInserted (
const QModelIndex& parent,
int start,
int end);
116 void cellsChanged (
const QModelIndex& topLeft,
const QModelIndex& bottomRight);
std::string mName
Definition: regionmap.hpp:39
void removeRegion(const std::string ®ion)
Definition: regionmap.cpp:158
Role
Definition: regionmap.hpp:27
CellCoordinates getIndex(const QModelIndex &index) const
Translates a Qt model index into a cell index (which can contain negative components) ...
Definition: regionmap.cpp:28
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Definition: regionmap.cpp:299
std::map< std::string, unsigned int > mColours
region ID, colour (RGBA)
Definition: regionmap.hpp:50
bool mDeleted
Definition: regionmap.hpp:37
void buildRegions()
Definition: regionmap.cpp:52
Data & mData
Definition: regionmap.hpp:46
Model for the region map.
Definition: regionmap.hpp:21
void regionsChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: regionmap.cpp:455
Definition: regionmap.hpp:29
void updateSize()
Definition: regionmap.cpp:188
void cellsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: regionmap.cpp:479
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Definition: regionmap.cpp:411
void updateRegions(const std::vector< std::string > ®ions)
Update cells affected by the listed regions.
Definition: regionmap.cpp:167
Definition: regionmap.hpp:30
void regionsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
Definition: regionmap.cpp:416
CellDescription()
Definition: regionmap.cpp:13
void removeCell(const CellCoordinates &index)
May be called on a cell that is not in the map (in which case the call is ignored) ...
Definition: regionmap.cpp:137
CellCoordinates mMax
exclusive
Definition: regionmap.hpp:49
void addCell(const CellCoordinates &index, const CellDescription &description)
May be called on a cell that is already in the map (in which case an update is.
Definition: regionmap.cpp:96
Definition: nestedcolumnadapter.hpp:11
RegionMap(Data &data)
Definition: regionmap.cpp:275
std::map< CellCoordinates, CellDescription > mMap
Definition: regionmap.hpp:47
void cellsInserted(const QModelIndex &parent, int start, int end)
Definition: regionmap.cpp:494
CellCoordinates mMin
inclusive
Definition: regionmap.hpp:48
void addCells(int start, int end)
Definition: regionmap.cpp:116
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Definition: regionmap.cpp:315
Definition: cellcoordinates.hpp:12
Wrapper for Cell record.
Definition: cell.hpp:15
void regionsInserted(const QModelIndex &parent, int start, int end)
Definition: regionmap.cpp:434
Definition: regionmap.hpp:35
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Definition: regionmap.cpp:307
void buildMap()
Definition: regionmap.cpp:68
void addRegion(const std::string ®ion, unsigned int colour)
Definition: regionmap.cpp:153
std::string mRegion
Definition: regionmap.hpp:38
void cellsChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
Definition: regionmap.cpp:499
std::pair< CellCoordinates, CellCoordinates > getSize() const
Definition: regionmap.cpp:233