测绘程序设计基础 实验4 CSU

实验4 类的创建

(大地四边形类设计)

(工具:VS2010)

一、 实验目的

• 掌握面向对象编程基本思想
• 掌握VC++.net中创建类
• 掌握建立和使用对象
• 掌握运算符号重载
• 理解类的继承和多态性

二、实验内容与要求

设计一个大地四边形类,注意大地四边形的基本属性,功能上只要求能够设置和返回已知点坐标、8个观测角度、待定点近似坐标计算以及闭合差的计算。

三、设计与实现:

3.1 设计思路:

在这里插入图片描述

3.2 界面设计及属性:

在这里插入图片描述

3.3主要代码:

3.3.1文件:<Support.h> 
#pragma once
#include "Angle.h"
#include "math.h"
#include "matrix.h"

class Support
{
   
private:
	Angle Angles[8];
	Angle Results[8];
    double x1;
	double y1;
	double x2;
	double y2;
	double x3;
	double y3;
	double x4;
	double y4;
public:
	Support(void);
	~Support(void);
	void ForeIntersecPos(double Xa,double Ya, double Xb,double Yb, 
                     double Alfa,double Beta, double &Xp,double &Yp);

	int SplitStringArray(CString str, char split, CStringArray& aStr);
	//读取数据至数组

	void read(CString strdate,Support &p);
	//对数据进行处理
    void out(CString &strResult,Support &p,double Sigma);
	void pocess(CString strdate,CString &strResult);
	//输出
};


3.3.2文件:<Support.cpp>  
/***************************************************************************
*  文件名:<Support.cpp>                                                    *
*                                                                          *
*  描述:大地四边形                                                         *
*                                                                          *
*  历史:**日期**         **理由**            **签名**                     *
*      2019年4月5日    代码格式修改        张                        *
*                                                                          *
*  外部过程:                                                              *
*                                                                          *
/**************************************************************************/


/***************************************************************************
*  名字:void ForeIntersecPos                                              *
*                                                                          *
*  描述:前方交会函数,利用引用赋值                                        *
*                                                                          *
*  历史:**日期**         **理由**            **签名**                     *
*      2019年4月5日      引用该函数           张                     *
*  参数: 1.double Xa                                                      *
*         2.double Ya                                                      *
*         3.double Xb                                                      *
*         4.double Yb                                                      *
*         5.double Alfa                                                    *
*         6.double Beta                                                    *
*         7.double &Xp                                                     *
*         8.double &Yp                                                     *
*  返回值:无返回值                                                        *
*                                                                          *
*  注:                                                                    *
/**************************************************************************/
void Support::ForeIntersecPos(double Xa,double Ya, double Xb,double Yb, double Alfa,double Beta, double &Xp,double &Yp)
{
   
	
        double ctgA, ctgB;
//计算角a,b的反正切值
        ctgA = 1 / tan(Alfa);
        ctgB = 1 / tan(Beta);
        //计算前方交会定位值
        Xp = ((Xa * ctgB + Xb * ctgA) + (Yb - Ya)) / (ctgA + ctgB);
        Yp = ((Ya * ctgB + Yb * ctgA) + (Xa - Xb)) / (ctgA + ctgB);

}
	


/***************************************************************************
*  名字:double CSupport::SplitStringArray(CString str, char split, CStringArray& aStr)    *
*                                                                          *
*  描述:字符串分割函数                                                    *
*                                                                          *
*  历史:**日期**         **理由**            **签名**                     *
*      2019年3月20日       创建该函数          张                    *
*  参数: 1.CString str                                                    *
*         2.char split                                                     *
*         3.CStringArray& aStr                                             *
*  返回值:int类型数据 返回n                                              *
*                                                                          *
*  注:                                                                    *
/**************************************************************************/
int Support::SplitStringArray(CString str, char split, CStringArray& aStr)
{
   
	int startIdx = 0;
	int idx = str.Find(split, startIdx)
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值