marIsocontour.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "marIsocontour.h"
00020
00021
00022 marIsocontour::marIsocontour() {
00023 intmax = -1;
00024 }
00025
00026
00027 marIsocontour::~marIsocontour() {
00028
00029
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