36 static std::string
INVALID_LAYER_SET =
"Cannot set layer coordinates, given layer is not initialized properly";
37 static std::string
INVALID_LAYER_GET =
"Cannot get layer coordinates, layer is not initialized properly";
89 throw NotSet(INVALID_LAYER_SET);
100 throw NotSet(INVALID_LAYER_SET);
131 throw NotSet(INVALID_LAYER_GET);
145 throw NotSet(INVALID_LAYER_GET);
159 double dx = pt.
x -
static_cast<double>(
static_cast<int32_t
>(pt.
x));
160 double dy = pt.
y -
static_cast<double>(
static_cast<int32_t
>(pt.
y));
166 return os <<
"x=" << p.
x <<
", y=" << p.
y;
173 double rx = current.
x - target.
x;
174 double ry = current.
y - target.
y;
175 double rz = current.
z - target.
z;
184 double rx = current.
x - target.
x;
185 double ry = current.
y - target.
y;
186 double rz = current.
z - target.
z;
ExactModelCoordinate getExactLayerCoordinates() const
Gets exact layer coordinates set to this location.
void setLayerCoordinates(const ModelCoordinate &coordinates)
Sets "cell precise" layer coordinates to this location.
void setExactLayerCoordinates(const ExactModelCoordinate &coordinates)
Sets precise layer coordinates to this location.
Layer * getLayer() const
Gets the layer where this location is pointing to.
ExactModelCoordinate m_exact_layer_coords
void setLayer(Layer *layer)
Sets layer where this location is pointing to.
void setMapCoordinates(const ExactModelCoordinate &coordinates)
Sets map coordinates to this location.
Location()
Default constructor.
bool isValid() const
Tells if location is valid Location is valid if:
void reset()
Resets location (so that layer and coordinate information becomes invalid)
static std::string INVALID_LAYER_GET
Map * getMap() const
Gets the map where this location is pointing to.
double getLayerDistanceTo(const Location &location) const
Gets layer distance to another location.
double getMapDistanceTo(const Location &location) const
Gets distance in map coordinates to another location on the Map.
std::ostream & operator<<(std::ostream &os, const Location &l)
Stream output operator.
double getCellOffsetDistance() const
Gets offset distance from cell center.
ExactModelCoordinate & getExactLayerCoordinatesRef()
Gets reference to exact layer coordinates.
Location & operator=(const Location &rhs)
Assignment operator.
CellGrid * getCellGrid() const
Get the Cellgrid.
DoublePoint intPt2doublePt(Point pt)
Convert from 2D int32_t point to 2D double point.
static std::string INVALID_LAYER_SET
ExactModelCoordinate getMapCoordinates() const
Gets map coordinates set to this location.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
Map * getMap() const
Get the map this layer is contained in.
ExactModelCoordinate toMapCoordinates(const ModelCoordinate &layer_coords)
Transforms given point from layer coordinates to map coordinates.
virtual ExactModelCoordinate toExactLayerCoordinates(const ExactModelCoordinate &map_coord)=0
Transforms given point from map coordinates to layer coordinates.
virtual ModelCoordinate toLayerCoordinatesFromExactLayerCoordinates(const ExactModelCoordinate &exact_layer_coords)=0
Transforms given point from exact layer coordinates to cell precision layer coordinates.
virtual ModelCoordinate toLayerCoordinates(const ExactModelCoordinate &map_coord)=0
Transforms given point from map coordinates to layer coordinates.