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::FMTEvent Class Reference

Base class for a spatial event (FMTsaevent or FMTsesevent): a set of FMTCoordinate corresponding to the coordinates present in the event. More...

#include <FMTEvent.h>

Public Member Functions

std::set< FMTCoordinate >::const_iterator midPosition () const
 Get the mid point of the elements of the event.
 
 ~FMTEvent ()=default
 Default destructor for FMTEvent.
 
 FMTEvent (const FMTEvent &rhs)=default
 Copy constructor for FMTEvent.
 
FMTEventoperator= (const FMTEvent &rhs)=default
 Copy assignment operator for FMTEvent.
 
 FMTEvent ()=default
 Default constructor for FMTEvent.
 
 FMTEvent (const FMTCoordinate &p_location, int p_actionId, int p_period, size_t p_centroidGraphFamily)
 Construct a FMTEvent from a location, an action id, a period and a centroid graph family.
 
bool empty () const
 Test whether the event is empty.
 
size_t size () const
 Return the size of the event.
 
size_t hash () const
 Hash the event.
 
FMTEventRelation getRelation (const FMTEvent &rhs) const
 Return the relation between this event and another one.
 
bool operator== (const FMTEvent &rhs) const
 Comparison operator for FMTEvent.
 
bool operator!= (const FMTEvent &rhs) const
 Comparison operator for FMTEvent.
 
bool operator< (const FMTEvent &rhs) const
 Less than operator for FMTEvent.
 
size_t perimeter () const
 Return the perimeter of the event, including any internal holes.
 
size_t height () const
 Return the height of the event.
 
size_t width () const
 Return the width of the event.
 
FMTCoordinate averageCentroid () const
 Return the centroid based on the envelope of the event.
 
std::string getStats () const
 Return the patch stats (size, perimeter, height and width) as a string.
 
virtual void erase (const FMTCoordinate &newlocation)
 Erase a coordinate from the event.
 
virtual void merge (const FMTEvent &event)
 Merge another event into this one.
 
virtual void insert (const FMTCoordinate &newlocation)
 Insert a coordinate in the event.
 
void setActionId (const int &laction_id)
 Set the action id of the event.
 
const int & getActionId () const
 Return the action id of the event.
 
const int & getPeriod () const
 Return the period of the event.
 
const size_t & getGraphFamily () const
 Return the graph family of the event.
 
const std::set< FMTCoordinate > & getElements () const
 Return the elements (coordinates) of the event.
 
virtual std::vector< std::set< FMTCoordinate >::const_iterator > ignit (const size_t &eventmaximalsize, const std::set< FMTCoordinate >::const_iterator &ignit, int p_actionId, int p_period, size_t p_GraphFamily)
 Ignite the event at a coordinate for an action, a period and a graph family, up to a maximal size.
 
virtual bool spread (const size_t &eventminimalsize, const size_t &eventmaximalsize, const size_t &neighboringsize, const std::set< FMTCoordinate > &territory, std::vector< std::set< FMTCoordinate >::const_iterator > active)
 Spread the event within a territory from the active coordinates, respecting the size bounds.
 
double distance (const FMTEvent &rhs) const
 Return the distance between this event and another one.
 
template<typename T >
bool within (const T &dist, const FMTEvent &rhs) const
 Return true if the event is within a distance of another event's envelope.
 
template<typename T >
bool within (const T &dist, const FMTCoordinate &location) const
 Return true if a coordinate is within a distance of the event's coordinates.
 
bool contain (const FMTCoordinate &coord) const
 Return true if a coordinate is in the elements of the event.
 
bool willSplitEvent (const FMTCoordinate &p_coordinate) const
 Return true if removing a coordinate will split the event.
 
bool splitEvent (std::vector< FMTEvent > &splittedevents) const
 Split the event, filling a vector with the split events and removing the elements from the current event.
 
std::set< FMTCoordinategetTerritory (const size_t &distance) const
 Return the adjacent territory of the event based on a distance.
 
std::vector< std::set< FMTCoordinate >::const_iterator > getBorders () const
 Return the coordinates of the border of the event.
 
std::vector< std::pair< FMTCoordinate, FMTCoordinate > > getOutsideBordersPair () const
 Return the outside borders of the event as pairs of coordinates.
 
std::array< FMTCoordinate, 4 > getEnveloppe () const
 Return the four coordinates that create the envelope of the event.
 
void getClosesCoordinates (const FMTEvent &rhs, std::set< FMTCoordinate >::const_iterator &thiscoordinate, std::set< FMTCoordinate >::const_iterator &rhscoordinate) const
 Return the closest coordinates between this event and another one.
 

Static Public Member Functions

static std::string getStatsHeader ()
 Return the header of the patch stats (size, perimeter, height and width).
 

