This file is indexed.

/usr/include/terralib/stat/TeSkaterGrafo.h is in libterralib-dev 4.3.0+dfsg.2-11.

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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//---------------------------------------------------------------------------
#ifndef GrafoH
#define GrafoH
//---------------------------------------------------------------------------

#include "TeSTElementSet.h"
#include "TeNeighbours.h"
#include "lista.h"

#define RAIO 4

class STAT_DLL TSkaterGrafo {

public:

    typedef struct No_Grafo
	{
      char Label[50];
      double X;
      double Y;
      TListaVizinho *Vizinhos;
      TListaVizinho *ArViz;
      double *Variaveis;
      int Populacao;
      char Mark;
    } Grafo_t, *Grafo_ptr;

    typedef struct Grafo
	{
       Grafo_ptr Nos;
       int Num_Var;
       int Size;
    }MyGrafo_t,*MyGrafo_ptr;

/**** Funcoes Publicas ****/
 TSkaterGrafo(bool hasPop);
 template<typename Matrix> bool  MontaGrafo(TeSTElementSet& regSet, Matrix* proxMatrix);
 void  Escalona(double *,double *);
 void  Escala(int,int);
 void  Adjacente(int *,double *,int i);
 void  Adjacente1(int *,double *,int i);
 int Size() {return GetSize();}
 double MinX() {return X_min;}
 double MaxX() {return X_max;}
 double MinY() {return Y_min;}
 double MaxY() {return Y_max;}
 double Coord_X(int Indice){return Get_X(Indice);}
 double Coord_Y(int Indice) {return Get_Y(Indice);}
 int Num_Var() {return GetNum_Var();}


 /***** Area Privada *****/
private:
    MyGrafo_ptr MyGrafo;
	std::map<std::string,unsigned int> Hash_;

	double X_min,X_max;//Usado para conversao de escala
    double Y_min,Y_max;//Usado para conversao de escala
    double Cx,Gamax;   //Usados na conversao de escala
    double Cy,Gamay;   //Usados na conversao de escala

    double  Distancia(int,int);
    double  Get_X(int Indice);
    double  Get_Y(int Indice);
    int GetSize();
    int  GetNum_Var();

     //Variaveis que sao inicializadas de fora
    char *NArq;
    char *NViz;
    char Tem_Pop;

    friend class TArvore;
    friend class TParticao;
    friend class TPrincipal;
    friend class TEstatistica;
};

template<typename Matrix> bool  
TSkaterGrafo::MontaGrafo(TeSTElementSet& regSet, Matrix* proxMatrix)
{

//  long nAreas = regSet.numElements();

  typename TeSTElementSet::iterator it = regSet.begin(); 
  int  nCov   = (*it).getProperties().size();


  //Monta lista de areas

  TeCoord2D centroid;
  (*it).centroid(centroid);
  X_min=X_max=centroid.x();
  Y_min=Y_max=centroid.y();
  //Obtem o numero de variaveis --> se tem populacao e menos um
  if (this->Tem_Pop)
          MyGrafo->Num_Var = nCov-1; //Obtem o numero de variaveis
  else
          MyGrafo->Num_Var = nCov;

  string val;
  int i;

  //Monta areas
  while (it != regSet.end()) 
  {
		(*it).centroid(centroid);    
		MyGrafo->Nos = 
		  (Grafo_ptr) realloc(MyGrafo->Nos,sizeof(Grafo_t)*((MyGrafo->Size)+1));
		sprintf(MyGrafo->Nos[MyGrafo->Size].Label,"%s",(*it).objectId().c_str());
		MyGrafo->Nos[MyGrafo->Size].Vizinhos = NULL;
		MyGrafo->Nos[MyGrafo->Size].ArViz = NULL;

		Hash_[std::string(MyGrafo->Nos[MyGrafo->Size].Label)] = MyGrafo->Size;

		MyGrafo->Nos[MyGrafo->Size].X = centroid.x();
		if(centroid.x() < X_min) X_min =centroid.x();// Procura limites da tela
		else if(centroid.x() > X_max) X_max = centroid.x();
    
		MyGrafo->Nos[MyGrafo->Size].Y =centroid.y();
		if(centroid.y()< Y_min) Y_min = centroid.y(); //Procura limites da tela
		else if(centroid.y() > Y_max) Y_max = centroid.y();
    
		MyGrafo->Nos[MyGrafo->Size].Variaveis = 
		  (double *) malloc(sizeof(double)*MyGrafo->Num_Var);
		for(i=0;i<MyGrafo->Num_Var;i++) {
		  (*it).getPropertyValue(val, i);
		  MyGrafo->Nos[MyGrafo->Size].Variaveis[i] = atof(val.c_str()); 
		}
		if (Tem_Pop) {
		  (*it).getPropertyValue(val, MyGrafo->Num_Var);
		  MyGrafo->Nos[MyGrafo->Size].Populacao = (int)atof(val.c_str());//covs[a*nCov+nCov-1];
		}
		else
		  MyGrafo->Nos[MyGrafo->Size].Populacao = 0;
    
		MyGrafo->Nos[MyGrafo->Size].Mark=1;
		(MyGrafo->Size)++;
		(++it);
  }

  int L_indice,V_indice;
  double dist;

  it = regSet.begin();
	
	while ( it != regSet.end())
	{
		TeNeighboursMap	neighbors = proxMatrix->getMapNeighbours((*it).objectId());

		//Grafo eh desconexo
		if (neighbors.size() == 0) 
		{
			Hash_.clear();
		  return false;
		}
		
		std::map<std::string,unsigned int>::iterator ith = Hash_.find((*it).objectId());
		if (ith != Hash_.end())
			L_indice = ith->second;
		else
			L_indice = 0;

		MyGrafo->Nos[L_indice].Vizinhos = new TListaVizinho;
		MyGrafo->Nos[L_indice].ArViz = new TListaVizinho;

		typename TeNeighboursMap::iterator itNeigs = neighbors.begin();
	 			
		while(itNeigs != neighbors.end())
		{
			ith = Hash_.find((*itNeigs).first);
			if (ith != Hash_.end())
				V_indice = ith->second;
			else
				V_indice = 0;
		   dist = Distancia(L_indice,V_indice);
		   MyGrafo->Nos[L_indice].Vizinhos->Insere(V_indice,dist);
		   (++itNeigs);
		}
		(++it);
	}

  Hash_.clear();
  return true;
}

#endif