![]() |
TerraLib 4.1
|
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_NEGHBOURS_H 00028 #define __TERRALIB_INTERNAL_NEGHBOURS_H 00029 00030 #include "TeUtils.h" 00031 #include "TeAttribute.h" 00032 00033 #include <vector> 00034 #include <string> 00035 #include <map> 00036 using namespace std; 00037 00038 00040 class TL_DLL TeProxMatrixAttributes 00041 { 00042 private: 00043 double _weight; 00044 int _slice; 00045 int _order; 00046 double _centroid_distance; 00047 double _borders_length; 00048 double _net_objects_distance; 00049 double _net_minimum_path; 00050 00051 00052 public: 00053 00055 TeProxMatrixAttributes(); 00056 00058 TeProxMatrixAttributes(const double& w, const int& slice, const int& order, 00059 const double& cent_dist, const double& border_length, 00060 const double& net_distance, const double& net_minimun_path): 00061 _weight(w), _slice(slice), 00062 _order(order), _centroid_distance(cent_dist), 00063 _borders_length(border_length), 00064 _net_objects_distance(net_distance), 00065 _net_minimum_path(net_minimun_path) 00066 {} 00067 00069 TeProxMatrixAttributes (const TeProxMatrixAttributes& att); 00070 00072 double Weight() {return _weight;} 00073 00075 int Slice () {return _slice;} 00076 00078 int Order() {return _order;} 00079 00081 double BorderLength() {return _borders_length;} 00082 00084 double CentroidDistance() {return _centroid_distance;} 00085 00087 double NetworkObjectsDistance() {return _net_objects_distance;} 00088 00090 double NetworkMinimumPath () {return _net_minimum_path;} 00091 00093 void Weight(double w) {_weight = w;} 00094 00096 void Slice (int s) {_slice = s;} 00097 00099 void Order(int o) {_order = o;} 00100 00102 void BorderLength(double l) {_borders_length = l;} 00103 00105 void CentroidDistance(double d) {_centroid_distance = d;} 00106 00108 void NetworkObjectsDistance(double d) {_net_objects_distance = d;} 00109 00111 void NetworkMinimumPath (double d) {_net_minimum_path = d;} 00112 00114 TePropertyVector getProperties (); 00115 00117 bool WasBordersLengthComputed () {if (_borders_length == -1.0) return false; else return true;} 00118 00120 bool WasCentroidDistanceComputed () {if (_centroid_distance == -1.0) return false; else return true;} 00121 00123 bool WasNetworkObjectsDistanceComputed () {if (_net_objects_distance == -1.0) return false; else return true;} 00124 00126 bool WasNetworkMinimumPathComputed () {if (_net_minimum_path == -1.0) return false; else return true;} 00127 00129 TeProxMatrixAttributes& operator= (const TeProxMatrixAttributes& att); 00130 00132 bool operator==(const TeProxMatrixAttributes& att) const; 00133 00135 virtual ~TeProxMatrixAttributes() {} 00136 }; 00137 00139 typedef map<string, TeProxMatrixAttributes> TeNeighboursMap; 00140 00141 00143 class TL_DLL TeNeighbours 00144 { 00145 private: 00146 typedef pair<string, TeProxMatrixAttributes> neigh_values; 00147 typedef vector<neigh_values> neigh_vector; 00148 00149 neigh_vector _neigh; 00150 00151 00152 public: 00153 00154 typedef neigh_vector::iterator iterator; 00155 typedef neigh_vector::const_iterator const_iterator; 00156 00158 TeNeighbours () {}; 00159 00161 TeNeighbours(const TeNeighboursMap& neigh); 00162 00164 TeNeighbours(const TeNeighbours& neigh); 00165 00167 int size() const { return _neigh.size();} 00168 00170 iterator begin() { return _neigh.begin();} 00171 00173 iterator end() { return _neigh.end();} 00174 00176 string ObjectId (int n); 00177 00179 string operator[](int n); 00180 00182 double Weight (int n); 00183 00185 double Weight (const string& object_id); 00186 00188 TeProxMatrixAttributes Attributes (int n); 00189 00191 bool Insert (const string& object_id, const TeProxMatrixAttributes& attr); 00192 00194 bool Remove (const string& object_id); 00195 00197 TeNeighbours& operator= (const TeNeighbours& neigh); 00198 00200 bool operator==(const TeNeighbours& p); 00201 00203 virtual ~TeNeighbours() {} 00204 00205 }; 00206 00207 #endif