27 #include "../common/ByteSwapUtils.h" 28 #include "../common/Globals.h" 29 #include "../common/StringUtils.h" 30 #include "../core/translator/Translator.h" 31 #include "../dataaccess/dataset/DataSetType.h" 32 #include "../datatype/Array.h" 33 #include "../datatype/ByteArray.h" 34 #include "../datatype/DateTimeInstant.h" 35 #include "../datatype/DateTimeProperty.h" 36 #include "../datatype/SimpleData.h" 37 #include "../datatype/TimeInstant.h" 38 #include "../memory/DataSet.h" 39 #include "../memory/DataSetItem.h" 40 #include "../geometry/Envelope.h" 41 #include "../geometry/Geometry.h" 42 #include "../geometry/GeometryProperty.h" 43 #include "../geometry/WKBReader.h" 51 #include <terralib4/kernel/TeAttribute.h> 52 #include <terralib4/kernel/TeDatabase.h> 53 #include <terralib4/kernel/TeLayer.h> 60 #include <boost/lexical_cast.hpp> 76 for(
int i = 0; i !=
m_nCols; ++i)
78 TeAttributeList attrList = table.attributeList();
79 TeAttribute attr = attrList[i];
88 TeDatabasePortal* portal =
m_db->getPortal();
90 portal->query(queryLatin1 +
m_table.name());
92 m_size = portal->numRows();
94 while(portal->fetchRow())
98 for(
int i = 0; i !=
m_nCols; ++i)
100 int pType =
m_table.attributeList()[i].rep_.type_;
106 std::string aux(portal->getData(i));
112 item->
setDouble(i, portal->getDouble(i));
116 item->
setInt32(i, portal->getInt(i));
121 TeTime date = portal->getDate(i);
124 int m = date.month();
127 int min = date.minute();
128 int s = date.second();
136 dateTime =
new te::dt::Date((
unsigned short)y, (
unsigned short)m, (
unsigned short)d);
144 te::dt::Date dt((
unsigned short)y, (
unsigned short)m, (
unsigned short)d);
163 item->
setChar(i, (
char)portal->getData(i));
167 item->
setInt32(i, portal->getInt(i));
171 item->
setBool(i, portal->getBool(i));
230 return !(
size() > 0);
377 return std::unique_ptr<te::dt::Array>();
static te::dt::TimeDuration td(20, 30, 50, 11)
Property * getProperty(std::size_t i) const
It returns the i-th property.
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
te::da::DataSetType * m_dt
virtual double getDouble(std::size_t i) const =0
Method for retrieving a double attribute value.
void setDouble(std::size_t i, double value)
It sets the value of the i-th property.
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not...
TETERRALIB4EXPORT std::string Convert2Utf8(const std::string &str)
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
A class that models the description of a dataset.
virtual std::string getNumeric(std::size_t i) const =0
Method for retrieving a numeric attribute value.
virtual float getFloat(std::size_t i) const =0
Method for retrieving a float attribute value.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
bool isConnected() const
It returns true if the dataset is connected and false if it is disconnected. A dataset can be connect...
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
void setChar(std::size_t i, char value)
It sets the value of the i-th property.
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
It models a property definition.
te::common::TraverseType getTraverseType() const
It returns the traverse type associated to the dataset.
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.
std::unique_ptr< te::dt::Property > Convert2T5(const TeAttributeRep &attRep)
It creates a valid TerraLib 5 property given a valid TerraLib 4.x attribute representation.
A class to represent time instant.
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
void setInt32(std::size_t i, boost::int32_t value)
It sets the value of the i-th property.
bool isEmpty() const
It returns true if the collection is empty.
std::unique_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
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).
TraverseType
A dataset can be traversed in two ways:
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
virtual boost::int16_t getInt16(std::size_t i) const =0
Method for retrieving a 16-bit integer attribute value (2 bytes long).
A base class for date data types.
void setDateTime(std::size_t i, te::dt::DateTime *value)
It sets the value of the i-th property.
Implements the DataSource class for the TerraLib 4.x Data Access Driver.
virtual boost::int32_t getInt32(std::size_t i) const =0
Method for retrieving a 32-bit integer attribute value (4 bytes long).
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
static te::dt::TimeDuration dt(20, 30, 50, 11)
std::unique_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
std::unique_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
std::string getPropertyName(std::size_t i) const
It returns the property name at position pos.
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
bool moveNext()
It moves the internal pointer to the next item of the collection.
TETERRALIB4EXPORT std::string Convert2Latin1(const std::string &str)
bool isPositionValid() const
It tells if the dataset internal pointer is on a valid position.
int getType() const
It returns the property data type.
void add(Constraint *c)
It adds a new constraint.
An implementation of the DatasetItem class for the TerraLib In-Memory Data Access driver...
void setByteArray(std::size_t i, te::dt::ByteArray *value)
It sets the value of the i-th property.
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
TeDatabasePortal * m_portal
A class to represent time duration with nano-second/micro-second resolution.
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
The type for date and time types: date, date period, date duration, time duration, time instant, time period, time instant with time zone or time period with time zone.
int getPropertyDataType(std::size_t i) const
It returns the underlying data type of the property at position pos.
void setBool(std::size_t i, bool value)
It sets the value of the i-th property.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
std::unique_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
Utilitary functions for dealing with TerraLib 5 and 4.x conversion.
DateTimeType
The subtype of date and time type, based on ISO 8621.
virtual boost::int64_t getInt64(std::size_t i) const =0
Method for retrieving a 64-bit integer attribute value (8 bytes long).
void setString(std::size_t i, const std::string &value)
It sets the value of the i-th property.
An utility class for converting a TerraLib 4.x geometry to a TerraLib 5.
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
TableDataSet(TeDatabase *db, TeTable table)
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
std::string getDatasetNameOfProperty(std::size_t i) const
It returns the underlying dataset name of the property at position pos.
bool moveFirst()
It moves the internal pointer to the first item in the collection.
virtual std::string getString(std::size_t i) const =0
Method for retrieving a string value attribute.
A class for representing binary data.
std::size_t size() const
It returns the collection size, if it is known.
std::unique_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
const std::string & getName() const
It returns the property name.
te::common::AccessPolicy getAccessPolicy() const
It returns the read and write permission associated to the dataset.