openModeller
Version 1.5.0
|
#include <Environment.hh>
Public Member Functions | |
~EnvironmentImpl () | |
EnvironmentImpl * | clone () const |
unsigned int | numLayers () const |
size_t | numCategoricalLayers () const |
int | isCategorical (int i) |
void | getMinMax (Sample *min, Sample *max) const |
void | normalize (Normalizer *normalizerPtr) |
void | resetNormalization () |
Sample | get (Coord x, Coord y) const |
Sample | getNormalized (Coord x, Coord y) const |
Sample | getUnnormalized (Coord x, Coord y) const |
Sample | getRandom (Coord *x=0, Coord *y=0) const |
int | checkCoordinates (Coord x, Coord y) const |
int | getRegion (Coord *xmin, Coord *ymin, Coord *xmax, Coord *ymax) const |
int | getExtremes (Sample *min, Sample *max) const |
Map * | getLayer (int index) const |
int | changeMask (const std::string &mask_file) |
Map * | getMask () const |
const std::string & | getLayerPath (int index) const |
const std::string & | getMaskPath () const |
void | removeLayer (unsigned int index) |
virtual ConfigurationPtr | getConfiguration () const |
virtual void | setConfiguration (const ConstConfigurationPtr &) |
Public Member Functions inherited from Configurable | |
virtual | ~Configurable () |
Public Member Functions inherited from Normalizable | |
virtual | ~Normalizable () |
Private Types | |
typedef std::pair< std::string, Map * > | layer |
typedef std::vector< layer > | layers |
Private Member Functions | |
EnvironmentImpl () | |
EnvironmentImpl (const std::vector< std::string > &categs, const std::vector< std::string > &maps, const std::string &mask_file="") | |
void | initialize (const std::vector< std::string > &categs, const std::vector< std::string > &maps, const std::string &mask_file="") |
void | getUnnormalizedInternal (Sample *, Coord x, Coord y) const |
void | clearMask () |
void | clearLayers () |
int | changeLayers (const std::vector< std::string > &categs, const std::vector< std::string > &maps) |
void | calcRegion () |
Private Member Functions inherited from ReferenceCountedObject | |
ReferenceCountedObject () | |
virtual | ~ReferenceCountedObject ()=0 |
Static Private Member Functions | |
static ConfigurationPtr | getLayerConfig (const layer &l, bool basicConfig=false) |
static void | loadLayers (const std::vector< std::string > &map_ids, std::vector< Map * > &map_refs, int categ=0) |
static layer | makeLayer (const ConstConfigurationPtr &config, Map *map) |
static layer | makeLayer (const std::string &filename, int categ) |
static layer | makeLayer (const std::string &filename, Map *map) |
Private Attributes | |
layers | _layers |
Vector with all layers that describe the variables. More... | |
layer | _mask |
Mask (can be 0). More... | |
Coord | _xmin |
Intersection of all layers. More... | |
Coord | _ymin |
Intersection of all layers. More... | |
Coord | _xmax |
Intersection of all layers. More... | |
Coord | _ymax |
Intersection of all layers. More... | |
Normalizer * | _normalizerPtr |
Normalize the environment. More... | |
Friends | |
class | ReferenceCountedPointer< EnvironmentImpl > |
class | ReferenceCountedPointer< const EnvironmentImpl > |
EnvironmentPtr dllexp | createEnvironment (const std::vector< std::string > &categs, const std::vector< std::string > &maps, const std::string &mask_file) |
EnvironmentPtr dllexp | createEnvironment (const std::vector< std::string > &categs, const std::vector< std::string > &maps) |
EnvironmentPtr dllexp | createEnvironment (const ConstConfigurationPtr &config) |
EnvironmentPtr dllexp | createEnvironment () |
Allow access to environmental variables by means of vectors gathering data from all layers on the sampled points.
Definition at line 69 of file Environment.hh.
|
private |
Definition at line 85 of file Environment.hh.
|
private |
Definition at line 86 of file Environment.hh.
|
private |
Definition at line 174 of file Environment.cpp.
Referenced by clone().
|
private |
Vector with file names that contain the variables to be used and also the mask layer.
categs | Categorical layers (e.g. soil). |
maps | Continuous layers (e.g. temperature). |
mask_file | Mask file. |
Definition at line 185 of file Environment.cpp.
References initialize().
EnvironmentImpl::~EnvironmentImpl | ( | ) |
Definition at line 208 of file Environment.cpp.
References _normalizerPtr, clearLayers(), and clearMask().
|
private |
Calculate the widest region common to all layers.
Definition at line 817 of file Environment.cpp.
References _layers, _mask, _xmax, _xmin, _ymax, _ymin, Log::instance(), MAXFLOAT, and Log::warn().
Referenced by changeLayers(), changeMask(), removeLayer(), and setConfiguration().
|
private |
Rebuild the layer representation.
Definition at line 450 of file Environment.cpp.
References _layers, calcRegion(), clearLayers(), loadLayers(), and makeLayer().
Referenced by initialize().
int EnvironmentImpl::changeMask | ( | const std::string & | mask_file | ) |
Change the mask.
Definition at line 498 of file Environment.cpp.
References _mask, calcRegion(), clearMask(), RasterException::getCode(), makeLayer(), and Sleep.
Referenced by initialize().
Return 0 if (x,y) falls outside the mask. If there's no mask, return != 0 always.
Definition at line 742 of file Environment.cpp.
References _mask, _xmax, _ymax, Log::debug(), and Log::instance().
Referenced by getUnnormalizedInternal().
|
private |
Definition at line 257 of file Environment.cpp.
References _layers.
Referenced by changeLayers(), setConfiguration(), and ~EnvironmentImpl().
|
private |
Definition at line 270 of file Environment.cpp.
References _mask.
Referenced by changeMask(), setConfiguration(), and ~EnvironmentImpl().
EnvironmentImpl * EnvironmentImpl::clone | ( | ) | const |
Deep copy of this.
Definition at line 224 of file Environment.cpp.
References _layers, _mask, _normalizerPtr, EnvironmentImpl(), and normalize().
Read for vector 'sample' all values of environmental variables of coordinate (x,y). Returns a Sample of dim 0 if environment has a mask and point is outside its borders. If the environment has been normalized, the Sample returned will be normalized.
Definition at line 686 of file Environment.cpp.
References _normalizerPtr, getNormalized(), and getUnnormalized().
|
virtual |
Implements Configurable.
Definition at line 282 of file Environment.cpp.
References _layers, _mask, and getLayerConfig().
Returns the minimum and maximum values of each layer. If the environment has been normalized, the values returned are normalized.
Definition at line 788 of file Environment.cpp.
References _layers, _normalizerPtr, Normalizer::normalize(), and Sample::resize().
|
inline |
Definition at line 165 of file Environment.hh.
|
staticprivate |
Definition at line 87 of file Environment.cpp.
References min().
Referenced by getConfiguration().
|
inline |
Definition at line 172 of file Environment.hh.
|
inline |
Definition at line 170 of file Environment.hh.
|
inline |
Definition at line 174 of file Environment.hh.
Indicate that all non categorical variable layers must be normalized according to the interval [min, max].
Implements Normalizable.
Definition at line 576 of file Environment.cpp.
References _layers, and Map::getMinMax().
Definition at line 670 of file Environment.cpp.
References _normalizerPtr, getUnnormalizedInternal(), Normalizer::normalize(), numCategoricalLayers(), and Sample::setCategoricalThreshold().
Referenced by get().
Read for 'sample' all values of environmental variables of a valid coordinate (inside the mask) randomly chosen returns coordinates (x,y) through pointer arguments. If the environment has been normalized, the Sample returned will be normalized.
Definition at line 699 of file Environment.cpp.
References _xmax, _xmin, _ymax, _ymin, Log::error(), Log::instance(), and Sample::size().
Definition at line 662 of file Environment.cpp.
References getUnnormalizedInternal().
Referenced by get().
Definition at line 629 of file Environment.cpp.
References _layers, Sample::begin(), checkCoordinates(), Log::debug(), Log::instance(), and Sample::resize().
Referenced by getNormalized(), and getUnnormalized().
|
private |
Definition at line 193 of file Environment.cpp.
References _normalizerPtr, changeLayers(), and changeMask().
Referenced by EnvironmentImpl().
int EnvironmentImpl::isCategorical | ( | int | i | ) |
Returns 1 if the i-th variable is categorical. else returns 0.
Definition at line 567 of file Environment.cpp.
References _layers.
|
staticprivate |
Definition at line 405 of file Environment.cpp.
References RasterException::getCode(), RasterFactory::instance(), and Sleep.
Referenced by changeLayers(), and setConfiguration().
|
staticprivate |
Definition at line 111 of file Environment.cpp.
Referenced by changeLayers(), changeMask(), and setConfiguration().
|
staticprivate |
|
virtual |
Set specific normalization parameters
Implements Normalizable.
Definition at line 600 of file Environment.cpp.
References _normalizerPtr, Normalizer::getCopy(), and resetNormalization().
Referenced by clone().
size_t EnvironmentImpl::numCategoricalLayers | ( | ) | const |
|
inline |
Definition at line 108 of file Environment.hh.
Referenced by removeLayer().
void EnvironmentImpl::removeLayer | ( | unsigned int | index | ) |
Definition at line 857 of file Environment.cpp.
References _layers, calcRegion(), and numLayers().
void EnvironmentImpl::resetNormalization | ( | ) |
Reset normalization parameters
Definition at line 616 of file Environment.cpp.
References _normalizerPtr.
Referenced by normalize().
|
virtual |
Implements Configurable.
Definition at line 310 of file Environment.cpp.
References _layers, _mask, calcRegion(), clearLayers(), clearMask(), loadLayers(), and makeLayer().
|
friend |
Definition at line 55 of file Environment.cpp.
|
friend |
Definition at line 62 of file Environment.cpp.
|
friend |
Definition at line 68 of file Environment.cpp.
|
friend |
Definition at line 77 of file Environment.cpp.
|
friend |
Definition at line 72 of file Environment.hh.
|
friend |
Definition at line 71 of file Environment.hh.
|
private |
Vector with all layers that describe the variables.
Definition at line 222 of file Environment.hh.
Referenced by calcRegion(), changeLayers(), clearLayers(), clone(), getConfiguration(), getExtremes(), getMinMax(), getUnnormalizedInternal(), isCategorical(), numCategoricalLayers(), removeLayer(), and setConfiguration().
|
private |
Mask (can be 0).
Definition at line 223 of file Environment.hh.
Referenced by calcRegion(), changeMask(), checkCoordinates(), clearMask(), clone(), getConfiguration(), and setConfiguration().
|
private |
Normalize the environment.
Definition at line 230 of file Environment.hh.
Referenced by clone(), get(), getExtremes(), getNormalized(), initialize(), normalize(), resetNormalization(), and ~EnvironmentImpl().
|
private |
Intersection of all layers.
Definition at line 227 of file Environment.hh.
Referenced by calcRegion(), checkCoordinates(), getRandom(), and getRegion().
|
private |
Intersection of all layers.
Definition at line 225 of file Environment.hh.
Referenced by calcRegion(), getRandom(), and getRegion().
|
private |
Intersection of all layers.
Definition at line 228 of file Environment.hh.
Referenced by calcRegion(), checkCoordinates(), getRandom(), and getRegion().
|
private |
Intersection of all layers.
Definition at line 226 of file Environment.hh.
Referenced by calcRegion(), getRandom(), and getRegion().