FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
Spatial::FMTCoordinate Class Reference

Spatially referenced coordinate holding an x and y position on a raster grid. More...

#include <FMTCoordinate.h>

Public Member Functions

 FMTCoordinate ()
 Default constructor for FMTCoordinate.
 
 ~FMTCoordinate ()=default
 Default destructor for FMTCoordinate.
 
 FMTCoordinate (uint16_t p_x, uint16_t p_y)
 Construct a FMTCoordinate from an x and y position.
 
 FMTCoordinate (const FMTCoordinate &rhs)
 Copy constructor for FMTCoordinate.
 
FMTCoordinate at (unsigned int id) const
 Return the coordinate at a given index.
 
double distance (const FMTCoordinate &coord) const
 Return the distance to another coordinate.
 
template<typename T >
bool within (const T &ldistance, const FMTCoordinate &coord) const
 Return true if another coordinate is within a given distance.
 
void upEnveloppe (std::array< FMTCoordinate, 4 > &enveloppe) const
 Update the bounding envelope with this coordinate.
 
size_t hash () const
 Return the hash of the coordinate.
 
FMTCoordinateoperator= (const FMTCoordinate &rhs)
 Copy assignment operator for FMTCoordinate.
 
const std::vector< double > getSpatialCoordinate (std::vector< double > geoTransform) const
 Return the spatial coordinate using a geographic transform.
 
bool operator== (const FMTCoordinate &rhs) const
 Equality comparison operator of FMTCoordinate.
 
bool operator< (const FMTCoordinate &rhs) const
 Less than comparison operator of FMTCoordinate.
 
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.
 
 operator std::string () const
 Convert the coordinate to its string representation.
 
std::set< FMTCoordinategetNeighbors (const uint16_t &nsize, const bool &circle=false) const
 Return the neighboring coordinates within a given size.
 
uint16_t getX () const
 Return the x position of the coordinate.
 
uint16_t getY () const
 Return the y position of the coordinate.
 

Static Public Member Functions

static FMTCoordinate getAverageCentroid (const std::array< FMTCoordinate, 4 > &p_enveloppe)
 Return the average centroid of an envelope.
 
static std::set< FMTCoordinategetTerritory (const std::array< FMTCoordinate, 4 > &p_enveloppe, const size_t &p_distance)
 Return the coordinates of a territory within a distance of an envelope.
 
static size_t getHeight (const std::array< FMTCoordinate, 4 > &p_enveloppe)
 Return the height of an envelope.
 
static size_t getWidth (const std::array< FMTCoordinate, 4 > &p_enveloppe)
 Return the width of an envelope.
 

Friends

class boost::serialization::access
 

Detailed Description

Spatially referenced coordinate holding an x and y position on a raster grid.

Constructor & Destructor Documentation

◆ FMTCoordinate() [1/3]

Spatial::FMTCoordinate::FMTCoordinate ( )

Default constructor for FMTCoordinate.

◆ ~FMTCoordinate()

Spatial::FMTCoordinate::~FMTCoordinate ( )
default

Default destructor for FMTCoordinate.

◆ FMTCoordinate() [2/3]

Spatial::FMTCoordinate::FMTCoordinate ( uint16_t  p_x,
uint16_t  p_y 
)

Construct a FMTCoordinate from an x and y position.

Parameters
[in]p_xthe x position.
[in]p_ythe y position.

◆ FMTCoordinate() [3/3]

Spatial::FMTCoordinate::FMTCoordinate ( const FMTCoordinate rhs)

Copy constructor for FMTCoordinate.

Parameters
[in]rhsthe FMTCoordinate to copy.

Member Function Documentation

◆ at()

FMTCoordinate Spatial::FMTCoordinate::at ( unsigned int  id) const

Return the coordinate at a given index.

Parameters
[in]idthe index.
Returns
the coordinate at the index.

◆ closest()

std::set< FMTCoordinate >::const_iterator Spatial::FMTCoordinate::closest ( const std::vector< std::set< FMTCoordinate >::const_iterator > &  coordinates,
double &  approximation 
) const

Return the closest coordinate among the given coordinates.

Parameters
[in]coordinatesthe coordinates to search.
[out]approximationthe approximated distance to the closest coordinate.
Returns
an iterator to the closest coordinate.

