/*========================================================================= Program: wxMaracas Module: $RCSfile: marIsocontour.cpp,v $ Language: C++ Date: $Date: 2009/05/14 13:55:08 $ Version: $Revision: 1.1 $ Copyright: (c) 2002, 2003 License: This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "marIsocontour.h" // ---------------------------------------------------------------------------- marIsocontour::marIsocontour() { intmax = -1; } // ---------------------------------------------------------------------------- marIsocontour::~marIsocontour() { //TODO - SACAR A UTILS for (int ind = 0; ind < listContour.size(); ind++) { marPoint* p = listContour[ind]; listContour[ind] = NULL; delete p; } listContour.clear(); } // ---------------------------------------------------------------------------- marIsocontour::marIsocontour(double intmax) { this->intmax = intmax; } // ---------------------------------------------------------------------------- void marIsocontour::getCG(double *x, double *y) { double sumax = 0; double sumay = 0; for (int i = 0; i < listContour.size(); i++){ double x, y; getPoint(i, &x, &y); sumax +=x; sumay +=y; } sumax /= listContour.size(); sumay /= listContour.size(); *x = (double) sumax; *y = (double) sumay; } // ---------------------------------------------------------------------------- void marIsocontour::insertPoint(double x, double y) { marPoint* p = new marPoint(x, y); listContour.push_back(p); } // ---------------------------------------------------------------------------- void marIsocontour::getPoint(int i, double *x, double *y) { marPoint* p = listContour[i]; *x = p->getX(); *y = p->getY(); } // ---------------------------------------------------------------------------- void marIsocontour::setPoint(int i, double x, double y) { marPoint *p = listContour[i]; p->setPoint(x, y); } // ---------------------------------------------------------------------------- int marIsocontour::getSize() { return listContour.size(); } // ---------------------------------------------------------------------------- double marIsocontour::getMaxIntensity() { return intmax; } // ---------------------------------------------------------------------------- int marIsocontour::getType() { return type; } // ---------------------------------------------------------------------------- void marIsocontour::setType(int type) { this->type = type; } // ---------------------------------------------------------------------------- int marIsocontour::getDir(int i) { marPoint* p = listContour[i]; return p->getDirection(); } // ---------------------------------------------------------------------------- void marIsocontour::setDir(int i, int direction) { marPoint *p = listContour[i]; p->setDirection(direction); } // ---------------------------------------------------------------------------- void marIsocontour::setInside(int i, bool ins) { marPoint *p = listContour[i]; p->setInside(ins); } // ---------------------------------------------------------------------------- bool marIsocontour::getInside(int i) { marPoint* p = listContour[i]; return p->getInside(); } // ---------------------------------------------------------------------------- void marIsocontour::setMaxIntensity(double intmax) { this->intmax = intmax; } // ---------------------------------------------------------------------------- void marIsocontour::removeLastPoint() { listContour.pop_back(); }