中南大学测绘课程设计控制网程序.docx
- 文档编号:29569305
- 上传时间:2023-07-24
- 格式:DOCX
- 页数:34
- 大小:22.36KB
中南大学测绘课程设计控制网程序.docx
《中南大学测绘课程设计控制网程序.docx》由会员分享,可在线阅读,更多相关《中南大学测绘课程设计控制网程序.docx(34页珍藏版)》请在冰豆网上搜索。
中南大学测绘课程设计控制网程序
控制网ClzControlNetAdjust头文件
#pragmaonce
#include"ClzControlPoint.h"
#include"ClzAngleObs.h"
#include"ClzDistObs.h"
#include"Matrix.h"
#include"Angle.h"
classClzControlNetAdjust
{
public:
ClzControlNetAdjust();
~ClzControlNetAdjust();
private:
ClzControlPoint*m_pUnknowPoint;
intm_iUnknowPointCount;
ClzControlPoint*m_pKnowPoint;
intm_iKnowPointCount;
ClzAngleObs*m_pAngleObs;
intm_iAngleObsCount;
ClzDistObs*m_pDistObs;
intm_iDistObsCount;
public:
doubleAnglesigma;
doubleDistsigma;
intm_iStationCount;
boolLoadObsData(constCString&strFileName);
voidCoordinateEstimates();
voidSetAnglesigmaD(doubleAsigma,doubleDsigma,doublecount);
voidErrorEllipseDraw(CDC*pDC,CRect&rect);
voidCalculateErrorEquations(constCString&strFileName);
private:
ClzControlPoint*SearchKnownPointUsingID(CStringstrID);
ClzControlPoint*SearchUnknownPointUsingID(CStringstrID);
voidSetKnowPointSize(intsize);
voidSetUnknowPointSize(intsize);
voidSetAngleObsSize(intsize);
voidSetDistObsSize(intsize);
CString*SplitString(CStringstr,charsplit,intiSubStrs);
ClzControlPoint*SearchPointUsingID(CStringstrPointID);
AngleAzimuth(doubledX1,doubleMy1,doubledX2,doubleMy2);
doubleHDist(ClzControlPoint*cpStation1,ClzControlPoint*cpEnd1);
AngleZeroAngle(ClzAngleObsAngleObs);
voidFormErrorEquations(CMatrix&B,CMatrix&f);
voidComAngleObsEff(ClzAngleObsAngleObs,double&Fi,double&Ci,double&Di,double&Ck,double&Dk);
voidComDistObsEff(ClzDistObsDistObs,double&Fi,double&Ci,double&Di,double&Ck,double&Dk);
voidFixedWeight(CMatrix&p);
voidGetMaxXY(double&dx,double&dy,double&minx,double&maxy);
voidOutMatrixToFile(constCMatrix&mat,CStdioFile&SF);
}
;
控制网ClzControlNetAdujst类源文件
#include"stdafx.h"
#include"ClzControlNetAdujst.h"
#include
#include"math.h"
constdoublePI=atan(1.0)*4.0;
constdoubleEPSILON=1.0E-12;
constdoubleR0=206265;
ClzControlNetAdjust:
:
ClzControlNetAdjust()
{
m_pUnknowPoint=NULL;
m_iUnknowPointCount=0;
m_pKnowPoint=NULL;
m_iKnowPointCount=0;
m_pAngleObs=NULL;
m_iAngleObsCount=0;
m_pDistObs=NULL;
m_iDistObsCount=0;
Anglesigma=0;
Distsigma=0;
m_iStationCount=0;
}
ClzControlNetAdjust:
:
~ClzControlNetAdjust()
{
delete[]m_pUnknowPoint;
m_pUnknowPoint=NULL;
delete[]m_pKnowPoint;
m_pKnowPoint=NULL;
delete[]m_pAngleObs;
m_pAngleObs=NULL;
delete[]m_pDistObs;
m_pDistObs=NULL;
}
voidClzControlNetAdjust:
:
SetKnowPointSize(intsize)
{
if(m_pKnowPoint!
=NULL)
{delete[]m_pKnowPoint;
m_pKnowPoint=NULL;
m_iKnowPointCount=0;}
m_iKnowPointCount=size;
m_pKnowPoint=newClzControlPoint[size];
}
voidClzControlNetAdjust:
:
SetUnknowPointSize(intsize)
{
if(m_pUnknowPoint!
=NULL)
{
delete[]m_pUnknowPoint;
m_pUnknowPoint=NULL;
m_iUnknowPointCount=0;
}
m_iUnknowPointCount=size;
m_pUnknowPoint=newClzControlPoint[size];
}
voidClzControlNetAdjust:
:
SetAngleObsSize(intsize)
{
if(m_pAngleObs!
=NULL)
{
delete[]m_pAngleObs;
m_pAngleObs=NULL;
m_iAngleObsCount=0;
}
m_iAngleObsCount=size;
m_pAngleObs=newClzAngleObs[size];
}
voidClzControlNetAdjust:
:
SetDistObsSize(intsize)
{
if(m_pDistObs!
=NULL)
{
delete[]m_pDistObs;
m_pDistObs=NULL;
m_iDistObsCount=0;
}
m_iDistObsCount=size;
m_pDistObs=newClzDistObs[size];
}
CString*ClzControlNetAdjust:
:
SplitString(CStringstr,charsplit,intiSubStrs)
{
intiPos=0;//分割符位置
intiNums=0;//分割符的总数
CStringstrTemp=str;
CStringstrRight;
//先计算子字符串的数量
while(iPos!
=-1)
{
iPos=strTemp.Find(split);
if(iPos==-1)
{
break;
}
strRight=strTemp.Mid(iPos+1,str.GetLength());
strTemp=strRight;
iNums++;
}
if(iNums==0)//没有找到分割符
{
//子字符串数就是字符串本身
iSubStrs=1;
returnNULL;
}
//子字符串数组
iSubStrs=iNums+1;//子串的数量=分割符数量+1
CString*pStrSplit;
pStrSplit=newCString[iSubStrs];
strTemp=str;
CStringstrLeft;
for(inti=0;i { iPos=strTemp.Find(split); //左子串 strLeft=strTemp.Left(iPos); //右子串 strRight=strTemp.Mid(iPos+1,strTemp.GetLength()); strTemp=strRight; pStrSplit[i]=strLeft; } pStrSplit[iNums]=strTemp; returnpStrSplit; } ClzControlPoint*ClzControlNetAdjust: : SearchKnownPointUsingID(CStringstrID) { for(inti=0;i { if(strID==m_pKnowPoint[i].strPointID) { return&m_pKnowPoint[i]; } } returnNULL; } ClzControlPoint*ClzControlNetAdjust: : SearchUnknownPointUsingID(CStringstrID) { for(inti=0;i { if(strID==m_pUnknowPoint[i].strPointID) { return&m_pUnknowPoint[i]; } } returnNULL; } ClzControlPoint*ClzControlNetAdjust: : SearchPointUsingID(CStringstrPointID) { ClzControlPoint*pCP=NULL; pCP=SearchKnownPointUsingID(strPointID); if(pCP==NULL) { pCP=SearchUnknownPointUsingID(strPointID); } returnpCP; } AngleClzControlNetAdjust: : Azimuth(doubledX1,doubledY1,doubledX2,doubledY2) { AngleA; intsgn; if(dY2-dY1+EPSILON>=0) { sgn=1; } elsesgn=-1; A(RAD)=PI-sgn*PI/2-atan((dX2-dX1)/(dY2-dY1+EPSILON)); returnA; } doubleClzControlNetAdjust: : HDist(ClzControlPoint*cpStation1,ClzControlPoint*cpEnd1) { doubledDist; dDist=sqrt((cpStation1->X-cpEnd1->X)*(cpStation1->X-cpEnd1->X)+(cpStation1->Y-cpEnd1->Y)*(cpStation1->Y-cpEnd1->Y)); returndDist; } AngleClzControlNetAdjust: : ZeroAngle(ClzAngleObsAngleObs) { AngleZeroAlf; for(inti=0;i { if((m_pAngleObs[i].cpStation->strPointID==AngleObs.cpStation->strPointID)&&m_pAngleObs[i].ObsAngle(DMS)-0.000000 { ZeroAlf=Azimuth(m_pAngleObs[i].cpStation->X,m_pAngleObs[i].cpStation->Y,m_pAngleObs[i].cpEnd->X,m_pAngleObs[i].cpEnd->Y); } } returnZeroAlf; } voidClzControlNetAdjust: : FormErrorEquations(CMatrix&B,CMatrix&f) { intiObsCount,iUnknownCount; iObsCount=m_iAngleObsCount+m_iDistObsCount; iUnknownCount=m_iStationCount+m_iUnknowPointCount*2; B.SetSize(iObsCount,iUnknownCount); f.SetSize(iObsCount,1); for(inti=0;i for(intj=0;j { B(i,j)=0; } for(inti=0;i { f(i,0)=0; } //方向值误差方程 intStationNum=1; inttmpi=1; for(inti=0;i { doublefi,ci,di,ck,dk; ComAngleObsEff(m_pAngleObs[i],fi,ci,di,ck,dk); if(m_pAngleObs[i].cpStation->strPointID! =m_pAngleObs[tmpi].cpStation->strPointID ) StationNum++; B(i,m_iUnknowPointCount*2-1+StationNum)=-1; tmpi=i; for(intj=0;j { if(m_pAngleObs[i].cpStation->strPointID==m_pUnknowPoint[j].strPointID) { B(i,2*j)=ci; B(i,2*j+1)=di; } if(m_pAngleObs[i].cpEnd->strPointID==m_pUnknowPoint[j].strPointID) { B(i,2*j)=ck; B(i,2*j+1)=dk; } } f(i,0)=fi; } //距离观测误差方程 for(inti=0;i { doublefi,ci,di,ck,dk; ComDistObsEff(m_pDistObs[i],fi,ci,di,ck,dk); for(intj=0;j { if(m_pDistObs[i].cpStart->strPointID==m_pUnknowPoint[j].strPointID) { B(i+m_iAngleObsCount,2*j)=ci; B(i+m_iAngleObsCount,2*j+1)=di; } if(m_pDistObs[i].cpEnd->strPointID==m_pUnknowPoint[j].strPointID) { B(i+m_iAngleObsCount,2*j)=ck; B(i+m_iAngleObsCount,2*j+1)=dk; } } f(i+m_iAngleObsCount,0)=fi; } } voidClzControlNetAdjust: : ComAngleObsEff(ClzAngleObsAngleObs,double&Fi,double&Ci,double&Di,double&Ck,double&Dk) { doubledXik,dYik,dSik; dXik=AngleObs.cpEnd->X-AngleObs.cpStation->X; dYik=AngleObs.cpEnd->Y-AngleObs.cpStation->Y; dSik=HDist(AngleObs.cpStation,AngleObs.cpEnd); AngleAziik; Aziik=Azimuth(AngleObs.cpStation->X,AngleObs.cpStation->Y,AngleObs.cpEnd->X,AngleObs.cpEnd->Y); doublea,b; a=R0*dYik/(dSik*dSik*1000.0); b=-R0*dXik/(dSik*dSik*1000.0); Ci=a; Di=b; Ck=-a; Dk=-b; AngleZero; Zero=ZeroAngle(AngleObs); doubleL0; L0=Aziik(RAD)-Zero(RAD); if(L0<0) L0=L0+2*PI; Fi=AngleObs.ObsAngle(RAD)-L0; Fi=Fi*R0;;//常数项单位改为秒 } voidClzControlNetAdjust: : ComDistObsEff(ClzDistObsDistObs,double&Fi,double&Ci,double&Di,double&Ck,double&Dk) { doubledSik; dSik=HDist(DistObs.cpStart,DistObs.cpEnd); doublec,d; c=(DistObs.cpEnd->X-DistObs.cpStart->X)/dSik; d=(DistObs.cpEnd->Y-DistObs.cpStart->Y)/dSik; Ci=-c; Di=-d; Ck=c; Dk=d; Fi=(DistObs.dDist-dSik)*1000; } voidClzControlNetAdjust: : OutMatrixToFile(constCMatrix&mat,CStdioFile&SF) { CStringstrLine,strTmp; for(inti=0;i { strLine.Empty(); for(intj=0;j { strTmp.Format(_T("%.4f"),mat(i,j)); strLine=strLine+strTmp; } SF.WriteString(strLine+_T("\r\n")); } } voidClzControlNetAdjust: : FixedWeight(CMatrix&p) { intiCount=m_iAngleObsCount+m_iDistObsCount; p.SetSize(iCount,iCount); p.Unit(); for(inti=m_iAngleObsCount;i { p(i,i)=Anglesigma*Anglesigma/(Distsigma*Distsigma*m_pDistObs[i-m_iAngleObsCount].dDist/1000); } } //控制网主函数 voidClzControlNetAdjust: : CalculateErrorEquations(constCString&strFileName) { CStdioFilesf; CStringstrLine; setlocale(LC_ALL,""); if(! sf.Open(strFileName,CFile: : modeCreate|CFile: : modeWrite))return; strLine.Format(_T("概算后坐标\n")); sf.WriteString(strLine); strLine.Format(_T("未知点个数: %d\n"),m_i
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 中南 大学 测绘 课程设计 控制 程序
![提示](https://static.bdocx.com/images/bang_tan.gif)