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";
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;
Map * getMap() const
Get the map this layer is contained in.
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.
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.
void reset()
Resets location (so that layer and coordinate information becomes invalid)
double getCellOffsetDistance() const
Gets offset distance from cell center.
static std::string INVALID_LAYER_GET
Layer * getLayer() const
Gets the layer where this location is pointing to.
ModelCoordinate getLayerCoordinates() const
Gets cell precision layer coordinates set to this location.
Map * getMap() const
Gets the map where this location is pointing to.
std::ostream & operator<<(std::ostream &os, const Location &l)
Stream output operator.
Point doublePt2intPt(DoublePoint pt)
Convert from 2D double point to 2D int32_t point.
bool isValid() const
Tells if location is valid Location is valid if:
ExactModelCoordinate & getExactLayerCoordinatesRef()
Gets reference to exact layer coordinates.
CellGrid * getCellGrid() const
Get the Cellgrid.
Location & operator=(const Location &rhs)
Assignment operator.
DoublePoint intPt2doublePt(Point pt)
Convert from 2D int32_t point to 2D double point.
static std::string INVALID_LAYER_SET
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.
double getMapDistanceTo(const Location &location) const
Gets distance in map coordinates to another location on the Map.
double getLayerDistanceTo(const Location &location) const
Gets layer distance to another location.
ExactModelCoordinate getExactLayerCoordinates() const
Gets exact layer coordinates set to this location.
ExactModelCoordinate getMapCoordinates() const
Gets map coordinates set to this location.
virtual ModelCoordinate toLayerCoordinates(const ExactModelCoordinate &map_coord)=0
Transforms given point from map coordinates to layer coordinates.