| 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/image_processing/TePDIRaster2Vector.hpp
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright  2001-2004 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 *************************************************************************************/
    00023
    00034 #ifndef  TEPDIRASTER2VECTOR_HPP
    00035   #define  TEPDIRASTER2VECTOR_HPP
    00036
    00037   #include "TePDIParameters.hpp"
    00038   #include "TePDIAlgorithm.hpp"
    00039
    00040   #include "TePDITileIndexer.hpp"
    00041
    00042   #include "../kernel/TeRaster.h"
    00043   #include "../kernel/TeLayer.h"
    00044   #include "../kernel/TeRTree.h"
    00045
    00046
    00050   class PDI_DLL TePDIRaster2VectorPolStruct
    00051   {
    00052     public:
    00053
    00057       int value_;
    00058
    00062       double tile_indexer_dy_;
    00063
    00067       TePDITileIndexer* indexer_;
    00068
    00072       TePolygon poly_;
    00073
    00077       void init()
    00078       {
    00079         value_ = 0;
    00080         tile_indexer_dy_ = 1.0;
    00081         indexer_ = 0;
    00082       };
    00083
    00087       void clear()
    00088       {
    00089         if( indexer_ ) {
    00090           delete indexer_;
    00091         }
    00092
    00093         init();
    00094       };
    00095
    00099       TePDIRaster2VectorPolStruct()
    00100       {
    00101         init();
    00102       };
    00103
    00108       TePDIRaster2VectorPolStruct(
    00109         const TePDIRaster2VectorPolStruct& external )
    00110       {
    00111         init();
    00112
    00113         reset( external.poly_, external.value_,
    00114           external.tile_indexer_dy_ );
    00115       }
    00116
    00123       TePDIRaster2VectorPolStruct( const TePolygon& p,
    00124         const int& v,
    00125         const double& tile_indexer_dy )
    00126       {
    00127         init();
    00128
    00129         reset( p, v, tile_indexer_dy );
    00130       }
    00131
    00135       ~TePDIRaster2VectorPolStruct()
    00136       {
    00137         clear();
    00138       };
    00139
    00145       const TePDIRaster2VectorPolStruct& operator=(
    00146         const TePDIRaster2VectorPolStruct& external )
    00147       {
    00148         reset( external.poly_, external.value_,
    00149           external.tile_indexer_dy_ );
    00150
    00151         return external;
    00152       }
    00153
    00160       void reset( const TePolygon& p, const int& v,
    00161         const double& tile_indexer_dy )
    00162       {
    00163         clear();
    00164
    00165         poly_ = p;
    00166         value_ = v;
    00167         tile_indexer_dy_ = tile_indexer_dy;
    00168
    00169         indexer_ = new TePDITileIndexer( poly_,
    00170           tile_indexer_dy_ );
    00171       }
    00172   };
    00173
    00198   class PDI_DLL TePDIRaster2Vector : public TePDIAlgorithm
    00199   {
    00200     public:
    00202     typedef TeSharedPtr< TePDIRaster2Vector > pointer;
    00204     typedef const TeSharedPtr< TePDIRaster2Vector > const_pointer;
    00205
    00209     TePDIRaster2Vector();
    00210
    00214     ~TePDIRaster2Vector();
    00215
    00225       bool CheckParameters( const TePDIParameters& parameters ) const;
    00226
    00227     protected:
    00228
    00232       bool raster_uses_dummy_;
    00233
    00237       double dummy_value_;
    00238
    00242       TeCoord2D directions_[8];
    00243
    00245       TePDITypes::TePDIRasterPtrType raster_;
    00246
    00248       double resx_;
    00249
    00251       double resy_;
    00252
    00254       long   nLines_;
    00255
    00257       long   nCols_;
    00258
    00260       unsigned int raster_channel_;
    00261
    00266       TeSAM::TeRTree<unsigned int, 8, 4>*    rtreePolygons_;
    00267
    00269       vector<TePDIRaster2VectorPolStruct>  containerPolygons_;
    00270
    00276       bool RunImplementation();
    00277
    00283       void ResetState( const TePDIParameters& params );
    00284
    00293       bool detectEdge(long i, long j, TeLine2D &line );
    00294
    00301       bool startingEdgeTest( const int& x, const int& y );
    00302
    00306       void clear();
    00307
    00308   };
    00309
    00310
    00315 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines