测绘程序设计-实验八_水准网平差程序设计报告

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

《误差理论与测量平差基础课程设计(VC.net)》实习报告(VisualC++.Net)班级:学号:姓名:12014年2月17日至2月28日水准网平差程序设计一、实验目的•巩固过程的定义与调用•巩固类的创建与使用•巩固间接平差模型及平差计算•掌握平差程序设计的基本技巧与步骤二、实验内容水准网平差程序设计。设计一个水准网平差的程序,要求数据从文件中读取,计算部分与界面无关。1.水准网间接平差模型:2.计算示例:近似高程计算:23.水准网平差计算一般步骤(1)读取观测数据和已知数据;(2)计算未知点高程近似值;(3)列高差观测值误差方程;(4)根据水准路线长度计算高差观测值的权;(5)组成法方程;(6)解法方程,求得未知点高程改正数及平差后高程值;(7)求高差观测值残差及平差后高差观测值;3(8)精度评定;(9)输出平差结果。4.水准网高程近似值计算算法5.输入数据格式示例3已知点数A,151.5664B,144.5684已知点号及高程C,144.31949未知数P1,P2,P3,P4,P5,P6,P7,P8,P9未知点号15高差观测数据个数B,P4,1.4966,0.4B,P1,1.7881,0.5P1,A,5.2065,0.7P4,P2,2.0850,0.9P2,A,3.4175,0.4C,P3,1.2081,1.0P3,A,6.0372,0.6C,P5,4.3306,0.7高差观测数据:起点,终点,高差,路线长度P6,P5,3.6513,0.6P7,P6,2.5122,0.34P7,P9,2.0415,0.8P9,P4,1.5366,0.7C,P4,1.7450,0.8P8,P5,2.7436,0.4P9,P8,1.3783,0,5实验代码:#pragmaonceclassLevelControlPoint{public:LevelControlPoint(void);~LevelControlPoint(void);public:CStringstrName;//点名CStringstrID;//点号floatH;boolflag;//标记是否已经计算出近似高程值,若计算出则为,否则为};classCDhObs{public:CDhObs(void);~CDhObs(void);public:LevelControlPoint*cpBackObj;//后视点LevelControlPoint*cpFrontObj;//前视点doubleObsValue;//高差值doubleDist;//测站的距离};#includeStdAfx.h#includeLevelControlPoint.hLevelControlPoint::LevelControlPoint(void){strName=_T();strID=_T();H=0;flag=0;5}LevelControlPoint::~LevelControlPoint(void){}CDhObs::CDhObs(void){}CDhObs::~CDhObs(void){}#pragmaonce#includeLevelControlPoint.h#includeMatrix.hclassAdjustLevel{public:AdjustLevel(void);~AdjustLevel(void);public:LevelControlPoint*m_pKnownPoint;//已知点数组intm_iKnownPointCount;//已知点个数LevelControlPoint*m_pUnknownPoint;//未知点数组intm_iUnknownPointCount;//未知点个数CDhObs*m_pDhObs;//高差观测值数组intm_iDhObsCount;//高差观测值个数public:voidSetKnownPointSize(intsize);//创建大小为size的已知点数组voidSetUnkonwnPointSize(intsize);//创建大小为size的未知点数组voidSetDhObsSize(intsize);//创建大小为size的观测值数组boolLoadObsData(constCString&strFile);//读入观测文件CString*SplitString(CStringstr,charsplit,int&iSubStrs);voidApproHeignt(void);//计算近似值private:LevelControlPoint*SearchKnownPointUsingID(CStringID);LevelControlPoint*SearchUnknownPointUsingID(CStringID);LevelControlPoint*SearchPointUsingID(CStringID);CMatrixLevleWeight(void);//计算权矩阵public:voidFormErrorEquation(CMatrix&B,CMatrix&L);//组成误差方程voidEquationCompute(CMatrix&x);//计算法方程voidAccuracy_Assessment(double&r0,CMatrix&Qxx);//精度评定voidCompAdjust(double&r0,CMatrixQx[]);};6#includeStdAfx.h#includeAdjustLevel.h#includelocale.h#includeLevelControlPoint.h#includemath.hAdjustLevel::AdjustLevel(void){m_pKnownPoint=NULL;//已知点数组m_iKnownPointCount=0;//已知点个数m_pUnknownPoint=NULL;//未知点数组m_iUnknownPointCount=0;//未知点个数m_pDhObs=NULL;//高差观测值数组m_iDhObsCount=0;//高差观测值个数}AdjustLevel::~AdjustLevel(void){if(m_pKnownPoint!=NULL){delete[]m_pKnownPoint;m_pKnownPoint=NULL;}if(m_pUnknownPoint!=NULL){delete[]m_pUnknownPoint;m_pUnknownPoint=NULL;}if(m_pDhObs!=NULL){delete[]m_pDhObs;m_pDhObs=NULL;}}voidAdjustLevel::SetKnownPointSize(intsize){m_pKnownPoint=newLevelControlPoint[size];//创建动态指针m_iKnownPointCount=size;}7voidAdjustLevel::SetUnkonwnPointSize(intsize){m_pUnknownPoint=newLevelControlPoint[size];m_iUnknownPointCount=size;}voidAdjustLevel::SetDhObsSize(intsize){m_pDhObs=newCDhObs[size];m_iDhObsCount=size;//高差观测值个数}boolAdjustLevel::LoadObsData(constCString&strFile){CStdioFilesf;if(!sf.Open(strFile,CFile::modeRead))returnfalse;//创建并打开文件对象CStringstrLine;boolbEOF=sf.ReadString(strLine);//读取第一行,即已知点的数目SetKnownPointSize(_ttoi(strLine));//根据已知点的数目,创建已知点数组;intn=0;for(inti=0;im_iKnownPointCount;i++)//读取已知点的点名和高程值{sf.ReadString(strLine);CString*pstrData=SplitString(strLine,',',n);m_pKnownPoint[i].strName=pstrData[0];m_pKnownPoint[i].strID=pstrData[0];m_pKnownPoint[i].H=_tstof(pstrData[1]);m_pKnownPoint[i].flag=1;//已知点不用平差,故将其的flag设置为delete[]pstrData;pstrData=NULL;}sf.ReadString(strLine);//读取未知点的个数SetUnkonwnPointSize(_ttoi(strLine));//根据未知点的个数创建未知点数组sf.ReadString(strLine);//读取未知点的点名CString*pstrData=SplitString(strLine,',',n);for(inti=0;im_iUnknownPointCount;i++)//将未知点的点名放入未知点数组{m_pUnknownPoint[i].strName=pstrData[i];m_pUnknownPoint[i].strID=pstrData[i];m_pUnknownPoint[i].H=0;//未知点的高程值设置为m_pUnknownPoint[i].flag=0;//还没有求得近似高程,故其flag设置为}8if(pstrData!=NULL){delete[]pstrData;pstrData=NULL;}sf.ReadString(strLine);//读取观测值的个数SetDhObsSize(_ttoi(strLine));//按照观测值的大小,创建观测值数组for(inti=0;im_iDhObsCount;i++)//分行读取观测值的数据,将其存入观测值数组{sf.ReadString(strLine);CString*pstrData=SplitString(strLine,',',n);m_pDhObs[i].cpBackObj=SearchPointUsingID(pstrData[0]);//后视点m_pDhObs[i].cpFrontObj=SearchPointUsingID(pstrData[1]);//前视点m_pDhObs[i].HObsValue=_tstof(pstrData[2]);//高差观测值m_pDhObs[i].Dist=_tstof(pstrData[3]);//距离观测值delete[]pstrData;pstrData=NULL;}sf.Close();return1;}CString*AdjustLevel::SplitString(CStringstr,charsplit,int&iSubStrs){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;9returnNULL;}//子字符串数组iSubStrs=iNums+1;//子串的数量=分割符数量+1CString*pStrSplit;pStrSplit=newCString[iSubStrs];strTemp=str;CStringstr

1 / 19
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功