openModeller  Version 1.5.0
OccurrencesImpl Class Reference

#include <Occurrences.hh>

Inheritance diagram for OccurrencesImpl:
Inheritance graph
Collaboration diagram for OccurrencesImpl:
Collaboration graph

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 ()
 
OccurrencesImplclone () 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< ScalarVectorgetEnvironmentMatrix ()
 
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_
 
GeoTransformgt_
 
std::vector< OccurrencePtroccur_
 

Friends

class ReferenceCountedPointer< OccurrencesImpl >
 
class ReferenceCountedPointer< const OccurrencesImpl >
 

Detailed Description

Representation of a set of occurrences.

Definition at line 78 of file Occurrences.hh.

Member Typedef Documentation

Definition at line 85 of file Occurrences.hh.

Definition at line 86 of file Occurrences.hh.

Constructor & Destructor Documentation

OccurrencesImpl::OccurrencesImpl ( double  default_abundance)
inline

Creates a collection of occurrences points.

Definition at line 91 of file Occurrences.hh.

Referenced by clone().

OccurrencesImpl::OccurrencesImpl ( const std::string &  label,
const std::string &  coord_system = GeoTransform::getDefaultCS() 
)
inline

Creates a collection of occurrence points.

Parameters
labelLabel for the collection.
coord_systemCoordinate 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_.

Member Function Documentation

void OccurrencesImpl::appendFrom ( const OccurrencesPtr source)

Appends all occurrences from source

Parameters
sourceOccurrences object where occurrence pointers will be appended from.

Definition at line 379 of file Occurrences.cpp.

References end(), and insert().

Here is the call graph for this function:

const_iterator OccurrencesImpl::begin ( ) const
inline

Linear access

Definition at line 204 of file Occurrences.hh.

Referenced by setConfiguration().

iterator OccurrencesImpl::begin ( )
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().

Here is the call graph for this function:

char const* OccurrencesImpl::coordSystem ( ) const
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.

Parameters
idUnique id
longitudeLongitude in native coordinates
latitudeLatitude in native coordinates
error(longitude, latitude) uncertanty in meters.
abundance- the abundance of the species: 0 for absence points.
num_attributesNumber of possible modelling attributes.
attributesVector with possible modelling attributes.
num_envNumber of environment variables at sample
envVector 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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

int OccurrencesImpl::dimension ( ) const

Definition at line 344 of file Occurrences.cpp.

References hasEnvironment(), and occur_.

Referenced by getEnvironmentMatrix().

Here is the call graph for this function:

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_.

Here is the call graph for this function:

const_iterator OccurrencesImpl::end ( ) const
inline
iterator OccurrencesImpl::end ( )
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().

Here is the call graph for this function:

ConfigurationPtr OccurrencesImpl::getConfiguration ( ) const
virtual

Implements Configurable.

Definition at line 88 of file Occurrences.cpp.

References coordSystem(), end(), gt_, label(), occur_, and GeoTransform::transfIn().

Here is the call graph for this function:

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_.

Here is the call graph for this function:

void OccurrencesImpl::getMinMax ( Sample min,
Sample max 
) const

normalizable interface

Definition at line 251 of file Occurrences.cpp.

References end(), and occur_.

Here is the call graph for this function:

ConstOccurrencePtr OccurrencesImpl::getRandom ( ) const

Choose an occurrence at random.

Definition at line 361 of file Occurrences.cpp.

References numOccurrences(), and occur_.

Here is the call graph for this function:

bool OccurrencesImpl::hasEnvironment ( ) const

Definition at line 331 of file Occurrences.cpp.

References numOccurrences(), and occur_.

Referenced by dimension().

Here is the call graph for this function:

void OccurrencesImpl::initGeoTransform ( )
private

Definition at line 74 of file Occurrences.cpp.

References cs_, GeoTransform::getDefaultCS(), and gt_.

Referenced by setConfiguration(), and setCoordinateSystem().

Here is the call graph for this function:

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().

bool OccurrencesImpl::isEmpty ( ) const
inline

Test for empty.

Definition at line 198 of file Occurrences.hh.

Referenced by setEnvironment().

char const* OccurrencesImpl::label ( ) const
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 
)

Normalize

Definition at line 215 of file Occurrences.cpp.

References end(), and occur_.

Here is the call graph for this function:

int OccurrencesImpl::numAttributes ( ) const
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.

int OccurrencesImpl::numOccurrences ( ) const
inline

Number of occurrences.

Definition at line 195 of file Occurrences.hh.

Referenced by dump(), getEnvironmentMatrix(), getRandom(), and hasEnvironment().

ConstOccurrencePtr OccurrencesImpl::operator[] ( int  i) const
inline

Vector/Random access

Definition at line 201 of file Occurrences.hh.

void OccurrencesImpl::reserve ( int  estimate)
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.

References end(), and occur_.

Here is the call graph for this function:

void OccurrencesImpl::setConfiguration ( const ConstConfigurationPtr config)
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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void OccurrencesImpl::setLabel ( const std::string &  label)

set the label

Definition at line 61 of file Occurrences.cpp.

References label(), and label_.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class ReferenceCountedPointer< const OccurrencesImpl >
friend

Definition at line 81 of file Occurrences.hh.

friend class ReferenceCountedPointer< OccurrencesImpl >
friend

Definition at line 80 of file Occurrences.hh.

Member Data Documentation

std::string OccurrencesImpl::cs_
private

Definition at line 249 of file Occurrences.hh.

Referenced by clone(), initGeoTransform(), setConfiguration(), and setCoordinateSystem().

double OccurrencesImpl::default_abundance_
private

Definition at line 246 of file Occurrences.hh.

Referenced by setConfiguration().

GeoTransform* OccurrencesImpl::gt_
private
std::string OccurrencesImpl::label_
private

Definition at line 248 of file Occurrences.hh.

Referenced by clone(), dump(), setConfiguration(), and setLabel().


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