1、中南大学测绘课程设计控制网程序控制网ClzControlNetAdjust头文件#pragma once#include ClzControlPoint.h#include ClzAngleObs.h#include ClzDistObs.h#include Matrix.h#include Angle.hclass ClzControlNetAdjustpublic: ClzControlNetAdjust(); ClzControlNetAdjust();private: ClzControlPoint * m_pUnknowPoint; int m_iUnknowPointCount;
2、ClzControlPoint * m_pKnowPoint; int m_iKnowPointCount; ClzAngleObs * m_pAngleObs; int m_iAngleObsCount; ClzDistObs * m_pDistObs; int m_iDistObsCount; public: double Anglesigma; double Distsigma; int m_iStationCount; bool LoadObsData(const CString& strFileName); void CoordinateEstimates(); void SetAn
3、glesigmaD(double Asigma,double Dsigma,double count); void ErrorEllipseDraw(CDC * pDC, CRect& rect); void CalculateErrorEquations(const CString& strFileName);private: ClzControlPoint* SearchKnownPointUsingID(CString strID); ClzControlPoint* SearchUnknownPointUsingID(CString strID); void SetKnowPointS
4、ize(int size); void SetUnknowPointSize(int size); void SetAngleObsSize(int size); void SetDistObsSize(int size); CString* SplitString(CString str, char split, int iSubStrs); ClzControlPoint* SearchPointUsingID(CString strPointID); Angle Azimuth(double dX1, double My1, double dX2, double My2); double
5、 HDist(ClzControlPoint* cpStation1, ClzControlPoint* cpEnd1); Angle ZeroAngle(ClzAngleObs AngleObs); void FormErrorEquations(CMatrix &B, CMatrix &f); void ComAngleObsEff(ClzAngleObs AngleObs ,double& Fi, double& Ci, double& Di, double& Ck, double& Dk); void ComDistObsEff(ClzDistObs DistObs, double&
6、Fi, double& Ci, double& Di, double& Ck, double& Dk); void FixedWeight(CMatrix &p); void GetMaxXY(double& dx, double& dy,double& minx,double& maxy); void OutMatrixToFile(const CMatrix& mat, CStdioFile& SF);控制网ClzControlNetAdujst类源文件#include stdafx.h#include ClzControlNetAdujst.h#include #include math
7、.hconst double PI =atan(1.0)*4.0;const double EPSILON = 1.0E-12;const double R0 = 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; Anglesigm
8、a=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;void ClzControlNetAdjust:SetKnowPointSize(int size) if (m
9、_pKnowPoint != NULL) delete m_pKnowPoint; m_pKnowPoint = NULL; m_iKnowPointCount=0; m_iKnowPointCount = size; m_pKnowPoint = new ClzControlPointsize;void ClzControlNetAdjust:SetUnknowPointSize(int size) if (m_pUnknowPoint != NULL) delete m_pUnknowPoint; m_pUnknowPoint = NULL; m_iUnknowPointCount = 0
10、; m_iUnknowPointCount = size; m_pUnknowPoint = new ClzControlPointsize;void ClzControlNetAdjust:SetAngleObsSize(int size) if (m_pAngleObs!=NULL) delete m_pAngleObs; m_pAngleObs = NULL; m_iAngleObsCount = 0; m_iAngleObsCount = size; m_pAngleObs = new ClzAngleObssize;void ClzControlNetAdjust:SetDistOb
11、sSize(int size) if (m_pDistObs!=NULL) delete m_pDistObs; m_pDistObs = NULL; m_iDistObsCount = 0; m_iDistObsCount = size; m_pDistObs = new ClzDistObssize;CString* ClzControlNetAdjust:SplitString(CString str, char split, int iSubStrs) int iPos = 0; /分割符位置 int iNums = 0; /分割符的总数 CString strTemp = str;
12、CString strRight; /先计算子字符串的数量 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; return NULL; /子字符串数组 iSubStrs = iNums + 1; /子串的数量 = 分割符数量 + 1 CString*
13、pStrSplit; pStrSplit = new CStringiSubStrs; strTemp = str; CString strLeft; for (int i = 0; i iNums; i+) iPos = strTemp.Find(split); /左子串 strLeft = strTemp.Left(iPos); /右子串 strRight = strTemp.Mid(iPos + 1, strTemp.GetLength(); strTemp = strRight; pStrSpliti = strLeft; pStrSplitiNums = strTemp; retur
14、n pStrSplit;ClzControlPoint* ClzControlNetAdjust:SearchKnownPointUsingID(CString strID) for (int i = 0; im_iKnowPointCount; i+) if (strID = m_pKnowPointi.strPointID) return &m_pKnowPointi; return NULL;ClzControlPoint* ClzControlNetAdjust:SearchUnknownPointUsingID(CString strID) for (int i = 0; i= 0)
15、 sgn = 1; else sgn = -1; A(RAD)= PI - sgn*PI / 2 - atan(dX2 - dX1) / (dY2 - dY1 + EPSILON); return A;double ClzControlNetAdjust:HDist(ClzControlPoint* cpStation1, ClzControlPoint* cpEnd1) double dDist; dDist = sqrt(cpStation1-X - cpEnd1-X)*(cpStation1-X - cpEnd1-X) + (cpStation1-Y - cpEnd1-Y)*(cpSta
16、tion1-Y- cpEnd1-Y); return dDist;Angle ClzControlNetAdjust:ZeroAngle(ClzAngleObs AngleObs) Angle ZeroAlf; for (int i = 0; i strPointID = AngleObs.cpStation-strPointID) & m_pAngleObsi.ObsAngle(DMS)-0.000000 X, m_pAngleObsi.cpStation-Y, m_pAngleObsi.cpEnd-X, m_pAngleObsi.cpEnd-Y); return ZeroAlf;void
17、ClzControlNetAdjust:FormErrorEquations(CMatrix &B, CMatrix &f) int iObsCount, iUnknownCount; iObsCount = m_iAngleObsCount + m_iDistObsCount; iUnknownCount = m_iStationCount + m_iUnknowPointCount * 2; B.SetSize(iObsCount, iUnknownCount); f.SetSize(iObsCount, 1); for (int i = 0; i iObsCount;i+) for (i
18、nt j = 0; j iUnknownCount; j+) B(i, j) = 0; for (int i = 0; i iObsCount; i+) f(i, 0) = 0; /方向值误差方程 int StationNum = 1; int tmpi = 1; for (int i = 0; i strPointID != m_pAngleObstmpi.cpStation-strPointID ) StationNum+; B(i, m_iUnknowPointCount * 2 - 1 + StationNum) = -1; tmpi = i; for (int j = 0; j st
19、rPointID = m_pUnknowPointj.strPointID) B(i, 2 * j) = ci; B(i, 2 * j + 1) = di; if (m_pAngleObsi.cpEnd-strPointID = m_pUnknowPointj.strPointID) B(i, 2 * j) = ck; B(i, 2 * j + 1) = dk; f(i, 0) = fi; /距离观测误差方程 for (int i = 0; i m_iDistObsCount; i+) double fi, ci, di, ck, dk; ComDistObsEff(m_pDistObsi,f
20、i,ci,di,ck,dk); for (int j = 0; j strPointID = m_pUnknowPointj.strPointID) B(i+m_iAngleObsCount, 2 * j) = ci; B(i+m_iAngleObsCount, 2 * j + 1) = di; if (m_pDistObsi.cpEnd-strPointID = m_pUnknowPointj.strPointID) B(i + m_iAngleObsCount, 2 * j) = ck; B(i + m_iAngleObsCount, 2 * j + 1) = dk; f(i+m_iAng
21、leObsCount, 0) = fi; void ClzControlNetAdjust:ComAngleObsEff(ClzAngleObs AngleObs , double& Fi, double& Ci, double& Di, double& Ck, double& Dk) double dXik, dYik,dSik; dXik = AngleObs.cpEnd-X - AngleObs.cpStation-X; dYik = AngleObs.cpEnd-Y - AngleObs.cpStation-Y; dSik = HDist(AngleObs.cpStation, Ang
22、leObs.cpEnd); Angle Aziik; Aziik = Azimuth(AngleObs.cpStation-X, AngleObs.cpStation-Y, AngleObs.cpEnd-X, AngleObs.cpEnd-Y ); double a, b; a = R0*dYik / (dSik*dSik * 1000.0); b =- R0*dXik / (dSik*dSik * 1000.0); Ci = a; Di = b; Ck = -a; Dk = -b; Angle Zero; Zero = ZeroAngle(AngleObs); double L0; L0 =
23、 Aziik(RAD) - Zero(RAD); if (L0 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;void ClzControlNetAdjust:OutMatrixToFile(const CMatrix& mat, CStdioFile& SF) CString strLine, strTmp; for (int i = 0; im
24、at.Row(); i+) strLine.Empty(); for (int j = 0; jmat.Col(); j+) strTmp.Format(_T(%.4f ), mat(i, j); strLine = strLine + strTmp; SF.WriteString(strLine + _T(rn); void ClzControlNetAdjust:FixedWeight(CMatrix &p) int iCount = m_iAngleObsCount + m_iDistObsCount; p.SetSize(iCount, iCount); p.Unit(); for (
25、int i = m_iAngleObsCount ; i iCount; i+) p(i, i) = Anglesigma*Anglesigma / (Distsigma*Distsigma*m_pDistObsi-m_iAngleObsCount.dDist/1000); /控制网主函数void ClzControlNetAdjust:CalculateErrorEquations(const CString& strFileName) CStdioFile sf; CString strLine; setlocale(LC_ALL, ); if (!sf.Open(strFileName, CFile:modeCreate | CFile:modeWrite)return; strLine.Format(_T(概算后坐标n); sf.WriteString(strLine); strLine.Format(_T(未知点个数:%dn), m_i
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1