27 #include "../common/Translator.h" 
   28 #include "../dataaccess/dataset/DataSetType.h" 
   29 #include "../datatype/DateTimeProperty.h" 
   30 #include "../datatype/ByteArray.h" 
   31 #include "../datatype/TimeInstant.h" 
   32 #include "../geometry/Envelope.h" 
   33 #include "../geometry/Geometry.h" 
   34 #include "../geometry/WKBReader.h" 
   35 #include "../srs/Config.h" 
   42 #include <ogrsf_frmts.h> 
   62   layer->ResetReading();
 
   70     OGRSpatialReference* osrs = 
m_layer->GetSpatialRef();
 
   78   OGRFeature::DestroyFeature(m_currentFeature);
 
   84   m_ogrDs->ReleaseResultSet(m_layer);
 
   86   OGRDataSource::DestroyDataSource(m_ogrDs);
 
   96   return m_dt->getProperty(pos)->getType();
 
  101   return m_dt->getProperty(pos)->getName();
 
  111   return !(size() > 0);
 
  116   OGREnvelope psExtent;
 
  117   m_layer->GetExtent(&psExtent);
 
  119   return std::auto_ptr<te::gm::Envelope>(env);
 
  124   return m_layer->GetFeatureCount();
 
  129   OGRFeature::DestroyFeature(m_currentFeature);
 
  131   m_currentFeature = m_layer->GetNextFeature();
 
  134   return m_currentFeature != 0;
 
  139   return move(m_i - 1);
 
  144   m_layer->ResetReading();
 
  151   m_layer->ResetReading();
 
  158   int lastPos = m_layer->GetFeatureCount() - 1;
 
  159   return move(lastPos);
 
  167   int p = 
static_cast<int>(i);
 
  169   OGRErr error = m_layer->SetNextByIndex(p);
 
  172   if(error == OGRERR_NONE)
 
  190   return m_i >= (int)size();
 
  195   return m_i > 
static_cast<int>(size());
 
  215   return m_currentFeature->GetFieldAsInteger(i);
 
  235   return m_currentFeature->GetFieldAsDouble(i);
 
  240   return m_currentFeature->GetFieldAsString(i);
 
  245   return m_currentFeature->GetFieldAsString(i);
 
  251   GByte* bytes = m_currentFeature->GetFieldAsBinary(i, &size);
 
  254   byteArray->
copy((
char*)bytes, size);
 
  256   return std::auto_ptr<te::dt::ByteArray>(byteArray);
 
  261   char* wkb = (
char*)getWKB();
 
  266   return std::auto_ptr<te::gm::Geometry>(geom);
 
  277     return std::auto_ptr<te::dt::DateTime>(0);
 
  287   if(m_currentFeature->GetFieldAsDateTime(i, &pnYear, &pnMonth, &pnDay, &pnHour, &pnMinute, &pnSecond, &pnTZFlag) == FALSE)
 
  288     return std::auto_ptr<te::dt::DateTime>(
new te::dt::Date);
 
  296     dateTime = 
new te::dt::Date((
unsigned short)pnYear, (
unsigned short)pnMonth, (
unsigned short)pnDay);
 
  309   return std::auto_ptr<te::dt::DateTime>(dateTime);
 
  314   return std::auto_ptr<te::dt::Array>(0); 
 
  319   if(m_currentFeature->IsFieldSet(i) == 0)
 
  328   OGRGeometry* geom = m_currentFeature->GetGeometryRef();
 
  333   if(geom->getGeometryType() == wkbPolygon)
 
  334     geom = OGRGeometryFactory::forceToMultiPolygon(geom);
 
  335   else if(geom->getGeometryType() == wkbLineString)
 
  336     geom = OGRGeometryFactory::forceToMultiLineString(geom);
 
  337   else if(geom->getGeometryType() == wkbPoint)
 
  338     geom = OGRGeometryFactory::forceToMultiPoint(geom);
 
  340   int wkbSize = geom->WkbSize();
 
  342   if(wkbSize > m_wkbArraySize)
 
  344     m_wkbArraySize = wkbSize;
 
  345     delete [] m_wkbArray;
 
  346     m_wkbArray = 
new unsigned char[m_wkbArraySize];
 
  349   geom->exportToWkb(wkbNDR, m_wkbArray);
 
  352   if(geom->getGeometryType() & 0x80000000)
 
  354     unsigned int newcode = 0x0FFFFFFF & geom->getGeometryType();
 
  356     memcpy(m_wkbArray + 1, &newcode, 
sizeof(
unsigned int));
 
  359   return (
const unsigned char*)m_wkbArray;
 
boost::int32_t getInt32(std::size_t i) const 
Method for retrieving a 32-bit integer attribute value (4 bytes long). 
 
TEOGREXPORT int Convert2TerraLibProjection(OGRSpatialReference *osrs)
It converts the OGR Projection to TerraLib Projection. 
 
bool moveNext()
It moves the internal pointer to the next item of the collection. 
 
This class is designed to declare objects to be thrown as exceptions by TerraLib. ...
 
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const 
Method for retrieving a byte array. 
 
int m_srid
The SRS id associated to this dataset. 
 
int getPropertyDataType(std::size_t pos) const 
It returns the underlying data type of the property at position pos. 
 
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset. 
 
char getChar(std::size_t i) const 
Method for retrieving a signed character attribute value (1 byte long). 
 
virtual void setSRID(int srid)=0
It sets the Spatial Reference System ID of the geometry and all its parts if it is a GeometryCollecti...
 
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. 
 
std::string getPropertyName(std::size_t pos) const 
It returns the property name at position pos. 
 
A class for data providers of OGR. 
 
bool isBeforeBegin() const 
It tells if the dataset internal pointer is in a position before the first element of the collection ...
 
DataSet()
Default constructor. 
 
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const 
Method for retrieving a raster attribute value. 
 
bool isAtBegin() const 
It tells if the dataset internal pointer is on the first element of the collection or not...
 
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB. 
 
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib. 
 
boost::int16_t getInt16(std::size_t i) const 
Method for retrieving a 16-bit integer attribute value (2 bytes long). 
 
bool isAtEnd() const 
It tells if the dataset internal pointer is on the last element of the collection. 
 
A base class for date data types. 
 
Utility functions for OGR support. 
 
bool isNull(std::size_t i) const 
It checks if the attribute value is NULL. 
 
std::string getString(std::size_t i) const 
Method for retrieving a string value attribute. 
 
const unsigned char * getWKB() const 
 
bool hasGeom() const 
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false...
 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards. 
 
std::size_t size() const 
It returns the collection size, if it is known. 
 
Implementation of a DataSet for OGR data provider. 
 
bool movePrevious()
It moves the internal pointer to the previous item of the collection. 
 
bool move(std::size_t i)
It moves the dataset internal pointer to a given position. 
 
#define TR_OGR(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
 
bool getBool(std::size_t i) const 
Method for retrieving a boolean attribute value. 
 
te::da::DataSetType * m_dt
DataSetType. 
 
DateTimeType
The subtype of date and time type. 
 
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const 
Method for retrieving an array. 
 
TEOGREXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry. 
 
bool moveFirst()
It moves the internal pointer to the first item in the collection. 
 
void copy(char *data, std::size_t size)
It copies the data from the given pointer to the byte array. 
 
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const 
Method for retrieving a geometric attribute value. 
 
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection. 
 
A class to represent time instant. 
 
It models a property definition. 
 
std::string getDatasetNameOfProperty(std::size_t pos) const 
It returns the underlying dataset name of the property at position pos. 
 
std::string getNumeric(std::size_t i) const 
Method for retrieving a numeric attribute value. 
 
boost::int64_t getInt64(std::size_t i) const 
Method for retrieving a 64-bit integer attribute value (8 bytes long). 
 
bool isEmpty() const 
It returns true if the collection is empty. 
 
bool isAfterEnd() const 
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
 
An Envelope defines a 2D rectangular region. 
 
A class for representing binary data. 
 
An exception class for the OGR module. 
 
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const 
Method for retrieving a date and time attribute value. 
 
Implementation of a DataSet for OGR data provider. 
 
std::size_t getNumProperties() const 
It returns the number of properties that composes an item of the dataset. 
 
A class to represent time duration with nano-second/micro-second resolution. 
 
unsigned char getUChar(std::size_t i) const 
Method for retrieving an unsigned character attribute value (1 byte long). 
 
float getFloat(std::size_t i) const 
Method for retrieving a float attribute value. 
 
double getDouble(std::size_t i) const 
Method for retrieving a double attribute value. 
 
bool moveLast()
It sets the dataset internal pointer to the last item in the collection.