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

📄 mainfrm.cpp

📁 对测井数据显示、编辑、处理
💻 CPP
字号:
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "WellDataProcess.h"

#include "MainFrm.h"

#include "CurveCompareView.h"
#include "WellDataProcessView.h"

#include "GlobalData.h"


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

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
	//{{AFX_MSG_MAP(CMainFrame)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	ON_WM_CREATE()

	ON_COMMAND(ID_TOOL_INTERPRET_COARSE, OnToolInterpretCoarse)
	ON_COMMAND(ID_TOOL_SHOW_CURVE, OnToolShowCurve)
	ON_UPDATE_COMMAND_UI(ID_TOOL_SHOW_CURVE, OnUpdateToolShowCurve)
	ON_COMMAND(ID_TOOL_STOP_FIRST_INTERPRET, OnToolStopFirstInterpret)
	ON_UPDATE_COMMAND_UI(ID_TOOL_STOP_FIRST_INTERPRET, OnUpdateToolStopFirstInterpret)
	ON_COMMAND(ID_TOOL_SYNTH_TRACE, OnToolSynthTrace)
	ON_UPDATE_COMMAND_UI(ID_TOOL_SYNTH_TRACE, OnUpdateToolSynthTrace)
	ON_COMMAND(ID_TOOL_SAVE_LAYER, OnToolSaveLayer)
	ON_UPDATE_COMMAND_UI(ID_TOOL_SAVE_LAYER, OnUpdateToolSaveLayer)
	ON_COMMAND(ID_TOOL_RESTART_INTERPRET, OnToolRestartInterpret)
	ON_COMMAND(ID_TOOL_INTERPRET_FINE_MOVELAYER, OnToolInterpretFineMovelayer)
	ON_COMMAND(ID_TOOL_INTERPRET_FINE_MOVELINE, OnToolInterpretFineMoveline)
	ON_UPDATE_COMMAND_UI(ID_TOOL_INTERPRET_FINE_MOVELINE, OnUpdateToolInterpretFineMoveline)
	ON_COMMAND(ID_TOOL_INTERPRET_DELETE_LAYER, OnToolInterpretDeleteLayer)
	ON_UPDATE_COMMAND_UI(ID_TOOL_INTERPRET_DELETE_LAYER, OnUpdateToolInterpretDeleteLayer)
	ON_COMMAND(ID_TOOL_INTERPRET_INSERT_LAYER, OnToolInterpretInsertLayer)
	ON_UPDATE_COMMAND_UI(ID_TOOL_INTERPRET_INSERT_LAYER, OnUpdateToolInterpretInsertLayer)
	ON_UPDATE_COMMAND_UI(ID_TOOL_INTERPRET_FINE_MOVELAYER, OnUpdateToolInterpretFineMovelayer)
	ON_COMMAND(ID_TOOL_FIRST_INTERPRET_UNDO, OnToolFirstInterpretUndo)
	ON_UPDATE_COMMAND_UI(ID_TOOL_FIRST_INTERPRET_UNDO, OnUpdateToolFirstInterpretUndo)
	ON_UPDATE_COMMAND_UI(ID_TOOL_INTERPRET_COARSE, OnUpdateToolInterpretCoarse)
	ON_COMMAND(ID_TOOL_DC_FORWARD, OnToolDcForward)
	ON_COMMAND(ID_TOOL_DC_INVERSION, OnToolDcInversion)
	ON_COMMAND(ID_TOOL_FEM_FORWARD, OnToolFemForward)
	ON_COMMAND(ID_TOOL_FEM_INVERSION, OnToolFemInversion)
	ON_COMMAND(ID_TOOL_MT_FORWARD, OnToolMtForward)
	ON_COMMAND(ID_TOOL_MT_INVERSION, OnToolMtInversion)
	ON_COMMAND(ID_TOOL_TEM_FORWARD, OnToolTemForward)
	ON_COMMAND(ID_TOOL_TEM_INVERSION, OnToolTemInversion)
	ON_COMMAND(ID_TOOL_PARA_SET, OnToolParaSet)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

static UINT indicators[] =
{
	ID_SEPARATOR,           // status line indicator
	ID_SEPARATOR,
	ID_INDICATOR_CAPS,
	ID_INDICATOR_NUM,
	ID_INDICATOR_SCRL,
};

/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction

CMainFrame::CMainFrame()
{
	// TODO: add member initialization code here
	
}

CMainFrame::~CMainFrame()
{
}

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	int nIndex = m_wndToolBar.CommandToIndex(ID_MY_BUTTON);
	m_wndToolBar.SetButtonInfo (24, ID_MY_BUTTON, TBBS_SEPARATOR ,60);
	CRect rect;
	m_wndToolBar.GetItemRect(24,rect);

	rect.top += 1;
	rect.bottom = rect.top + 100;

	if(!m_meanComboBox.Create(WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_HSCROLL,
		rect,&m_wndToolBar,FRAME_COMBOBOX_ID))
		return -1;
	
		
	m_meanComboBox.InitStorage(0,1);
	
    m_meanComboBox.InsertString(-1, "DEC");
	m_meanComboBox.InsertString(-1, "LOG");
	m_meanComboBox.EnableWindow(FALSE);

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	DockControlBar(&m_wndToolBar);

	return 0;
}

BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
	if( !CFrameWnd::PreCreateWindow(cs) )
		return FALSE;
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	cs.lpszName = "测井资料分析";//-----石油大学(北京)";
	cs.style&=~FWS_ADDTOTITLE;

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics

#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
	CFrameWnd::AssertValid();
}

void CMainFrame::Dump(CDumpContext& dc) const
{
	CFrameWnd::Dump(dc);
}

#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class

	VERIFY(m_wndSplitter.CreateStatic (this, 1, 2));
	VERIFY(m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS(CWellDataProcessView), 
		CSize(640, 100), pContext));
	VERIFY(m_wndSplitter.CreateView (0, 1, RUNTIME_CLASS(CCurveCompareView), 
		CSize(360, 100), pContext));

	return TRUE;

}

void CMainFrame::ShowStatusMsg(CString str)
{
	m_wndStatusBar.SetPaneText(1,str);
	
}


void CMainFrame::OnToolInterpretCoarse() 
{
	// TODO: Add your command handler code here
	if(g_pAnalyseWnd->m_arrButtom.GetActiveIndex() == -1)
	{
		AfxMessageBox("请先设置解释曲线!");
		return;
	}

	g_pAnalyseWnd->SetInterpret(TRUE); 
	g_pAnalyseWnd->SetInterpretMode(1);
//	g_pAnalyseWnd->m_arrButtom.SetActive(0);
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw();

	m_meanComboBox.SetCurSel(0);
	m_meanComboBox.EnableWindow(TRUE);
		
}





void CMainFrame::OnToolShowCurve() 
{
	// TODO: Add your command handler code here
	g_pAnalyseWnd->ReadData();
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw();
		
}

void CMainFrame::OnUpdateToolInterpretCoarse(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(!g_pAnalyseWnd->GetIsInterpretCoarse()); 
}


void CMainFrame::OnUpdateToolShowCurve(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code herpCmdUI->Enable(!g_pAnalyseWnd->m_bIsHaveData); 
	pCmdUI->Enable(!g_pAnalyseWnd->GetIsHaveData());
}


void CMainFrame::OnToolStopFirstInterpret() 
{
	// TODO: Add your command handler code here
	g_pAnalyseWnd->SetInterpretMode(0);
		
}