Friends

class boost::serialization::access
 

Detailed Description

Base class for a spatial event (FMTsaevent or FMTsesevent): a set of FMTCoordinate corresponding to the coordinates present in the event.

Constructor & Destructor Documentation

◆ ~FMTEvent()

Spatial::FMTEvent::~FMTEvent ( )
default

Default destructor for FMTEvent.

◆ FMTEvent() [1/3]

Spatial::FMTEvent::FMTEvent ( const FMTEvent rhs)
default

Copy constructor for FMTEvent.

Parameters
[in]rhsthe FMTEvent to copy.

◆ FMTEvent() [2/3]

Spatial::FMTEvent::FMTEvent ( )
default

Default constructor for FMTEvent.

◆ FMTEvent() [3/3]

Spatial::FMTEvent::FMTEvent ( const FMTCoordinate p_location,
int  p_actionId,
int  p_period,
size_t  p_centroidGraphFamily 
)

Construct a FMTEvent from a location, an action id, a period and a centroid graph family.

Parameters
[in]p_locationthe location.
[in]p_actionIdthe action id.
[in]p_periodthe period.
[in]p_centroidGraphFamilythe centroid graph family.

Member Function Documentation

◆ averageCentroid()

FMTCoordinate Spatial::FMTEvent::averageCentroid ( ) const

Return the centroid based on the envelope of the event.

Returns
the average centroid.

◆ contain()

bool Spatial::FMTEvent::contain ( const FMTCoordinate coord) const

Return true if a coordinate is in the elements of the event.

Parameters
[in]coordthe coordinate.
Returns
true if the coordinate is in the event else false.

◆ distance()

double Spatial::FMTEvent::distance ( const FMTEvent rhs) const

Return the distance between this event and another one.

Parameters
[in]rhsthe other event.
Returns
the distance.

◆ empty()

bool Spatial::FMTEvent::empty ( ) const

Test whether the event is empty.

Returns
true if the event is empty else false.

◆ erase()

virtual void Spatial::FMTEvent::erase ( const FMTCoordinate newlocation)
virtual

Erase a coordinate from the event.

Parameters
[in]newlocationthe coordinate to erase.

◆ getActionId()

const int & Spatial::FMTEvent::getActionId ( ) const

Return the action id of the event.

Returns
the action id.

◆ getBorders()

std::vector< std::set< FMTCoordinate >::const_iterator > Spatial::FMTEvent::getBorders ( ) const

Return the coordinates of the border of the event.

Returns
the border coordinates.

◆ getClosesCoordinates()

void Spatial::FMTEvent::getClosesCoordinates ( const FMTEvent rhs,
std::set< FMTCoordinate >::const_iterator &  thiscoordinate,
std::set< FMTCoordinate >::const_iterator &  rhscoordinate 
) const

Return the closest coordinates between this event and another one.

Parameters
[in]rhsthe other event.
[out]thiscoordinatethe closest coordinate of this event.
[out]rhscoordinatethe closest coordinate of the other event.

◆ getElements()

const std::set< FMTCoordinate > & Spatial::FMTEvent::getElements ( ) const

Return the elements (coordinates) of the event.

Returns
the event elements.

◆ getEnveloppe()

std::array< FMTCoordinate, 4 > Spatial::FMTEvent::getEnveloppe ( ) const

Return the four coordinates that create the envelope of the event.

Returns
the envelope coordinates.

◆ getGraphFamily()

const size_t & Spatial::FMTEvent::getGraphFamily ( ) const

Return the graph family of the event.

Returns
the graph family.

◆ getOutsideBordersPair()

std::vector< std::pair< FMTCoordinate, FMTCoordinate > > Spatial::FMTEvent::getOutsideBordersPair ( ) const

Return the outside borders of the event as pairs of coordinates.

Returns
the outside border pairs.

◆ getPeriod()

const int & Spatial::FMTEvent::getPeriod ( ) const

Return the period of the event.

Returns
the period.

◆ getRelation()

FMTEventRelation Spatial::FMTEvent::getRelation ( const FMTEvent rhs) const

Return the relation between this event and another one.

Parameters
[in]rhsthe other event.
Returns
the event relation.

◆ getStats()

std::string Spatial::FMTEvent::getStats ( ) const

Return the patch stats (size, perimeter, height and width) as a string.

Returns
the stats.

◆ getStatsHeader()

static std::string Spatial::FMTEvent::getStatsHeader ( )
static

Return the header of the patch stats (size, perimeter, height and width).

Returns
the stats header.

◆ getTerritory()

std::set< FMTCoordinate > Spatial::FMTEvent::getTerritory ( const size_t &  distance) const

Return the adjacent territory of the event based on a distance.

Parameters
[in]distancethe distance.
Returns
the territory coordinates.

◆ hash()

size_t Spatial::FMTEvent::hash ( ) const

Hash the event.

Returns
the hash of the event.

◆ height()

size_t Spatial::FMTEvent::height ( ) const

Return the height of the event.

Returns
the height.

◆ ignit()

virtual std::vector< std::set< FMTCoordinate >::const_iterator > Spatial::FMTEvent::ignit ( const size_t &  eventmaximalsize,
const std::set< FMTCoordinate >::const_iterator &  ignit,
int  p_actionId,
int  p_period,
size_t  p_GraphFamily 
)
virtual

Ignite the event at a coordinate for an action, a period and a graph family, up to a maximal size.

Parameters
[in]eventmaximalsizethe maximal event size.
[in]ignitthe ignition coordinate.
[in]p_actionIdthe action id.
[in]p_periodthe period.
[in]p_GraphFamilythe graph family.
Returns
the active coordinates.

◆ insert()

virtual void Spatial::FMTEvent::insert ( const FMTCoordinate newlocation)
virtual

Insert a coordinate in the event.

Parameters
[in]newlocationthe coordinate to insert.

◆ merge()

virtual void Spatial::FMTEvent::merge ( const FMTEvent event)
virtual

Merge another event into this one.

Parameters
[in]eventthe event to merge.

◆ midPosition()

std::set< FMTCoordinate >::const_iterator Spatial::FMTEvent::midPosition ( ) const

Get the mid point of the elements of the event.

Returns
an iterator to the mid coordinate.

◆ operator!=()

bool Spatial::FMTEvent::operator!= ( const FMTEvent rhs) const

Comparison operator for FMTEvent.

Parameters
[in]rhsthe FMTEvent to compare to.
Returns
true if both events are different else false.

◆ operator<()

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

Less than operator for FMTEvent.

Parameters
[in]rhsthe FMTEvent to compare to.
Returns
true if this event is less than the other else false.

◆ operator=()

FMTEvent & Spatial::FMTEvent::operator= ( const FMTEvent rhs)
default

Copy assignment operator for FMTEvent.

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

◆ operator==()

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

Comparison operator for FMTEvent.

Parameters
[in]rhsthe FMTEvent to compare to.
Returns
true if both events are equal else false.

◆ perimeter()

size_t Spatial::FMTEvent::perimeter ( ) const

Return the perimeter of the event, including any internal holes.

Returns
the perimeter.

◆ setActionId()

void Spatial::FMTEvent::setActionId ( const int &  laction_id)

Set the action id of the event.

Parameters
[in]laction_idthe action id.

◆ size()

size_t Spatial::FMTEvent::size ( ) const

Return the size of the event.

Returns
the event size.

◆ splitEvent()

bool Spatial::FMTEvent::splitEvent ( std::vector< FMTEvent > &  splittedevents) const

Split the event, filling a vector with the split events and removing the elements from the current event.

Parameters
[in,out]splittedeventsthe split events.
Returns
true if the event was split else false.

◆ spread()

virtual bool Spatial::FMTEvent::spread ( const size_t &  eventminimalsize,
const size_t &  eventmaximalsize,
const size_t &  neighboringsize,
const std::set< FMTCoordinate > &  territory,
std::vector< std::set< FMTCoordinate >::const_iterator >  active 
)
virtual

Spread the event within a territory from the active coordinates, respecting the size bounds.

Parameters
[in]eventminimalsizethe minimal event size.
[in]eventmaximalsizethe maximal event size.
[in]neighboringsizethe neighboring size.
[in]territorythe territory to spread in.
[in]activethe active coordinates.
Returns
true if the event spread within the bounds else false.

◆ width()

size_t Spatial::FMTEvent::width ( ) const

Return the width of the event.

Returns
the width.

◆ willSplitEvent()

bool Spatial::FMTEvent::willSplitEvent ( const FMTCoordinate p_coordinate) const

Return true if removing a coordinate will split the event.

Parameters
[in]p_coordinatethe coordinate that will be removed.
Returns
true if it will split the event else false.

◆ within() [1/2]

template<typename T >
bool Spatial::FMTEvent::within ( const T &  dist,
const FMTCoordinate location 
) const

Return true if a coordinate is within a distance of the event's coordinates.

Template Parameters
Tthe distance type.
Parameters
[in]distthe distance.
[in]locationthe coordinate.
Returns
true if the coordinate is within the distance else false.

◆ within() [2/2]

template<typename T >
bool Spatial::FMTEvent::within ( const T &  dist,
const FMTEvent rhs 
) const

Return true if the event is within a distance of another event's envelope.

Template Parameters
Tthe distance type.
Parameters
[in]distthe distance.
[in]rhsthe other event.
Returns
true if the event 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: