OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
CSMWorld::RegionMap Class Reference

Model for the region map. More...

#include <regionmap.hpp>

Inheritance diagram for CSMWorld::RegionMap:
Collaboration diagram for CSMWorld::RegionMap:

Classes

struct  CellDescription
 

Public Types

enum  Role { Role_Region = Qt::UserRole, Role_CellId = Qt::UserRole+1 }
 

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

CellCoordinates getIndex (const QModelIndex &index) const
 Translates a Qt model index into a cell index (which can contain negative components) More...
 
QModelIndex getIndex (const CellCoordinates &index) const
 
CellCoordinates getIndex (const Cell &cell) const
 
void buildRegions ()
 
void buildMap ()
 
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. More...
 
void addCells (int start, int end)
 
void removeCell (const CellCoordinates &index)
 May be called on a cell that is not in the map (in which case the call is ignored) More...
 
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. More...
 
void updateSize ()
 
std::pair< CellCoordinates,
CellCoordinates
getSize () const
 

Private Attributes

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

Detailed Description

Model for the region map.

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

Member Enumeration Documentation

Enumerator
Role_Region 
Role_CellId 

Constructor & Destructor Documentation

CSMWorld::RegionMap::RegionMap ( Data data)

Here is the call graph for this function:

Member Function Documentation

void CSMWorld::RegionMap::addCell ( const CellCoordinates index,
const CellDescription description 
)
private

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

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::addCells ( int  start,
int  end 
)
private

Here is the call graph for this function:

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.

Here is the call graph for this function:

void CSMWorld::RegionMap::buildMap ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::buildRegions ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::cellsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslot

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::cellsChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
)
privateslot

Here is the caller graph for this function:

void CSMWorld::RegionMap::cellsInserted ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslot

Here is the caller graph for this function:

int CSMWorld::RegionMap::columnCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Here is the caller graph for this function:

QVariant CSMWorld::RegionMap::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
virtual
Note
Calling this function with role==Role_CellId may return the ID of a cell that does not exist.
Todo:
GUI class in non-GUI code. Needs to be addressed eventually.

Here is the call graph for this function:

Qt::ItemFlags CSMWorld::RegionMap::flags ( const QModelIndex &  index) const
virtual
CSMWorld::CellCoordinates CSMWorld::RegionMap::getIndex ( const QModelIndex &  index) const
private

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

Here is the call graph for this function:

Here is the caller graph for this function:

QModelIndex CSMWorld::RegionMap::getIndex ( const CellCoordinates index) const
private

Here is the call graph for this function:

CSMWorld::CellCoordinates CSMWorld::RegionMap::getIndex ( const Cell cell) const
private
std::pair< CSMWorld::CellCoordinates, CSMWorld::CellCoordinates > CSMWorld::RegionMap::getSize ( ) const
private

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::regionsAboutToBeRemoved ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslot

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::regionsChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight 
)
privateslot

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::regionsInserted ( const QModelIndex &  parent,
int  start,
int  end 
)
privateslot

Here is the call graph for this function:

Here is the caller graph for this function:

void CSMWorld::RegionMap::removeCell ( const CellCoordinates index)
private

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

Here is the call graph for this function:

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.

Here is the call graph for this function:

int CSMWorld::RegionMap::rowCount ( const QModelIndex &  parent = QModelIndex()) const
virtual

Here is the caller graph for this function:

void CSMWorld::RegionMap::updateRegions ( const std::vector< std::string > &  regions)
private

Update cells affected by the listed regions.

Here is the call graph for this function:

void CSMWorld::RegionMap::updateSize ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

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

region ID, colour (RGBA)

Data& CSMWorld::RegionMap::mData
private
std::map<CellCoordinates, CellDescription> CSMWorld::RegionMap::mMap
private
CellCoordinates CSMWorld::RegionMap::mMax
private

exclusive

CellCoordinates CSMWorld::RegionMap::mMin
private

inclusive


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