Main Page   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

MDITwoLevel.h

00001 //---------------------------------------------------------------------------
00002 
00003 #ifndef MDITwoLevelH
00004 #define MDITwoLevelH
00005 //---------------------------------------------------------------------------
00006 #include <Classes.hpp>
00007 #include <Controls.hpp>
00008 #include <StdCtrls.hpp>
00009 #include <Forms.hpp>
00010 #include <ComCtrls.hpp>
00011 #include <Menus.hpp>
00012 #include <Dialogs.hpp>
00013 #include <Printers.hpp>
00014 #include <Clipbrd.hpp>
00015 #include <ExtCtrls.hpp>
00016 #include <ActnCtrls.hpp>
00017 #include <ActnMan.hpp>
00018 #include <CustomizeDlg.hpp>
00019 #include <ToolWin.hpp>
00020 #include <Grids.hpp>
00021 #include <ValEdit.hpp>
00022 #include <Buttons.hpp>
00023 #include <gl\gl.h>
00024 #include <gl\glu.h>
00025 #include "data.h"
00026 #include "vector.h"
00027 #include "MDITransfer.h"
00028 //---------------------------------------------------------------------------
00029 
00034 #define PREVIEW_SIZE    128
00035 
00049 class TTwoLevelForm : public TForm
00050 {
00051 __published:    // IDE-managed Components
00052     TPanel *Hauptpanel;
00053     TBevel *Bevel;
00054     TGroupBox *GroupBox;
00055     TTrackBar *TbResolution;
00056     TLabel *LResolution;
00057     TCheckBox *CbWindowSize;
00058     TCheckBox *CbResize;
00059     TPageControl *PageControl1;
00060     TTabSheet *TsPreview;
00061     TTabSheet *TsCommon;
00062     TCheckBox *CbAutoUpdate;
00063     TCheckBox *CbThreeLinear;
00064     TLabel *Label1;
00065     TLabel *LRotation;
00066     TLabel *Label2;
00067     TLabel *LDist;
00068     TTimer *DrawingTimer;
00069     TLabel *Label3;
00070     TLabel *Label4;
00071     TLabel *LProgress;
00072     TEdit *EmaxTime;
00073     TSpeedButton *SbmaxTime;
00074     TPanel *PmaxTime;
00075     TTrackBar *TbmaxTime;
00076     TPanel *PThres;
00077     TTrackBar *TbThres;
00078     TLabel *Label6;
00079     TEdit *EThres;
00080     TSpeedButton *SbThres;
00081     TTabSheet *TsMIP;
00082     TLabel *Label7;
00083     TLabel *Label8;
00084     TLabel *Label9;
00085     TTabSheet *TsNPR;
00086     TLabel *Label10;
00087     TTabSheet *TsAverage;
00088     TLabel *Label11;
00089     TTabSheet *TsFirstHit;
00090     TTabSheet *TsTransparent;
00091     TLabel *Label12;
00092     TLabel *Label13;
00093     TLabel *LTime;
00094     TLabel *Label14;
00095     TTabSheet *TabSheet1;
00096     TLabel *Label15;
00097     TLabel *Label17;
00098     TPanel *PTwoLevelAlpha;
00099     TTrackBar *TbTwoLevelAlpha;
00100     TEdit *EFHAlpha;
00101     TSpeedButton *SbFHAlpha;
00102     TPanel *PFHThres;
00103     TTrackBar *TbFHThres;
00104     TLabel *Label18;
00105     TEdit *EFHThres;
00106     TSpeedButton *SbFHThres;
00107     TListBox *LbFirstHit;
00108     TLabel *Label19;
00109     TLabel *Label20;
00110     TEdit *EMIPAlpha;
00111     TSpeedButton *SbMIPAlpha;
00112     TLabel *Label21;
00113     TListBox *LbMIP;
00114     TLabel *Label24;
00115     TEdit *EAverageAlpha;
00116     TSpeedButton *SbAverageAlpha;
00117     TLabel *Label25;
00118     TListBox *LbAverage;
00119     TLabel *Label26;
00120     TEdit *ETransparentAlpha;
00121     TSpeedButton *SbTransparentAlpha;
00122     TLabel *Label27;
00123     TListBox *LbTransparent;
00124     TLabel *Label22;
00125     TEdit *ENPRAlpha;
00126     TSpeedButton *SbNPRAlpha;
00127     TLabel *Label23;
00128     TListBox *LbNPR;
00129     TLabel *Label28;
00130     TEdit *EAmbient;
00131     TSpeedButton *SbAmbient;
00132     TShape *SAmbient;
00133     TLabel *Label29;
00134     TShape *SLight;
00135     TEdit *ELight;
00136     TSpeedButton *SbLight;
00137     TPanel *PAmbient;
00138     TTrackBar *TbAmbient;
00139     TPanel *PLight;
00140     TTrackBar *TbLight;
00141     TColorDialog *ColorDialog1;
00142     TTrackBar *TbPower;
00143     TLabel *Label30;
00144     TLabel *LPower;
00145     TLabel *Label31;
00146     TLabel *LLightPos;
00147     TLabel *Label5;
00148     TLabel *Lrpc;
00149     TLabel *Label32;
00150     TTrackBar *TbNPRPower;
00151     TLabel *LNPRPower;
00152     TCheckBox *CbSinus;
00153     TPanel *PButtons;
00154     TSpeedButton *SbStop;
00155     TPanel *PRef;
00156     TTrackBar *TbRef;
00157     TLabel *Label16;
00158     TEdit *EMIPRef;
00159     TSpeedButton *SbMIPRef;
00160     TLabel *Label33;
00161     TEdit *ENPRRef;
00162     TSpeedButton *SbNPRRef;
00163     TLabel *Label34;
00164     TEdit *EAverageRef;
00165     TSpeedButton *SbAverageRef;
00166     TSpeedButton *SbSaveJpg;
00167     TSaveDialog *SaveDialogImage;
00168     TSpeedButton *SbStart;
00169     void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
00170     void __fastcall FormCreate(TObject *Sender);
00171     void __fastcall FormResize(TObject *Sender);
00172     void __fastcall FormPaint(TObject *Sender);
00173     void __fastcall FormActivate(TObject *Sender);
00174     void __fastcall CbWindowSizeClick(TObject *Sender);
00175     void __fastcall TbResolutionChange(TObject *Sender);
00176     void __fastcall FormClick(TObject *Sender);
00177     void __fastcall FormMouseDown(TObject *Sender, TMouseButton Button,
00178       TShiftState Shift, int X, int Y);
00179     void __fastcall FormMouseMove(TObject *Sender, TShiftState Shift,
00180       int X, int Y);
00181     void __fastcall FormMouseUp(TObject *Sender, TMouseButton Button,
00182       TShiftState Shift, int X, int Y);
00183     void __fastcall TbThresChange(TObject *Sender);
00184     void __fastcall CbResizeClick(TObject *Sender);
00185     void __fastcall DrawingTimerTimer(TObject *Sender);
00186     void __fastcall Button1Click(TObject *Sender);
00187     void __fastcall TbmaxTimeChange(TObject *Sender);
00188     void __fastcall EmaxTimeChange(TObject *Sender);
00189     void __fastcall TbmaxTimeExit(TObject *Sender);
00190     void __fastcall SbmaxTimeClick(TObject *Sender);
00191     void __fastcall SbThresClick(TObject *Sender);
00192     void __fastcall EThresChange(TObject *Sender);
00193     void __fastcall TbThresExit(TObject *Sender);
00194     void __fastcall PageControl1Changing(TObject *Sender,
00195       bool &AllowChange);
00196     void __fastcall SbFHAlphaClick(TObject *Sender);
00197     void __fastcall TbTwoLevelAlphaChange(TObject *Sender);
00198     void __fastcall EFHAlphaChange(TObject *Sender);
00199     void __fastcall EFHThresChange(TObject *Sender);
00200     void __fastcall SbFHThresClick(TObject *Sender);
00201     void __fastcall LbFirstHitClick(TObject *Sender);
00202     void __fastcall LbFirstHitDblClick(TObject *Sender);
00203     void __fastcall TbFHThresChange(TObject *Sender);
00204     void __fastcall TsFirstHitShow(TObject *Sender);
00205     void __fastcall SbMIPAlphaClick(TObject *Sender);
00206     void __fastcall LbMIPClick(TObject *Sender);
00207     void __fastcall EMIPAlphaChange(TObject *Sender);
00208     void __fastcall LbMIPDblClick(TObject *Sender);
00209     void __fastcall TsMIPShow(TObject *Sender);
00210     void __fastcall ENPRAlphaChange(TObject *Sender);
00211     void __fastcall SbNPRAlphaClick(TObject *Sender);
00212     void __fastcall LbNPRClick(TObject *Sender);
00213     void __fastcall LbNPRDblClick(TObject *Sender);
00214     void __fastcall TsNPRShow(TObject *Sender);
00215     void __fastcall EAverageAlphaChange(TObject *Sender);
00216     void __fastcall SbAverageAlphaClick(TObject *Sender);
00217     void __fastcall LbAverageClick(TObject *Sender);
00218     void __fastcall LbAverageDblClick(TObject *Sender);
00219     void __fastcall TsAverageShow(TObject *Sender);
00220     void __fastcall ETransparentAlphaChange(TObject *Sender);
00221     void __fastcall SbTransparentAlphaClick(TObject *Sender);
00222     void __fastcall LbTransparentClick(TObject *Sender);
00223     void __fastcall LbTransparentDblClick(TObject *Sender);
00224     void __fastcall TsTransparentShow(TObject *Sender);
00225     void __fastcall EAmbientChange(TObject *Sender);
00226     void __fastcall SAmbientMouseUp(TObject *Sender,
00227       TMouseButton Button, TShiftState Shift, int X, int Y);
00228     void __fastcall ELightChange(TObject *Sender);
00229     void __fastcall SbAmbientClick(TObject *Sender);
00230     void __fastcall SLightMouseUp(TObject *Sender, TMouseButton Button,
00231       TShiftState Shift, int X, int Y);
00232     void __fastcall SbLightClick(TObject *Sender);
00233     void __fastcall TbAmbientChange(TObject *Sender);
00234     void __fastcall TbLightChange(TObject *Sender);
00235     void __fastcall TbPowerChange(TObject *Sender);
00236     void __fastcall TbNPRPowerChange(TObject *Sender);
00237     void __fastcall CbSinusClick(TObject *Sender);
00238     void __fastcall SbMIPRefClick(TObject *Sender);
00239     void __fastcall EMIPRefChange(TObject *Sender);
00240     void __fastcall TbRefChange(TObject *Sender);
00241     void __fastcall SbNPRRefClick(TObject *Sender);
00242     void __fastcall ENPRRefChange(TObject *Sender);
00243     void __fastcall SbAverageRefClick(TObject *Sender);
00244     void __fastcall EAverageRefChange(TObject *Sender);
00245     void __fastcall SbStopClick(TObject *Sender);
00246     void __fastcall SbSaveJpgClick(TObject *Sender);
00247     void __fastcall SbStartClick(TObject *Sender);
00248 private:        // User declarations
00249     HDC hdc;
00250     HGLRC hrc;
00251     int PixelFormat;
00252     GLfloat w, h, wh;
00253     bool _formCreate;
00257     int _rotx, _roty, _rotz;
00258     int _startX, _startY;
00259     double _lightX, _lightY;
00260     int _dist;
00261     int _rowsize, _pagesize;
00265     int _actualBit;
00269     bool _traging;
00273     bool _rightButton;
00277     int _resolution;
00278 
00280 
00284     int _pic_size;
00288     int _oldres;
00294     int _progress;
00298     bool _stopIt;
00306     int _actres;
00310     int _actposx;
00314     int _actposy;
00321     int _rpc;
00325     float _maxTime;
00329     vectord _viewx;
00333     vectord _viewy;
00337     vectord _viewz;
00341     vectord _center;
00345     double _l2;
00349     double _step;
00353     vectord _start;
00357     vectord _lightPos;
00361     vectord _lightDir;
00362 
00366     int _thres;
00367 
00369 
00372     double _ambient;
00376     rgb _ambientCol;
00380     double _light;
00384     rgb _lightCol;
00388     int _power;
00392     bool _sinus;
00393 
00397     TDateTime _startTime;
00398 
00402     TEdit *_TwoLevelAlphaEdit;
00403 
00407     TEdit *_RefEdit;
00408 
00410 
00413     double _alphaFH;
00417     int _thresFH;
00425     int _firstHit;
00426 
00428 
00431     double _alphaMIP;
00435     int _MIP;
00439     double _MIPref;
00440 
00442 
00445     double _alphaNPR;
00449     int _NPR;
00453     double _NPRref;
00454 
00456 
00459     double _alphaNR;
00463     int _NR;
00467     int _NPRpower;
00468 
00470 
00473     double _alphaAverage;
00477     int _Average;
00481     double _Averageref;
00482 
00484 
00487     double _alphaTransparent;
00491     int _Transparent;
00492 
00493     void __fastcall PaintGL();
00494     void __fastcall PrepareGLWindow();
00495 
00496 
00500     int __fastcall _getFirstBitIndex(int val);
00505     int __fastcall _getNextBitIndex(int val);
00510     void __fastcall _resize();
00511 
00518     void inline __fastcall _render();
00519 
00532     void inline __fastcall _draw(rgb &val, int x, int y, int step);
00536     void inline __fastcall _resetRenderer();
00540     void inline __fastcall _renderPreview();
00547     bool inline __fastcall _renderImage();
00551     bool inline __fastcall _isInside(vectorf & v);
00555     bool inline __fastcall _isInside(vectord & v);
00560     float inline __fastcall _getValue(vectorf & v);
00566     double inline __fastcall _getValue(const vectord & v);
00571     double inline __fastcall _getGradLength(const vectord & v);
00576     vectorf inline __fastcall _getGradient(vectorf & v);
00585     vectord inline __fastcall _getGradient(vectord & v);
00586 
00595     void inline __fastcall _calcColor(rgb& col, vectord &normal,
00596                                       vectord& view, vectord& light);
00597 
00601     void _setupTLAlpha(TSpeedButton* sb, TEdit* e, TTabSheet* ts, double f);
00602 
00606     void _setupRef(TSpeedButton* sb, TEdit* e, TTabSheet* ts, double f);
00607 
00615     void _setupListBox(TListBox* lb, int & rc);
00616 
00621     void __fastcall _unsetBitInAllRCs(int idx);
00622 
00623 public:         // User declarations
00624     __fastcall TTwoLevelForm(TComponent* Owner);
00625     void __fastcall SetPixelFormatDescriptor();
00626 };
00627 //---------------------------------------------------------------------------
00628 extern PACKAGE TTwoLevelForm *TwoLevelForm;
00629 //---------------------------------------------------------------------------
00630 #endif

Generated on Thu Jan 23 06:17:39 2003 for Vol by doxygen1.2.18