◆ distance()

double Spatial::FMTCoordinate::distance ( const FMTCoordinate coord) const

Return the distance to another coordinate.

Parameters
[in]coordthe other coordinate.
Returns
the distance between the two coordinates.

◆ getAverageCentroid()

static FMTCoordinate Spatial::FMTCoordinate::getAverageCentroid ( const std::array< FMTCoordinate, 4 > &  p_enveloppe)
static

Return the average centroid of an envelope.

Parameters
[in]p_enveloppethe envelope.
Returns
the average centroid coordinate.

◆ getHeight()

static size_t Spatial::FMTCoordinate::getHeight ( const std::array< FMTCoordinate, 4 > &  p_enveloppe)
static

Return the height of an envelope.

Parameters
[in]p_enveloppethe envelope.
Returns
the height of the envelope.

◆ getNeighbors()

std::set< FMTCoordinate > Spatial::FMTCoordinate::getNeighbors ( const uint16_t &  nsize,
const bool &  circle = false 
) const

Return the neighboring coordinates within a given size.

Parameters
[in]nsizethe neighborhood size.
[in]circleif true uses a circular neighborhood.
Returns
the set of neighboring coordinates.

◆ getSpatialCoordinate()

const std::vector< double > Spatial::FMTCoordinate::getSpatialCoordinate ( std::vector< double >  geoTransform) const

Return the spatial coordinate using a geographic transform.

Parameters
[in]geoTransformthe geographic transform.
Returns
the spatial coordinate.

◆ getTerritory()

static std::set< FMTCoordinate > Spatial::FMTCoordinate::getTerritory ( const std::array< FMTCoordinate, 4 > &  p_enveloppe,
const size_t &  p_distance 
)
static

Return the coordinates of a territory within a distance of an envelope.

Parameters
[in]p_enveloppethe envelope.
[in]p_distancethe distance.
Returns
the set of coordinates of the territory.

◆ getWidth()

static size_t Spatial::FMTCoordinate::getWidth ( const std::array< FMTCoordinate, 4 > &  p_enveloppe)
static

Return the width of an envelope.

Parameters
[in]p_enveloppethe envelope.
Returns
the width of the envelope.

◆ getX()

uint16_t Spatial::FMTCoordinate::getX ( ) const

Return the x position of the coordinate.

Returns
the x position.

◆ getY()

uint16_t Spatial::FMTCoordinate::getY ( ) const

Return the y position of the coordinate.

Returns
the y position.

◆ hash()

size_t Spatial::FMTCoordinate::hash ( ) const

Return the hash of the coordinate.

Returns
the hash value.

◆ operator std::string()

Spatial::FMTCoordinate::operator std::string ( ) const

Convert the coordinate to its string representation.

Returns
the string representation of the coordinate.

◆ operator<()

bool Spatial::FMTCoordinate::operator< ( const FMTCoordinate rhs) const

Less than comparison operator of FMTCoordinate.

Parameters
[in]rhsthe FMTCoordinate to compare with.
Returns
true if this coordinate is less than rhs else false.

◆ operator=()

FMTCoordinate & Spatial::FMTCoordinate::operator= ( const FMTCoordinate rhs)

Copy assignment operator for FMTCoordinate.

Parameters
[in]rhsthe FMTCoordinate to copy.
Returns
a reference to this FMTCoordinate.

◆ operator==()

bool Spatial::FMTCoordinate::operator== ( const FMTCoordinate rhs) const

Equality comparison operator of FMTCoordinate.

Parameters
[in]rhsthe FMTCoordinate to compare with.
Returns
true if both coordinates are equal else false.

◆ upEnveloppe()

void Spatial::FMTCoordinate::upEnveloppe ( std::array< FMTCoordinate, 4 > &  enveloppe) const

Update the bounding envelope with this coordinate.

Parameters
[in,out]enveloppethe envelope to update.

◆ within()

template<typename T >
bool Spatial::FMTCoordinate::within ( const T &  ldistance,
const FMTCoordinate coord 
) const

Return true if another coordinate is within a given distance.

Template Parameters
Tthe distance type.
Parameters
[in]ldistancethe distance threshold.
[in]coordthe other coordinate.
Returns
true if the coordinate is within the distance else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

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