00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
00039
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
00054
00055 TeProxMatrixAttributes();
00056
00057
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
00068
00069 TeProxMatrixAttributes (const TeProxMatrixAttributes& att);
00070
00071
00072 double Weight() {return _weight;}
00073
00074
00075 int Slice () {return _slice;}
00076
00077
00078 int Order() {return _order;}
00079
00080
00081 double BorderLength() {return _borders_length;}
00082
00083
00084 double CentroidDistance() {return _centroid_distance;}
00085
00086
00087 double NetworkObjectsDistance() {return _net_objects_distance;}
00088
00089
00090 double NetworkMinimumPath () {return _net_minimum_path;}
00091
00092
00093 void Weight(double w) {_weight = w;}
00094
00095
00096 void Slice (int s) {_slice = s;}
00097
00098
00099 void Order(int o) {_order = o;}
00100
00101
00102 void BorderLength(double l) {_borders_length = l;}
00103
00104
00105 void CentroidDistance(double d) {_centroid_distance = d;}
00106
00107
00108 void NetworkObjectsDistance(double d) {_net_objects_distance = d;}
00109
00110
00111 void NetworkMinimumPath (double d) {_net_minimum_path = d;}
00112
00113
00114 TePropertyVector getProperties ();
00115
00116
00117 bool WasBordersLengthComputed () {if (_borders_length == -1.0) return false; else return true;}
00118
00119
00120 bool WasCentroidDistanceComputed () {if (_centroid_distance == -1.0) return false; else return true;}
00121
00122
00123 bool WasNetworkObjectsDistanceComputed () {if (_net_objects_distance == -1.0) return false; else return true;}
00124
00125
00126 bool WasNetworkMinimumPathComputed () {if (_net_minimum_path == -1.0) return false; else return true;}
00127
00128
00129 TeProxMatrixAttributes& operator= (const TeProxMatrixAttributes& att);
00130
00131
00132 bool operator==(const TeProxMatrixAttributes& att) const;
00133
00134
00135 virtual ~TeProxMatrixAttributes() {}
00136 };
00137
00138
00139 typedef map<string, TeProxMatrixAttributes> TeNeighboursMap;
00140
00141
00142
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
00157
00158 TeNeighbours () {};
00159
00160
00161 TeNeighbours(const TeNeighboursMap& neigh);
00162
00163
00164 TeNeighbours(const TeNeighbours& neigh);
00165
00166
00167 int size() const { return _neigh.size();}
00168
00169
00170 iterator begin() { return _neigh.begin();}
00171
00172
00173 iterator end() { return _neigh.end();}
00174
00175
00176 string ObjectId (int n);
00177
00178
00179 string operator[](int n);
00180
00181
00182 double Weight (int n);
00183
00184
00185 double Weight (const string& object_id);
00186
00187
00188 TeProxMatrixAttributes Attributes (int n);
00189
00190
00191 bool Insert (const string& object_id, const TeProxMatrixAttributes& attr);
00192
00193
00194 bool Remove (const string& object_id);
00195
00196
00197 TeNeighbours& operator= (const TeNeighbours& neigh);
00198
00199
00200 bool operator==(const TeNeighbours& p);
00201
00202
00203 virtual ~TeNeighbours() {}
00204
00205 };
00206
00207 #endif