NGen
Loading...
Searching...
No Matches
geojson::FeatureCollection Class Reference

#include <FeatureCollection.hpp>

+ Collaboration diagram for geojson::FeatureCollection:

Public Member Functions

 FeatureCollection (FeatureList &new_features, std::vector< double > bounding_box)
 Constructor.
 
 FeatureCollection (FeatureList &&new_features, std::vector< double > &&bounding_box)
 Move Constructor.
 
 FeatureCollection ()
 
 FeatureCollection (const FeatureCollection &feature_collection)
 Copy constructor.
 
template<typename C >
 FeatureCollection (const FeatureCollection &feature_collection, C &filter)
 Copy constructor with filter.
 
virtual ~FeatureCollection ()
 Destructor.
 
int get_size ()
 
bool is_empty ()
 
std::vector< double > get_bounding_box () const
 
Feature get_feature (int index) const
 Retrieve Feature by index in collection.
 
int find (Feature feature)
 Finds the index of given Feature in the collection.
 
int find (std::string ID)
 Finds the index of a Feature with the given ID.
 
Feature remove_feature (int index)
 Removes a feature from the collection based on index.
 
Feature remove_feature_by_id (std::string ID)
 Removes a Feature based on its ID.
 
Feature get_feature (std::string id) const
 Retrieves a Feature based on its ID.
 
FeatureList::const_iterator begin () const
 
FeatureList::const_iterator end () const
 
JSONProperty get (std::string key) const
 
void visit_features (FeatureVisitor &visitor)
 
void set (const std::string &key, short value)
 
void set (const std::string &key, int value)
 
void set (const std::string &key, long value)
 
void set (const std::string &key, float value)
 
void set (const std::string &key, double value)
 
void set (const std::string &key, std::string value)
 
void set (const std::string &key, JSONProperty &property)
 
void add_feature (Feature feature, std::string *id=nullptr)
 
void add_feature_id (const std::string &id, Feature feature)
 Add a reference to a feature by id.
 
void set_ids_from_member (const std::string &member_name="id")
 
void set_ids_from_property (const std::string &property_name="id")
 
void set_ids (const std::string &id_field_name="id")
 
void update_ids (const std::string &alt_id={})
 Update the collection's feature id mapping.
 
int link_features_from_property (std::string *from_property=nullptr, std::string *to_property=nullptr)
 
int link_features_from_attribute (std::string *from_attribute=nullptr, std::string *to_attribute=nullptr)
 

Private Attributes

FeatureList features
 
std::vector< double > bounding_box
 
std::map< std::string, Featurefeature_by_id
 
std::map< std::string, JSONPropertyforeign_members
 

Constructor & Destructor Documentation

◆ FeatureCollection() [1/5]

geojson::FeatureCollection::FeatureCollection ( FeatureList & new_features,
std::vector< double > bounding_box )
inline

Constructor.

Parameters
new_featuresAn overall list of features
bounding_boxA set of bounds for all features

References features.

◆ FeatureCollection() [2/5]

geojson::FeatureCollection::FeatureCollection ( FeatureList && new_features,
std::vector< double > && bounding_box )
inline

Move Constructor.

Parameters
new_featuresAn overall list of features
bounding_boxA set of bounds for all features

◆ FeatureCollection() [3/5]

geojson::FeatureCollection::FeatureCollection ( )
inline

◆ FeatureCollection() [4/5]

geojson::FeatureCollection::FeatureCollection ( const FeatureCollection & feature_collection)
inline

Copy constructor.

Parameters
feature_collectionThe FeatureCollection to copy

References bounding_box, features, get_bounding_box(), and update_ids().

◆ FeatureCollection() [5/5]

template<typename C >
geojson::FeatureCollection::FeatureCollection ( const FeatureCollection & feature_collection,
C & filter )
inline

Copy constructor with filter.

Parameters
feature_collectionThe FeatureCollection to copy
filterA container

References bounding_box, features, get_bounding_box(), and update_ids().

◆ ~FeatureCollection()

virtual geojson::FeatureCollection::~FeatureCollection ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ add_feature()

void FeatureCollection::add_feature ( Feature feature,
std::string * id = nullptr )

References feature_by_id, and features.

Referenced by Network_Test::add_catchment().

◆ add_feature_id()

void FeatureCollection::add_feature_id ( const std::string & id,
Feature feature )

Add a reference to a feature by id.

Parameters
idThe id used to reference a feature
featureA feature that may be referred to by id

References feature_by_id.

◆ begin()

FeatureList::const_iterator FeatureCollection::begin ( ) const

References features.

◆ end()

FeatureList::const_iterator FeatureCollection::end ( ) const

References features.

◆ find() [1/2]

int FeatureCollection::find ( Feature feature)

Finds the index of given Feature in the collection.

Parameters
featureThe feature to look for
Returns
-1 if the feature isn't in the collection, the numerical index otherwise

References features, and get_size().

Referenced by remove_feature().

◆ find() [2/2]

int FeatureCollection::find ( std::string ID)

Finds the index of a Feature with the given ID.

Parameters
IDThe ID of the Feature to look for
Returns
-1 if the feature isn't in the collection, the numerical index otherwise

References features, and get_size().

◆ get()

JSONProperty FeatureCollection::get ( std::string key) const

◆ get_bounding_box()

std::vector< double > FeatureCollection::get_bounding_box ( ) const

References bounding_box.

Referenced by FeatureCollection(), and FeatureCollection().

◆ get_feature() [1/2]

Feature FeatureCollection::get_feature ( int index) const

Retrieve Feature by index in collection.

Parameters
indexThe index of the feature
Returns
The Feature at the given index

References features.

Referenced by remove_feature(), and remove_feature_by_id().

◆ get_feature() [2/2]

Feature FeatureCollection::get_feature ( std::string id) const

Retrieves a Feature based on its ID.

Parameters
IDThe ID of the Feature to retrieve
Returns
The feature with the given ID; null if a Feature with that ID isn't present

References feature_by_id.

◆ get_size()

int FeatureCollection::get_size ( )
Returns
The number of elements within the collection

References features.

Referenced by find(), find(), and remove_feature_by_id().

◆ is_empty()

bool FeatureCollection::is_empty ( )
Returns
Whether or not the collection is empty

References features.

◆ link_features_from_attribute()

int FeatureCollection::link_features_from_attribute ( std::string * from_attribute = nullptr,
std::string * to_attribute = nullptr )

References feature_by_id, features, and get().

◆ link_features_from_property()

int FeatureCollection::link_features_from_property ( std::string * from_property = nullptr,
std::string * to_property = nullptr )

References feature_by_id, features, and get().

◆ remove_feature()

Feature FeatureCollection::remove_feature ( int index)

Removes a feature from the collection based on index.

Parameters
indexThe index of the Feature to remove
Returns
The Feature that was removed

References feature_by_id, features, find(), and get_feature().

◆ remove_feature_by_id()

Feature FeatureCollection::remove_feature_by_id ( std::string ID)

Removes a Feature based on its ID.

Parameters
IDThe ID of the Feature to remove
Returns
The removed Feature; null if a Feature wasn't found

References feature_by_id, features, get_feature(), and get_size().

◆ set() [1/7]

void FeatureCollection::set ( const std::string & key,
double value )

References foreign_members.

◆ set() [2/7]

void FeatureCollection::set ( const std::string & key,
float value )

References foreign_members.

◆ set() [3/7]

void FeatureCollection::set ( const std::string & key,
int value )

References foreign_members.

◆ set() [4/7]

void FeatureCollection::set ( const std::string & key,
JSONProperty & property )

References foreign_members.

◆ set() [5/7]

void FeatureCollection::set ( const std::string & key,
long value )

References foreign_members.

◆ set() [6/7]

void FeatureCollection::set ( const std::string & key,
short value )

References foreign_members.

◆ set() [7/7]

void FeatureCollection::set ( const std::string & key,
std::string value )

References foreign_members.

◆ set_ids()

void FeatureCollection::set_ids ( const std::string & id_field_name = "id")

◆ set_ids_from_member()

void FeatureCollection::set_ids_from_member ( const std::string & member_name = "id")

◆ set_ids_from_property()

void FeatureCollection::set_ids_from_property ( const std::string & property_name = "id")

◆ update_ids()

void FeatureCollection::update_ids ( const std::string & alt_id = {})

Update the collection's feature id mapping.

Parameters
alt_idOptional, An alternative feature property to also index the feature by

References feature_by_id, and features.

Referenced by FeatureCollection(), FeatureCollection(), set_ids(), set_ids_from_member(), and set_ids_from_property().

◆ visit_features()

void FeatureCollection::visit_features ( FeatureVisitor & visitor)

References features.

Member Data Documentation

◆ bounding_box

std::vector<double> geojson::FeatureCollection::bounding_box
private

◆ feature_by_id

std::map<std::string, Feature> geojson::FeatureCollection::feature_by_id
private

◆ features

◆ foreign_members

std::map<std::string, JSONProperty> geojson::FeatureCollection::foreign_members
private

Referenced by get(), set(), set(), set(), set(), set(), set(), and set().


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