OpenMW
Classes | Public Types | Public Member Functions | Private Slots | Private Member Functions | Private Attributes
CSMWorld::RegionMap Class Reference

Model for the region map. More...

#include <regionmap.hpp>

List of all members.

Classes

struct  CellDescription

Public Types

typedef std::pair< int, int > CellIndex

Public Member Functions

 RegionMap (Data &data)
virtual int rowCount (const QModelIndex &parent=QModelIndex()) const
virtual int columnCount (const QModelIndex &parent=QModelIndex()) const
virtual QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const
virtual Qt::ItemFlags flags (const QModelIndex &index) const

Private Slots

void regionsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
void regionsInserted (const QModelIndex &parent, int start, int end)
void regionsChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void cellsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
void cellsInserted (const QModelIndex &parent, int start, int end)
void cellsChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)

Private Member Functions

CellIndex getIndex (const QModelIndex &index) const
 Translates a Qt model index into a cell index (which can contain negative components)
QModelIndex getIndex (const CellIndex &index) const
void buildRegions ()
void buildMap ()
void addCell (const CellIndex &index, const CellDescription &description)
 May be called on a cell that is already in the map (in which case an update is.
void addCells (int start, int end)
void removeCell (const CellIndex &index)
 May be called on a cell that is not in the map (in which case the call is ignored)
void addRegion (const std::string &region, unsigned int colour)
void removeRegion (const std::string &region)
void updateRegions (const std::vector< std::string > &regions)
 Update cells affected by the listed regions.
void updateSize ()
std::pair< CellIndex, CellIndexgetSize () const

Private Attributes

DatamData
std::map< CellIndex,
CellDescription
mMap
CellIndex mMin
 inclusive
CellIndex mMax
 exclusive
std::map< std::string,
unsigned int > 
mColours
 region ID, colour (RGBA)

Detailed Description

Model for the region map.

This class does not holds any record data (other than for the purpose of buffering).


Member Typedef Documentation

typedef std::pair<int, int> CSMWorld::RegionMap::CellIndex

Constructor & Destructor Documentation


Member Function Documentation

void CSMWorld::RegionMap::addCell ( const CellIndex index,
const CellDescription description 
) [private]

May be called on a cell that is already in the map (in which case an update is.

void CSMWorld::RegionMap::addCells ( int  start,
int  end 
) [private]
void CSMWorld::RegionMap::addRegion ( const std::string &  region,
unsigned int  colour 
) [private]

May be called on a region that is already listed (in which case an update is performed)

Note:
This function does not update the region map.
void CSMWorld::RegionMap::buildMap ( ) [private]
void CSMWorld::RegionMap::cellsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [private, slot]
void CSMWorld::RegionMap::cellsChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [private, slot]
void CSMWorld::RegionMap::cellsInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [private, slot]
int CSMWorld::RegionMap::columnCount ( const QModelIndex &  parent = QModelIndex()) const [virtual]
QVariant CSMWorld::RegionMap::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const [virtual]
Todo:
GUI class in non-GUI code. Needs to be addressed eventually.
Qt::ItemFlags CSMWorld::RegionMap::flags ( const QModelIndex &  index) const [virtual]
CSMWorld::RegionMap::CellIndex CSMWorld::RegionMap::getIndex ( const QModelIndex &  index) const [private]

Translates a Qt model index into a cell index (which can contain negative components)

QModelIndex CSMWorld::RegionMap::getIndex ( const CellIndex index) const [private]
void CSMWorld::RegionMap::regionsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
) [private, slot]
void CSMWorld::RegionMap::regionsChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
) [private, slot]
void CSMWorld::RegionMap::regionsInserted ( const QModelIndex &  parent,
int  start,
int  end 
) [private, slot]
void CSMWorld::RegionMap::removeCell ( const CellIndex index) [private]

May be called on a cell that is not in the map (in which case the call is ignored)

void CSMWorld::RegionMap::removeRegion ( const std::string &  region) [private]

May be called on a region that is not listed (in which case the call is ignored)

Note:
This function does not update the region map.
int CSMWorld::RegionMap::rowCount ( const QModelIndex &  parent = QModelIndex()) const [virtual]
void CSMWorld::RegionMap::updateRegions ( const std::vector< std::string > &  regions) [private]

Update cells affected by the listed regions.

void CSMWorld::RegionMap::updateSize ( ) [private]

Member Data Documentation

std::map<std::string, unsigned int> CSMWorld::RegionMap::mColours [private]

region ID, colour (RGBA)

exclusive

inclusive


The documentation for this class was generated from the following files: