27 #include "../common/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> 
   63   layer->ResetReading();
 
   71     OGRSpatialReference* osrs = 
m_layer->GetSpatialRef();
 
   79   OGRFeature::DestroyFeature(m_currentFeature);
 
   85   m_ogrDs->ReleaseResultSet(m_layer);
 
   87   OGRDataSource::DestroyDataSource(m_ogrDs);
 
   97   return m_dt->getProperty(pos)->getType();
 
  102   return m_dt->getProperty(pos)->getName();
 
  120   return !(size() > 0);
 
  125   OGREnvelope psExtent;
 
  126   m_layer->GetExtent(&psExtent);
 
  128   return std::auto_ptr<te::gm::Envelope>(env);
 
  133   return m_layer->GetFeatureCount();
 
  138   OGRFeature::DestroyFeature(m_currentFeature);
 
  140   m_currentFeature = m_layer->GetNextFeature();
 
  143   return m_currentFeature != 0;
 
  148   return move(m_i - 1);
 
  153   m_layer->ResetReading();
 
  160   m_layer->ResetReading();
 
  167   int lastPos = m_layer->GetFeatureCount() - 1;
 
  168   return move(lastPos);
 
  176   int p = 
static_cast<int>(i);
 
  178   OGRErr error = m_layer->SetNextByIndex(p);
 
  181   if(error == OGRERR_NONE)
 
  199   return m_i >= (int)size();
 
  204   return m_i > 
static_cast<int>(size());
 
  224   return m_currentFeature->GetFieldAsInteger(i);
 
  244   return m_currentFeature->GetFieldAsDouble(i);
 
  249   return m_currentFeature->GetFieldAsString(i);
 
  254   return m_currentFeature->GetFieldAsString(i);
 
  260   GByte* bytes = m_currentFeature->GetFieldAsBinary(i, &size);
 
  263   byteArray->
copy((
char*)bytes, size);
 
  265   return std::auto_ptr<te::dt::ByteArray>(byteArray);
 
  270   char* wkb = (
char*)getWKB();
 
  275   return std::auto_ptr<te::gm::Geometry>(geom);
 
  286     return std::auto_ptr<te::dt::DateTime>(0);
 
  296   if(m_currentFeature->GetFieldAsDateTime(i, &pnYear, &pnMonth, &pnDay, &pnHour, &pnMinute, &pnSecond, &pnTZFlag) == FALSE)
 
  297     return std::auto_ptr<te::dt::DateTime>(
new te::dt::Date);
 
  305     dateTime = 
new te::dt::Date((
unsigned short)pnYear, (
unsigned short)pnMonth, (
unsigned short)pnDay);
 
  318   return std::auto_ptr<te::dt::DateTime>(dateTime);
 
  323   return std::auto_ptr<te::dt::Array>(0); 
 
  328   if(m_currentFeature->IsFieldSet(i) == 0)
 
  337   OGRGeometry* geom = m_currentFeature->GetGeometryRef()->clone();
 
  342   if(geom->getGeometryType() == wkbPolygon)
 
  343     geom = OGRGeometryFactory::forceToMultiPolygon(geom);
 
  344   else if(geom->getGeometryType() == wkbLineString)
 
  345     geom = OGRGeometryFactory::forceToMultiLineString(geom);
 
  346   else if(geom->getGeometryType() == wkbPoint)
 
  347     geom = OGRGeometryFactory::forceToMultiPoint(geom);
 
  349   int wkbSize = geom->WkbSize();
 
  351   if(wkbSize > m_wkbArraySize)
 
  353     m_wkbArraySize = wkbSize;
 
  354     delete [] m_wkbArray;
 
  355     m_wkbArray = 
new unsigned char[m_wkbArraySize];
 
  358   geom->exportToWkb(wkbNDR, m_wkbArray);
 
  361   if(geom->getGeometryType() & 0x80000000)
 
  363     unsigned int newcode = 0x0FFFFFFF & geom->getGeometryType();
 
  365     memcpy(m_wkbArray + 1, &newcode, 
sizeof(
unsigned int));
 
  368   OGRGeometryFactory::destroyGeometry(geom);
 
  370   return (
const unsigned char*)m_wkbArray;
 
An exception class for the OGR module. 
 
bool isEmpty() const 
It returns true if the collection is empty. 
 
std::size_t getNumProperties() const 
It returns the number of properties that composes an item of the dataset. 
 
te::da::DataSetType * m_dt
DataSetType. 
 
std::string getDatasetNameOfProperty(std::size_t pos) const 
It returns the underlying dataset name of the property at position pos. 
 
float getFloat(std::size_t i) const 
Method for retrieving a float attribute value. 
 
te::common::CharEncoding getCharEncoding() const 
It returns the string property character encoding. 
 
CharEncoding
Supported charsets (character encoding). 
 
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 ...
 
bool hasGeom() const 
It returns true if the DataSetType has at least one geometry property; otherwise, it returns false...
 
DataSet()
Default constructor. 
 
int m_srid
The SRS id associated to this dataset. 
 
unsigned char getUChar(std::size_t i) const 
Method for retrieving an unsigned character attribute value (1 byte long). 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
boost::int64_t getInt64(std::size_t i) const 
Method for retrieving a 64-bit integer attribute value (8 bytes long). 
 
te::common::CharEncoding getPropertyCharEncoding(std::size_t i) const 
It returns the property character encoding at position pos. 
 
bool isAfterEnd() const 
It tells if the dataset internal pointer is on the sentinel position after the last element of the co...
 
Implementation of a DataSet for OGR data provider. 
 
std::auto_ptr< te::gm::Geometry > getGeometry(std::size_t i) const 
Method for retrieving a geometric attribute value. 
 
It models a property definition. 
 
A class to represent time instant. 
 
bool isAtEnd() const 
It tells if the dataset internal pointer is on the last element of the collection. 
 
std::auto_ptr< te::dt::ByteArray > getByteArray(std::size_t i) const 
Method for retrieving a byte array. 
 
std::auto_ptr< te::rst::Raster > getRaster(std::size_t i) const 
Method for retrieving a raster attribute value. 
 
bool getBool(std::size_t i) const 
Method for retrieving a boolean attribute value. 
 
An Envelope defines a 2D rectangular region. 
 
double getDouble(std::size_t i) const 
Method for retrieving a double attribute value. 
 
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib. 
 
A base class for date data types. 
 
bool move(std::size_t i)
It moves the dataset internal pointer to a given position. 
 
std::string getNumeric(std::size_t i) const 
Method for retrieving a numeric attribute value. 
 
TEOGREXPORT te::gm::Geometry * Convert2TerraLib(OGRGeometry *ogrGeom)
It converts the OGR Geometry to TerraLib Geometry. 
 
boost::int16_t getInt16(std::size_t i) const 
Method for retrieving a 16-bit integer attribute value (2 bytes long). 
 
The type for string types: FIXED_STRING, VAR_STRING or STRING. 
 
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. 
 
bool moveNext()
It moves the internal pointer to the next item of the collection. 
 
Utility functions for OGR support. 
 
boost::int32_t getInt32(std::size_t i) const 
Method for retrieving a 32-bit integer attribute value (4 bytes long). 
 
bool isNull(std::size_t i) const 
It checks if the attribute value is NULL. 
 
const unsigned char * getWKB() const 
 
std::string getString(std::size_t i) const 
Method for retrieving a string value attribute. 
 
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. 
 
std::auto_ptr< te::gm::Envelope > getExtent(std::size_t i)
It computes the bounding rectangle for a spatial property of the dataset. 
 
Implementation of a DataSet for OGR data provider. 
 
bool moveBeforeFirst()
It moves the internal pointer to a position before the first item in the collection. 
 
char getChar(std::size_t i) const 
Method for retrieving a signed character attribute value (1 byte long). 
 
DateTimeType
The subtype of date and time type, based on ISO 8621. 
 
int getPropertyDataType(std::size_t pos) const 
It returns the underlying data type of the property at position pos. 
 
bool isAtBegin() const 
It tells if the dataset internal pointer is on the first element of the collection or not...
 
std::size_t size() const 
It returns the collection size, if it is known. 
 
void copy(char *data, std::size_t size)
It copies the data from the given pointer to the byte array. 
 
bool movePrevious()
It moves the internal pointer to the previous item of the collection. 
 
bool moveLast()
It sets the dataset internal pointer to the last item in the collection. 
 
std::auto_ptr< te::dt::Array > getArray(std::size_t i) const 
Method for retrieving an array. 
 
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...
 
TEOGREXPORT int Convert2TerraLibProjection(OGRSpatialReference *osrs)
It converts the OGR Projection to TerraLib Projection. 
 
A class for representing binary data. 
 
static Geometry * read(const char *wkb)
It returns a valid geometry from a given WKB. 
 
bool moveFirst()
It moves the internal pointer to the first item in the collection. 
 
std::auto_ptr< te::dt::DateTime > getDateTime(std::size_t i) const 
Method for retrieving a date and time attribute value.