void CMainFrame::OnUpdateToolStopFirstInterpret(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CMainFrame::OnToolSynthTrace() 
{
	g_pCurveComWnd->m_nShowKind = 2;
	g_pCurveComWnd->ReadData();
	g_pCurveComWnd->Plot();
	g_pCurveComWnd->ReDraw(); 
	
}

void CMainFrame::OnUpdateToolSynthTrace(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	

	
}

void CMainFrame::OnToolSaveLayer() 
{
	
	static char BASED_CODE szFilter[] = "Layer Files (*.lay)  |*.lay | All Files (*.*) | *.*||";
	CFileDialog dlg(FALSE, NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,szFilter);
	int nCmd = dlg.DoModal();
	if(nCmd == IDCANCEL)
		return;
	CString strFileName = dlg.GetPathName();
	
	g_pAnalyseWnd->SaveInterLayerData(strFileName); 
	
	
}

void CMainFrame::OnUpdateToolSaveLayer(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}


void CMainFrame::OnToolRestartInterpret() 
{
	g_pAnalyseWnd->ReStartInterpretLayer();	
}

void CMainFrame::OnToolInterpretFineMovelayer() 
{
	g_pAnalyseWnd->ContinuationWellCurve();
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw();
	
}

void CMainFrame::OnToolInterpretFineMoveline() 
{
	// TODO: Add your command handler code here
	g_pAnalyseWnd->SetInterpret(TRUE); 
	g_pAnalyseWnd->SetInterpretMode(2);
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw();
	g_pAnalyseWnd->SetFocus();

	
}

void CMainFrame::OnUpdateToolInterpretFineMoveline(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here

	
}

void CMainFrame::OnToolInterpretDeleteLayer() 
{
	g_pAnalyseWnd->DeleteLayer();
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw(); 

	
}

void CMainFrame::OnUpdateToolInterpretDeleteLayer(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here

}

void CMainFrame::OnToolInterpretInsertLayer() 
{
	g_pAnalyseWnd->InsertLayer();
	g_pAnalyseWnd->Plot();
	g_pAnalyseWnd->ReDraw(); 
	
}

void CMainFrame::OnUpdateToolInterpretInsertLayer(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
	
}

void CMainFrame::OnUpdateToolInterpretFineMovelayer(CCmdUI* pCmdUI) 
{
	pCmdUI->Enable(!g_pAnalyseWnd->GetIsContinue()); 	
}

void CMainFrame::OnToolFirstInterpretUndo() 
{
	g_pAnalyseWnd->UndoInterpret();
}

void CMainFrame::OnUpdateToolFirstInterpretUndo(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	
}

void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf)
{
	CRect rect;
	DWORD dw;
	UINT n;

	// get MFC to adjust the dimensions of all docked ToolBars
	// so that GetWindowRect will be accurate
	
	RecalcLayout();
	LeftOf->GetWindowRect(&rect);
	rect.OffsetRect(1,0);
	dw=LeftOf->GetBarStyle();
	n = 0;
	n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
	n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
	n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
	n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;

	DockControlBar(Bar,n,&rect);
}


void CMainFrame::OnToolDcForward() 
{
	// TODO: Add your command handler code here
	CString  strName = GetAppPath() + "\\bin\\ltp.exe";
	if(WinExec(strName,SW_SHOW)<31)
	{
		AfxMessageBox("正演程序启动失败");
		return;
	}	
}

void CMainFrame::OnToolDcInversion() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::OnToolFemForward() 
{
	// TODO: Add your command handler code here
	//调用模块程序
	CString  strName = GetAppPath() + "\\bin\\ltp.exe";
	if(WinExec(strName,SW_SHOW)<31)
	{
		AfxMessageBox("正演程序启动失败");
		return;
	}	
	
}

void CMainFrame::OnToolFemInversion() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::OnToolMtForward() 
{
	g_pCurveComWnd->m_nShowKind = 1;
	g_pCurveComWnd->ReadData();
	g_pCurveComWnd->Plot();
	g_pCurveComWnd->ReDraw(); 

	
}

void CMainFrame::OnToolMtInversion() 
{
	// TODO: Add your command handler code here
	
}

void CMainFrame::OnToolTemForward() 
{
	// TODO: Add your command handler code here
	CString  strName = GetAppPath() + "\\bin\\ltp.exe";
	if(WinExec(strName,SW_SHOW)<31)
	{
		AfxMessageBox("正演程序启动失败");
		return;
	}	
}

void CMainFrame::OnToolTemInversion() 
{
	// TODO: Add your command handler code here
	
}


void CMainFrame::OnToolParaSet() 
{
	// TODO: Add your command handler code here
}

⌨️ 快捷键说明

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