| 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/functions/TeCellAlgorithms.h
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 *************************************************************************************/
    00027 #ifndef  __TERRALIB_INTERNAL_CELLALGORITHMS_H
    00028 #define  __TERRALIB_INTERNAL_CELLALGORITHMS_H
    00029
    00030 #include "../kernel/TeSTElementSet.h"
    00031 #include "../kernel/TeComputeAttributeStrategies.h"
    00032 #include "../kernel/TeRaster.h"
    00033
    00034 #include "TeFunctionsDefines.h"
    00035
    00036 class TeDatabase;
    00037 class TeDatabasePortal;
    00038 class TeLayer;
    00039 class TeGraphNetwork;
    00040 class TeTable;
    00041
    00042 using namespace std;
    00043
    00045 class TLFUNCTIONS_DLL TeBoxRasterIterator
    00046 {
    00047            public:
    00049                       TeBoxRasterIterator(TeRaster* raster_, TeBox box);
    00050
    00052                TeBoxRasterIterator& operator++();
    00053
    00055                TeBoxRasterIterator operator++(int);
    00056
    00058                double operator*();
    00059
    00061         bool operator==(const TeBoxRasterIterator& rhs) const;
    00062
    00064         bool operator!=(const TeBoxRasterIterator& rhs) const;
    00065
    00067                       bool getProperty(TeProperty& prop);
    00068
    00070                       TeBoxRasterIterator begin();
    00071
    00073                       TeBoxRasterIterator end();
    00074
    00075            private:
    00076                       int xo, yo, xf, yf, x, y;
    00077                       bool end_;
    00078                       TeRaster* raster;
    00079 };
    00080
    00089
    00090 /*         \param layerName      name of the new layer with cell representations
    00091            \param theme                     pointer to the theme that has the polygons
    00092            \param resX                                 X resolution of each cell
    00093            \param resY                                 Y resolution of each cell
    00094            \param box                       bounding box of interest
    00095            \return a pointer to the new layer created if success or null if fail
    00096 */
    00097 TLFUNCTIONS_DLL TeLayer* TeCreateCells(const string& layerName,TeTheme* theme, double resX, double resY, TeBox& box);
    00098
    00100 /*         \param layerName      name of the new layer with cell representations
    00101            \param layerBase      pointer to the base layer
    00102            \param resX                                 X resolution of each cell
    00103            \param resY                                 Y resolution of each cell
    00104            \param mask                                 flag that indicates if the cells should be created only over the polygons of the layer
    00105            \param box                       bounding box of interest
    00106            \return a pointer to the new layer created if success or null if fail
    00107 */
    00108 TLFUNCTIONS_DLL TeLayer* TeCreateCells( const string& layerName, TeLayer* layerBase,
    00109                                     double resX, double resY, TeBox& box, bool mask = true);
    00110
    00117
    00118 /*         \param themeOut                             cell theme
    00119            \param newAttrTable              new attribute table where the generated statistics will be kept
    00120            \param stat                                            the structure that contains the statistics which will be generated
    00121            \param themeIn                              point or cell theme
    00122            \param db                                   a pointer to the database
    00123            \return true if the operation was successfully done
    00124 */
    00125 TLFUNCTIONS_DLL bool
    00126 TeCellStatistics(TeTheme* themeOut, TeTable& newAttrTable, TeGroupingAttr& stat,
    00127                                              TeTheme* themeIn, TeDatabase* db);
    00128
    00130 /*         \param tableAttrCell  attribute table name where the generated statistics will be kept
    00131            \param portal                               a pointer to the database portal that contains the generated statistics
    00132            \return true if the operation was successfully done
    00133 */
    00134 TLFUNCTIONS_DLL bool TeKeepStatistics(TeTable& tableAttrCell, TeDatabasePortal* portal);
    00135
    00145
    00146
    00147 /*         \param input_theme                                     a pointer to the input theme to calculate the distances
    00148            \param rep                                                        input theme representation to be used
    00149            \param cell_layer                                      a pointer to the output cell layer
    00150            \param cell_tablename                       output cell attribute dynamic table; if does not exist, the table will be created by the function
    00151            \param output_columnname                    output attribute name
    00152            \param time_interval                        time interval of output cells attributes
    00153            \return true if the operation was successfully done
    00154 */
    00155 TLFUNCTIONS_DLL bool TeFillCellDistanceOperation(TeTheme* input_theme,
    00156                                                                                          TeGeomRep rep,
    00157                                                                                          TeLayer* cell_layer,
    00158                                                                                          const string& cell_tablename,
    00159                                                                                          const string& output_columnname,
    00160                                                                                          TeTimeInterval time_interval = TeTimeInterval());
    00161
    00165 /*         \param input_theme                                     a pointer to the input theme to calculate the distances
    00166            \param rep                                                        input theme representation to be used
    00167            \param cell_layer                                      a pointer to the output cell layer
    00168            \param cell_tablename                       output cell attribute table; if does not exist, the table will be created by the function
    00169            \param output_columnName                    output attribute name
    00170            \param time_interval                        time interval of output cells attributes
    00171            \return true if the operation was successfully done
    00172 */
    00173
    00174 TLFUNCTIONS_DLL bool TeFillCellCategoryCountPercentageRasterOperation(TeDatabase* database,
    00175                                                                                                                                                  string raster_layername,
    00176                                                                                                                                                  string cell_layername,
    00177                                                                                                                                                  const string& cell_tablename,
    00178                                                                                                                                                  const string attrName,
    00179                                                                                                                                                  TeTimeInterval t);
    00180
    00181
    00182
    00183 TLFUNCTIONS_DLL bool TeFillCellCategoryAreaPercentageOperation(TeTheme* theme,
    00184                                                                                                                             const string attrName,
    00185                                                                                                                             TeLayer* cell_layer,
    00186                                                                                                                             const string& cell_tablename,
    00187                                                                                                                             TeTimeInterval t = TeTimeInterval());
    00188
    00189
    00190 TLFUNCTIONS_DLL bool TeFillCellCategoryAreaPercentageOperation(TeTheme* input_theme,
    00191                                                                                                                             const string attr_name,
    00192                                                                                                                             TeLayer* cell_layer,
    00193                                                                                                                             const string& cell_tablename,
    00194                                                                                                                             map<string, string>& classesMap,
    00195                                                                                                                             TeTimeInterval time_interval = TeTimeInterval());
    00196
    00198 /*         \param db                                                         the database which contains the layer of cells
    00199            \patam operation                                       the operation used to compute the attribute
    00200            \param cell_layername                       the name of the layer of cells
    00201            \param cell_tablename                       output cell attribute table; if does not exist, the table will be created by the function
    00202            \param output_columnname                    output attribute name
    00203            \param time_interval                        time interval of output cells attributes
    00204            \return true if the operation was successfully done
    00205 */
    00206 TLFUNCTIONS_DLL bool TeFillCellSpatialOperation(TeDatabase* db,
    00207                                             TeComputeSpatialStrategy* operation,
    00208                                                                                         const string& cell_layername,
    00209                                             const string& cell_tablename,
    00210                                             const string& output_columnname,
    00211                                                                                         TeTimeInterval time_interval = TeTimeInterval());
    00212
    00214 /*         \param db                                                         a pointer to the database in which input and output layers are stored
    00215            \param input_layername                                 name of input layer
    00216            \param rep                                                        input layer representation to be used
    00217            \param input_tablename                                 input layer attribute table to be used
    00218            \param input_attrname                       input layer attribute to be used to compute output attribute
    00219            \param operation                                       operation to be applied (see TeComputeAttrStrategy hierarchy)
    00220            \param cell_layername                       output cell layer
    00221            \param cell_tablename                       output cell attribute dynamic table; if does not exist, the table will be created by the function
    00222            \param output_columnName                    output attribute name
    00223            \param time_interval                        time interval of output cells attributes
    00224            \return true if the operation was successfully done
    00225 */
    00226 TLFUNCTIONS_DLL bool TeFillCellNonSpatialOperation(TeDatabase* db,
    00227                                                                                                    const string& input_layername,
    00228                                                                                                    TeGeomRep rep,
    00229                                                                                                    const string& input_tablename,
    00230                                                                                                    const string& input_attrname,
    00231                                                                                                    TeComputeAttrStrategy<TeSTElementSet::propertyIterator>* operation,
    00232                                                                                                    const string& cell_layername,
    00233                                                                                                    const string& cell_tablename,
    00234                                                                                                    const string& output_columnName,
    00235                                                                                                    TeTimeInterval time_interval = TeTimeInterval());
    00236
    00238 /*         \param theme                                                      a pointer to an input theme
    00239            \param rep                                                        input theme representation to be used
    00240            \param input_tablename                                 input theme attribute table to be used
    00241            \param input_attrname                       input theme attribute to be used to compute output attribute
    00242            \param operation                                       operation to be applied (see TeComputeAttrStrategy hierarchy)
    00243            \param cell_layername                       output cell layer
    00244            \param cell_tablename                       output cell attribute dynamic table; if does not exist, the table will be created by the function
    00245            \param output_columnName                    output attribute name
    00246            \param time_interval                        time interval of output cells attributes
    00247            \return true if the operation was successfully done
    00248 */
    00249 TLFUNCTIONS_DLL bool TeFillCellNonSpatialOperation (TeTheme* theme,
    00250                                                                                                    TeGeomRep rep,
    00251                                                                                                    const string& input_attrname,
    00252                                                                                                    TeComputeAttrStrategy<TeSTElementSet::propertyIterator>* operation,
    00253                                                                                                    TeLayer* cell_layer,
    00254                                                                                                    const string& cell_tablename,
    00255                                                                                                    const string& output_columnName,
    00256                                                                                                    TeTimeInterval time_interval = TeTimeInterval());
    00257
    00259 /*         \param db                                                         a pointer to the database in which input and output layers are stored
    00260            \param input_raster_layername    name of input layer that contains a raster representation
    00261            \param operation                                       operation to be applied (see TeComputeAttrStrategy hierarchy)
    00262            \param cell_layername                       output cell layer
    00263            \param cell_tablename                       output cell attribute dynamic table; if does not exist, the table will be created by the function
    00264            \param output_columnName                    output attribute name
    00265            \param time_interval                        time interval of output cells attributes
    00266            \return true if the operation was successfully done
    00267 */
    00268 TLFUNCTIONS_DLL bool TeFillCellNonSpatialRasterOperation(TeDatabase* db,
    00269                                                                                                               const string& input_raster_layername,
    00270                                                                                                               TeComputeAttrStrategy<TeBoxRasterIterator>* operation,
    00271                                                                                                               const string& cell_layername,
    00272                                                                                                               const string& cell_tablename,
    00273                                                                                                               const string& output_columnName,
    00274                                                                                                               TeTimeInterval time_interval = TeTimeInterval());
    00275
    00278 /*  \param db                       a pointer to the database in which input and output layers are stored
    00279     \param objects                  set of objects (e.g., ports)
    00280     \param rep                      objects representation type
    00281     \param net                      netork to be used to verify and quantify cell connectivity to each cell
    00282     \param input_attrname           connected objects attribute to be used to compute output attribute
    00283     \param t                        time interval of output cells attributes
    00284     \param cell_layername           output cell layer
    00285     \param cell_tablename           output cell attribute dynamic table; if does not exist, the table will be created by the function
    00286     \param output_columnName        output attribute name
    00287     \param operation                operation to be applied (see TeComputeAttrStrategy hierarchy)
    00288     \param local_distance_factor    multiplier used to compute connection strenght weights: local distance factor (see GPM documentation)
    00289     \param net_distance_factor      multiplier used to compute connection strenght weights: distance to network factor (see GPM documentation)
    00290     \param net_conn_factor          multiplier used to compute connection strenght weights: connection through network factor (see GPM documentation)
    00291     \param mult_factor              multiplier used to compute connection strenght weights: weight multiplier factor (see GPM documentation)
    00292 */
    00293 TLFUNCTIONS_DLL bool TeFillCellConnectionOperation (TeDatabase* db,
    00294                                     TeSTElementSet objects,
    00295                                     TeGeomRep rep,
    00296                                     TeGraphNetwork* net,
    00297                                     const string& /*input_attrName*/,
    00298                                     TeTimeInterval t,
    00299                                     const string& cell_layername,
    00300                                     const string& cell_tablename,
    00301                                     const string& /*output_columnName*/,
    00302                                     TeComputeAttrStrategy<TeSTElementSet::propertyIterator>* operation,
    00303                                     double /*local_distance_factor = 0.0*/,
    00304                                     double /*net_distance_factor = 0.25*/,
    00305                                     double /*net_conn_factor = 1.0*/,
    00306                                     double /*mult_factor = 1000000.0*/);
    00307
    00308
    00309
    00311 /*         \param db                                                         a pointer to the database in which input and output layers are stored
    00312            \param input_layername                                 name of input cell layer
    00313            \param input_tablename                                 input layer attribute table to be used
    00314            \param operation                                       operation to be applied (see TeComputeAttrStrategy hierarchy)
    00315            \param attrNames                                       names of input/output attribute names to be aggregated
    00316            \param cell_layername                       output cell layer
    00317            \param cell_tablename                       output cell attribute dynamic table; if does not exist, the table will be created by the function
    00318            \param time_interval                        time interval of output cells attributes
    00319            \return true if the operation was successfully done
    00320 */
    00321 TLFUNCTIONS_DLL bool TeFillCellAggregateOperation(TeDatabase* db,
    00322                                                                                                    const string& input_layername,
    00323                                                                                                    const string& input_tablename,
    00324                                                                                                    TeComputeAttrStrategy<TeSTElementSet::propertyIterator>* operation,
    00325                                                                                                    vector<string>& attrNames,
    00326                                                                                                    const string& cell_layername,
    00327                                                                                                    const string& cell_tablename,
    00328                                                                                                    TeTimeInterval time_interval = TeTimeInterval());
    00335
    00336 /*         \param cell_layer                a pointer to a layer of cells
    00337            \param cell_tablename the name of the table in the layer of cells
    00338            \param cells                                the object to be filled
    00339            \return if the function was successfully executed
    00340 */
    00341 TLFUNCTIONS_DLL bool TeFillCellInitLoad (TeLayer* cell_layer, const string& cell_tablename, TeCellSet& cells);
    00342
    00343
    00345 /*         \param cell                                 the cell which owns the attribute(s)
    00346            \param result                    the result of an operation to be used to fill the set
    00347            \param cellObjSet     the set to be filled
    00348            \param atttype                   the type of the table to be filled
    00349            \patam t                         the time interval of the attribute(s)
    00350            \return if the function was successfully executed
    00351 */
    00352 TLFUNCTIONS_DLL void TeFillCellInitSTO (const TeCell& cell, TePropertyVector& result, TeSTElementSet& cellObjSet, TeAttrTableType atttype, TeTimeInterval& t);
    00353
    00354
    00356 /*         \param cell                                 the cell which owns the attribute(s)
    00357            \param result                    the result of an operation to be used to fill the set
    00358            \param cellObjSet     the set to be filled
    00359            \param atttype                   the type of the table to be filled
    00360            \patam t                         the time interval of the attribute(s)
    00361            \return if the function was successfully executed
    00362 */
    00363 TLFUNCTIONS_DLL void TeFillCellInitSTO (const TeCell& cell, vector<string>& result, TeSTElementSet& cellObjSet, TeAttrTableType atttype, TeTimeInterval& t);
    00364
    00365
    00367 /*         \param cell_layer                           the layer where the table will be created
    00368            \param cell_table_name                      the name of the new table
    00369            \return if the function was successfully executed
    00370 */
    00371 TLFUNCTIONS_DLL bool TeCreateBasicDynamicCellTable (TeLayer* cell_layer, const string cell_tablename);
    00372
    00375 #endif
    00376

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines