8#ifndef FMTCOORD_Hm_included
9#define FMTCOORD_Hm_included
12#include <boost/unordered_map.hpp>
15#include <boost/serialization/serialization.hpp>
16#include <boost/serialization/nvp.hpp>
17#include <boost/serialization/array.hpp>
83 void upEnveloppe(std::array<FMTCoordinate, 4>& enveloppe)
const;
125 std::set<FMTCoordinate>::const_iterator
closest(
const std::vector<std::set<FMTCoordinate>::const_iterator>& coordinates,
double& approximation)
const;
131 operator std::string()
const;
139 std::set<FMTCoordinate>
getNeighbors(
const uint16_t& nsize,
const bool& circle =
false)
const;
154 static std::set<FMTCoordinate>
getTerritory(
const std::array<FMTCoordinate, 4>& p_enveloppe,
const size_t& p_distance);
161 static size_t getHeight(
const std::array<FMTCoordinate, 4>& p_enveloppe);
168 static size_t getWidth(
const std::array<FMTCoordinate, 4>& p_enveloppe);
182 friend class boost::serialization::access;
193 template<
class Archive>
194 void serialize(Archive& ar,
const unsigned int version)
196 ar & BOOST_SERIALIZATION_NVP(m_x);
197 ar & BOOST_SERIALIZATION_NVP(m_y);
206 void _getXyGap(
const FMTCoordinate& rhs,
int& xgap,
int& y_gap)
const;
213 double _distanceApproximation(
const FMTCoordinate& coord)
const;
228 return p_coord.
hash();
#define FMTEXPORT
Definition: FMTutility.h:125
Spatially referenced coordinate holding an x and y position on a raster grid.
Definition: FMTCoordinate.h:29
const std::vector< double > getSpatialCoordinate(std::vector< double > geoTransform) const
Return the spatial coordinate using a geographic transform.
static size_t getWidth(const std::array< FMTCoordinate, 4 > &p_enveloppe)
Return the width of an envelope.
double distance(const FMTCoordinate &coord) const
Return the distance to another coordinate.
FMTCoordinate()
Default constructor for FMTCoordinate.
bool within(const T &ldistance, const FMTCoordinate &coord) const
Return true if another coordinate is within a given distance.
FMTCoordinate at(unsigned int id) const
Return the coordinate at a given index.
void upEnveloppe(std::array< FMTCoordinate, 4 > &enveloppe) const
Update the bounding envelope with this coordinate.
static std::set< FMTCoordinate > getTerritory(const std::array< FMTCoordinate, 4 > &p_enveloppe, const size_t &p_distance)
Return the coordinates of a territory within a distance of an envelope.
FMTCoordinate(const FMTCoordinate &rhs)
Copy constructor for FMTCoordinate.
~FMTCoordinate()=default
Default destructor for FMTCoordinate.
size_t hash() const
Return the hash of the coordinate.
uint16_t getY() const
Return the y position of the coordinate.
std::set< FMTCoordinate >::const_iterator closest(const std::vector< std::set< FMTCoordinate >::const_iterator > &coordinates, double &approximation) const
Return the closest coordinate among the given coordinates.
static FMTCoordinate getAverageCentroid(const std::array< FMTCoordinate, 4 > &p_enveloppe)
Return the average centroid of an envelope.
std::set< FMTCoordinate > getNeighbors(const uint16_t &nsize, const bool &circle=false) const
Return the neighboring coordinates within a given size.
static size_t getHeight(const std::array< FMTCoordinate, 4 > &p_enveloppe)
Return the height of an envelope.
FMTCoordinate(uint16_t p_x, uint16_t p_y)
Construct a FMTCoordinate from an x and y position.
uint16_t getX() const
Return the x position of the coordinate.
Definition: FMTAreaParser.h:40
Definition: FMTAction.h:463
std::size_t operator()(const Spatial::FMTCoordinate &p_coord) const
Definition: FMTCoordinate.h:223