| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/shapelib/TeDriverSHPDBF.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright � 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00027 #ifndef __TERRALIB_INTERNAL_DBFSHPDRIVER_H
    00028 #define __TERRALIB_INTERNAL_DBFSHPDRIVER_H
    00029
    00030 #include "../../kernel/TeTable.h"
    00031 #include "../../kernel/TeSTElementSet.h"
    00032 #include "../../kernel/TeDataTypes.h"
    00033 #include "../../kernel/TeMultiGeometry.h"
    00034
    00035 // Using the local modified Frank-Shapelib
    00036 #include "../../../shapelib/shapefil.h"
    00037
    00038 #include "TeSHPDefines.h"
    00039
    00040 #include <string>
    00041 using namespace std;
    00042
    00043 class TeLayer;
    00044 class TeAsciiFile;
    00045 class TeProjection;
    00046 class TeDatabase;
    00047 class TePolygonSet;
    00048 class TeQuerier;
    00049 class TeTheme;
    00050
    00051
    00069 SHP_DLL bool TeReadDBFAttributeList(const string& dbfFileName, TeAttributeList& attList);
    00070
    00078 SHP_DLL bool TeReadDBFAttributes (const string& dbfFileName, TeTable& table,
    00079                                                                     int nrecords=-1, int rinitial=0, bool createAuto=false);
    00080
    00090 SHP_DLL bool TeImportDBFTable(const string& dbfFileName, TeDatabase* db, TeLayer* layer=0,TeAttrTableType tableType=TeAttrExternal, string objectIdAtt = "object_id_");
    00091
    00093
    00098 SHP_DLL void TeDBFRowDecode                 (DBFHandle& dbfHandle, int nr, TeTableRow& row); // End of subgroup DBF format
    00100
    00106
    00107
    00112 SHP_DLL void TeSHPPointDecode    (SHPObject* psShape, TePointSet& ps, string& objectId);
    00113
    00115
    00120 SHP_DLL void TeSHPPolyLineDecode(SHPObject* psShape, TeLineSet& ls, string& objectId);
    00121
    00123
    00128 SHP_DLL void TeSHPPolygonDecode  (SHPObject* psShape, TePolygonSet& pols, string& objectId);
    00129
    00131
    00136 SHP_DLL bool TeDecodeShape(SHPObject* psShape, TeMultiGeometry& geomestries, string& objectId); // End of Shape decode group
    00138
    00139
    00153 SHP_DLL bool
    00154 TeGetSHPInfo(std::string shpfileName, unsigned int& nShapes, TeBox& box, TeGeomRep& rep);
    00155
    00156
    00163 SHP_DLL TeLayer* TeImportShape(const string& shpFileName, TeDatabase* db, const string& layerName="");
    00164
    00172 SHP_DLL bool TeImportShape (TeLayer* layer, const string& shpFileName, string attrTableName="",
    00173                                                        string objectIdAttr="", unsigned int  chunkSize = 60, const bool& useTransaction = true);
    00174
    00180 SHP_DLL bool TeExportQuerierToShapefile(TeQuerier* querier, const std::string& baseName);
    00181
    00189 SHP_DLL bool TeExportThemeToShapefile(TeTheme* theme, TeSelectedObjects selOb = TeAll, const std::string& baseName="",
    00190                                                                                                      const std::vector<std::string> attributes = std::vector<std::string>());
    00191
    00197 SHP_DLL bool TeExportLayerToShapefile(TeLayer* layer, const string& baseName="");
    00198
    00202 SHP_DLL bool TeExportShapefile(TeLayer* layer, const string& shpFileName, const string& tableName, const string& restriction = "");
    00203
    00210 SHP_DLL bool TeExportPolygonSet2SHP( const TePolygonSet& ps,const string& base_file_name  );
    00211
    00213
    00217 SHP_DLL bool TeSTOSetBuildSHP(TeSTElementSet& stoset, const string& fileName);
    00218
    00219 SHP_DLL DBFHandle TeCreateDBFFile (const string& dbfFilename, TeAttributeList& attList);
    00220
    00221 SHP_DLL  void TeWriteDataProjectionToFile(TeProjection* projection, const std::string& fileName);
    00222
    00223  // End of subgroup SHAPEFILE format
    00225
    00226
    00227 #include "../../kernel/TeGeoDataDriver.h"
    00228
    00230 class SHP_DLL TeShapefileDriver: public TeGeoDataDriver
    00231 {
    00232            std::string shpFileName_;
    00233            std::string dbfFileName_;
    00234            SHPHandle  hSHP_;
    00235            DBFHandle  hDBF_;
    00236
    00237 public:
    00238
    00240            TeShapefileDriver(std::string fileName);
    00241
    00243            ~TeShapefileDriver();
    00244
    00245            std::string getFileName();
    00246
    00248            bool isDataAccessible();
    00249
    00251            TeProjection* getDataProjection();
    00252
    00254            /*
    00255                       \param nObjects to return the number of objects accessible in the data set
    00256                       \param ext to return the spatial extension of the geometries in the data set
    00257                       \param repres to return the type of geometries in the file
    00258                       \return true if or false whether it can retrieve the information or not
    00259            */
    00260            bool getDataInfo(unsigned int& nObjects , TeBox& ext, TeGeomRep& repres);
    00261
    00263            bool getDataAttributesList(TeAttributeList& attList);
    00264
    00266            /*
    00267                       \param dataSet to return data set
    00268                       \return true if or false whether it can retrieve the information or not
    00269            */
    00270            bool loadData(TeSTElementSet* dataSet);
    00271
    00273            void close();
    00274 };
    00275
    00276  // End of group ImpExp format
    00286
    00287 #endif
    00288

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines