openModeller
Version 1.5.0
|
#include <Occurrences.hh>
Public Types | |
typedef std::vector < OccurrencePtr > ::const_iterator | const_iterator |
typedef std::vector < OccurrencePtr >::iterator | iterator |
Public Member Functions | |
OccurrencesImpl (double default_abundance) | |
OccurrencesImpl (const std::string &label, const std::string &coord_system=GeoTransform::getDefaultCS()) | |
~OccurrencesImpl () | |
OccurrencesImpl * | clone () const |
void | reserve (int estimate) |
char const * | label () const |
char const * | coordSystem () const |
bool | hasEnvironment () const |
int | dimension () const |
void | setLabel (const std::string &label) |
void | setCoordinateSystem (const std::string &cs) |
void | createOccurrence (const std::string &id, Coord longitude, Coord latitude, Scalar error, Scalar abundance, int num_attributes=0, Scalar *attributes=0, int num_env=0, Scalar *env=0) |
void | createOccurrence (const std::string &id, Coord longitude, Coord latitude, Scalar error, Scalar abundance, std::vector< double > attributes, std::vector< double > env) |
void | insert (const OccurrencePtr &) |
iterator | erase (const iterator &it) |
int | numAttributes () const |
int | numOccurrences () const |
bool | isEmpty () const |
ConstOccurrencePtr | operator[] (int i) const |
const_iterator | begin () const |
const_iterator | end () const |
iterator | begin () |
iterator | end () |
ConstOccurrencePtr | getRandom () const |
void | getMinMax (Sample *min, Sample *max) const |
void | normalize (Normalizer *normalizerPtr, size_t categoricalThreshold=0) |
void | resetNormalization () |
void | setEnvironment (const EnvironmentPtr &env, const char *type="Sample") |
void | appendFrom (const OccurrencesPtr &source) |
std::vector< ScalarVector > | getEnvironmentMatrix () |
void | dump (std::string msg="") const |
virtual ConfigurationPtr | getConfiguration () const |
virtual void | setConfiguration (const ConstConfigurationPtr &) |
Public Member Functions inherited from Configurable | |
virtual | ~Configurable () |
Private Member Functions | |
void | initGeoTransform () |
Private Member Functions inherited from ReferenceCountedObject | |
ReferenceCountedObject () | |
virtual | ~ReferenceCountedObject ()=0 |
Private Attributes | |
double | default_abundance_ |
std::string | label_ |
std::string | cs_ |
GeoTransform * | gt_ |
std::vector< OccurrencePtr > | occur_ |
Friends | |
class | ReferenceCountedPointer< OccurrencesImpl > |
class | ReferenceCountedPointer< const OccurrencesImpl > |
Representation of a set of occurrences.
Definition at line 78 of file Occurrences.hh.
typedef std::vector<OccurrencePtr>::const_iterator OccurrencesImpl::const_iterator |
Definition at line 85 of file Occurrences.hh.
typedef std::vector<OccurrencePtr>::iterator OccurrencesImpl::iterator |
Definition at line 86 of file Occurrences.hh.
|
inline |
Creates a collection of occurrences points.
Definition at line 91 of file Occurrences.hh.
Referenced by clone().
|
inline |
Creates a collection of occurrence points.
label | Label for the collection. |
coord_system | Coordinate system of the occurrences points to be inserted in this collection (in WKT format). |
Definition at line 106 of file Occurrences.hh.
OccurrencesImpl::~OccurrencesImpl | ( | ) |
Definition at line 55 of file Occurrences.cpp.
References gt_.
void OccurrencesImpl::appendFrom | ( | const OccurrencesPtr & | source | ) |
Appends all occurrences from source
source | Occurrences object where occurrence pointers will be appended from. |
Definition at line 379 of file Occurrences.cpp.
References end(), and insert().
|
inline |
|
inline |
Definition at line 206 of file Occurrences.hh.
OccurrencesImpl * OccurrencesImpl::clone | ( | ) | const |
Deep copy of this.
Definition at line 312 of file Occurrences.cpp.
References cs_, end(), insert(), label_, occur_, and OccurrencesImpl().
|
inline |
coordinate system name
Definition at line 129 of file Occurrences.hh.
Referenced by getConfiguration().
void OccurrencesImpl::createOccurrence | ( | const std::string & | id, |
Coord | longitude, | ||
Coord | latitude, | ||
Scalar | error, | ||
Scalar | abundance, | ||
int | num_attributes = 0 , |
||
Scalar * | attributes = 0 , |
||
int | num_env = 0 , |
||
Scalar * | env = 0 |
||
) |
Create an occurrence.
id | Unique id |
longitude | Longitude in native coordinates |
latitude | Latitude in native coordinates |
error | (longitude, latitude) uncertanty in meters. |
abundance | - the abundance of the species: 0 for absence points. |
num_attributes | Number of possible modelling attributes. |
attributes | Vector with possible modelling attributes. |
num_env | Number of environment variables at sample |
env | Vector with environment variables. |
deprecated by STL vector version.
Definition at line 273 of file Occurrences.cpp.
References gt_, insert(), and GeoTransform::transfOut().
Referenced by OccurrencesReader::_addAbsence(), OccurrencesReader::_addPresence(), and setConfiguration().
void OccurrencesImpl::createOccurrence | ( | const std::string & | id, |
Coord | longitude, | ||
Coord | latitude, | ||
Scalar | error, | ||
Scalar | abundance, | ||
std::vector< double > | attributes, | ||
std::vector< double > | env | ||
) |
Create an occurrence using STL vectors to input attributes and environment data
Definition at line 290 of file Occurrences.cpp.
References gt_, insert(), and GeoTransform::transfOut().
int OccurrencesImpl::dimension | ( | ) | const |
Definition at line 344 of file Occurrences.cpp.
References hasEnvironment(), and occur_.
Referenced by getEnvironmentMatrix().
void OccurrencesImpl::dump | ( | std::string | msg = "" | ) | const |
Print occurrence data and its points.
Definition at line 438 of file Occurrences.cpp.
References end(), Log::info(), Log::instance(), label_, numOccurrences(), and occur_.
|
inline |
Definition at line 205 of file Occurrences.hh.
Referenced by appendFrom(), clone(), dump(), getConfiguration(), getEnvironmentMatrix(), getMinMax(), normalize(), resetNormalization(), and setConfiguration().
|
inline |
Definition at line 207 of file Occurrences.hh.
OccurrencesImpl::iterator OccurrencesImpl::erase | ( | const iterator & | it | ) |
Remove a single entry
Definition at line 370 of file Occurrences.cpp.
References occur_, and swap().
|
virtual |
Implements Configurable.
Definition at line 88 of file Occurrences.cpp.
References coordSystem(), end(), gt_, label(), occur_, and GeoTransform::transfIn().
std::vector< ScalarVector > OccurrencesImpl::getEnvironmentMatrix | ( | ) |
Return matrix as a vector of vectors (layers X respective values for each occurrence).
Definition at line 400 of file Occurrences.cpp.
References dimension(), end(), numOccurrences(), and occur_.
normalizable interface
Definition at line 251 of file Occurrences.cpp.
ConstOccurrencePtr OccurrencesImpl::getRandom | ( | ) | const |
Choose an occurrence at random.
Definition at line 361 of file Occurrences.cpp.
References numOccurrences(), and occur_.
bool OccurrencesImpl::hasEnvironment | ( | ) | const |
Definition at line 331 of file Occurrences.cpp.
References numOccurrences(), and occur_.
Referenced by dimension().
|
private |
Definition at line 74 of file Occurrences.cpp.
References cs_, GeoTransform::getDefaultCS(), and gt_.
Referenced by setConfiguration(), and setCoordinateSystem().
void OccurrencesImpl::insert | ( | const OccurrencePtr & | oc | ) |
Add an occurrence created outside.
Definition at line 306 of file Occurrences.cpp.
References occur_.
Referenced by appendFrom(), clone(), and createOccurrence().
|
inline |
|
inline |
label of the occurrences
Definition at line 126 of file Occurrences.hh.
Referenced by getConfiguration(), and setLabel().
void OccurrencesImpl::normalize | ( | Normalizer * | normalizerPtr, |
size_t | categoricalThreshold = 0 |
||
) |
|
inline |
Number of attributes of the thing occurred. This is the number of dependent variables, ie the variables to be modelled.
Fixme - this is currently hard-coded to 0.
Definition at line 192 of file Occurrences.hh.
|
inline |
Number of occurrences.
Definition at line 195 of file Occurrences.hh.
Referenced by dump(), getEnvironmentMatrix(), getRandom(), and hasEnvironment().
|
inline |
Vector/Random access
Definition at line 201 of file Occurrences.hh.
|
inline |
change the reserve setting for the container
Definition at line 123 of file Occurrences.hh.
Referenced by Garp::cacheSamples().
void OccurrencesImpl::resetNormalization | ( | ) |
Reset normalization
Definition at line 236 of file Occurrences.cpp.
|
virtual |
Implements Configurable.
Definition at line 128 of file Occurrences.cpp.
References begin(), createOccurrence(), cs_, default_abundance_, end(), GeoTransform::getDefaultCS(), initGeoTransform(), Log::instance(), label_, UNUSED, and Log::warn().
void OccurrencesImpl::setCoordinateSystem | ( | const std::string & | cs | ) |
set the coordinate system
All occurrences inserted after this call are assumed to be in this coordinate system.
Definition at line 67 of file Occurrences.cpp.
References cs_, and initGeoTransform().
void OccurrencesImpl::setEnvironment | ( | const EnvironmentPtr & | env, |
const char * | type = "Sample" |
||
) |
Sets environment object in each occurrence object
Definition at line 181 of file Occurrences.cpp.
References Log::instance(), isEmpty(), occur_, Sample::size(), and Log::warn().
void OccurrencesImpl::setLabel | ( | const std::string & | label | ) |
set the label
Definition at line 61 of file Occurrences.cpp.
References label(), and label_.
|
friend |
Definition at line 81 of file Occurrences.hh.
|
friend |
Definition at line 80 of file Occurrences.hh.
|
private |
Definition at line 249 of file Occurrences.hh.
Referenced by clone(), initGeoTransform(), setConfiguration(), and setCoordinateSystem().
|
private |
Definition at line 246 of file Occurrences.hh.
Referenced by setConfiguration().
|
private |
Definition at line 251 of file Occurrences.hh.
Referenced by createOccurrence(), getConfiguration(), initGeoTransform(), and ~OccurrencesImpl().
|
private |
Definition at line 248 of file Occurrences.hh.
Referenced by clone(), dump(), setConfiguration(), and setLabel().
|
private |
Definition at line 253 of file Occurrences.hh.
Referenced by clone(), dimension(), dump(), erase(), getConfiguration(), getEnvironmentMatrix(), getMinMax(), getRandom(), hasEnvironment(), insert(), normalize(), resetNormalization(), and setEnvironment().