www.pudn.com > DLT_Zhang.zip > DLTDlg.cpp, change:2011-06-20,size:18723b


// DLTDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "DLT.h" 
#include "DLTDlg.h" 
#include "ImportData.h" 
#include <math.h> 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CAboutDlg dialog used for App About 
 
double d_interior[3]={0};			//内方位元素值 
double d_interior_l[3]={0};			//左片内方位元素 
double d_interior_r[3]={0};			//右片内方位元素 
 
int PhNum;							//像点个数 
 
double d_exterior_DLT_l[6]={0};		//解算后的左片外方位元素 
double d_exterior_DLT_r[6]={0};		//解算后的右片外方位元素 
 
class CAboutDlg : public CDialog 
{ 
public: 
	CAboutDlg(); 
 
// Dialog Data 
	//{{AFX_DATA(CAboutDlg) 
	enum { IDD = IDD_ABOUTBOX }; 
	//}}AFX_DATA 
 
	// ClassWizard generated virtual function overrides 
	//{{AFX_VIRTUAL(CAboutDlg) 
	protected: 
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support 
	//}}AFX_VIRTUAL 
 
// Implementation 
protected: 
	//{{AFX_MSG(CAboutDlg) 
	//}}AFX_MSG 
	DECLARE_MESSAGE_MAP() 
}; 
 
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) 
{ 
	//{{AFX_DATA_INIT(CAboutDlg) 
	//}}AFX_DATA_INIT 
} 
 
void CAboutDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CAboutDlg) 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) 
	//{{AFX_MSG_MAP(CAboutDlg) 
		// No message handlers 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
//矩阵转置 
void transpose(double *m1, double *m2, int m, int n) 
{ 
	int i,j; 
	for(i=0;i<m;i++) 
		for(j=0;j<n;j++) 
			m2[j*m+i]=m1[i*n+j];		 
} 
 
//矩阵相乘 
void mult(double *m1, double *m2, double *result, int i_1, int j_12, int j_2)		 
{ 
	int i,j,k;  
	for(i=0;i<i_1;i++) 
        for(j=0;j<j_2;j++) 
		{ 
			result[i*j_2+j]=0.0; 
            for(k=0;k<j_12;k++) 
				result[i*j_2+j]+=m1[i*j_12+k]*m2[j+k*j_2]; 
		}		 
} 
 
//矩阵求逆 
bool inv(double a[],int n) 
{ 
	int *is,*js,i,j,k,l,u,v; 
	double d,p; 
	is=new int[n]; 
    js=new int[n]; 
	for (k=0; k<=n-1; k++) 
	{  
		d=0.0; 
		for (i=k; i<=n-1; i++) 
		{ 
			for (j=k; j<=n-1; j++) 
			{  
				l=i*n+j; 
				p=fabs(a[l]); 
				if (p>d)  
				{  
					d=p; 
					is[k]=i;  
					js[k]=j; 
				} 
			} 
		} 
		if(d==0) 
		{  
			delete is;  
			delete js; 
			return false; 
		} 
		if (is[k]!=k) 
		{ 
			for (j=0; j<=n-1; j++) 
			{  
				u=k*n+j; v=is[k]*n+j; 
				p=a[u]; a[u]=a[v]; a[v]=p; 
			} 
		} 
		if (js[k]!=k) 
		{ 
			for (i=0; i<=n-1; i++) 
			{  
				u=i*n+k; v=i*n+js[k]; 
				p=a[u]; a[u]=a[v]; a[v]=p; 
			} 
		} 
		l=k*n+k; 
		a[l]=1.0/a[l]; 
		for (j=0; j<=n-1; j++) 
		{ 
			if (j!=k) 
			{  
				u=k*n+j; a[u]=a[u]*a[l]; 
			} 
		} 
		for (i=0; i<=n-1; i++) 
		{ 
			if (i!=k) 
			{ 
				for (j=0; j<=n-1; j++) 
				{ 
					if (j!=k) 
					{  
						u=i*n+j; 
						a[u]=a[u]-a[i*n+k]*a[k*n+j]; 
					} 
				} 
			} 
		} 
		for (i=0; i<=n-1; i++) 
		{ 
			if (i!=k) 
			{  
				u=i*n+k; a[u]=-a[u]*a[l]; 
			} 
			 
		} 
		 
	} 
	for (k=n-1; k>=0; k--) 
	{  
		if (js[k]!=k) 
		{ 
			for (j=0; j<=n-1; j++) 
			{  
				u=k*n+j; v=js[k]*n+j; 
				p=a[u]; a[u]=a[v]; a[v]=p; 
			} 
		} 
		if (is[k]!=k) 
		{ 
			for (i=0; i<=n-1; i++) 
			{  
				u=i*n+k; v=i*n+is[k]; 
				p=a[u]; a[u]=a[v]; a[v]=p; 
			} 
		} 
	} 
	delete is;  
	delete js; 
	return 1; 
} 
 
