⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 computeview.cpp

📁 计算摄动力模型中关于海潮固体潮极潮以及利用行星星历表计算太阳月亮位置的程序
💻 CPP
字号:
// computeView.cpp : implementation of the CComputeView class
//

#include "stdafx.h"
#include "compute.h"
#include "RinexNEpoch.h"
#include "math.h"
#include "SingleEpochDlg.h"
#include "CorrectModel.h"

#include "computeDoc.h"
#include "computeView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CComputeView

IMPLEMENT_DYNCREATE(CComputeView, CView)

BEGIN_MESSAGE_MAP(CComputeView, CView)
	//{{AFX_MSG_MAP(CComputeView)
	ON_COMMAND(ID_COMPUTE, OnCompute)
	ON_COMMAND(ID_VIEW_SATRESULT, OnViewSatresult)
	ON_COMMAND(ID_CORRECT, OnCorrect)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CComputeView construction/destruction

CComputeView::CComputeView()
{
	// TODO: add construction code here

}

CComputeView::~CComputeView()
{
}

BOOL CComputeView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CComputeView drawing

void CComputeView::OnDraw(CDC* pDC)
{
	CComputeDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CComputeView printing

BOOL CComputeView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CComputeView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CComputeView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CComputeView diagnostics

#ifdef _DEBUG
void CComputeView::AssertValid() const
{
	CView::AssertValid();
}

void CComputeView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CComputeDoc* CComputeView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CComputeDoc)));
	return (CComputeDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CComputeView message handlers

void CComputeView::OnCompute() 
{
	// TODO: Add your command handler code here
	int prn,year,month,day,hour,min;
	double sec;

	int nFile;
	int tyr,tmon,tdy,sv_sel,thr,tmi;
	float tsec;
	double xs[3],fRange=0.0,toe;
	bool base=true;
	CString File_status;
	// 	CString fName[]={"e:\\cheng\\gpscalc\\shao3260.98n","e:\\cheng\\gpscalc\\taej3260.98n"};
	CString fName[]={"d:\\auto1580.05n"};//auto1160.04N;00091281.00N
	CString	ComFile="d:\\NAV1";
	//lhx
	CString OutFile="d:\\XYZOUT.DAT";

	CSingleEpochDlg sedlg;
	if(sedlg.DoModal()==IDOK)
	{
		prn=sedlg.prn;
		year=sedlg.year;
		month=sedlg.month;
		day=sedlg.day;
		hour=sedlg.hour;
		min=sedlg.min;
		sec=sedlg.sec;
	//lhx

	tyr=3,tmon=5,tdy=8,sv_sel=4,thr=2,tmi=0,tsec=0.0;
	nFile=1;
	svp_Calc(fName,nFile,ComFile,year,month,day,hour,min,
		sec,prn,fRange,xs,File_status,toe,base);
	MessageBox("ok!计算完毕!请阅读结果文件XYZOUT.DAT");
	}
//lhx
	char Filebuff1[81];
	FILE *fp3;
	if((fp3=fopen(OutFile,"w"))==NULL)
	{
		sprintf(Filebuff1,"打开 %s 文件错!",OutFile);
		File_status=Filebuff1;
	}
	fprintf(fp3,"prn=%d\n",prn);
	for (int i=0;i<3;i++)
	{
		fprintf(fp3,"%f\n",xs[i]);
	}
	fclose(fp3);
	//AfxMessageBox("计算完毕!请阅读结果文件XYZOUT.DAT");

//lhx

}

void CComputeView::OnViewSatresult() 
{
	// TODO: Add your command handler code here
	AfxMessageBox("尚未加入代码!");
}

void CComputeView::OnCorrect() 
{
	// TODO: Add your command handler code here
	double Solid_Coef[5],Ocean_Coef[5],Pole_Coef[2];
	double CoefDot[5];
	double jd;

	jd=2452277.5;

	//设置类的对象
	CCorrectModel CModel;

	//调用类的成员函数
	CModel.SetJUL(jd); //根据儒略日,计算太阳和月亮位置
	CModel.GetSoildTide(Solid_Coef); //计算固体潮
	CModel.GetOceanTide(Ocean_Coef); //计算海潮
	CModel.GetPoleTide(Pole_Coef);  //计算极潮

	CoefDot[0]=Solid_Coef[0]+Ocean_Coef[0];                 // correct C20
	CoefDot[1]=Solid_Coef[1]+Ocean_Coef[1]+Pole_Coef[0];    // correct C21
	CoefDot[2]=Solid_Coef[2]+Ocean_Coef[2];                // correct C22
	CoefDot[3]=Solid_Coef[3]+Ocean_Coef[3]+Pole_Coef[1];   // correct S21
	CoefDot[4]=Solid_Coef[4]+Ocean_Coef[4];               // correct S22
	AfxMessageBox("ok!");

	//HC[4]+=CoefDot[0];
	//HC[5]+=CoefDot[1];
	//HC[6]+=CoefDot[2];

	//HS[5]+=CoefDot[3];
	//HS[6]+=CoefDot[4];

	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -