#include <TeSkaterGrafo.h>
Definition at line 13 of file TeSkaterGrafo.h.
Public Types | |
| typedef struct Grafo_t * | Grafo_ptr |
| typedef struct MyGrafo_t * | MyGrafo_ptr |
Public Member Functions | |
| void | Adjacente (int *, double *, int i) |
| void | Adjacente1 (int *, double *, int i) |
| double | Coord_X (int Indice) |
| double | Coord_Y (int Indice) |
| void | Escala (int, int) |
| void | Escalona (double *, double *) |
| double | MaxX () |
| double | MaxY () |
| double | MinX () |
| double | MinY () |
| template<typename Matrix> | |
| bool | MontaGrafo (TeSTElementSet ®Set, Matrix *proxMatrix) |
| int | Num_Var () |
| int | Size () |
| TSkaterGrafo (bool hasPop) | |
Private Member Functions | |
| double | Distancia (int, int) |
| double | Get_X (int Indice) |
| double | Get_Y (int Indice) |
| int | GetNum_Var () |
| int | GetSize () |
Private Attributes | |
| double | Cx |
| double | Cy |
| double | Gamax |
| double | Gamay |
| std::map < std::string, unsigned int > | Hash_ |
| MyGrafo_ptr | MyGrafo |
| char * | NArq |
| char * | NViz |
| char | Tem_Pop |
| double | X_max |
| double | X_min |
| double | Y_max |
| double | Y_min |
Friends | |
| class | TArvore |
| class | TEstatistica |
| class | TParticao |
| class | TPrincipal |
| typedef struct Grafo_t * TSkaterGrafo::Grafo_ptr |
| typedef struct MyGrafo_t* TSkaterGrafo::MyGrafo_ptr |
| TSkaterGrafo::TSkaterGrafo | ( | bool | hasPop | ) |
Definition at line 12 of file TeSkaterGrafo.cpp.
References MyGrafo, MyGrafo_t::Nos, MyGrafo_t::Size, and Tem_Pop.
00012 { 00013 00014 MyGrafo= new MyGrafo_t; 00015 MyGrafo->Nos = (Grafo_ptr) malloc(sizeof(Grafo_t)); 00016 MyGrafo->Size = 0; 00017 Tem_Pop = (hasPop) ? 1 : 0; 00018 };
| void TSkaterGrafo::Adjacente | ( | int * | Indice, | |
| double * | Peso, | |||
| int | i | |||
| ) |
Definition at line 48 of file TeSkaterGrafo.cpp.
References TListaVizinho::Adjacente(), MyGrafo, MyGrafo_t::Nos, and Grafo_t::Vizinhos.
Referenced by TArvore::Prim().
| void TSkaterGrafo::Adjacente1 | ( | int * | Indice, | |
| double * | Peso, | |||
| int | i | |||
| ) |
Definition at line 52 of file TeSkaterGrafo.cpp.
References TListaVizinho::Adjacente(), Grafo_t::ArViz, MyGrafo, and MyGrafo_t::Nos.
| double TSkaterGrafo::Coord_X | ( | int | Indice | ) | [inline] |
| double TSkaterGrafo::Coord_Y | ( | int | Indice | ) | [inline] |
| double TSkaterGrafo::Distancia | ( | int | L_indice, | |
| int | V_indice | |||
| ) | [private] |
Definition at line 29 of file TeSkaterGrafo.cpp.
References MyGrafo, MyGrafo_t::Nos, MyGrafo_t::Num_Var, and Grafo_t::Variaveis.
Referenced by MontaGrafo().
00029 { 00030 00031 int i; 00032 double Acc=0; 00033 00034 for(i=0;i < MyGrafo->Num_Var;i++) 00035 Acc += (MyGrafo->Nos[L_indice].Variaveis[i] - MyGrafo->Nos[V_indice].Variaveis[i]) * 00036 (MyGrafo->Nos[L_indice].Variaveis[i] - MyGrafo->Nos[V_indice].Variaveis[i]); 00037 return sqrt(Acc); 00038 };
| void TSkaterGrafo::Escala | ( | int | Altura, | |
| int | Largura | |||
| ) |
Definition at line 57 of file TeSkaterGrafo.cpp.
References Cx, Cy, Gamax, Gamay, RAIO, X_max, X_min, Y_max, and Y_min.
00057 { 00058 00059 Cx = (Largura - 2*(RAIO))/(X_max-X_min); 00060 Gamax = -RAIO/Cx - X_min; 00061 00062 Cy = (Altura - 2*(RAIO))/(Y_max-Y_min); 00063 Gamay = -RAIO/Cy - Y_min; 00064 };
| void TSkaterGrafo::Escalona | ( | double * | X, | |
| double * | Y | |||
| ) |
| double TSkaterGrafo::Get_X | ( | int | Indice | ) | [private] |
Definition at line 66 of file TeSkaterGrafo.cpp.
References MyGrafo, MyGrafo_t::Nos, and Grafo_t::X.
| double TSkaterGrafo::Get_Y | ( | int | Indice | ) | [private] |
Definition at line 71 of file TeSkaterGrafo.cpp.
References MyGrafo, MyGrafo_t::Nos, and Grafo_t::Y.
| int TSkaterGrafo::GetNum_Var | ( | ) | [private] |
| int TSkaterGrafo::GetSize | ( | ) | [private] |
| double TSkaterGrafo::MaxX | ( | ) | [inline] |
| double TSkaterGrafo::MaxY | ( | ) | [inline] |
| double TSkaterGrafo::MinX | ( | ) | [inline] |
| double TSkaterGrafo::MinY | ( | ) | [inline] |
| bool TSkaterGrafo::MontaGrafo | ( | TeSTElementSet & | regSet, | |
| Matrix * | proxMatrix | |||
| ) | [inline] |
Definition at line 81 of file TeSkaterGrafo.h.
References Grafo_t::ArViz, TeBaseSTInstanceSet< GeometryType, TimeType, InstanceType >::begin(), Distancia(), TeBaseSTInstanceSet< GeometryType, TimeType, InstanceType >::end(), Hash_, TListaVizinho::Insere(), Grafo_t::Label, Grafo_t::Mark, MyGrafo, MyGrafo_t::Nos, NULL, MyGrafo_t::Num_Var, Grafo_t::Populacao, MyGrafo_t::Size, Tem_Pop, Grafo_t::Variaveis, Grafo_t::Vizinhos, Grafo_t::X, TeCoord2D::x(), X_max, X_min, Grafo_t::Y, TeCoord2D::y(), Y_max, and Y_min.
Referenced by TeSkaterFunction().
00082 { 00083 00084 // long nAreas = regSet.numElements(); 00085 00086 typename TeSTElementSet::iterator it = regSet.begin(); 00087 int nCov = (*it).getProperties().size(); 00088 00089 00090 //Monta lista de areas 00091 00092 TeCoord2D centroid; 00093 (*it).centroid(centroid); 00094 X_min=X_max=centroid.x(); 00095 Y_min=Y_max=centroid.y(); 00096 //Obtem o numero de variaveis --> se tem populacao e menos um 00097 if (this->Tem_Pop) 00098 MyGrafo->Num_Var = nCov-1; //Obtem o numero de variaveis 00099 else 00100 MyGrafo->Num_Var = nCov; 00101 00102 string val; 00103 int i; 00104 00105 //Monta areas 00106 while (it != regSet.end()) 00107 { 00108 (*it).centroid(centroid); 00109 MyGrafo->Nos = 00110 (Grafo_ptr) realloc(MyGrafo->Nos,sizeof(Grafo_t)*((MyGrafo->Size)+1)); 00111 sprintf(MyGrafo->Nos[MyGrafo->Size].Label,"%s",(*it).objectId().c_str()); 00112 MyGrafo->Nos[MyGrafo->Size].Vizinhos = NULL; 00113 MyGrafo->Nos[MyGrafo->Size].ArViz = NULL; 00114 00115 Hash_[std::string(MyGrafo->Nos[MyGrafo->Size].Label)] = MyGrafo->Size; 00116 00117 MyGrafo->Nos[MyGrafo->Size].X = centroid.x(); 00118 if(centroid.x() < X_min) X_min =centroid.x();// Procura limites da tela 00119 else if(centroid.x() > X_max) X_max = centroid.x(); 00120 00121 MyGrafo->Nos[MyGrafo->Size].Y =centroid.y(); 00122 if(centroid.y()< Y_min) Y_min = centroid.y(); //Procura limites da tela 00123 else if(centroid.y() > Y_max) Y_max = centroid.y(); 00124 00125 MyGrafo->Nos[MyGrafo->Size].Variaveis = 00126 (double *) malloc(sizeof(double)*MyGrafo->Num_Var); 00127 for(i=0;i<MyGrafo->Num_Var;i++) { 00128 (*it).getPropertyValue(val, i); 00129 MyGrafo->Nos[MyGrafo->Size].Variaveis[i] = atof(val.c_str()); 00130 } 00131 if (Tem_Pop) { 00132 (*it).getPropertyValue(val, MyGrafo->Num_Var); 00133 MyGrafo->Nos[MyGrafo->Size].Populacao = (int)atof(val.c_str());//covs[a*nCov+nCov-1]; 00134 } 00135 else 00136 MyGrafo->Nos[MyGrafo->Size].Populacao = 0; 00137 00138 MyGrafo->Nos[MyGrafo->Size].Mark=1; 00139 (MyGrafo->Size)++; 00140 (++it); 00141 } 00142 00143 int L_indice,V_indice; 00144 double dist; 00145 00146 it = regSet.begin(); 00147 00148 while ( it != regSet.end()) 00149 { 00150 TeNeighboursMap neighbors = proxMatrix->getMapNeighbours((*it).objectId()); 00151 00152 //Grafo eh desconexo 00153 if (neighbors.size() == 0) 00154 { 00155 Hash_.clear(); 00156 return false; 00157 } 00158 00159 std::map<std::string,unsigned int>::iterator ith = Hash_.find((*it).objectId()); 00160 if (ith != Hash_.end()) 00161 L_indice = ith->second; 00162 else 00163 L_indice = 0; 00164 00165 MyGrafo->Nos[L_indice].Vizinhos = new TListaVizinho; 00166 MyGrafo->Nos[L_indice].ArViz = new TListaVizinho; 00167 00168 typename TeNeighboursMap::iterator itNeigs = neighbors.begin(); 00169 00170 while(itNeigs != neighbors.end()) 00171 { 00172 ith = Hash_.find((*itNeigs).first); 00173 if (ith != Hash_.end()) 00174 V_indice = ith->second; 00175 else 00176 V_indice = 0; 00177 dist = Distancia(L_indice,V_indice); 00178 MyGrafo->Nos[L_indice].Vizinhos->Insere(V_indice,dist); 00179 (++itNeigs); 00180 } 00181 (++it); 00182 } 00183 00184 Hash_.clear(); 00185 return true; 00186 }
| int TSkaterGrafo::Num_Var | ( | ) | [inline] |
| int TSkaterGrafo::Size | ( | void | ) | [inline] |
friend class TArvore [friend] |
Definition at line 74 of file TeSkaterGrafo.h.
friend class TEstatistica [friend] |
Definition at line 77 of file TeSkaterGrafo.h.
friend class TParticao [friend] |
Definition at line 75 of file TeSkaterGrafo.h.
friend class TPrincipal [friend] |
Definition at line 76 of file TeSkaterGrafo.h.
double TSkaterGrafo::Cx [private] |
double TSkaterGrafo::Cy [private] |
double TSkaterGrafo::Gamax [private] |
double TSkaterGrafo::Gamay [private] |
std::map<std::string,unsigned int> TSkaterGrafo::Hash_ [private] |
MyGrafo_ptr TSkaterGrafo::MyGrafo [private] |
Definition at line 55 of file TeSkaterGrafo.h.
Referenced by Adjacente(), Adjacente1(), TParticao::BFS_Desvio(), TParticao::BFS_Main(), TParticao::BFS_Media(), TParticao::BFS_Salva(), TParticao::Dist(), Distancia(), Get_X(), Get_Y(), GetNum_Var(), GetSize(), TArvore::Monta_Arvore(), MontaGrafo(), TParticao::Particiona(), TArvore::Prim(), and TSkaterGrafo().
char* TSkaterGrafo::NArq [private] |
Definition at line 70 of file TeSkaterGrafo.h.
char* TSkaterGrafo::NViz [private] |
Definition at line 71 of file TeSkaterGrafo.h.
char TSkaterGrafo::Tem_Pop [private] |
double TSkaterGrafo::X_max [private] |
double TSkaterGrafo::X_min [private] |
double TSkaterGrafo::Y_max [private] |
double TSkaterGrafo::Y_min [private] |
1.5.3