8#ifndef FMTEVENT_Hm_included
9#define FMTEVENT_Hm_included
15#include <boost/serialization/serialization.hpp>
16#include <boost/serialization/nvp.hpp>
17#include <boost/serialization/set.hpp>
22class FMTEventRelation;
70 size_t p_centroidGraphFamily);
211 virtual std::vector<std::set<FMTCoordinate>::const_iterator>
ignit(
const size_t& eventmaximalsize,
212 const std::set<FMTCoordinate>::const_iterator& ignit,
int p_actionId,
int p_period,
size_t p_GraphFamily);
223 virtual bool spread(
const size_t& eventminimalsize,
const size_t& eventmaximalsize,
224 const size_t& neighboringsize,
const std::set<FMTCoordinate>& territory, std::vector<std::set<FMTCoordinate>::const_iterator> active);
272 bool splitEvent(std::vector<FMTEvent>& splittedevents)
const;
285 std::vector<std::set<FMTCoordinate>::const_iterator>
getBorders()
const;
306 std::set<FMTCoordinate>::const_iterator& thiscoordinate,
307 std::set<FMTCoordinate>::const_iterator& rhscoordinate)
const;
309 friend class boost::serialization::access;
317 template<
class Archive>
318 void serialize(Archive& ar,
const unsigned int version)
320 ar& BOOST_SERIALIZATION_NVP(m_actionId);
321 ar& BOOST_SERIALIZATION_NVP(m_period);
322 ar& BOOST_SERIALIZATION_NVP(m_elements);
338 size_t m_centroidGraphFamily;
343 std::set<FMTCoordinate>m_elements;
355 return (event.
hash());
#define FMTEXPORT
Definition: FMTutility.h:125
Spatially referenced coordinate holding an x and y position on a raster grid.
Definition: FMTCoordinate.h:29
Relation between two spatial events, holding the from and to action, period and coordinate of the clo...
Definition: FMTEventRelation.h:26
Base class for a spatial event (FMTsaevent or FMTsesevent): a set of FMTCoordinate corresponding to t...
Definition: FMTEvent.h:28
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.
std::vector< std::pair< FMTCoordinate, FMTCoordinate > > getOutsideBordersPair() const
Return the outside borders of the event as pairs of coordinates.
std::set< FMTCoordinate > getTerritory(const size_t &distance) const
Return the adjacent territory of the event based on a distance.
size_t height() const
Return the height of the event.
bool contain(const FMTCoordinate &coord) const
Return true if a coordinate is in the elements of the event.
FMTEvent()=default
Default constructor for FMTEvent.
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.
double distance(const FMTEvent &rhs) const
Return the distance between this event and another one.
bool operator!=(const FMTEvent &rhs) const
Comparison operator for FMTEvent.
FMTEvent(const FMTEvent &rhs)=default
Copy constructor for FMTEvent.
bool splitEvent(std::vector< FMTEvent > &splittedevents) const
Split the event, filling a vector with the split events and removing the elements from the current ev...
bool within(const T &dist, const FMTCoordinate &location) const
Return true if a coordinate is within a distance of the event's coordinates.
~FMTEvent()=default
Default destructor for FMTEvent.
FMTCoordinate averageCentroid() const
Return the centroid based on the envelope of the event.
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.
bool operator<(const FMTEvent &rhs) const
Less than operator for FMTEvent.
bool within(const T &dist, const FMTEvent &rhs) const
Return true if the event is within a distance of another event's envelope.
const int & getActionId() const
Return the action id of the event.
virtual void erase(const FMTCoordinate &newlocation)
Erase a coordinate from the event.
static std::string getStatsHeader()
Return the header of the patch stats (size, perimeter, height and width).
std::vector< std::set< FMTCoordinate >::const_iterator > getBorders() const
Return the coordinates of the border of the event.
std::set< FMTCoordinate >::const_iterator midPosition() const
Get the mid point of the elements of the event.
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.
std::string getStats() const
Return the patch stats (size, perimeter, height and width) as a string.
void setActionId(const int &laction_id)
Set the action id of 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.
bool operator==(const FMTEvent &rhs) const
Comparison operator for FMTEvent.
const int & getPeriod() const
Return the period of the event.
bool empty() const
Test whether the event is empty.
FMTEventRelation getRelation(const FMTEvent &rhs) const
Return the relation between this event and another one.
size_t perimeter() const
Return the perimeter of the event, including any internal holes.
size_t size() const
Return the size of the event.
bool willSplitEvent(const FMTCoordinate &p_coordinate) const
Return true if removing a coordinate will split the event.
FMTEvent & operator=(const FMTEvent &rhs)=default
Copy assignment operator for FMTEvent.
size_t width() const
Return the width of the event.
size_t hash() const
Hash the event.
Definition: FMTAreaParser.h:40
Definition: FMTAction.h:463
std::size_t operator()(const Spatial::FMTEvent &event) const
Definition: FMTEvent.h:353