www.pudn.com > MFC_OGLTest1.rar > MFC_OGLTestView.cpp, change:2007-11-13,size:19319b


// MFC_OGLTestView.cpp : implementation of the CMFC_OGLTestView class 
// 
 
#include "stdafx.h" 
#include "MFC_OGLTest.h" 
 
#include "MFC_OGLTestDoc.h" 
#include "MFC_OGLTestView.h" 
#include "ReadAndWriteFun.h" 
#include "SelectTypeDlg.h" 
#include "PixelSite.h" 
#include"gl\gl.h" 
#include"gl\glu.h" 
#include"gl\glaux.h" 
#include<math.h> 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView 
 
IMPLEMENT_DYNCREATE(CMFC_OGLTestView, CView) 
 
BEGIN_MESSAGE_MAP(CMFC_OGLTestView, CView) 
	//{{AFX_MSG_MAP(CMFC_OGLTestView) 
	ON_WM_SIZE() 
	ON_WM_ERASEBKGND() 
	ON_WM_DESTROY() 
	ON_COMMAND(ID_FILE_OPEN, OnFileOpen) 
	//}}AFX_MSG_MAP 
	// Standard printing commands 
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) 
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView construction/destruction 
 
CMFC_OGLTestView::CMFC_OGLTestView() 
{ 
	// TODO: add construction code here 
    xrotate=45.0f; 
    yrotate=-90.0f; 
    zrotate=-90.0f;  
    xOrg=0, xMax=70; 
    yOrg=0, yMax=70; 
    zOrg=0, zMax=70; 
    a=true; 
	b=false; 
	rc=false; 
	vc=false; 
	PI=3.1415926; 
    SAElevation = new float[20]; 
} 
 
CMFC_OGLTestView::~CMFC_OGLTestView() 
{ 
} 
 
BOOL CMFC_OGLTestView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return CView::PreCreateWindow(cs); 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView drawing 
 
void CMFC_OGLTestView::OnDraw(CDC* pDC) 
{ 
	CMFC_OGLTestDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
    int x = ::GetSystemMetrics(SM_CXSCREEN); 
	int y = ::GetSystemMetrics(SM_CYSCREEN); 
    ::glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); 
 	 
	if(rc) 
	{ 
		PixelSite* site = new PixelSite; 
		site->GetPixel(); 
		glBegin(GL_POINTS);									 
 
         
		//set Background 
        glColor3f(0.0f,0.0f,0.0f); 
 
		//draw the inital PPI which is the first on the elevation of 0.5 
        for(int j=0;j<360;j++) 
		{ 
		   for(int i=0;i<460;i++) 
		   { 
	          if((int)(SARData[0][j][i])>0&&(int)(SARData[0][j][i])<20) 
			  { 
			       
				  glColor3f(0.0f,0.0f,1.0f); 
				  glVertex3f(0.0f+(float)(site->XData[j][i]), 0.0f+(float)(site->YData[j][i]), 0.0f+(float)(site->ZData[i]));					 
		    
			  }else if((int)(SARData[0][j][i])>=20&&(int)(SARData[0][j][i])<50){ 
	              glColor3f(1.0f,1.0f,0.0f); 
				  glVertex3f(0.0f+(float)(site->XData[j][i]), 0.0f+(float)(site->YData[j][i]), 0.0f+(float)(site->ZData[i]));		   
			  }else if((int)(SARData[0][j][i])>=50&&(int)(SARData[0][j][i])<100){ 
	              glColor3f(1.0f,0.0f,0.0f); 
				  glVertex3f(0.0f+(float)(site->XData[j][i]), 0.0f+(float)(site->YData[j][i]), 0.0f+(float)(site->ZData[i]));		   
			  } 
		   } 
		} 
         
         
		//draw the inital PPI which is the second on the elevation of 1.5 
        for(int j1=0;j1<360;j1++) 
		{ 
		   for(int i1=0;i1<460;i1++) 
		   { 
	          if((int)(SARData[1][j1][i1])>0&&(int)(SARData[1][j1][i1])<20) 
			  { 
			       
				  glColor3f(0.0f,0.0f,1.0f); 
				  glVertex3f(0.0f+(float)(site->X1Data[j1][i1]), 0.0f+(float)(site->Y1Data[j1][i1]), 0.0f+(float)(site->Z1Data[i1]));					 
		    
			  }else if((int)(SARData[1][j1][i1])>=20&&(int)(SARData[1][j1][i1])<50){ 
	              glColor3f(1.0f,1.0f,0.0f); 
				  glVertex3f(0.0f+(float)(site->X1Data[j1][i1]), 0.0f+(float)(site->Y1Data[j1][i1]), 0.0f+(float)(site->Z1Data[i1]));		   
			  }else if((int)(SARData[1][j1][i1])>=50&&(int)(SARData[1][j1][i1])<100){ 
	              glColor3f(1.0f,0.0f,0.0f); 
				  glVertex3f(0.0f+(float)(site->X1Data[j1][i1]), 0.0f+(float)(site->Y1Data[j1][i1]), 0.0f+(float)(site->Z1Data[i1]));		   
			  } 
		   } 
		} 
 
 
 
		//start to insert value 
 
        //start to insert value of the PPI 
        //get the insert value of the PPI which elevation is 0.5 
		int midvalue[360][460]; 
	    for(int c=0;c<360;c++) 
		{ 
		   for(int b=0;b<460;b++) 
		   { 
				midvalue[c][b]=0; 
		   } 
		} 
		for(int g=0;g<360;g++) 
		{ 
			for(int h=0;h<460;h++) 
			{ 
				if((g+1)==360) 
				{ 
                     midvalue[359][h]=(int)(SARData[0][359][h]+SARData[0][0][h])/2; 
				}else{ 
					 midvalue[g][h]=(int)(SARData[0][g][h]+SARData[0][g+1][h])/2; 
				} 
			} 
		} 
/* 
        //get the insert value of the PPI which elevation is 1.5 
		int midvalue1[360][460]; 
	    for(int c1=0;c1<360;c1++) 
		{ 
		   for(int b1=0;b1<460;b1++) 
		   { 
				midvalue1[c1][b1]=0; 
		   } 
		} 
		for(int g1=0;g1<360;g1++) 
		{ 
			for(int h1=0;h1<460;h1++) 
			{ 
				if((g1+1)==360) 
				{ 
                     midvalue1[359][h1]=(int)(SARData[1][359][h1]+SARData[1][0][h1])/2; 
				}else{ 
					 midvalue1[g1][h1]=(int)(SARData[1][g1][h1]+SARData[1][g1+1][h1])/2; 
				} 
			} 
		} 
*/ 
        //draw the insert value of the PPI which elevation is 0.5 on the right image 
		for(int m=300;m>-300;m--) 
			 { 
				 for(int n=0;n<400;n++) 
				 { 
                      for(int k=1;k<=180;k++) 
					  { 
						  if(site->cosvalue[300-m][n]>cos(k*PI/180)&&site->cosvalue[300-m][n]<cos((k-1)*PI/180)) 
						  { 
							  for(int l=1;l<460;l++) 
							  { 
							      if(site->distance[300-m][n]>=((l-1)*cos(30*PI/180))&&site->distance[300-m][n]<=l*cos(30*PI/180)) 
								  { 
								     if(midvalue[k-1][l]==0) 
									 { 
				                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f(0.0f+(float)n, 0.0f+(float)m, 0.0f+(float)(sqrt((n-0)*(n-0)+(m-0)*(m-0))*tan((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>0&&midvalue[k-1][l]<=20){ 
			                           glColor3f(0.0f,0.0f,1.0f); 
				                       glVertex3f(0.0f+(float)n, 0.0f+(float)m, 0.0f+(float)(sqrt((n-0)*(n-0)+(m-0)*(m-0))*tan((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>=20&&midvalue[k-1][l]<=50){ 
			                           glColor3f(1.0f,1.0f,0.0f); 
				                       glVertex3f(0.0f+(float)n, 0.0f+(float)m, 0.0f+(float)(sqrt((n-0)*(n-0)+(m-0)*(m-0))*tan((30)*PI/180))); 
									 } 
								  } 
							  } 
						  } 
					  } 
				 } 
			 } 
 
        //draw the insert value of the PPI which elevation is 0.5 on the left image 
        /*for(int m1=-300;m1<300;m1++) 
			 { 
				 for(int n1=-400;n1<0;n1++) 
				 { 
                      for(int k=180;k<360;k++) 
					  { 
						  if((m1-0)/sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))>cos(k*PI/180)&&(m1-0)/sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))<cos((k+1)*PI/180)) 
						  { 
							  for(int l=1;l<460;l++) 
							  { 
							      if(sqrt((n1-x)*(n1-x)+(m1-y)*(m1-y))>=(l-1)&&sqrt((n1-x)*(n1-x)+(m1-y)*(m1-y))<=l) 
								  { 
								     if(midvalue[k][l]==0) 
									 { 
				                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>0&&midvalue[k-1][l]<=20){ 
			                           glColor3f(0.0f,0.0f,1.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>=20&&midvalue[k-1][l]<=30){ 
			                           glColor3f(1.0f,1.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>=30&&midvalue[k-1][l]<=50){ 
									   glColor3f(0.0f,1.0f,1.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else if(midvalue[k-1][l]>50){ 
									   glColor3f(1.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else{ 
                                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 } 
								  } 
							  } 
						  } 
					  } 
				 } 
			 }*/ 
 
 
        //draw the insert value of the PPI which elevation is 1.5 on the right image 
		for(int m2=300;m2>-300;m2--) 
			 { 
				 for(int n2=0;n2<400;n2++) 
				 { 
                      for(int k=1;k<=180;k++) 
					  { 
						  if(site->cosvalue[300-m2][n2]>cos(k*PI/180)&&site->cosvalue[300-m2][n2]<cos((k-1)*PI/180)) 
						  { 
							  for(int l=1;l<460;l++) 
							  { 
							      if(site->distance[300-m2][n2]>=((l-1)*cos(45*PI/180))&&site->distance[300-m2][n2]<=l*cos(45*PI/180)) 
								  { 
								     if(midvalue[k-1][l]==0) 
									 { 
				                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f(0.0f+(float)n2, 0.0f+(float)m2, 0.0f+(float)(sqrt((n2-0)*(n2-0)+(m2-0)*(m2-0))*tan((45)*PI/180))); 
									 }else if(midvalue[k-1][l]>0&&midvalue[k-1][l]<=20){ 
			                           glColor3f(0.0f,0.0f,1.0f); 
				                       glVertex3f(0.0f+(float)n2, 0.0f+(float)m2, 0.0f+(float)(sqrt((n2-0)*(n2-0)+(m2-0)*(m2-0))*tan((45)*PI/180))); 
									 }else if(midvalue[k-1][l]>=20&&midvalue[k-1][l]<=50){ 
			                           glColor3f(1.0f,1.0f,0.0f); 
				                       glVertex3f(0.0f+(float)n2, 0.0f+(float)m2, 0.0f+(float)(sqrt((n2-0)*(n2-0)+(m2-0)*(m2-0))*tan((45)*PI/180))); 
									 } 
								  } 
							  } 
						  } 
					  } 
				 } 
			 } 
 
        //draw the insert value of the PPI which elevation is 1.5 on the left image 
        /*for(int m1=-300;m1<300;m1++) 
			 { 
				 for(int n1=-400;n1<0;n1++) 
				 { 
                      for(int k=180;k<360;k++) 
					  { 
						  if((m1-0)/sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))>cos(k*PI/180)&&(m1-0)/sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))<cos((k+1)*PI/180)) 
						  { 
							  for(int l=1;l<460;l++) 
							  { 
							      if(sqrt((n1-x)*(n1-x)+(m1-y)*(m1-y))>=(l-1)&&sqrt((n1-x)*(n1-x)+(m1-y)*(m1-y))<=l) 
								  { 
								     if(midvalue1[k][l]==0) 
									 { 
				                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((45)*PI/180))); 
									 }else if(midvalue1[k-1][l]>0&&midvalue1[k-1][l]<=20){ 
			                           glColor3f(0.0f,0.0f,1.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((45)*PI/180))); 
									 }else if(midvalue1[k-1][l]>=20&&midvalue1[k-1][l]<=30){ 
			                           glColor3f(1.0f,1.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((45)*PI/180))); 
									 }else if(midvalue1[k-1][l]>=30&&midvalue1[k-1][l]<=50){ 
									   glColor3f(0.0f,1.0f,1.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((45)*PI/180))); 
									 }else if(midvalue1[k-1][l]>50){ 
									   glColor3f(1.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 }else{ 
                                       glColor3f(0.0f,0.0f,0.0f); 
				                       glVertex3f((float)n1, (float)m1, 0.0f+(float)(sqrt((n1-0)*(n1-0)+(m1-0)*(m1-0))*sin((30)*PI/180))); 
									 } 
								  } 
							  } 
						  } 
					  } 
				 } 
			 }*/ 
 
 
		//start to insert value of the CAPPI 
		//get the insert value of the CAPPI 
/*		int CAmidvalue[360][40]; 
		for(int ag1=0;ag1<360;ag1++) 
		{ 
			for(int he1=0;he1<40;he1++) 
			{ 
				CAmidvalue[ag1][he1]=0; 
			} 
		} 
		for(int ag=0;ag<360;ag++) 
		{ 
		   for(int he=0;he<40;he++) 
		   { 
			  int l1 = (int)(he/sin(30*PI/180)); 
			  int l2 = (int)(he/sin(45*PI/180)); 
			  CAmidvalue[ag][he] = (midvalue[ag][l1]+midvalue1[ag][l2])/2; 
		   } 
			 
		} 
 
		//draw the insert value of CAPPI on the right image 
		//draw the insert value of the CAPPI on the right image 
        for(int riy=300;riy>-300;riy--) 
		{ 
			for(int rix=0;rix<400;rix++) 
			{ 
				for(int i=1;i<=180;i++) 
				{ 
                    if(site->cosvalue[300-riy][rix]>cos(i*PI/180)&&site->cosvalue[300-riy][rix]<cos((i-1)*PI/180)) 
					{ 
						for(int k=0;k<40;k++) 
						{ 
                            if(site->distance[300-riy][rix]>=k/tan(45*PI/180)&&site->distance[300-riy][rix]<=k/tan(30*PI/180)) 
							{ 
							   if(CAmidvalue[i-1][k]==0) 
							   { 
                                   glColor3f(0.0f,0.0f,0.0f); 
				                   glVertex3f(0.0f+(float)rix, 0.0f+(float)riy, 0.0f+(float)(k)); 
							   }else if(CAmidvalue[i-1][k]>0&&CAmidvalue[i-1][k]<20){ 
                                   glColor3f(0.0f,0.0f,1.0f); 
				                   glVertex3f(0.0f+(float)rix, 0.0f+(float)riy, 0.0f+(float)(k)); 
							   }else if(CAmidvalue[i-1][k]>=20&&CAmidvalue[i-1][k]<50){ 
                                   glColor3f(1.0f,1.0f,0.0f); 
				                   glVertex3f(0.0f+(float)rix, 0.0f+(float)riy, 0.0f+(float)(k)); 
							   } 
							} 
						} 
					} 
				} 
			} 
		} 
*/ 
		 
	  glEnd(); 
      delete site; 
	} 
     
    ::glFinish();  
    SwapBuffers( m_hDC );  
     
 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView printing 
 
BOOL CMFC_OGLTestView::OnPreparePrinting(CPrintInfo* pInfo) 
{ 
	// default preparation 
	return DoPreparePrinting(pInfo); 
} 
 
void CMFC_OGLTestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add extra initialization before printing 
} 
 
void CMFC_OGLTestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) 
{ 
	// TODO: add cleanup after printing 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView diagnostics 
 
#ifdef _DEBUG 
void CMFC_OGLTestView::AssertValid() const 
{ 
	CView::AssertValid(); 
} 
 
void CMFC_OGLTestView::Dump(CDumpContext& dc) const 
{ 
	CView::Dump(dc); 
} 
 
CMFC_OGLTestDoc* CMFC_OGLTestView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMFC_OGLTestDoc))); 
	return (CMFC_OGLTestDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMFC_OGLTestView message handlers 
 
void CMFC_OGLTestView::OnInitialUpdate()  
{ 
	CView::OnInitialUpdate(); 
	 
	// TODO: Add your specialized code here and/or call the base class 
	m_pDC = new CClientDC(this); 
    m_hDC=m_pDC->GetSafeHdc(); 
    static PIXELFORMATDESCRIPTOR pfd =  
	{ 
        sizeof(PIXELFORMATDESCRIPTOR),  // size of this pfd 
        1,                              // version number 
        PFD_DRAW_TO_WINDOW   |          // support window 
          PFD_SUPPORT_OPENGL |          // support OpenGL 
          PFD_DOUBLEBUFFER,             // double buffered 
        PFD_TYPE_RGBA,                  // RGBA type 
        24,                             // 24-bit color depth 
        0, 0, 0, 0, 0, 0,               // color bits ignored 
        0,                              // no alpha buffer 
        0,                              // shift bit ignored 
        0,                              // no accumulation buffer 
        0, 0, 0, 0,                     // accum bits ignored 
        16,                             // 16-bit z-buffer 
        0,                              // no stencil buffer 
        0,                              // no auxiliary buffer 
        PFD_MAIN_PLANE,                 // main layer 
        0,                              // reserved 
        0, 0, 0                         // layer masks ignored 
    }; 
    int   m_PixelFormat; 
    m_PixelFormat = ::ChoosePixelFormat(m_hDC, &pfd); 
    ::SetPixelFormat(m_hDC, m_PixelFormat, &pfd);  
    // 
    m_hRC = ::wglCreateContext( m_hDC );  
    wglMakeCurrent( m_hDC, m_hRC );  
 
  
 
 
} 
 
void CMFC_OGLTestView::OnSize(UINT nType, int cx, int cy)  
{ 
	CView::OnSize(nType, cx, cy); 
	 
	// TODO: Add your message handler code here 
    if ( 0 >= cx || 0 >= cy ) 
    return; 
    ::glShadeModel(GL_SMOOTH); 
    ::glClearColor(0.0f, 0.0f, 0.0f, 255.0f); 
    // specify the back of the buffer as clear depth 
    ::glClearDepth(1.0f); 
    // enable depth testing 
    ::glEnable(GL_DEPTH_TEST); 
	::glDepthFunc(GL_LEQUAL);								// The Type Of Depth Testing To Do 
	::glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations 
    ::glViewport(0, 0, cx, cy);  
    ::glMatrixMode( GL_PROJECTION ); 
    ::glLoadIdentity(); 
    ::glOrtho( xOrg - xMax, xOrg + xMax, yOrg - yMax, yOrg + yMax,zOrg-zMax, zOrg + zMax); 
    //::gluLookAt(0.0f,0.0f,0.0f,0.0f,0.0f,3.0f,0.0f,0.0f,0.0f); 
    //::glTranslatef(0.0f,0.0f,3.0f); 
	::glScalef (0.2f, 0.2f, 0.2f); 
    ::glRotatef( -90, 1.0f, 0.0f, 0.0f ); 
    //::glRotatef(-90.0, 0.0f, 1.0f, 0.0f ); 
    //yrotate-=1; 
    //::glRotatef(-90, 0.0f, 0.0f, 1.0f ); 
    ::glMatrixMode( GL_MODELVIEW);  
    //::glLoadIdentity(); 
     
    Invalidate(); 
	 
} 
 
BOOL CMFC_OGLTestView::OnEraseBkgnd(CDC* pDC)  
{ 
	// TODO: Add your message handler code here and/or call default 
	return true; 
 
	//return CView::OnEraseBkgnd(pDC); 
} 
 
void CMFC_OGLTestView::OnDestroy()  
{ 
	CView::OnDestroy(); 
	 
	// TODO: Add your message handler code here 
	wglDeleteContext(m_hRC);  
} 
 
void CMFC_OGLTestView::OnFileOpen()  
{ 
	// TODO: Add your command handler code here 
     CFileDialog dlg(true); 
	if(dlg.DoModal()==IDOK) 
	{ 
		ReadAndWriteFun* rawf = new ReadAndWriteFun; 
		a = rawf->ReadBaseData(dlg.GetPathName()); 
		if(a){ 
            SAElevation = rawf->Elevation; 
			int i = rawf->NumValidCuts; 
			for(int j=0;j<i;j++) 
			{ 
				for(int k=0;k<360;k++) 
				{ 
					for(int l=0;l<460;l++) 
					{ 
                         SARData[j][k][l] = rawf->RData[j][k][l]; 
			             //SAVData = rawf->VData; 
			             //SAWData = rawf->WData; 
					} 
				} 
			} 
			for(int m=0;m<i;m++) 
			{ 
				for(int n=0;n<360;n++) 
				{ 
					for(int p=0;p<920;p++) 
					{ 
                         //SARData[j][k][l] = rawf->RData[j][k][l]; 
			             SAVData[m][n][p] = rawf->VData[m][n][p]; 
			             //SAWData = rawf->WData; 
					} 
				} 
			} 
            CString str; 
			str.Format("%f%c%f%c%d",SARData[0][0][0],',',SAElevation[0],',',i); 
			MessageBox(str); 
            CSelectTypeDlg dialog; 
		    if(dialog.DoModal()==IDOK) 
			{ 
				m_edite = dialog.m_edite; 
				if(m_edite==0) 
				{ 
                      
				        //b=true; 
                        rc=true; 
				}else{ 
					rc=false; 
				} 
				if(m_edite==1) 
				{ 
					  
				        //b=true; 
                        vc=true; 
						 
				}else{ 
					vc=false; 
				} 
				     
			} 
           Invalidate(true); 
		}else{ 
			MessageBox("ļʧܣ"); 
		} 
		delete rawf; 
	}  
}