/usr/include/terralib/kernel/TeNetwork.h is in libterralib-dev 4.0.0-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | /************************************************************************************
TerraLib - a library for developing GIS applications.
Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
This code is part of the TerraLib library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
You should have received a copy of the GNU Lesser General Public
License along with this library.
The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The library provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this library and its documentation.
*************************************************************************************/
/*! \file TeNetwork.h
\brief This file defines class for handling networks in Terralib
*/
#ifndef TeNetwork_H
#define TeNetwork_H
#include "TeGeometry.h"
#include "graph.h"
class TeSTElementSet;
//! class for handling networks
class TL_DLL TeGraphNetwork
{
protected:
//! Set of nodes and the cost of each edge
br_stl::Graph<TeNode, double> graph_;
//! Set of geometric representation of edges
TeLineSet line_set_;
//! A map to associate each edge (line object_id) to its cost
map<string, double> line_cost_;
public:
//! Empty constructor
TeGraphNetwork() : graph_ (true) {}; // directed graph
//! Create a graph from TeLineSet; the line size is considered the cost. In this case, graph non-directed.
TeGraphNetwork (TeLineSet& ls);
//! Create a graph from TeLineSet; the cost is given by the map.
TeGraphNetwork (TeLineSet& ls, map<string, double>& line_costs);
//! Create a network from a set of line objects; the cost is given by the attrName sto property. The graph is non-directed.
TeGraphNetwork (TeSTElementSet& stos, string& attrName);
//! Assignment operator
TeGraphNetwork& operator=(TeGraphNetwork& other)
{
if(this != &other)
{
graph_ = other.graph_;
line_set_ = other.getLineSet();
line_cost_ = other.getLineCosts();
}
return (*this);
}
//! Add lineset to graph. Useful specially for directed graphs (lines must be entered in both directions. It has to be tested for existing graphs.
bool Add (TeLineSet& ls, map<string, double>& line_costs);
//! Calculate the minimun path
bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
//! Get the i-th node
bool getNode (int i, TeNode& node);
//! Get the nearest network node of a specific point (p1)
bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
//! Get the nearest network lines point from a specific point (p1)
bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
//! Get line Set
TeLineSet getLineSet () { return line_set_;}
//! Get line costs
map<string, double> getLineCosts () {return line_cost_;}
//! Insert a new line
void insertLine (TeLine2D& line, const double& attr);
//! Insert a new node
bool breakLineSet (TeNode& node, int i); //maybe should be done externally.
//! Destructor
virtual ~TeGraphNetwork () {}
};
//! class for handling networks
class TL_DLL TeNetwork
{
public:
//! Set of nodes and the cost of each edge
br_stl::Graph<TeNode, double> graph_;
//! Set of edges
TeLineSet line_set_;
//! A map to associate each edge (line object_id) to its arc
map<string, TeArc> arcs_map_;
public:
//! Empty constructor
TeNetwork() : graph_ (false) { };
//! Create a graph from TeLineSet, the line size is considered the cost
TeNetwork (TeLineSet& ls);
//! Calculate the minimun path
bool minimumPath (TeNode& n1, TeNodeSet& set, vector<double>& dist);
//! Insert a new line
void insertLine (TeLine2D& line, const double& attr);
//! Insert a new node
bool insertNode (TeNode& node, int i);
//! Get the i-th node
bool getNode (int i, TeNode& node);
//! Get the nearest network point of a specific point (p1)
bool nearestNetworkPoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
//! Get the nearest network node of a specific point (p1)
bool nearestNodePoint (TeCoord2D& p1, int& lindex, TeCoord2D& pinter, double& distance, double tol = 0.0);
//! Destructor
virtual ~TeNetwork () {}
//! Get line Set
TeLineSet getLineSet () { return line_set_;}
};
#endif
|