NGen
Loading...
Searching...
No Matches
geojson::FeatureBase Class Referenceabstract

Represents an individual feature within a Geojson definition. More...

#include <FeatureBase.hpp>

+ Inheritance diagram for geojson::FeatureBase:
+ Collaboration diagram for geojson::FeatureBase:

Public Member Functions

 FeatureBase (const FeatureBase &feature)
 Copy Constructor.
 
virtual ~FeatureBase ()
 Destructor.
 
FeatureType get_type () const
 Retrieve an indicator as to what type of feature this is.
 
virtual void add_origination_feature (FeatureBase *feature, bool connect=true)
 Set a separate feature as upstream from this instance.
 
virtual void add_destination_feature (FeatureBase *feature, bool connect=true)
 Set a separate feature as destination from this instance.
 
virtual void assign_neighbors ()
 Searches for features that share common destinations and links them.
 
virtual void add_neighbor_feature (FeatureBase *feature, bool connect=true)
 Links this feature to a feature that shares a common destination.
 
virtual JSONProperty get_property (const std::string &key) const
 Get a value from the set of properties.
 
virtual void set_id (const std::string &new_id)
 Sets the ID for the Feature.
 
virtual JSONProperty get (const std::string &key) const
 Get a foreign member value by name.
 
virtual void set (const std::string &key, short value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, int value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, long value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, float value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, double value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, std::string value)
 Sets a foreign member value.
 
virtual void set (const std::string &key, JSONProperty property)
 Sets a foreign member value.
 
virtual bool has_key (const std::string &key)
 
virtual std::vector< std::string > keys () const
 Retrieves a listing of all foreign member keys.
 
virtual std::vector< std::string > property_keys () const
 Retireves a listing of all property keys.
 
virtual bool has_property (std::string property_name) const
 
virtual std::vector< geojson::geometryget_geometry_collection () const
 Collects a collection of everything held within the inner geometry collection.
 
std::vector< double > get_bounding_box () const
 Collects all values describing the bounds of this feature.
 
const PropertyMapget_properties () const
 
PropertyMapget_properties ()
 
std::string get_id () const
 
std::string get_id (std::string alt_id) const
 
int get_number_of_destination_features ()
 
int get_number_of_origination_features ()
 
int get_number_of_neighbors ()
 
FeatureBaseget_destination_feature (std::string id)
 
FeatureBaseget_origination_feature (std::string id)
 
std::vector< FeatureBase * > origination_features () const
 
std::vector< FeatureBase * > destination_features () const
 
std::vector< FeatureBase * > neighbor_features () const
 
int get_origination_length ()
 
int get_destination_length ()
 
int get_contributor_count ()
 
bool is_leaf ()
 
bool is_root ()
 
template<class T >
geometry () const
 
::geojson::geometry geometry () const
 
template<class T >
geometry (int index) const
 
virtual void visit (FeatureVisitor &visitor)=0
 
bool operator== (const FeatureBase &rhs)
 
bool operator!= (const FeatureBase &other)
 

Protected Member Functions

 FeatureBase (std::string new_id="", PropertyMap new_properties=PropertyMap(), std::vector< double > new_bounding_box=std::vector< double >(), std::vector< FeatureBase * > origination_features=std::vector< FeatureBase * >(), std::vector< FeatureBase * > destination_features=std::vector< FeatureBase * >(), PropertyMap members=PropertyMap())
 Verbose constructor for the basic attributes of a feature.
 
virtual void break_links ()
 
virtual void remove_destination (FeatureBase *feature)
 
virtual void remove_origination (FeatureBase *feature)
 
virtual void remove_neighbor (FeatureBase *feature)
 

Protected Attributes

FeatureType type
 
::geojson::geometry geom
 
std::vector<::geojson::geometrygeometry_collection
 
PropertyMap properties
 
std::vector< double > bounding_box
 
PropertyMap foreign_members
 
std::string id
 
std::vector< FeatureBase * > origination
 
std::vector< FeatureBase * > destination
 
std::vector< FeatureBase * > neighbors
 

Friends

class FeatureCollection
 

Detailed Description

Represents an individual feature within a Geojson definition.

Constructor & Destructor Documentation

◆ FeatureBase() [1/2]

geojson::FeatureBase::FeatureBase ( std::string new_id = "",
PropertyMap new_properties = PropertyMap(),
std::vector< double > new_bounding_box = std::vector<double>(),
std::vector< FeatureBase * > origination_features = std::vector<FeatureBase*>(),
std::vector< FeatureBase * > destination_features = std::vector<FeatureBase*>(),
PropertyMap members = PropertyMap() )
inlineprotected

Verbose constructor for the basic attributes of a feature.

