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>
152 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
155 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
158 std::auto_ptr<te::st::ObservationDataSet>
171 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(info.
getDataSetName(), &geom, sr, &dt, tr, travType));
173 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
182 std::auto_ptr<te::st::TrajectoryDataSet>
195 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
198 std::auto_ptr<te::st::TrajectoryDataSet>
212 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
216 geomPropName, &geom, r, travType));
218 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
221 std::auto_ptr<te::st::TrajectoryDataSet>
235 std::string geomPropName = dsettype->getProperty(info.
getGeomPropIdx())->getName();
239 geomPropName, &e, r, travType));
241 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
244 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);
264 std::auto_ptr<te::st::TrajectoryDataSet>
281 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
284 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
287 std::auto_ptr<te::st::TrajectoryDataSet>
302 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
305 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
309 std::vector<TimeSeriesDataSetInfo>& )
314 std::auto_ptr<te::st::TimeSeriesDataSet>
328 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
331 std::auto_ptr<te::st::TimeSeriesDataSet>
345 std::auto_ptr<te::da::DataSet> dset(inMemDataSource->getDataSet(
348 return buildDataSet(static_cast<te::stmem::DataSet*>(dset.release()), info);
351 std::auto_ptr<te::dt::DateTimePeriod>
364 std::auto_ptr<te::dt::DateTimePeriod>
379 std::auto_ptr<te::dt::DateTimePeriod>
423 int begTimePropIdx,
int endTimePropIdx,
int gmPropIdx)
427 throw Exception(
"The DataSet was not loaded correctly!");
431 throw Exception(
"The DataSetType was not loaded correctly!");
439 memDS->
add(dsname, dsettype.release(), inMemdset);
442 std::auto_ptr<te::st::ObservationDataSet>
458 std::auto_ptr<te::st::TrajectoryDataSet>
466 period.release(), *ev.get()));
469 std::auto_ptr<te::st::TimeSeriesDataSet>
STDataLoaderFromMemDS()
Constructor.
static const std::string sm_STMemoryDataSourceId
The global id of the st memory data source.
A class to represent a time series data set.
A class to represent a DataSet that contains observations.
A class that contains infos about a DataSet that contains observations.
te::da::DataSourcePtr m_ds
This file contains a class responsible for loading spatiotemporal data from a ST in-memory 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.
Implements a DataSource that contains In-Memory DataSets indexed by space and time.
int getGeomPropIdx() const
It returns the index of the property that is a geometry property.
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
const ObservationDataSetInfo & getObservationDataSetInfo() const
It returns information about the DataSet that contians the time series observations.
void add(const std::string &name, te::da::DataSetType *t, DataSet *d)
It adds a new DataSet and DataSetType into the DataSource.
SpatialRelation
Spatial relations between geometric objects.
void getInfo(const TrajectoryDataSetInfo &input, std::vector< TrajectoryDataSetInfo > &output)
It returns the information about all trajectories that exist in a single DataSet. ...
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent(const ObservationDataSetInfo &info)
It returns the temporal extent of the data set with observations.
const ObservationDataSetInfo & getObservationDataSetInfo() const
It returns information about the DataSet that contians the trajectory observations.
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
int getGeomPropIdx() const
It returns the indexes of the DataSet properties that contains the geometries associated to the traje...
virtual ~STDataLoaderFromMemDS()
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns information about the DataSource from which the DataSet comes.
TESTEXPORT ObservationDataSetType GetType(const ObservationDataSetInfo &info)
An auxiliary function that transform ObservationDataSetInfo into ObservationDataSetType.
TraverseType
A dataset can be traversed in two ways:
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent(const std::string &name)
It returns the temporal extent associated to a DataSet.
static DataSourceManager & getInstance()
It returns a reference to the singleton instance.
An Envelope defines a 2D rectangular region.
int getBeginTimePropIdx() const
It returns the index of the DataSet property that contains the phenomenon beginning time...
TEDATAACCESSEXPORT DataSet * GetDataSet(const std::string &name, const std::string &datasourceId)
std::auto_ptr< ObservationDataSet > buildDataSet(te::stmem::DataSet *ds, const ObservationDataSetInfo &info)
It builds an ObservationDataSet from a given DataSet.
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns the information about the DataSource.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A class that contains infos about a DataSet that contains observations of one or more trajectories...
A class to represent a trajectory data set.
const std::string & getId() const
Implementation of a in-memory data set that contains spatiotemporal observations indexed by time and ...
std::auto_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent of the observations.
A class that contains infos about a DataSet that contains observations of one or more time series...
A class that represents a data source component.
std::string getDataSetName() const
It returns the DataSet name.
TEDATAACCESSEXPORT DataSetType * GetDataSetType(const std::string &name, const std::string &datasourceId)
const te::da::DataSourceInfo & getDataSourceInfo() const
It returns information about the DataSource from which the DataSet comes.
te::gm::Envelope getSpatialExtent(const ObservationDataSetInfo &info)
It returns the temporal extent of the data set with observations of a coverage series.
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.
int getEndTimePropIdx() const
It returns the index of the DataSet property that contains the phenomenon end time.