OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
cellcoordinates.hpp
Go to the documentation of this file.
1 #ifndef CSM_WOLRD_CELLCOORDINATES_H
2 #define CSM_WOLRD_CELLCOORDINATES_H
3 
4 #include <iosfwd>
5 #include <string>
6 #include <utility>
7 
8 #include <QMetaType>
9 
10 namespace CSMWorld
11 {
13  {
14  int mX;
15  int mY;
16 
17  public:
18 
20 
21  CellCoordinates (int x, int y);
22 
23  CellCoordinates (const std::pair<int, int>& coordinates);
24 
25  int getX() const;
26 
27  int getY() const;
28 
29  CellCoordinates move (int x, int y) const;
31 
32  std::string getId (const std::string& worldspace) const;
34 
35  static bool isExteriorCell (const std::string& id);
36 
41  static std::pair<CellCoordinates, bool> fromId (const std::string& id);
42 
44  static std::pair<int, int> coordinatesToCellIndex (float x, float y);
45  };
46 
47  bool operator== (const CellCoordinates& left, const CellCoordinates& right);
48  bool operator!= (const CellCoordinates& left, const CellCoordinates& right);
49  bool operator< (const CellCoordinates& left, const CellCoordinates& right);
50 
51  std::ostream& operator<< (std::ostream& stream, const CellCoordinates& coordiantes);
52 }
53 
54 Q_DECLARE_METATYPE (CSMWorld::CellCoordinates)
55 
56 #endif
int getX() const
Definition: cellcoordinates.cpp:15
int mX
Definition: cellcoordinates.hpp:14
static std::pair< CellCoordinates, bool > fromId(const std::string &id)
Definition: cellcoordinates.cpp:45
CellCoordinates move(int x, int y) const
Return a copy of *this, moved by the given offset.
Definition: cellcoordinates.cpp:25
bool operator<(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:79
static bool isExteriorCell(const std::string &id)
Definition: cellcoordinates.cpp:40
std::string getId(const std::string &worldspace) const
Return the ID for the cell at these coordinates.
Definition: cellcoordinates.cpp:30
static std::pair< int, int > coordinatesToCellIndex(float x, float y)
Definition: cellcoordinates.cpp:62
bool operator==(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:69
int mY
Definition: cellcoordinates.hpp:15
bool operator!=(const CellCoordinates &left, const CellCoordinates &right)
Definition: cellcoordinates.cpp:74
Definition: cellcoordinates.hpp:12
int getY() const
Definition: cellcoordinates.cpp:20
CellCoordinates()
Definition: cellcoordinates.cpp:8
std::ostream & operator<<(std::ostream &stream, const CellCoordinates &coordiantes)
Definition: cellcoordinates.cpp:90