[mareframe] Annotation of /trunk/gadget/migrationarea.cc
Annotation of /trunk/gadget/migrationarea.cc
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
1 : |
agomez |
1 |
#include "migrationarea.h" |
2 : |
|
|
#include "errorhandler.h" |
3 : |
|
|
#include "readfunc.h" |
4 : |
|
|
#include "rectangle.h" |
5 : |
|
|
#include "gadget.h" |
6 : |
|
|
#include "global.h" |
7 : |
|
|
|
8 : |
|
|
MigrationArea::MigrationArea(CommentStream& infile, char* name, int id) {
|
9 : |
|
|
|
10 : |
|
|
areaid = id;
|
11 : |
|
|
areaName = new char[strlen(name) + 1];
|
12 : |
|
|
strcpy(areaName, name);
|
13 : |
|
|
|
14 : |
|
|
// read rectangles
|
15 : |
|
|
infile >> ws;
|
16 : |
|
|
if (countColumns(infile) != 4)
|
17 : |
|
|
handle.logFileMessage(LOGFAIL, "wrong number of columns in inputfile - should be 4");
|
18 : |
|
|
while (!infile.eof() && !infile.fail())
|
19 : |
|
|
rectangles.resize(new Rectangle(infile));
|
20 : |
|
|
|
21 : |
|
|
int i;
|
22 : |
|
|
areaSize = 0.0;
|
23 : |
|
|
for (i = 0; i < rectangles.Size(); i++)
|
24 : |
|
|
areaSize += rectangles[i]->getArea();
|
25 : |
|
|
|
26 : |
|
|
handle.logMessage(LOGMESSAGE, "Read migration area file - number of rectangles", rectangles.Size());
|
27 : |
|
|
}
|
28 : |
|
|
|
29 : |
|
|
MigrationArea::~MigrationArea() {
|
30 : |
|
|
int i;
|
31 : |
|
|
delete[] areaName;
|
32 : |
|
|
for (i = 0; i < rectangles.Size(); i++)
|
33 : |
|
|
delete rectangles[i];
|
34 : |
|
|
}
|
|