double Max(double *a,int b) 
{ 
	double M=a[0]; 
	for(int i=1;i<b;i++) 
	{ 
		if(a[i]>=M) 
		{ 
			M=a[i]; 
		} 
	} 
	return M; 
} 
 
//DTL解算 
bool DLT(Photo* pPicData,			//像点坐标数据 
		 Control *pObjData,			//控制点坐标数据 
		 double *interior,			//求解的内方位元素 
		 double *exterior,			//求解的外方位元素 
		 int pNum)					//点数 
{ 
	//  A X = L 
	double *a=new double[pNum];				//A,初始化为1 
	for (int temp=0;temp<pNum;temp++) 
	{ 
		a[temp]=1.0; 
	} 
	double *A=new double[2*pNum*11];		//A矩阵为系数矩阵,大小为  2N*11 
	double X[11]={0};						//X为未知数矩阵L1~L11	大小为 11*1 
	double Xpre[11]={0};					 
	double *L=new double[2*pNum];			//观测值矩阵为2N*1 
 
	double *AT=new double[11*2*pNum]; 
 
	memset(AT,0,sizeof(double)*22*pNum);	//初始化AT 
	 
	double ATA[11*11]={0};					//初始化ATA 
	double ATL[11*1]={0};					//初始化ATL 
 
	memset(A,0,2*pNum*11*sizeof(double));	//初始化矩阵为0 
	memset(L,0,2*pNum*sizeof(double)); 
	//开始循环迭代 
	do 
	{ 
		for (int i=0;i<pNum;i++) 
		{	 
			//A矩阵初始化 
			A[(2*i+0)*11+0]=(double)(pObjData[i].x/a[i]); 
			A[(2*i+0)*11+1]=(double)(pObjData[i].y/a[i]); 
			A[(2*i+0)*11+2]=(double)(pObjData[i].z/a[i]); 
			A[(2*i+0)*11+3]=(double)(1/a[i]); 
			A[(2*i+0)*11+4]=(double)(0/a[i]); 
			A[(2*i+0)*11+5]=(double)(0/a[i]); 
			A[(2*i+0)*11+6]=(double)(0/a[i]); 
			A[(2*i+0)*11+7]=(double)(0/a[i]); 
			A[(2*i+0)*11+8]=(double)((pPicData[i].x*pObjData[i].x)/a[i]); 
			A[(2*i+0)*11+9]=(double)((pPicData[i].x*pObjData[i].y)/a[i]); 
			A[(2*i+0)*11+10]=(double)((pPicData[i].x*pObjData[i].z)/a[i]); 
		 
			A[(2*i+1)*11+0]=(double)(0/a[i]); 
			A[(2*i+1)*11+1]=(double)(0/a[i]); 
			A[(2*i+1)*11+2]=(double)(0/a[i]); 
			A[(2*i+1)*11+3]=(double)(0/a[i]); 
			A[(2*i+1)*11+4]=(double)(pObjData[i].x/a[i]); 
			A[(2*i+1)*11+5]=(double)(pObjData[i].y/a[i]); 
			A[(2*i+1)*11+6]=(double)(pObjData[i].z/a[i]); 
			A[(2*i+1)*11+7]=(double)(1/a[i]); 
			A[(2*i+1)*11+8]=(double)((pPicData[i].y*pObjData[i].x)/a[i]); 
			A[(2*i+1)*11+9]=(double)((pPicData[i].y*pObjData[i].y)/a[i]); 
			A[(2*i+1)*11+10]=(double)((pPicData[i].y*pObjData[i].z)/a[i]); 
			//L矩阵的初始化 
			L[i*2+0]=-pPicData[i].x; 
			L[i*2+1]=-pPicData[i].y; 
		} 
	 
		//X=(ATA)-1 *  ATL 
		transpose(A,AT,2*pNum,11); 
		mult(AT,A,ATA,11,2*pNum,11); 
		 
		if (inv(ATA,11)==0)				//求逆失败,无法迭代 
		{ 
			return false; 
		} 
		//得到ATA-1 
 
		mult(AT,L,ATL,11,2*pNum,1); 
		mult(ATA,ATL,X,11,11,1); 
		//修正X[] 
		for(int j=0;j<pNum;j++) 
		{ 
			Xpre[j]=X[j]+Xpre[j]; 
		} 
		//修正a 
		for(int k=0;k<pNum;k++) 
		{ 
			a[k]=pObjData[k].x*Xpre[8]+pObjData[k].y*Xpre[9]+pObjData[k].z*Xpre[10]+1; 
		} 
 
	}while(Max(X,11)<0.00001);//结束第一步迭代 
	 
	//求解内方位元素 
	interior[0]=-(X[0]*X[8]+X[1]*X[9]+X[2]*X[10])/(X[8]*X[8]+X[9]*X[9]+X[10]*X[10]);//x0 
	interior[1]=-(X[4]*X[8]+X[5]*X[9]+X[6]*X[10])/(X[8]*X[8]+X[9]*X[9]+X[10]*X[10]);//y0 
	 
	double gam3=sqrt(1/(X[8]*X[8]+X[9]*X[9]+X[10]*X[10]));//power(r,3) r的三次方 
	double C=((X[0]*X[4]+X[1]*X[5]+X[2]*X[6])/(X[8]*X[8]+X[9]*X[9]+X[10]*X[10])-interior[0]*interior[1]); 
	double dbeta=asin(C*C/((gam3*gam3*(X[0]*X[0]+X[1]*X[1]+X[2]*X[2])-interior[0]*interior[0])*(gam3*gam3*(X[4]*X[4]+X[5]*X[5]+X[6]*X[6]) 
		-interior[1]*interior[1]))); 
	double ds=sqrt((gam3*gam3*(X[0]*X[0]+X[1]*X[1]+X[2]*X[2])-interior[0]*interior[0])/(gam3*gam3*(X[4]*X[4]+X[5]*X[5]+X[6]*X[6]) 
		-interior[1]*interior[1]))-1; 
 
	interior[2]=cos(dbeta)*sqrt((X[0]*X[0]+X[1]*X[1]+X[2]*X[2])/(X[8]*X[8]+X[9]*X[9]+X[10]*X[10])-interior[0]*interior[0]);//f 
	 
	delete[] A; 
	delete[] AT; 
	delete[] L; 
	 
	//第二个迭代过程 
	double M[3*3]={X[0],X[1],X[2],X[4],X[5],X[6],X[8],X[9],X[10]}; 
	double B[3*1]={-X[3],-X[7],-1}; 
	//M X = B;  X=(MTM)-1MTB 
	double MT[3*3]={0}; 
	double MTM[3*3]={0}; 
	double MTB[3*1]={0}; 
	 
	double WF[3]={0};		//外方位元素线元素 
 
	transpose(M,MT,3,3); 
	mult(MT,M,MTM,3,3,3); 
	if (!inv(MTM,3)) 
		return 0; 
	mult(MT,B,MTB,3,3,1); 
	mult(MTM,MTB,WF,3,3,1); 
	 
	double a3,b3,c3; 
	a3=gam3*X[8]; 
	b3=gam3*X[9]; 
	c3=gam3*X[10]; 
	//三个角度元素 
	exterior[3]=atan(-a3/c3);			//phi 
	exterior[4]=asin(-b3);				//omega 
 
	double b1,b2; 
	b2=(X[5]*gam3+b3*interior[2])*(1+ds)*cos(dbeta)/interior[2]; 
	b1=(X[1]*gam3+b3*interior[2]+b2*interior[2]*tan(dbeta))/interior[2]; 
	exterior[5]=atan(b1/b2);			//kapa 
 
	exterior[0]=WF[0]; 
	exterior[1]=WF[1]; 
	exterior[2]=WF[2]; 
	return true; 
} 
 
//DLT计算函数 
UINT ThreadFunc_DLT(LPVOID lpParam) 
{ 
	CDLTDlg *pl=(CDLTDlg*)(lpParam); 
	bool isDLT=true; 
 
	//解算左片DLT 
	isDLT=DLT(pl->struct_Pic_l,pl->struct_Control,d_interior_l,d_exterior_DLT_l,PhNum); 
	if(isDLT==false) 
	{ 
		AfxMessageBox("左片数据无法完成解算!\r\n    请核对!",MB_OK,0); 
		return 0; 
	} 
 
	//解算右片DLT 
	isDLT=DLT(pl->struct_Pic_r,pl->struct_Control,d_interior_r,d_exterior_DLT_r,PhNum); 
	if(isDLT==0) 
	{ 
		AfxMessageBox("右片数据无法完成解算!\r\n    请核对!",MB_OK,0); 
		return 0; 
	} 
 
	AfxMessageBox("ok"); 
 
	pl->OnDLTUpdata(); 
 
	FILE *fp=fopen("DLT直接解算结果.txt","w"); 
	fprintf(fp,"   x0        y0       fx       Xs         Ys          Zs          phi     omega     kapa\r\n"); 
	fprintf(fp,"%8.4f%10.4f%10.4f%11.4f%11.4f%11.4f%10.4f%10.4f%10.4f\r\n", 
		d_interior_l[0], 
		d_interior_l[1], 
		d_interior_l[2], 
		d_exterior_DLT_l[0], 
		d_exterior_DLT_l[1], 
		d_exterior_DLT_l[2], 
		d_exterior_DLT_l[3], 
		d_exterior_DLT_l[4], 
		d_exterior_DLT_l[5]); 
	fprintf(fp,"%8.4f%10.4f%10.4f%11.4f%11.4f%11.4f%10.4f%10.4f%10.4f\r\n", 
		d_interior_r[0], 
		d_interior_r[1], 
		d_interior_r[2], 
		d_exterior_DLT_r[0], 
		d_exterior_DLT_r[1], 
		d_exterior_DLT_r[2], 
		d_exterior_DLT_r[3], 
		d_exterior_DLT_r[4], 
		d_exterior_DLT_r[5]); 
	fclose(fp); 
	 
	pl->SetWindowText("近景摄影测量----DLT解算完成!"); 
	return true; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CDLTDlg dialog 
 
CDLTDlg::CDLTDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CDLTDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CDLTDlg) 
	//}}AFX_DATA_INIT 
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32 
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); 
	struct_Pic_l=NULL; 
	struct_Pic_r=NULL; 
	struct_Control=NULL; 
} 
 
void CDLTDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CDLTDlg) 
	DDX_Control(pDX, IDC_LIST1, m_list1); 
	DDX_Control(pDX, IDC_LIST2, m_list2); 
	//}}AFX_DATA_MAP 
} 
 
BEGIN_MESSAGE_MAP(CDLTDlg, CDialog) 
	//{{AFX_MSG_MAP(CDLTDlg) 
	ON_WM_SYSCOMMAND() 
	ON_WM_PAINT() 
	ON_WM_QUERYDRAGICON() 
	ON_COMMAND(ID_MENUITEM32771, OnOpenImportData) 
	ON_COMMAND(IDM_DLT, OnDlt) 
	ON_COMMAND(IDM_RECTION, OnRection) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CDLTDlg message handlers 
 
BOOL CDLTDlg::OnInitDialog() 
{ 
	CDialog::OnInitDialog(); 
 
	// Add "About..." menu item to system menu. 
 
	// IDM_ABOUTBOX must be in the system command range. 
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); 
	ASSERT(IDM_ABOUTBOX < 0xF000); 
 
	CMenu* pSysMenu = GetSystemMenu(FALSE); 
	if (pSysMenu != NULL) 
	{ 
		CString strAboutMenu; 
		strAboutMenu.LoadString(IDS_ABOUTBOX); 
		if (!strAboutMenu.IsEmpty()) 
		{ 
			pSysMenu->AppendMenu(MF_SEPARATOR); 
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 
		} 
	} 
 
	// Set the icon for this dialog.  The framework does this automatically 
	//  when the application's main window is not a dialog 
	SetIcon(m_hIcon, TRUE);			// Set big icon 
	SetIcon(m_hIcon, FALSE);		// Set small icon 
	 
	// TODO: Add extra initialization here 
 
	OnInitUI(); 
	 
	return TRUE;  // return TRUE  unless you set the focus to a control 
} 
 
void CDLTDlg::OnSysCommand(UINT nID, LPARAM lParam) 
{ 
	if ((nID & 0xFFF0) == IDM_ABOUTBOX) 
	{ 
		CAboutDlg dlgAbout; 
		dlgAbout.DoModal(); 
	} 
	else 
	{ 
		CDialog::OnSysCommand(nID, lParam); 
	} 
} 
 
// If you add a minimize button to your dialog, you will need the code below 
//  to draw the icon.  For MFC applications using the document/view model, 
//  this is automatically done for you by the framework. 
 
void CDLTDlg::OnPaint()  
{ 
	if (IsIconic()) 
	{ 
		CPaintDC dc(this); // device context for painting 
 
		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 
 
		// Center icon in client rectangle 
		int cxIcon = GetSystemMetrics(SM_CXICON); 
		int cyIcon = GetSystemMetrics(SM_CYICON); 
		CRect rect; 
		GetClientRect(&rect); 
		int x = (rect.Width() - cxIcon + 1) / 2; 
		int y = (rect.Height() - cyIcon + 1) / 2; 
 
		// Draw the icon 
		dc.DrawIcon(x, y, m_hIcon); 
	} 
	else 
	{ 
		CDialog::OnPaint(); 
	} 
} 
 
// The system calls this to obtain the cursor to display while the user drags 
//  the minimized window. 
HCURSOR CDLTDlg::OnQueryDragIcon() 
{ 
	return (HCURSOR) m_hIcon; 
} 
 
void CDLTDlg::OnOpenImportData()  
{ 
	// TODO: Add your command handler code here 
	ImportData dlg; 
	if (dlg.DoModal()==IDOK) 
	{ 
		//以下是读入像点数据 
		FILE *fp=NULL; 
		fp=fopen(dlg.m_strPath_Photo,"r"); 
		if (fp==NULL) 
			return; 
		fscanf(fp,"%d",&PhNum); 
		if (PhNum<6) 
		{ 
			AfxMessageBox("像点数不得少于6!",MB_OK,-1);//条件判断   像点数不能小于6 
			fclose(fp); 
			return; 
		} 
		if (struct_Pic_l!=NULL)				//初始化并开辟空间 
		{ 
			delete[] struct_Pic_l; 
			struct_Pic_l=NULL; 
		} 
		if (struct_Pic_r!=NULL) 
		{ 
			delete[] struct_Pic_r; 
			struct_Pic_r=NULL; 
		} 
		struct_Pic_l=new Photo[PhNum];		 
		struct_Pic_r=new Photo[PhNum];		 
		int i; 
		for (i=0;i<PhNum;i++) 
		{ 
			char buf[256]; 
			fscanf(fp,"%s%lf%lf%lf%lf", 
				buf, 
				&struct_Pic_l[i].x, 
				&struct_Pic_l[i].y, 
				&struct_Pic_r[i].x, 
				&struct_Pic_r[i].y); 
			struct_Pic_l[i].name.Format("%s",buf); 
			struct_Pic_r[i].name=struct_Pic_l[i].name; 
		} 
		fclose(fp); 
 
		//以下是读入控制点数据 
		fp=NULL; 
		fp=fopen(dlg.m_strPath_Control,"r"); 
		if (fp==NULL)return; 
		int objNum; 
		fscanf(fp,"%d",&objNum); 
		if (objNum<PhNum) 
		{ 
			AfxMessageBox("小于已知像点数!",MB_OK,-1); 
			fclose(fp); 
			return; 
		} 
		Control * struct_Ctr_temp; 
		struct_Ctr_temp=NULL; 
		struct_Ctr_temp=new Control[objNum]; 
		for (i=0;i<objNum;i++) 
		{ 
			char buf[256]; 
			fscanf(fp,"%s%lf%lf%lf", 
				buf, 
				&struct_Ctr_temp[i].x, 
				&struct_Ctr_temp[i].y, 
				&struct_Ctr_temp[i].z); 
			struct_Ctr_temp[i].name.Format("%s",buf); 
		} 
		fclose(fp); 
		if (struct_Control!=NULL) 
		{ 
			delete[] struct_Control; 
			struct_Control=NULL; 
		} 
		struct_Control=new Control[PhNum]; 
		for (i=0;i<PhNum;i++) 
		{ 
			for (int j=0;j<objNum;j++) 
			{ 
				if (struct_Pic_l[i].name==struct_Ctr_temp[j].name) 
				{ 
					struct_Control[i]=struct_Ctr_temp[j]; 
					break; 
				} 
			} 
		} 
		delete[] struct_Ctr_temp; 
		 
		OnUpdataList(); 
	} 
} 
 
void CDLTDlg::OnUpdataList() 
{ 
	int i; 
	FILE *fp=fopen("左右像点坐标.txt","w"); 
	fprintf(fp,"%d\r\n",PhNum); 
	for (i=0;i<PhNum;i++) 
		fprintf(fp,"%s	%f	%f	%f	%f\r\n", 
		struct_Pic_l[i].name, 
		struct_Pic_l[i].x, 
		struct_Pic_l[i].y, 
		struct_Pic_r[i].x, 
		struct_Pic_r[i].y); 
	fclose(fp); 
	 
	CString instr; 
	m_list1.DeleteAllItems(); 
	 
	for (i=0;i<PhNum;i++) 
	{ 
		m_list1.InsertItem(i,struct_Control[i].name); 
		CString instr; 
		instr.Format("%.4f",struct_Pic_l[i].x); 
		m_list1.SetItemText(i,1,instr);			  
		instr.Format("%.4f",struct_Pic_l[i].y); 
		m_list1.SetItemText(i,2, instr); 
 
		instr.Format("%.4f",struct_Pic_r[i].x); 
		m_list1.SetItemText(i,3,instr);			  
		instr.Format("%.4f",struct_Pic_r[i].y); 
		m_list1.SetItemText(i,4, instr); 
 
		instr.Format("%.4f",struct_Control[i].x); 
		m_list1.SetItemText(i,5,instr);			  
		instr.Format("%.4f",struct_Control[i].y); 
		m_list1.SetItemText(i,6, instr); 
		instr.Format("%.4f",struct_Control[i].z); 
		m_list1.SetItemText(i,7, instr); 
	} 
	SetWindowText("近景摄影测量----成功导入坐标数据!"); 
	instr.Format("控制点坐标:  共%d个",PhNum); 
	GetDlgItem(IDC_STATIC_CTR)->SetWindowText(instr); 
 
} 
 
void CDLTDlg::OnInitUI()			//摘自MSDN事例程序 
{ 
	DWORD   dw=m_list1.GetExStyle();  
	dw|=LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP;  
	dw&=~LVS_EX_CHECKBOXES;  
	m_list1.SetExtendedStyle(dw); 
	//	m_list2.SetExtendedStyle (LVS_EX_FULLROWSELECT   |   LVS_EX_FLATSB   |   LVS_EX_INFOTIP   |   LVS_EX_GRIDLINES   |   LVS_EX_ONECLICKACTIVATE  ); 
	m_list1.InsertColumn(0, "    ID", LVCFMT_LEFT,73); 
	m_list1.InsertColumn(1, "左片x ", LVCFMT_LEFT,73); 
	m_list1.InsertColumn(2, "左片y ", LVCFMT_LEFT,73); 
	m_list1.InsertColumn(3, "右片x ", LVCFMT_LEFT,73); 
	m_list1.InsertColumn(4, "右片y ", LVCFMT_LEFT,73); 
	m_list1.InsertColumn(5, "控制点X", LVCFMT_LEFT,72); 
	m_list1.InsertColumn(6, "控制点Y", LVCFMT_LEFT,72); 
	m_list1.InsertColumn(7, "控制点Z", LVCFMT_LEFT,72); 
	m_list1.ShowScrollBar(SB_HORZ,FALSE); 
		 
	m_list2.SetExtendedStyle (dw); 
	m_list2.InsertColumn(0, "       ", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(1, "     x0", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(2, "     y0", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(3, "     f", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(4, "     Xs", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(5, "     Ys", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(6, "     Zs", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(7, "     φ", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(8, "     ω", LVCFMT_LEFT,83); 
	m_list2.InsertColumn(9, "     κ", LVCFMT_LEFT,83); 
 
} 
 
void CDLTDlg::OnDlt()  
{ 
	// TODO: Add your command handler code here 
		HANDLE hThread; 
	DWORD ThreadID; 
	hThread=CreateThread(NULL, 
		0, 
		(LPTHREAD_START_ROUTINE)ThreadFunc_DLT, 
		(LPVOID)this, 
		0, 
		&ThreadID);	 
	//OnDLTUpdata(); 
} 
 
 
void CDLTDlg::OnDLTUpdata() 
{ 
	CString instr; 
	m_list2.DeleteAllItems(); 
	//左片输出 
	m_list2.SetItemText(0,0,"left");	 
	instr.Format("%.4f",d_interior_l[0]); 
	m_list2.SetItemText(0,1,instr);			  
	instr.Format("%.4f",d_interior_l[1]); 
	m_list2.SetItemText(0,2, instr); 
	instr.Format("%.4f",d_interior_l[2]); 
	m_list2.SetItemText(0,3, instr); 
	 
	instr.Format("%.4f",d_exterior_DLT_l[0]); 
	m_list2.SetItemText(0,4,instr);			  
	instr.Format("%.4f",d_exterior_DLT_l[1]); 
	m_list2.SetItemText(0,5, instr); 
	instr.Format("%.4f",d_exterior_DLT_l[2]); 
	m_list2.SetItemText(0,6, instr); 
	instr.Format("%.4f",d_exterior_DLT_l[3]); 
	m_list2.SetItemText(0,7, instr); 
	instr.Format("%.4f",d_exterior_DLT_l[4]); 
	m_list2.SetItemText(0,8, instr); 
	instr.Format("%.4f",d_exterior_DLT_l[5]); 
	m_list2.SetItemText(0,9, instr); 
	//右片输出 
	m_list2.SetItemText(1,0,"right");	 
	instr.Format("%.4f",d_interior_r[0]); 
	m_list2.SetItemText(1,1,instr);			  
	instr.Format("%.4f",d_interior_r[1]); 
	m_list2.SetItemText(1,2, instr); 
	instr.Format("%.4f",d_interior_r[2]); 
	m_list2.SetItemText(1,3, instr); 
	 
	instr.Format("%.4f",d_exterior_DLT_r[0]); 
	m_list2.SetItemText(1,4,instr);			  
	instr.Format("%.4f",d_exterior_DLT_r[1]); 
	m_list2.SetItemText(1,5, instr); 
	instr.Format("%.4f",d_exterior_DLT_r[2]); 
	m_list2.SetItemText(1,6, instr); 
	instr.Format("%.4f",d_exterior_DLT_r[3]); 
	m_list2.SetItemText(1,7, instr); 
	instr.Format("%.4f",d_exterior_DLT_r[4]); 
	m_list2.SetItemText(1,8, instr); 
	instr.Format("%.4f",d_exterior_DLT_r[5]); 
	m_list2.SetItemText(1,9, instr); 
 
	SetWindowText("近景摄影测量----成功解算DTL!"); 
} 
 
void CDLTDlg::OnRection() //空间坐标解算 
{ 
	// TODO: Add your command handler code here 
	 
}