This file is indexed.

/usr/include/terralib/kernel/TePieBar.h is in libterralib-dev 4.3.0+dfsg.2-4build2.

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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
/************************************************************************************
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 TePieBar.h
    \brief This file contains a class that represents a char (pie or bar)  
*/
#ifndef TEPIEBAR_H
#define TEPIEBAR_H

#include "TeDefines.h"

//! A class that represents a chart (pie or bar)
class TL_DLL TePieBar
{
public:
	enum			TePieBarInput {ALL, TABSEL, QUERYSEL, LEGEND, NOTTABSEL, NOTQUERYSEL, NOTLEGEND};
	string			type_; // PIECHART or BARCHART
	int				themeId_;
	double			maxDiameter_;	
	double			minDiameter_;	
	double			diameter_;
	string			dimensionAttr_;
	vector<string>	attrVector_;
	vector<TeColor> colorVector_;
	double			maxHeight_;
	double			minHeight_;
	double			width_;
	double			maxValue_;
	double			minValue_;
	bool			keepDimension_;
	int				inputType_;
	TeDatabase		*db_;
	string			keyMove_;

	TePieBar() {}

	TePieBar(int themeId, TeDatabase* db)
	{
		themeId_ = themeId;
		db_ = db;
	}

	TePieBar (const TePieBar& pb )
	{
		type_ = pb.type_;
		themeId_ = pb.themeId_;
		maxDiameter_ = pb.maxDiameter_;	
		minDiameter_ = pb.minDiameter_;	
		diameter_ = pb.diameter_;
		dimensionAttr_ = pb.dimensionAttr_;
		maxHeight_ = pb.maxHeight_;
		minHeight_ = pb.minHeight_;
		width_ = pb.width_;
		maxValue_ = pb.maxValue_;
		minValue_ = pb.minValue_;
		keepDimension_ = pb.keepDimension_;
		inputType_ = pb.inputType_;
		db_ = pb.db_;
		keyMove_ = pb.keyMove_;

		attrVector_.clear();
		colorVector_.clear();
		int size = pb.attrVector_.size();
		int i = 0;
		while(i < size)
		{	attrVector_.push_back(pb.attrVector_[i]);
			colorVector_.push_back(pb.colorVector_[i]);
			i++;
		}
	}

	TePieBar& operator=(const TePieBar& pb)
	{
		type_ = pb.type_;
		themeId_ = pb.themeId_;
		maxDiameter_ = pb.maxDiameter_;	
		minDiameter_ = pb.minDiameter_;	
		diameter_ = pb.diameter_;
		dimensionAttr_ = pb.dimensionAttr_;
		maxHeight_ = pb.maxHeight_;
		minHeight_ = pb.minHeight_;
		width_ = pb.width_;
		maxValue_ = pb.maxValue_;
		minValue_ = pb.minValue_;
		keepDimension_ = pb.keepDimension_;
		inputType_ = pb.inputType_;
		db_ = pb.db_;
		keyMove_ = pb.keyMove_;

		attrVector_.clear();
		colorVector_.clear();
		int size = pb.attrVector_.size();
		int i = 0;
		while(i < size)
		{	attrVector_.push_back(pb.attrVector_[i]);
			colorVector_.push_back(pb.colorVector_[i]);
			i++;
		}
		return *this;
	}

	~TePieBar() {}

	void init(int themeId, TeDatabase* db)
	{
		themeId_ = themeId;
		db_ = db;
	}

	bool locate(TeCoord2D pt, double delta)
	{
		keyMove_.clear();
		string	TS = "AuxTheme" + Te2String(themeId_);
		string xmin = Te2String(pt.x()-delta);
		string xmax = Te2String(pt.x()+delta);
		string ymin = Te2String(pt.y()-delta);
		string ymax = Te2String(pt.y()+delta);

		TeDatabasePortal* portal = db_->getPortal();
		string sel = "SELECT SELKEY FROM " + TS + " WHERE ";
		sel += "PIEBARX > " + xmin + " AND ";
		sel += "PIEBARX < " + xmax + " AND ";
		sel += "PIEBARY > " + ymin + " AND ";
		sel += "PIEBARY < " + ymax;
		if(portal->query(sel) == false)
		{
			delete portal;
			return false;
		}

		bool b = portal->fetchRow(0);
		if(b == true)
			keyMove_ = portal->getData(0);
		delete portal;

		if(keyMove_.empty() == false)
			return true;
		return false;
	}

	void move(TeCoord2D pt)
	{
		if(keyMove_.empty() == true)
			return;

		string	x = Te2String(pt.x());
		string	y = Te2String(pt.y());
		string	TS = "AuxTheme" + Te2String(themeId_);
		string mover = "UPDATE " + TS + " SET PIEBARX = " + x + ", PIEBARY = " + y;
		mover += " WHERE SELKEY = '" + keyMove_ + "'";
		db_->execute(mover);
	}

	bool load()
	{
		TeDatabasePortal* portal = db_->getPortal();
		string sel = "SELECT * FROM piebars WHERE themeId = " + Te2String(themeId_);
		if(portal->query(sel))
		{
			bool b = portal->fetchRow(0);
			if(b == false)
			{
				delete portal;
				return false;
			}
			type_ = portal->getData("type");
			maxDiameter_ = portal->getDouble("maxDiameter");
			minDiameter_ = portal->getDouble("minDiameter");
			diameter_ = portal->getDouble("diameter"));
			string	attr = portal->getData("dimensionAttr");
			dimensionAttr_ = attr;
			maxHeight_ = portal->getDouble("maxHeight");
			minHeight_ = portal->getDouble("minHeight");
			width_ = portal->getDouble("width"));
			maxValue_ = portal->getDouble("maxValue");
			minValue_ = atof(portal->getData("minValue");
			keepDimension_ = portal->getDouble("keepDimension");
			inputType_ = portal->getDouble("inputType");
			int i;
			for(i=0; i<10; i++)
			{
				string attr = "attr" + Te2String(i+1);
				string vattr = portal->getData(attr);
				if(vattr.empty() == true)
					break;
				attrVector_.push_back(vattr);

				string red = "red" + Te2String(i+1);
				string green = "green" + Te2String(i+1);
				string blue = "blue" + Te2String(i+1);
				TeColor cor;
				cor.red_ = atoi(portal->getData(red));
				cor.green_ = atoi(portal->getData(green));
				cor.blue_ = atoi(portal->getData(blue));
				colorVector_.push_back(cor);
			}
			delete portal;
			return true;
		}
		delete portal;
		return false;
	}
	
	void save()
	{
		int	i;
		TeDatabasePortal* portal = db_->getPortal();
		bool b = portal->query("SELECT * FROM piebars");
		delete portal;
		if(b == false)
		{
			string criar = "CREATE TABLE piebars (themeId INTEGER,";
			criar += "type VARCHAR(16) DEFAULT NULL,";
			criar += "maxDiameter DOUBLE DEFAULT NULL,";
			criar += "minDiameter DOUBLE DEFAULT NULL,";
			criar += "diameter DOUBLE DEFAULT NULL,";
			criar += "dimensionAttr  VARCHAR(64) DEFAULT NULL,";
			criar += "maxHeight DOUBLE DEFAULT NULL,";
			criar += "minHeight DOUBLE DEFAULT NULL,";
			criar += "width DOUBLE DEFAULT NULL,";
			criar += "maxValue DOUBLE DEFAULT NULL,";
			criar += "minValue DOUBLE DEFAULT NULL,";
			criar += "keepDimension INTEGER DEFAULT 0,";
			criar += "inputType INTEGER DEFAULT 0,";
			for (i=0; i<10; i++)
			{
				criar += "attr" + Te2String(i+1) + " VARCHAR(64) DEFAULT NULL,";
				criar += "red" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
				criar += "green" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
				criar += "blue" + Te2String(i+1) + " INTEGER DEFAULT NULL,";
			}
			criar.erase(criar.size()-1, 1);
			criar += ")";
			db_->execute(criar);
		}

		string del = "DELETE FROM piebars WHERE themeId = " + Te2String(themeId_);
		db_->execute(del);

		if(attrVector_.size() == 0)
			return;
		string up = "INSERT INTO piebars (themeId, type, maxDiameter, ";
		up += "minDiameter, diameter, dimensionAttr, maxHeight, minHeight, ";
		up += "width, maxValue, minValue, keepDimension, inputType, ";
		for (i=0; i<attrVector_.size() && i<10; i++)
		{
			up += "attr" + Te2String(i+1) + ", ";
			up += "red" + Te2String(i+1) + ", ";
			up += "green" + Te2String(i+1) + ", ";
			up += "blue" + Te2String(i+1) + ", ";
		}
		up.erase(up.size()-2, 2);
		up += ")";

		up += " VALUES (" + Te2String(themeId_) + ", ";
		up += "'" + type_ + "', ";
		up += Te2String(maxDiameter_) + ", ";
		up += Te2String(minDiameter_) + ", ";
		up += Te2String(diameter_) + ", ";
		up += "'" + dimensionAttr_ + "', ";
		up += Te2String(maxHeight_) + ", ";
		up += Te2String(minHeight_) + ", ";
		up += Te2String(width_) + ", ";
		up += Te2String(maxValue_) + ", ";
		up += Te2String(minValue_) + ", ";
		up += Te2String(keepDimension_) + ", ";
		up += Te2String(inputType_) + ", ";
		for (i=0; i<attrVector_.size() && i<10; i++)
		{
			up += "'" + attrVector_[i] + "', ";
			up += Te2String(colorVector_[i].red_) + ", ";
			up += Te2String(colorVector_[i].green_) + ", ";
			up += Te2String(colorVector_[i].blue_) + ", ";
		}
		up.erase(up.size()-2, 2);
		up += ")";
		db_->execute(up);
	}
	
	void remove()
	{
		TeDatabasePortal* portal = db_->getPortal();
		bool b = portal->query("SELECT * FROM piebars");
		delete portal;
		if(b == false)
			return;

		string del = "DELETE FROM piebars WHERE themeId = " + Te2String(themeId_);
		db_->execute(del);
	}
};

#endif