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

📄 wshmdoc.cpp

📁 提供交互的方式选取合适的震相
💻 CPP
字号:
// wshmDoc.cpp : implementation of the CWshmDoc class
//

#include "stdafx.h"
#include "wshm.h"

#include "wshmDoc.h"
#include "../SacIO/SacIO.h"

#include <iterator>
#include <fstream>
#include <algorithm>


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

/////////////////////////////////////////////////////////////////////////////
// CWshmDoc

IMPLEMENT_DYNCREATE(CWshmDoc, CDocument)

BEGIN_MESSAGE_MAP(CWshmDoc, CDocument)
	//{{AFX_MSG_MAP(CWshmDoc)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

using namespace std;

/////////////////////////////////////////////////////////////////////////////
// CWshmDoc construction/destruction

CWshmDoc::CWshmDoc()
{
}

CWshmDoc::~CWshmDoc()
{
	Clear();
}

void CWshmDoc::Clear(void) {
	if( m_lsDataHolder.size() ) {
		list<CFileDataHolder *>::iterator iter = m_lsDataHolder.begin();
		while( iter != m_lsDataHolder.end() ) {
			delete (CSacFile*)*iter;
			++iter;
		}
		m_lsDataHolder.clear();
	}

	m_vecEventNm.clear();
}

BOOL CWshmDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CWshmDoc serialization

void CWshmDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CWshmDoc diagnostics

#ifdef _DEBUG
void CWshmDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CWshmDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CWshmDoc commands

void CWshmDoc::OpenListFile(const char * listfile) 
{
	if( NULL == strlen(listfile) )
		return;

	Clear();

	strcpy( m_strListFile , listfile );
	
	FILE *fp =fopen( m_strListFile, "rt" );

	if( NULL == fp )
		return;

	string strtmp;
	string strEventNm;
	CSacFile * pSacFile;
	bool bFirst = true;
	CTime tm;
	double delta;
	char cc[256];

	while( !feof(fp) ) {
		fscanf(fp, "%s", cc);
		strtmp = cc;
		if( strtmp.empty() )
			continue;

		pSacFile = new CSacFile ;
		pSacFile->LoadData(strtmp.c_str());
		if( bFirst ) {
			pSacFile->GetTime(tm, delta);
			bFirst = false;
		}
		else
			pSacFile->Align2Time(tm, delta);

		strEventNm = pSacFile->GetEvtNm();
		m_lsDataHolder.push_back(pSacFile);
		
		if( m_vecEventNm.end() == find(m_vecEventNm.begin(), m_vecEventNm.end(), strEventNm ) )
			m_vecEventNm.push_back(strEventNm);
//		m_EventDataHolder.insert( make_pair(strEventNm, pSacFile) );
	}
	fclose(fp);
	
}

long CWshmDoc::GetLsItemCount()
{
	list<CSacFile *>::size_type size = m_lsDataHolder.size();
	
	return size;
}

⌨️ 快捷键说明

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