#include #include #include #include #include #include ; #include ; #include //**************************************** double ZVal( double X1, double Y1, double Z1, double X2, double Y2, double Z2, double X3, double Y3, double Z3, double X, double Y ) { double denom = (X1*Y2 - X1*Y3 - X2*Y1 + X2*Y3 + X3*Y1 - X3*Y2); if(denom == 0 ) { return 0; } double Z = ( X*(Z1*Y2 - Z1*Y3 - Y1*Z2 + Y1*Z3 + Z2*Y3 - Y2*Z3) + Y*( - Z1*X2+ Z1*X3 + X1*Z2 - X1*Z3 + X2*Z3 - X3*Z2) + Z1*X2*Y3 - Z1*X3*Y2 - X1*Z2*Y3 + X1*Y2*Z3 - X2*Y1*Z3 + X3*Y1*Z2 ) /denom; return Z; } double Round(double x) { double xx = floor(x); if( (x - xx)<0.5 ) { return xx; } else { return ceil(x); } } //**************************************** //ColorScale colscal(16, -100, 100); //extern ColorScale colscal(16,-4000,4000); extern colscal; TArray; //***************** stream operators ************************* ostream& operator << (ostream& stm, const Color& c) { stm<<"COLOR"<<","<> (istream& istm, Color& c) { char tmpc; int i; //eating initial string // C O L O R , istm>>tmpc>>tmpc>>tmpc>>tmpc>>tmpc>>tmpc; istm >>c._r>>tmpc >>c._g>>tmpc >>c._b; return istm; } //--------------- //friend ostream& operator << (ostream& stm, const ColorScale& cs) { stm<> (istream& istm, ColorScale& cs) { const long s = cs.Size(); //cout<> ----"; int size=-1; //long size=-1; istm>>size; if( 0>cs.p()[i]; } else {} } } else { //cout<ValToCol(tmpv.u() ); } Brusch b(s.DC(), col.r(), col.g(), col.b() ); //Brusch b(s.DC(), 255, 255, 255 ); Value val = _raster.GetEntry(i,ii); fil< r.right/2) && (p.y < r.bottom/2) ) _balloon.ShowBalloon(pp.x, pp.y, 30, buf, BLOWERLEFT ); if( (p.x < r.right/2) && (p.y > r.bottom/2) ) _balloon.ShowBalloon(pp.x, pp.y, 30, buf, BUPPERRIGHT ); if( (p.x > r.right/2) && (p.y > r.bottom/2) ) _balloon.ShowBalloon(pp.x, pp.y, 30, buf, BUPPERLEFT ); //Neighbour investigation double dx = ( _raster.dimx()*p.x)/r.right ; double dy = ( _raster.dimy()*(r.bottom - p.y) )/r.bottom ; double x1 = Round(dx); double y1 = Round(dx); } ElectrodesWindow::RButtonDown(WORD wParam, LONG lParam, ColorScale &colscal ) { POINT p; p.x = LOWORD (lParam) ; p.y = HIWORD (lParam) ; RECT r; GetClientRect(hwnd(),(LPRECT)&r); int ixx, iyy; ixx = 1+( _raster.dimx()*p.x)/r.right ; iyy = 1+( _raster.dimy()*(r.bottom - p.y) )/r.bottom ; if( ixx < 0 || _raster.dimx() < ixx) { MessageBeep(0); return 0; } if( iyy < 0 || _raster.dimy() < iyy) { MessageBeep(0); return 0; } Value v = _raster.GetEntry(ixx,iyy); if( v.status() == 1 ) { MessageBeep(0); return 0; } int cnum = colscal.ValToColNum(v.u()); Color col = colscal.GetColor(cnum); CtrlColorDialog ddd(1, Main::hInstance, col.r(),col.g(),col.b()); int dresult = PerformDialog(hwnd(), &ddd); if(dresult == CTRLCOLORDIALOG_OK) { MessageBeep(0); colscal.SetColor( cnum, ddd.r(), ddd.g(), ddd.b() ); } } ElectrodesWindow::SaveRasterAsContourGraphics(char * path) { ofstream file(path); file<<"(*^"<< endl<<"::[ frontEndVersion = " <<'"'<<"Microsoft Windows Mathematica Notebook Front End Version 2.1"<<'"'<<';'<< endl<<" microsoftWindowsStandardFontEncoding;]"; file<