marIsocontour.cpp

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003  Program:   wxMaracas
00004  Module:    $RCSfile: marIsocontour.cpp,v $
00005  Language:  C++
00006  Date:      $Date: 2009/05/14 13:55:08 $
00007  Version:   $Revision: 1.1 $
00008  
00009   Copyright: (c) 2002, 2003
00010   License:
00011   
00012    This software is distributed WITHOUT ANY WARRANTY; without even 
00013    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014    PURPOSE.  See the above copyright notice for more information.
00015    
00016 =========================================================================*/
00017 
00018 
00019 #include "marIsocontour.h"
00020 
00021 // ----------------------------------------------------------------------------
00022 marIsocontour::marIsocontour() {
00023         intmax = -1;
00024 }
00025 
00026 // ----------------------------------------------------------------------------
00027 marIsocontour::~marIsocontour() {
00028         
00029         //TODO - SACAR A UTILS
00030         for (int ind = 0; ind < listContour.size(); ind++)
00031         {
00032                 marPoint* p = listContour[ind];
00033                 listContour[ind] = NULL;
00034                 delete p;
00035                 
00036         }
00037         listContour.clear();
00038 
00039 }
00040 
00041 // ----------------------------------------------------------------------------
00042 marIsocontour::marIsocontour(double intmax) {
00043         this->intmax = intmax;
00044 }
00045         
00046 // ----------------------------------------------------------------------------
00047 void marIsocontour::getCG(double *x, double *y) {
00048    double sumax = 0;
00049    double sumay = 0;
00050 
00051         for (int i = 0; i < listContour.size(); i++){
00052                 double x, y;
00053                 getPoint(i, &x, &y);
00054                 sumax +=x;
00055                 sumay +=y;
00056         }
00057 
00058         sumax /= listContour.size();
00059         sumay /= listContour.size();
00060 
00061         *x = (double) sumax;
00062         *y = (double) sumay;
00063 }
00064 
00065 // ----------------------------------------------------------------------------
00066 void marIsocontour::insertPoint(double x, double y) {
00067         marPoint* p = new marPoint(x, y);
00068         listContour.push_back(p);
00069 }
00070 
00071 // ----------------------------------------------------------------------------
00072 void marIsocontour::getPoint(int i, double *x, double *y) {
00073         marPoint* p = listContour[i];
00074         *x = p->getX();
00075         *y = p->getY();
00076 
00077 }
00078 
00079 // ----------------------------------------------------------------------------
00080 void marIsocontour::setPoint(int i, double x, double y) {
00081         marPoint *p = listContour[i];
00082         p->setPoint(x, y);
00083 }
00084 
00085 // ----------------------------------------------------------------------------
00086 int marIsocontour::getSize() {
00087         return listContour.size();
00088 }
00089 
00090 // ----------------------------------------------------------------------------
00091 double marIsocontour::getMaxIntensity() {
00092         return intmax;
00093 }
00094 
00095 // ----------------------------------------------------------------------------
00096 int marIsocontour::getType() {
00097         return type;
00098 }
00099 
00100 // ----------------------------------------------------------------------------
00101 void marIsocontour::setType(int type) {
00102         this->type = type;
00103 }
00104 
00105 // ----------------------------------------------------------------------------
00106 int marIsocontour::getDir(int i) {
00107         marPoint* p = listContour[i];
00108         return p->getDirection();
00109 }
00110 
00111 // ----------------------------------------------------------------------------
00112 void marIsocontour::setDir(int i, int direction) {
00113         marPoint *p = listContour[i];
00114         p->setDirection(direction);
00115 }
00116 
00117 // ----------------------------------------------------------------------------
00118 void marIsocontour::setInside(int i, bool ins) {
00119         marPoint *p = listContour[i];
00120         p->setInside(ins);
00121 }
00122 
00123 // ----------------------------------------------------------------------------
00124 bool marIsocontour::getInside(int i) {
00125         marPoint* p = listContour[i];
00126         return p->getInside();
00127 }
00128 
00129 // ----------------------------------------------------------------------------
00130 void marIsocontour::setMaxIntensity(double intmax) {
00131         this->intmax = intmax;
00132 }
00133 
00134 // ----------------------------------------------------------------------------
00135 void marIsocontour::removeLastPoint() {
00136         listContour.pop_back();
00137 }
00138 

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1