27 #include "../../../../core/translator/Translator.h" 28 #include "../../../../dataaccess/dataset/DataSetType.h" 29 #include "../../../../datatype/ByteArray.h" 30 #include "../../../../datatype/DateTimeProperty.h" 31 #include "../../../../datatype/StringProperty.h" 32 #include "../../../../datatype/TimeInstant.h" 33 #include "../../../../geometry/Envelope.h" 34 #include "../../../../geometry/Geometry.h" 35 #include "../../../../geometry/WKBReader.h" 36 #include "../../../../srs/Config.h" 43 #include <ogrsf_frmts.h> 45 #include <gdal_priv.h> 65 layer->ResetReading();
73 OGRSpatialReference* osrs =
m_layer->GetSpatialRef();
91 GDALClose((GDALDatasetH)
m_ogrDs);
116 return !(
size() > 0);
121 OGREnvelope psExtent;
124 return std::auto_ptr<te::gm::Envelope>(env);
129 return m_layer->GetFeatureCount();
163 int lastPos =
m_layer->GetFeatureCount() - 1;
164 return move(lastPos);
172 int p =
static_cast<int>(i);
174 OGRErr error =
m_layer->SetNextByIndex(p);
177 if(error == OGRERR_NONE)
200 return m_i >
static_cast<int>(
size());
259 byteArray->
copy((
char*)bytes, size);
261 return std::auto_ptr<te::dt::ByteArray>(byteArray);
266 char* wkb = (
char*)
getWKB();
271 return std::auto_ptr<te::gm::Geometry>(geom);
282 return std::auto_ptr<te::dt::DateTime>(0);
292 if(
m_currentFeature->GetFieldAsDateTime(i, &pnYear, &pnMonth, &pnDay, &pnHour, &pnMinute, &pnSecond, &pnTZFlag) == FALSE)
293 return std::auto_ptr<te::dt::DateTime>(
new te::dt::Date);
301 dateTime =
new te::dt::Date((
unsigned short)pnYear, (
unsigned short)pnMonth, (
unsigned short)pnDay);
314 return std::auto_ptr<te::dt::DateTime>(dateTime);
319 return std::auto_ptr<te::dt::Array>(0);
338 if(geom->getGeometryType() == wkbPolygon)
339 geom = OGRGeometryFactory::forceToMultiPolygon(geom);
340 else if(geom->getGeometryType() == wkbLineString)
341 geom = OGRGeometryFactory::forceToMultiLineString(geom);
342 else if(geom->getGeometryType() == wkbPoint)
343 geom = OGRGeometryFactory::forceToMultiPoint(geom);
345 int wkbSize = geom->WkbSize();
357 if(geom->getGeometryType() & 0x80000000)
359 unsigned int newcode = 0x0FFFFFFF & geom->getGeometryType();
361 memcpy(
m_wkbArray + 1, &newcode,
sizeof(
unsigned int));
364 OGRGeometryFactory::destroyGeometry(geom);
static te::dt::TimeDuration td(20, 30, 50, 11)
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const
Method for retrieving a byte array.
Property * getProperty(std::size_t i) const
It returns the i-th property.
Implementation of a DataSet for OGR data provider.
bool isNull(std::size_t i) const
It checks if the attribute value is NULL.
bool moveFirst()
It moves the internal pointer to the first item in the collection.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
boost::int32_t getInt32(std::size_t i) const
Method for retrieving a 32-bit integer attribute value (4 bytes long).
bool hasGeom() const
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false...
DataSet()
Default constructor.
boost::int64_t getInt64(std::size_t i) const
Method for retrieving a 64-bit integer attribute value (8 bytes long).
std::size_t getNumProperties() const
It returns the number of properties that composes an item of the dataset.
bool isAfterEnd() const
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
bool isBeforeBegin() const
It tells if the dataset internal pointer is in a position before the first element of the collection ...
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection.
#define TE_TR(message)
It marks a string in order to get translated.
std::string getString(std::size_t i) const
Method for retrieving a string value attribute.
It models a property definition.
A class to represent time instant.
std::string getDatasetNameOfProperty(std::size_t pos) const
It returns the underlying dataset name of the property at position pos.
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const
Method for retrieving a raster attribute value.
std::size_t size() const
It returns the collection size, if it is known.
bool getBool(std::size_t i) const
Method for retrieving a boolean attribute value.
boost::int16_t getInt16(std::size_t i) const
Method for retrieving a 16-bit integer attribute value (2 bytes long).
An Envelope defines a 2D rectangular region.
A base class for date data types.
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const
Method for retrieving an array.
bool isAtBegin() const
It tells if the dataset internal pointer is on the first element of the collection or not...
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
std::string getPropertyName(std::size_t pos) const
It returns the property name at position pos.
std::string getNumeric(std::size_t i) const
Method for retrieving a numeric attribute value.
bool isEmpty() const
It returns true if the collection is empty.
TERRAMOBILEPLUGINSDLLEXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry.
std::size_t size() const
It returns the number of properties of the CompositeProperty.
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset.
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const
Method for retrieving a geometric attribute value.
unsigned char getUChar(std::size_t i) const
Method for retrieving an unsigned character attribute value (1 byte long).
bool isAtEnd() const
It tells if the dataset internal pointer is on the last element of the collection.
te::da::DataSetType * m_dt
DataSetType.
bool movePrevious()
It moves the internal pointer to the previous item of the collection.
int getType() const
It returns the property data type.
const unsigned char * getWKB() const
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.
OGRFeature * m_currentFeature
A class to represent time duration with nano-second/micro-second resolution.
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.
virtual void setSRID(int srid) _NOEXCEPT_OP(true)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
int getPropertyDataType(std::size_t pos) const
It returns the underlying data type of the property at position pos.
bool moveNext()
It moves the internal pointer to the next item of the collection.
float getFloat(std::size_t i) const
Method for retrieving a float attribute value.
DateTimeType
The subtype of date and time type, based on ISO 8621.
TERRAMOBILEPLUGINSDLLEXPORT int Convert2TerraLibProjection(OGRSpatialReference *osrs)
It converts the OGR Projection to TerraLib Projection.
void copy(char *data, std::size_t size)
It copies the data from the given pointer to the byte array.
unsigned char * m_wkbArray
int m_srid
The SRS id associated to this dataset.
bool move(std::size_t i)
It moves the dataset internal pointer to a given position.
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const
Method for retrieving a date and time attribute value.
A class for representing binary data.
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB.
double getDouble(std::size_t i) const
Method for retrieving a double attribute value.
char getChar(std::size_t i) const
Method for retrieving a signed character attribute value (1 byte long).
const std::string & getName() const
It returns the property name.