Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] View of /trunk/gadget/migrationarea.cc
[mareframe] / trunk / gadget / migrationarea.cc Repository:
ViewVC logotype

View of /trunk/gadget/migrationarea.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (download) (annotate)
Mon Feb 10 17:09:07 2014 UTC (10 years, 4 months ago) by agomez
File size: 898 byte(s)
Initial version based on Gadget 2.2.00
#include "migrationarea.h"
#include "errorhandler.h"
#include "readfunc.h"
#include "rectangle.h"
#include "gadget.h"
#include "global.h"

MigrationArea::MigrationArea(CommentStream& infile, char* name, int id) {

  areaid = id;
  areaName = new char[strlen(name) + 1];
  strcpy(areaName, name);

  // read rectangles
  infile >> ws;
  if (countColumns(infile) != 4)
    handle.logFileMessage(LOGFAIL, "wrong number of columns in inputfile - should be 4");
  while (!infile.eof() && !infile.fail())
    rectangles.resize(new Rectangle(infile));

  int i;
  areaSize = 0.0;
  for (i = 0; i < rectangles.Size(); i++)
    areaSize += rectangles[i]->getArea();

  handle.logMessage(LOGMESSAGE, "Read migration area file - number of rectangles", rectangles.Size());
}

MigrationArea::~MigrationArea() {
  int i;
  delete[] areaName;
  for (i = 0; i < rectangles.Size(); i++)
    delete rectangles[i];
}

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge