📄 treeviewfile.cpp
字号:
}
}
catch(CDaoException* e)
{
e->ReportError();
e->Delete();
return;
}
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,"");
m_recordset->Close();
}
if( !strcmp(p_treestr,"输入已知点坐标高程"))
{ int row=1;
pchildframe->m_bianjiview->m_pGridCtrl->DeleteNonFixedRows();
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetColumnCount(4);
//pchildframe->m_bianjiview->m_pGridCtrl-> SetFixedRowCount(2);
static char* xm[]={"点号","X 坐标","Y 坐标","高程"};
for(int i=0;i<4;i++)
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(0,i,xm[i]);
pchildframe->m_bianjiview->m_pGridCtrl->SetRowCount(2);
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
mydoc->m_viewname=4;
try
{
CString strselect(_T("Select * From["));
strselect+="已知点坐标高程";
strselect+=_T("]");
m_recordset->Open(dbOpenDynaset,strselect);
if(!m_recordset->CanUpdate())
return;
while(!m_recordset->IsEOF())
{
COleVariant var1,var2,var3,var4;
var1=m_recordset->GetFieldValue(0);
var2=m_recordset->GetFieldValue(1);
var3=m_recordset->GetFieldValue(2);
var4=m_recordset->GetFieldValue(3);
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,CCrack::strVARIANT(var1));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,1,CCrack::strVARIANT(var2));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,2,CCrack::strVARIANT(var3));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,3,CCrack::strVARIANT(var4));
row++;
pchildframe->m_bianjiview->m_pGridCtrl->InsertRow("1");
m_recordset->MoveNext();
}
}
catch(CDaoException* e)
{
e->ReportError();
e->Delete();
return;
}
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,"");
m_recordset->Close();
}
if(!strcmp(p_treestr,"输入起始方向值"))
{ int row=1;
pchildframe->m_bianjiview->m_pGridCtrl->DeleteNonFixedRows();
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetColumnCount(3);
//pchildframe->m_bianjiview->m_pGridCtrl-> SetFixedRowCount(2);
static char* xm[]={"首点","末点","方位角"};
for(int i=0;i<3;i++)
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(0,i,xm[i]);
pchildframe->m_bianjiview->m_pGridCtrl->SetRowCount(2);
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
mydoc->m_viewname=5;
try
{
CString strselect(_T("Select * From["));
strselect+="起始方位角";
strselect+=_T("]");
m_recordset->Open(dbOpenDynaset,strselect);
if(!m_recordset->CanUpdate())
return;
while(!m_recordset->IsEOF())
{
COleVariant var1,var2,var3;
var1=m_recordset->GetFieldValue(0);
var2=m_recordset->GetFieldValue(1);
var3=m_recordset->GetFieldValue(2);
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,CCrack::strVARIANT(var1));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,1,CCrack::strVARIANT(var2));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,2,CCrack::strVARIANT(var3));
row++;
pchildframe->m_bianjiview->m_pGridCtrl->InsertRow("1");
m_recordset->MoveNext();
}
}
catch(CDaoException* e)
{
e->ReportError();
e->Delete();
return;
}
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,"");
m_recordset->Close();
}
if(!strcmp(p_treestr,"输入水平方向观测值"))
{ int row=1;
pchildframe->m_bianjiview->m_pGridCtrl->DeleteNonFixedRows();
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetColumnCount(3);
//pchildframe->m_bianjiview->m_pGridCtrl-> SetFixedRowCount(2);
static char* xm[]={"测站点","照准点","角度"};
for(int i=0;i<3;i++)
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(0,i,xm[i]);
pchildframe->m_bianjiview->m_pGridCtrl->SetRowCount(2);
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
mydoc->m_viewname=1;
try
{
CString strselect(_T("Select * From["));
strselect+="水平观测角";
strselect+=_T("]");
m_recordset->Open(dbOpenDynaset,strselect);
if(!m_recordset->CanUpdate())
return;
while(!m_recordset->IsEOF())
{
COleVariant var1,var2,var3;
var1=m_recordset->GetFieldValue(0);
var2=m_recordset->GetFieldValue(1);
var3=m_recordset->GetFieldValue(2);
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,CCrack::strVARIANT(var1));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,1,CCrack::strVARIANT(var2));
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,2,CCrack::strVARIANT(var3));
row++;
pchildframe->m_bianjiview->m_pGridCtrl->InsertRow("1");
m_recordset->MoveNext();
}
}
catch(CDaoException* e)
{
e->ReportError();
e->Delete();
return;
}
pchildframe->m_bianjiview->m_pGridCtrl->Invalidate();
pchildframe->m_bianjiview->m_pGridCtrl->SetItemText(row,0,"");
m_recordset->Close();
}
if(!strcmp(p_treestr,"导线网平差"))
{ CPingcha pdlg;
if(pdlg.DoModal()==IDOK)
{ //pchildframe->m_rightpaneview->DestroyWindow();
pchildframe->SetVisibleView((CView*)(pchildframe->m_pcview),(CView*)pchildframe->m_rightpaneview);
}
}
m_database->Close();
delete m_database;
delete m_recordset;
}
}
*pResult = 0;
}
int CTreeViewFile::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CTreeView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
BOOL CTreeViewFile::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
cs.style |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT;
return CTreeView::PreCreateWindow(cs);
}
void CLjbiao::Addcezhan(CString cez,CString dx)
{
czd newczd=new Cezhand;
newczd->czdian=cez;
newczd->dxdian=dx;
newczd->du=0;
newczd->isjd=0;
newczd->isknow=0;
newczd->x=0;
newczd->y=0;
newczd->istuidao=0;
newczd->pzzdian=NULL;
newczd->xuhao=0;
m_xian.Add(newczd);
}
void CLjbiao::Addzzdian(CString zd, CString cd, double jiaodu)
{
int j=Findczd(zd);
if(j==-1)
return;
zzd newzzd=new zhaozhund;
newzzd->dianhao=cd;
newzzd->myjiaodu=jiaodu;
newzzd->myzzdian=m_xian.GetAt(j)->pzzdian;
m_xian.GetAt(j)->pzzdian=newzzd;
m_xian.GetAt(j)->du++;
}
int CLjbiao::Findczd(CString pczd)
{
int count=m_xian.GetUpperBound();
if(count<0)
return -1;
int i;
for(i=0;i<=count;i++)
{
CString czstr=m_xian.GetAt(i)->czdian;
if(!strcmp(pczd,czstr))
return i;
}
return -1;
}
void CLjbiao::DeleteAllItems()
{int count ;
count =m_xian.GetUpperBound();
for(int i=0;i<=count;i++)
{
zzd pzzd1,pzzd2;
pzzd1=m_xian.GetAt(i)->pzzdian;
while(pzzd1)
{
pzzd2=pzzd1->myzzdian;
delete pzzd1;
pzzd1=pzzd2;
}
delete m_xian.GetAt(i);
}
m_xian.RemoveAll();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -