TerraLib 4.1
E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeNetwork.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 *************************************************************************************/
00026 #ifndef TeNetwork_H
00027 #define TeNetwork_H
00028 
00029 #include "TeGeometry.h"
00030 #include "graph.h"
00031 
00032 class TeSTElementSet;
00033 
00034 
00036 class TL_DLL TeGraphNetwork
00037 {
00038 protected:
00040            br_stl::Graph<TeNode, double>    graph_;
00041 
00043            TeLineSet                                                         line_set_; 
00044            
00046            map<string, double>                                    line_cost_;           
00047 
00048            
00049 public:
00050 
00052            TeGraphNetwork() : graph_ (true) {}; // directed graph
00053            
00054                       
00056            TeGraphNetwork (TeLineSet& ls);
00057            
00058 
00060            TeGraphNetwork (TeLineSet& ls, map<string, double>& line_costs);
00061            
00062 
00064            TeGraphNetwork (TeSTElementSet& stos, string& attrName);
00065 
00066            
00068            TeGraphNetwork& operator=(TeGraphNetwork& other)
00069            {
00070                       if(this != &other)
00071                       {
00072                                  graph_ = other.graph_;
00073                                  line_set_ = other.getLineSet();
00074                                  line_cost_ = other.getLineCosts();
00075                       }
00076                       return (*this);
00077            }
00078 
00080            bool Add (TeLineSet& ls, map<string, double>& line_costs); 
00081 
00083            bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
00084 
00086            bool getNode (int i, TeNode& node); 
00087            
00089            bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
00090 
00092            bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
00093 
00095            TeLineSet getLineSet () { return line_set_;}
00096 
00098            map<string, double>   getLineCosts () {return line_cost_;}
00099 
00101            void insertLine (TeLine2D& line, const double& attr);  
00102 
00104            bool breakLineSet (TeNode& node, int i); //maybe should be done externally.
00105 
00107            virtual ~TeGraphNetwork () {}
00108 
00109 };
00110 
00111 
00113 class TL_DLL TeNetwork
00114 {
00115 public:
00117            br_stl::Graph<TeNode, double>    graph_;
00118            
00120            TeLineSet                                                         line_set_; 
00121            
00123            map<string, TeArc>                                     arcs_map_; 
00124 
00125 public:
00127            TeNetwork() : graph_ (false) { };
00128 
00130            TeNetwork (TeLineSet& ls);  
00131 
00133            bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
00134 
00135 
00137            void insertLine (TeLine2D& line, const double& attr);
00138 
00139 
00141            bool insertNode (TeNode& node, int i);
00142 
00144            bool getNode (int i, TeNode& node); 
00145 
00147            bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
00148            
00150            bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
00151 
00153            virtual ~TeNetwork () {}
00154 
00156            TeLineSet getLineSet () { return line_set_;}
00157 
00158 };
00159 
00160 #endif 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines