29 #include "../../dataaccess/datasource/DataSourceInfo.h"
30 #include "../../dataaccess/datasource/DataSourceManager.h"
31 #include "../../dataaccess/dataset/DataSet.h"
32 #include "../../dataaccess/utils/Utils.h"
33 #include "../../datatype/DateTimePeriod.h"
36 #include "../../stmemory/DataSource.h"
37 #include "../../stmemory/DataSet.h"
40 #include "../Exception.h"
42 #include "../Globals.h"
44 #include "../core/observation/ObservationDataSetInfo.h"
45 #include "../core/trajectory/TrajectoryDataSetInfo.h"
46 #include "../core/timeseries/TimeSeriesDataSetInfo.h"
47 #include "../core/observation/ObservationDataSet.h"
48 #include "../core/trajectory/TrajectoryDataSet.h"
49 #include "../core/timeseries/TimeSeriesDataSet.h"
60 throw Exception(
"The STDataLoader is not inialized! Please, use the method STDataLoader::initialize");
66 std::auto_ptr<te::st::ObservationDataSet>
76 std::auto_ptr<te::da::DataSet> dset(m_ds->getDataSet(info.
getDataSetName(), travType));
78 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
82 std::auto_ptr<te::st::ObservationDataSet>
92 std::auto_ptr<te::da::DataSetType> dsettype(m_ds->getDataSetType(info.
getDataSetName()));
93 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
96 std::auto_ptr<te::da::DataSet> dset(m_ds->getDataSet(info.
getDataSetName(), geomPropName, &e, r, travType));
98 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
101 std::auto_ptr<te::st::ObservationDataSet>
111 std::auto_ptr<te::da::DataSetType> dsettype(m_ds->getDataSetType(info.
getDataSetName()));
112 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
115 std::auto_ptr<te::da::DataSet> dset(m_ds->getDataSet(info.
getDataSetName(), geomPropName, &geom, r, travType));
117 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
120 std::auto_ptr<te::st::ObservationDataSet>
132 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(info.
getDataSetName(), &dt, r, travType));
134 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
137 std::auto_ptr<te::st::ObservationDataSet>
150 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(info.
getDataSetName(), &geom, sr, &dt, tr, travType));
152 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
161 std::auto_ptr<te::st::TrajectoryDataSet>
174 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
177 std::auto_ptr<te::st::TrajectoryDataSet>
191 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
195 geomPropName, &geom, r, travType));
197 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
200 std::auto_ptr<te::st::TrajectoryDataSet>
214 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
218 geomPropName, &e, r, travType));
220 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
223 std::auto_ptr<te::st::TrajectoryDataSet>
237 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
240 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
243 std::auto_ptr<te::st::TrajectoryDataSet>
258 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
261 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
265 std::vector<TimeSeriesDataSetInfo>& )
270 std::auto_ptr<te::st::TimeSeriesDataSet>
284 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
287 std::auto_ptr<te::st::TimeSeriesDataSet>
301 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
304 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
307 std::auto_ptr<te::dt::DateTimePeriod>
320 std::auto_ptr<te::dt::DateTimePeriod>
335 std::auto_ptr<te::dt::DateTimePeriod>
379 int begTimePropIdx,
int endTimePropIdx,
int gmPropIdx)
383 throw Exception(
"The DataSet was not loaded correctly!");
387 throw Exception(
"The DataSetType was not loaded correctly!");
395 memDS->
add(dsname, dsettype.release(), inMemdset);
398 std::auto_ptr<te::st::ObservationDataSet>
414 std::auto_ptr<te::st::TrajectoryDataSet>
422 period.release(), *ev.get()));
425 std::auto_ptr<te::st::TimeSeriesDataSet>
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns the information about the DataSource.
void loadDataSet(const te::da::DataSourceInfo &info, const std::string dsname, int begTimePropIdx, int endTimePropIdx, int gmPropIdx)
It loads DataSet from the original DataSource and put it in the In-Memory DataSource.
std::auto_ptr< ObservationDataSet > buildDataSet(te::stmem::DataSet *ds, const ObservationDataSetInfo &info)
It builds an ObservationDataSet from a given DataSet.
A class that contains infos about a DataSet that contains observations of one or more time series...
This file contains a class responsible for loading spatiotemporal data from a ST in-memory DataSource...
const std::string & getId() const
A class that contains infos about a DataSet that contains observations.
void add(const std::string &name, te::da::DataSetType *t, DataSet *d)
It adds a new DataSet and DataSetType into the DataSource.
std::auto_ptr< ObservationDataSet > getDataSet(const ObservationDataSetInfo &info, te::common::TraverseType travType=te::common::FORWARDONLY)
It returns a ObservationDataSet, that is, a DataSet that contains observations.
virtual ~STDataLoaderFromMemDS()
std::string getDataSetName() const
It returns the DataSet name.
Implementation of a in-memory data set that contains spatiotemporal observations indexed by time and ...
A class that represents a data source component.
TEDATAACCESSEXPORT DataSet * GetDataSet(const std::string &name, const std::string &datasourceId)
int getBeginTimePropIdx() const
It returns the index of the DataSet property that contains the phenomenon beginning time...
static const std::string sm_STMemoryDataSourceId
The global id of the st memory data source.
te::da::DataSourcePtr m_ds
SpatialRelation
Spatial relations between geometric objects.
A class to represent a DataSet that contains observations.
TESTEXPORT ObservationDataSetType GetType(const ObservationDataSetInfo &info)
An auxiliary function that transform ObservationDataSetInfo into ObservationDataSetType.
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent(const std::string &name)
It returns the temporal extent associated to a DataSet.
void getInfo(const TrajectoryDataSetInfo &input, std::vector< TrajectoryDataSetInfo > &output)
It returns the information about all trajectories that exist in a single DataSet. ...
A class to represent a time series data set.
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the observations.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
STDataLoaderFromMemDS()
Constructor.
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
A class that contains infos about a DataSet that contains observations of one or more trajectories...
TEDATAACCESSEXPORT DataSetType * GetDataSetType(const std::string &name, const std::string &datasourceId)
Implements a DataSource that contains In-Memory DataSets indexed by space and time.
TraverseType
A dataset can be traversed in two ways:
int getGeomPropIdx() const
It returns the index of the property that is a geometry property.
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns information about the DataSource from which the DataSet comes.
int getEndTimePropIdx() const
It returns the index of the DataSet property that contains the phenomenon end time.
const ObservationDataSetInfo & getObservationDataSetInfo() const
It returns information about the DataSet that contians the time series observations.
const ObservationDataSetInfo & getObservationDataSetInfo() const
It returns information about the DataSet that contians the trajectory observations.
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns information about the DataSource from which the DataSet comes.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
int getGeomPropIdx() const
It returns the indexes of the DataSet properties that contains the geometries associated to the traje...
An Envelope defines a 2D rectangular region.
te::gm::Envelope getSpatialExtent(const ObservationDataSetInfo &info)
It returns the temporal extent of the data set with observations of a coverage series.
A class to represent a trajectory data set.
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent(const ObservationDataSetInfo &info)
It returns the temporal extent of the data set with observations.
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.