27 #include "../common/STLUtils.h" 28 #include "../core/translator/Translator.h" 29 #include "../dataaccess/dataset/DataSetType.h" 30 #include "../dataaccess/utils/Utils.h" 31 #include "../datatype/ByteArray.h" 32 #include "../datatype/DataType.h" 33 #include "../datatype/Property.h" 34 #include "../datatype/SimpleData.h" 35 #include "../datatype/StringProperty.h" 36 #include "../datatype/Utils.h" 37 #include "../geometry/Envelope.h" 38 #include "../geometry/Geometry.h" 39 #include "../geometry/Utils.h" 79 for(std::size_t i = 0; i != properties.size(); ++i)
87 copy(rhs, properties, limit);
99 std::vector<std::size_t> properties;
103 for(std::size_t i = 0; i != np; ++i)
104 properties.push_back(i);
106 copy(src, properties, limit);
111 bool unlimited =
true;
115 limit = std::numeric_limits<std::size_t>::max();
125 const std::size_t nproperties = properties.size();
127 while(src.
moveNext() && (i < limit))
129 std::unique_ptr<DataSetItem> item(
new DataSetItem(
this));
131 for(std::size_t c = 0; c < nproperties; ++c)
133 if(!src.
isNull(properties[c]))
134 item->setValue(c, src.
getValue(properties[c]).release());
136 item->setValue(c,
nullptr);
139 m_items->push_back(item.release());
146 if(!unlimited & (i < limit))
147 throw Exception(
TE_TR(
"The source dataset has few items than requested copy limit!"));
162 const std::size_t nitems =
m_items->size();
164 for(std::size_t i = 0; i < nitems; ++i)
166 if(&(
m_items->operator[](i)) == item)
179 m_ptypes.push_back(static_cast<int>(propertyType));
181 const std::size_t nitems =
m_items->size();
183 for(std::size_t i = 0; i < nitems; ++i)
184 m_items->operator[](i).m_data.push_back(defaultValue ? defaultValue->
clone() :
nullptr);
189 const std::size_t nitems =
m_items->size();
191 for(std::size_t i = 0; i < nitems; ++i)
192 m_items->operator[](i).m_data.erase(
m_items->operator[](i).m_data.begin() + pos);
223 const std::size_t nitems =
m_items->size();
225 for(std::size_t ii = 0; ii < nitems; ++ii)
229 mbr->Union(*(geom->getMBR()));
288 return m_i < static_cast<int>(
m_items->size());
312 return m_i < static_cast<int>(
m_items->size());
317 m_i =
static_cast<int>(i);
318 return m_i < static_cast<int>(
m_items->size());
333 return m_i == (
static_cast<int>(
m_items->size()) - 1);
338 return m_i >
static_cast<int>(
m_items->size());
343 return m_i > -1 && m_i < static_cast<int>(
m_items->size());
353 (*m_items)[
m_i].setChar(i, value);
358 (*m_items)[
m_i].setChar(name, value);
368 (*m_items)[
m_i].setUChar(i, value);
373 (*m_items)[
m_i].setUChar(name, value);
383 (*m_items)[
m_i].setInt16(i, value);
388 (*m_items)[
m_i].setInt16(name, value);
398 (*m_items)[
m_i].setInt32(i, value);
403 (*m_items)[
m_i].setInt32(name, value);
413 (*m_items)[
m_i].setInt64(i, value);
418 (*m_items)[
m_i].setInt64(name, value);
428 (*m_items)[
m_i].setBool(i, value);
433 (*m_items)[
m_i].setBool(name, value);
443 (*m_items)[
m_i].setFloat(i, value);
448 (*m_items)[
m_i].setFloat(name, value);
458 (*m_items)[
m_i].setDouble(i, value);
463 (*m_items)[
m_i].setDouble(name, value);
473 (*m_items)[
m_i].setNumeric(i, value);
478 (*m_items)[
m_i].setNumeric(name, value);
488 (*m_items)[
m_i].setString(i, value);
493 (*m_items)[
m_i].setString(name, value);
503 (*m_items)[
m_i].setByteArray(i, value);
508 (*m_items)[
m_i].setByteArray(name, value);
518 (*m_items)[
m_i].setGeometry(i, value);
523 (*m_items)[
m_i].setGeometry(name, value);
533 (*m_items)[
m_i].setRaster(i, value);
538 (*m_items)[
m_i].setRaster(name, value);
543 return std::unique_ptr<te::dt::DateTime>((*m_items)[
m_i].getDateTime(i));
548 (*m_items)[
m_i].setDateTime(i, value);
553 (*m_items)[
m_i].setDateTime(name, value);
559 return std::unique_ptr<te::dt::Array>(
nullptr);
569 (*m_items)[
m_i].setValue(i, value);
574 (*m_items)[
m_i].setValue(name, ad);
std::size_t size() const
It returns the collection size, if it is known.
void setString(std::size_t i, const std::string &value)
boost::shared_ptr< boost::ptr_vector< DataSetItem > > m_items
The list of dataset items.
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
bool isPositionValid() const
It tells if the dataset internal pointer is on a valid position.
std::unique_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
std::unique_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
void setByteArray(std::size_t i, te::dt::ByteArray *value)
Base exception class for plugin module.
A class that models the description of a dataset.
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.
DataSet()
Default constructor.
void setInt16(std::size_t i, boost::int16_t value)
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
An exception class for the TerraLib In-Memory Data Access driver.
std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
void setInt32(std::size_t i, boost::int32_t value)
bool moveFirst()
It moves the internal pointer to the first item in the collection.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
#define TE_TR(message)
It marks a string in order to get translated.
int getPropertyDataType(std::size_t pos) const
It returns the underlying data type of the property at position pos.
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
bool isEmpty() const
It returns true if the collection is empty.
It models a property definition.
std::vector< int > m_ptypes
The list of property types.
void drop(std::size_t pos)
It drops a property from the dataset.
void add(DataSetItem *item)
It adds a new item to the dataset and takes its ownership.
std::unique_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
void setInt64(std::size_t i, boost::int64_t value)
std::string getDatasetNameOfProperty(std::size_t pos) const
It returns the underlying dataset name of the property at position pos.
virtual bool moveNext()=0
It moves the internal pointer to the next item of the collection.
AccessPolicy
Supported data access policies (can be used as bitfield).
void setValue(std::size_t i, te::dt::AbstractData *value)
TraverseType
A dataset can be traversed in two ways:
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
virtual int getPropertyDataType(std::size_t i) const =0
It returns the underlying data type of the property at position pos.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
An Envelope defines a 2D rectangular region.
An abstract class for raster data strucutures.
std::unique_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
static te::dt::TimeDuration dt(20, 30, 50, 11)
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
std::vector< std::string > m_pnames
The list of property names.
virtual AbstractData * clone() const =0
It returns a clone of this object.
A base class for values that can be retrieved from the data access module.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
void setNumeric(std::size_t i, const std::string &value)
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
void remove()
It removes the current dataset item.
void setDateTime(std::size_t i, te::dt::DateTime *value)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void setFloat(std::size_t i, float value)
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not...
std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
DataSetItem * getItem() const
std::unique_ptr< DataSetItem > clone() const
It returns a clone of the DataSetItem.
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
bool moveNext()
It moves the internal pointer to the next item of the collection.
void setGeometry(std::size_t i, te::gm::Geometry *value)
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
A dataset is the unit of information manipulated by the data access module of TerraLib.
void copy(te::da::DataSet &src, std::size_t limit=0)
It copies up to limit items from the source dataset.
std::string getPropertyName(std::size_t pos) const
It returns the property name at position pos.
void update(te::dt::Property *prop)
It update a property from the dataset.
int m_i
The index of the current item.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
virtual std::unique_ptr< te::dt::AbstractData > getValue(std::size_t i) const
Method for retrieving any other type of data value stored in the data source.
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
void setChar(std::size_t i, char value)
virtual bool isNull(std::size_t i) const =0
It checks if the attribute value is NULL.
void clear()
It clears all the dataset items.
void setBool(std::size_t i, bool value)
void setUChar(std::size_t i, unsigned char value)
virtual std::size_t getNumProperties() const =0
It returns the number of properties that composes an item of the dataset.
virtual std::string getPropertyName(std::size_t i) const =0
It returns the property name at position pos.
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
void setRaster(std::size_t i, te::rst::Raster *value)
void setPropertyName(const std::string &name, std::size_t pos)
void setDouble(std::size_t i, double value)
A class for representing binary data.
void setPropertyDataType(int dt, std::size_t pos)
TEDATAACCESSEXPORT void GetPropertyInfo(const DataSetType *const dt, std::vector< std::string > &pnames, std::vector< int > &ptypes)
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.