Parameters
new_idAn id for the feature so that it may be referenced by name
new_propertiesA mapping between a name for a property and its values
new_bounding_boxA list of double values describing the boundaries for a feature
origination_featuresA series of raw pointers to features that lie upstream from this feature
destination_featuresA series of raw pointers to features that lie downstream from this feature
membersA mapping of foreign members for the feature between the member name and its value

References add_destination_feature(), add_origination_feature(), bounding_box, destination_features(), foreign_members, origination_features(), and properties.

◆ FeatureBase() [2/2]

◆ ~FeatureBase()

virtual geojson::FeatureBase::~FeatureBase ( )
inlinevirtual

Destructor.

References break_links().

Member Function Documentation

◆ add_destination_feature()

virtual void geojson::FeatureBase::add_destination_feature ( FeatureBase * feature,
bool connect = true )
inlinevirtual

Set a separate feature as destination from this instance.

Parameters
featureThe feature to link to that is destination from this instance
connectWhether or not to set this instance as upstream from the newly attached destination feature

References add_origination_feature(), geojson::contains(), and destination.

Referenced by FeatureBase(), and add_origination_feature().

◆ add_neighbor_feature()

virtual void geojson::FeatureBase::add_neighbor_feature ( FeatureBase * feature,
bool connect = true )
inlinevirtual

Links this feature to a feature that shares a common destination.

Parameters
featureA feature with a common destination
connectWhether or not this feature should be linked to the neighbor as well

References add_neighbor_feature(), geojson::contains(), and neighbors.

Referenced by add_neighbor_feature(), and assign_neighbors().

◆ add_origination_feature()

virtual void geojson::FeatureBase::add_origination_feature ( FeatureBase * feature,
bool connect = true )
inlinevirtual

Set a separate feature as upstream from this instance.

Parameters
featureThe feature to link to that is upstream from this instance
connectWhether or not to set this instance as downsteam from the newly attached upstream feature

References add_destination_feature(), and origination.

Referenced by FeatureBase(), and add_destination_feature().

◆ assign_neighbors()

virtual void geojson::FeatureBase::assign_neighbors ( )
inlinevirtual

Searches for features that share common destinations and links them.

References add_neighbor_feature(), destination, and destination_features().

◆ break_links()

virtual void geojson::FeatureBase::break_links ( )
inlineprotectedvirtual

References destination, neighbors, and origination.

Referenced by ~FeatureBase().

◆ destination_features()

std::vector< FeatureBase * > geojson::FeatureBase::destination_features ( ) const
inline

References destination.

Referenced by FeatureBase(), FeatureBase(), and assign_neighbors().

◆ geometry() [1/3]

template<class T >
T geojson::FeatureBase::geometry ( ) const
inline

◆ geometry() [2/3]

::geojson::geometry geojson::FeatureBase::geometry ( ) const
inline

References geom.

◆ geometry() [3/3]

template<class T >
T geojson::FeatureBase::geometry ( int index) const
inline

◆ get()

virtual JSONProperty geojson::FeatureBase::get ( const std::string & key) const
inlinevirtual

Get a foreign member value by name.

Parameters
keyThe name of the foreign member whose value to look for
Returns
The member value identified by the key

References foreign_members.

Referenced by FeatureBase(), and operator==().

◆ get_bounding_box()

std::vector< double > geojson::FeatureBase::get_bounding_box ( ) const
inline

Collects all values describing the bounds of this feature.

Returns
A collection of double values describing the bounds for this feature

References bounding_box.

Referenced by FeatureBase().

◆ get_contributor_count()

int geojson::FeatureBase::get_contributor_count ( )
inline

References geojson::contains(), and origination.

◆ get_destination_feature()

FeatureBase * geojson::FeatureBase::get_destination_feature ( std::string id)
inline

References destination.

◆ get_destination_length()

int geojson::FeatureBase::get_destination_length ( )
inline

References destination, and is_leaf().

◆ get_geometry_collection()

virtual std::vector< geojson::geometry > geojson::FeatureBase::get_geometry_collection ( ) const
inlinevirtual

Collects a collection of everything held within the inner geometry collection.

Returns
A collection of boost geometry objects
Exceptions
RuntimeError if this feature isn't a collection type

References geometry_collection, geojson::GeometryCollection, and type.

Referenced by geojson::CollectionFeature::CollectionFeature(), and FeatureBase().

◆ get_id() [1/2]

std::string geojson::FeatureBase::get_id ( ) const
inline

References id.

Referenced by FeatureBase(), and operator==().

◆ get_id() [2/2]

std::string geojson::FeatureBase::get_id ( std::string alt_id) const
inline

◆ get_number_of_destination_features()

int geojson::FeatureBase::get_number_of_destination_features ( )
inline

References destination.

◆ get_number_of_neighbors()

int geojson::FeatureBase::get_number_of_neighbors ( )
inline

References neighbors.

◆ get_number_of_origination_features()

int geojson::FeatureBase::get_number_of_origination_features ( )
inline

References origination.

◆ get_origination_feature()

FeatureBase * geojson::FeatureBase::get_origination_feature ( std::string id)
inline

References origination.

◆ get_origination_length()

int geojson::FeatureBase::get_origination_length ( )
inline

References is_root(), and origination.

◆ get_properties() [1/2]

PropertyMap & geojson::FeatureBase::get_properties ( )
inline

References properties.

◆ get_properties() [2/2]

const PropertyMap & geojson::FeatureBase::get_properties ( ) const
inline

References properties.

Referenced by FeatureBase().

◆ get_property()

virtual JSONProperty geojson::FeatureBase::get_property ( const std::string & key) const
inlinevirtual

Get a value from the set of properties.

Parameters
keyThe name of the property to get
Returns
The property identified by the key

References properties.

Referenced by get_id(), and operator==().

◆ get_type()

FeatureType geojson::FeatureBase::get_type ( ) const
inline

Retrieve an indicator as to what type of feature this is.

Returns
The type of feature for this instance

References type.

Referenced by FeatureBase(), geojson::LineStringFeature::LineStringFeature(), geojson::MultiLineStringFeature::MultiLineStringFeature(), geojson::MultiPointFeature::MultiPointFeature(), geojson::PointFeature::PointFeature(), and operator==().

◆ has_key()

virtual bool geojson::FeatureBase::has_key ( const std::string & key)
inlinevirtual

References keys().

◆ has_property()

virtual bool geojson::FeatureBase::has_property ( std::string property_name) const
inlinevirtual

References property_keys().

◆ is_leaf()

bool geojson::FeatureBase::is_leaf ( )
inline

References destination.

Referenced by get_destination_length().

◆ is_root()

bool geojson::FeatureBase::is_root ( )
inline

References origination.

Referenced by get_origination_length().

◆ keys()

virtual std::vector< std::string > geojson::FeatureBase::keys ( ) const
inlinevirtual

Retrieves a listing of all foreign member keys.

Returns
A list of all the names of foreign member values

References foreign_members.

Referenced by FeatureBase(), has_key(), and operator==().

◆ neighbor_features()

std::vector< FeatureBase * > geojson::FeatureBase::neighbor_features ( ) const
inline

References neighbors.

◆ operator!=()

bool geojson::FeatureBase::operator!= ( const FeatureBase & other)
inline

References operator==().

◆ operator==()

◆ origination_features()

std::vector< FeatureBase * > geojson::FeatureBase::origination_features ( ) const
inline

References origination.

Referenced by FeatureBase(), and FeatureBase().

◆ property_keys()

virtual std::vector< std::string > geojson::FeatureBase::property_keys ( ) const
inlinevirtual

Retireves a listing of all property keys.

Returns
A list of all the names of the properties for this feature

References properties, and property_keys().

Referenced by has_property(), operator==(), and property_keys().

◆ remove_destination()

virtual void geojson::FeatureBase::remove_destination ( FeatureBase * feature)
inlineprotectedvirtual

References destination.

◆ remove_neighbor()

virtual void geojson::FeatureBase::remove_neighbor ( FeatureBase * feature)
inlineprotectedvirtual

References neighbors.

◆ remove_origination()

virtual void geojson::FeatureBase::remove_origination ( FeatureBase * feature)
inlineprotectedvirtual

References origination.

◆ set() [1/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
double value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set() [2/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
float value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set() [3/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
int value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set() [4/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
JSONProperty property )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set() [5/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
long value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set() [6/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
short value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

Referenced by FeatureBase().

◆ set() [7/7]

virtual void geojson::FeatureBase::set ( const std::string & key,
std::string value )
inlinevirtual

Sets a foreign member value.

Parameters
keyThe name of the value to set
valueThe value to set

References foreign_members.

◆ set_id()

virtual void geojson::FeatureBase::set_id ( const std::string & new_id)
inlinevirtual

Sets the ID for the Feature.

Parameters
new_idThe new identifier for this feature

◆ visit()

Friends And Related Symbol Documentation

◆ FeatureCollection

friend class FeatureCollection
friend

Member Data Documentation

◆ bounding_box

std::vector<double> geojson::FeatureBase::bounding_box
protected

◆ destination

◆ foreign_members

PropertyMap geojson::FeatureBase::foreign_members
protected

◆ geom

◆ geometry_collection

◆ id

std::string geojson::FeatureBase::id
protected

Referenced by get_id(), and get_id().

◆ neighbors

std::vector<FeatureBase*> geojson::FeatureBase::neighbors
protected

◆ origination

◆ properties

PropertyMap geojson::FeatureBase::properties
protected

◆ type


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