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

📄 shotparaview.cpp

📁 这是本人两年前兼职为某个公司做的石油钻进设计软件
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// ShotParaView.cpp : implementation file
//

#include "stdafx.h"
#include "cvenus.h"
#include "ShotParaView.h"
#include	"MainFrm.h"
#include "resource.h"

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

/////////////////////////////////////////////////////////////////////////////
// CShotParaView

IMPLEMENT_DYNCREATE(CShotParaView, CFormView)

CShotParaView::CShotParaView()
	: CFormView(CShotParaView::IDD)
{
	//{{AFX_DATA_INIT(CShotParaView)
	m_fDate = 0.0f;
	m_fGun = 0.0f;
	m_fLimitDate = 0.0f;
	m_fLong = 0.0f;
	m_cstrModel = _T("");
	m_fShotPress = 0.0f;
	m_bAngle = FALSE;
	m_fAngle = 90.0f;
	//}}AFX_DATA_INIT
	m_bComputeSave = FALSE;


	CMainFrame*	pMainWnd = (CMainFrame*)AfxGetMainWnd();
	m_bWellState = pMainWnd->m_structWellInfo.bWellState;
	m_structSD.fPress = pMainWnd->m_structBDTTable.fStratumAverPress;
	m_structSD.fHole = pMainWnd->m_structBDTTable.fStratumHolePercent;
	m_structSD.fFilter = pMainWnd->m_structBDTTable.fStratumFilterPercent;
	m_structSD.cstrModel = pMainWnd->m_structBDTTable.strOilResCannulaModel;

	m_bComputeState = pMainWnd->m_structTTPResult.bState;
	int iTemp;
	pMainWnd->m_structTTPTable.lNum = pMainWnd->m_structBDTTable.lCount;
	if(pMainWnd->m_structTTPTable.bState == TRUE)
	{
		for(iTemp = 0 ;iTemp < pMainWnd->m_structBDTTable.lCount ;iTemp++)
		{
			pMainWnd->m_structTTPShotPara[iTemp].fShotDepth = pMainWnd->m_structSDT[iTemp].fShotDepth ;
			pMainWnd->m_structTTPShotPara[iTemp].fDiameter = pMainWnd->m_structSDT[iTemp].fDiameter ;
			pMainWnd->m_structTTPShotPara[iTemp].fPortion = pMainWnd->m_structSDT[iTemp].fPortion ;
			sprintf(pMainWnd->m_structTTPShotPara[iTemp].strModel ,"%s" ,pMainWnd->m_structSDT[iTemp].strModel );
			m_structDate [iTemp] = pMainWnd->m_structTTPShotPara[iTemp];
		}
	}
	else
	{
		for(iTemp = 0 ;iTemp < pMainWnd->m_structBDTTable.lCount ;iTemp++)
		{
			pMainWnd->m_structTTPShotPara[iTemp].fShotDepth = pMainWnd->m_structSDT[iTemp].fShotDepth ;
			pMainWnd->m_structTTPShotPara[iTemp].fDiameter = pMainWnd->m_structSDT[iTemp].fDiameter ;
			pMainWnd->m_structTTPShotPara[iTemp].fPortion = pMainWnd->m_structSDT[iTemp].fPortion ;
			pMainWnd->m_structTTPShotPara[iTemp].fDate = 12;
			pMainWnd->m_structTTPShotPara[iTemp].fLimitDate = 18;
			sprintf(pMainWnd->m_structTTPShotPara[iTemp].strModel ,"%s" ,pMainWnd->m_structSDT[iTemp].strModel );
			m_structDate [iTemp] = pMainWnd->m_structTTPShotPara[iTemp];
		}
		pMainWnd->m_structTTPTable.fGun = 0;
		pMainWnd->m_structTTPTable.fLong = 0;
	}

	m_structTTPTable = pMainWnd->m_structTTPTable;

	if(pMainWnd->m_structTTPResult.bState == TRUE)
	{
		m_fPressDiff = pMainWnd->m_structTTPResult.fPressDiff ;
		for(iTemp=0;iTemp<pMainWnd->m_structTTPResult.lNum;iTemp++)
		{
			m_fPP[iTemp] = pMainWnd->m_structTTPResult.fPP[iTemp];
			m_fPDepth[iTemp] = pMainWnd->m_structTTPResult.fPDepth[iTemp];
			m_fPDiameter[iTemp] = pMainWnd->m_structTTPResult.fPDiameter[iTemp];
		}
	}
	else
	{
		m_fPressDiff = 0;
		for(iTemp=0;iTemp<pMainWnd->m_structTTPResult.lNum;iTemp++)
		{
			m_fPP[iTemp] = NULL;
			m_fPDepth[iTemp] = NULL;
			m_fPDiameter[iTemp] = NULL;
		}
	}

}

CShotParaView::~CShotParaView()
{
}

void CShotParaView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CShotParaView)
	DDX_Control(pDX, IDC_EDIT_ANGLE, m_ctrlAngleEdit);
	DDX_Control(pDX, IDC_CHECK_ANGLE, m_ctrlAngleCheck);
	DDX_Control(pDX, IDC_LIST_SHOTPARA, m_ctrlShotPara);
	DDX_Control(pDX, IDC_LIST_DATE, m_ctrlListDate);
	DDX_Control(pDX, IDC_EDIT_MODEL, m_ctrl208);
	DDX_Control(pDX, IDC_EDIT_GUN, m_ctrl102);
	DDX_Control(pDX, IDC_TAB1, m_ctrlTab);
	DDX_Control(pDX, IDC_EDIT_LIMITDATE, m_ctrl209);
	DDX_Control(pDX, IDC_EDIT_DATE, m_ctrl207);
	DDX_Control(pDX, IDC_BUTTON_MODIFY, m_ctrl206);
	DDX_Control(pDX, IDC_STATIC204, m_ctrl204);
	DDX_Control(pDX, IDC_STATIC203, m_ctrl203);
	DDX_Control(pDX, IDC_STATIC202, m_ctrl202);
	DDX_Control(pDX, IDC_STATIC201, m_ctrl201);
	DDX_Control(pDX, IDC_STATIC103, m_ctrl106);
	DDX_Control(pDX, IDC_STATIC102, m_ctrl105);
	DDX_Control(pDX, IDC_STATIC101, m_ctrl104);
	DDX_Control(pDX, IDC_EDIT_LONG, m_ctrl101);
	DDX_Text(pDX, IDC_EDIT_DATE, m_fDate);
	DDX_Text(pDX, IDC_EDIT_GUN, m_fGun);
	DDX_Text(pDX, IDC_EDIT_LIMITDATE, m_fLimitDate);
	DDX_Text(pDX, IDC_EDIT_LONG, m_fLong);
	DDX_Text(pDX, IDC_EDIT_MODEL, m_cstrModel);
	DDX_Text(pDX, IDC_EDIT_SHOTPRESS, m_fShotPress);
	DDX_Check(pDX, IDC_CHECK_ANGLE, m_bAngle);
	DDX_Text(pDX, IDC_EDIT_ANGLE, m_fAngle);
	DDV_MinMaxFloat(pDX, m_fAngle, 0.f, 180.f);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CShotParaView, CFormView)
	ON_WM_CONTEXTMENU()
	//{{AFX_MSG_MAP(CShotParaView)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
	ON_BN_CLICKED(IDC_BUTTON_MODIFY, OnButtonModify)
	ON_NOTIFY(NM_CLICK, IDC_LIST_DATE, OnClickListDate)
	ON_BN_CLICKED(IDC_BUTTON_COMPUT, OnButtonComput)
	ON_BN_CLICKED(IDC_BUTTON_TTP_SAVE, OnButtonTtpSave)
	ON_BN_CLICKED(IDC_CHECK_ANGLE, OnCheckAngle)
	ON_WM_CREATE()
	ON_COMMAND(ID_SPD_CACL, OnSpdCacl)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CShotParaView diagnostics

#ifdef _DEBUG
void CShotParaView::AssertValid() const
{
	CFormView::AssertValid();
}

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

/////////////////////////////////////////////////////////////////////////////
// CShotParaView message handlers

void CShotParaView::OnInitialUpdate() 
{
	CFormView::OnInitialUpdate();
	
	TC_ITEM TabCtrlItem;
	TabCtrlItem.mask = TCIF_TEXT;
	TabCtrlItem.pszText = "校正射孔弹基本参数";
	m_ctrlTab.InsertItem( 0, &TabCtrlItem );
	TabCtrlItem.pszText = "射孔弹储存期限";
	m_ctrlTab.InsertItem( 1, &TabCtrlItem );

	UpdateData(TRUE);
	m_ctrlShotPara.InsertColumn (0,"射孔弹型号",LVCFMT_LEFT ,200,0);
	m_ctrlShotPara.InsertColumn (1,"穿深",LVCFMT_LEFT ,60,1);
	m_ctrlShotPara.InsertColumn (2,"孔径",LVCFMT_LEFT ,60,2);
	m_ctrlShotPara.InsertColumn (3,"校正系数",LVCFMT_LEFT ,100,3);
	m_ctrlShotPara.InsertColumn (4,"校正穿深",LVCFMT_LEFT ,100,4);
	m_ctrlShotPara.InsertColumn (5,"校正孔径",LVCFMT_LEFT ,100,5);
	
	m_ctrlListDate.InsertColumn (0 ,"射孔弹型号" ,LVCFMT_LEFT ,200 ,0 );
	m_ctrlListDate.InsertColumn (1 ,"规定储存时间" ,LVCFMT_LEFT ,150 ,1 );
	m_ctrlListDate.InsertColumn (2 ,"实际储存时间" ,LVCFMT_LEFT ,150 ,2 );

	m_fGun = m_structTTPTable.fGun ;
	m_fLong = m_structTTPTable.fLong ;
	UpdateData(FALSE);
			
	LVITEM pitem;
	pitem.mask=LVIF_TEXT;
	pitem.state=0;
	pitem.stateMask=0;
	pitem.iSubItem=0;
	pitem.pszText="";

	char strTemp[10];
	UpdateData();
	for(int iTemp = 0 ;iTemp < m_structTTPTable.lNum  ;iTemp++)
	{
		pitem.iItem = iTemp;
		m_ctrlListDate.InsertItem (&pitem);
		m_ctrlListDate.SetItemText (iTemp ,0 , m_structDate[iTemp].strModel );
		sprintf(strTemp ,"%3.1f" ,m_structDate[iTemp].fLimitDate );
		m_ctrlListDate.SetItemText (iTemp ,1 , strTemp );
		sprintf(strTemp ,"%3.1f" ,m_structDate[iTemp].fDate );
		m_ctrlListDate.SetItemText (iTemp ,2 , strTemp );

		m_ctrlShotPara.InsertItem (&pitem);
		m_ctrlShotPara.SetItemText (iTemp ,0 , m_structDate[iTemp].strModel  );
		sprintf(strTemp ,"%5.2f" ,m_structDate[iTemp].fShotDepth );
		m_ctrlShotPara.SetItemText (iTemp ,1 ,strTemp );
		sprintf(strTemp ,"%3.2f" ,m_structDate[iTemp].fDiameter );
		m_ctrlShotPara.SetItemText (iTemp ,2 ,strTemp );
		
		if(m_bComputeState == TRUE)
		{
			sprintf(strTemp,"%5.4f",m_fPP[iTemp]);
			m_ctrlShotPara.SetItemText (iTemp,3,strTemp);
			sprintf(strTemp,"%5.4f",m_fPDepth[iTemp]);
			m_ctrlShotPara.SetItemText (iTemp,4,strTemp);
			sprintf(strTemp,"%5.4f",m_fPDiameter[iTemp]);
			m_ctrlShotPara.SetItemText (iTemp,5,strTemp);
		}
	}
	m_cstrModel = m_structDate[0].strModel ;
	m_fLimitDate = m_structDate[0].fLimitDate ;
	m_fDate = m_structDate[0].fDate ;
	m_fShotPress = m_fPressDiff;
	m_fAngle = 90.0f;
	m_bAngle = FALSE;
	UpdateData(FALSE);
	
}


void CShotParaView::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) 
{
	// TODO: Add your control notification handler code here
	int selected = m_ctrlTab.GetCurSel ();
	switch(selected)
	{
	case 0:
		//
		m_ctrl101.ShowWindow (true);
		m_ctrl102.ShowWindow (true);
		m_ctrl104.ShowWindow (true);
		m_ctrl105.ShowWindow (true);
		m_ctrl106.ShowWindow (true);
		m_ctrlShotPara.ShowWindow (true);
		m_ctrlAngleCheck.ShowWindow(true);
		m_ctrlAngleEdit.ShowWindow(true);
		//
		m_ctrl201.ShowWindow (false);
		m_ctrl202.ShowWindow (false);
		m_ctrl203.ShowWindow (false);
		m_ctrl204.ShowWindow (false);
		m_ctrl206.ShowWindow (false);
		m_ctrl207.ShowWindow (false);
		m_ctrl208.ShowWindow (false);
		m_ctrl209.ShowWindow (false);
		m_ctrlListDate.ShowWindow (false);
		break;
	case 1:
		//
		m_ctrl101.ShowWindow (false);
		m_ctrl102.ShowWindow (false);
		m_ctrl104.ShowWindow (false);
		m_ctrl105.ShowWindow (false);
		m_ctrl106.ShowWindow (false);
		m_ctrlShotPara.ShowWindow (false);
		m_ctrlAngleCheck.ShowWindow(false);
		m_ctrlAngleEdit.ShowWindow(false);
		//
		m_ctrl201.ShowWindow (true);
		m_ctrl202.ShowWindow (true);
		m_ctrl203.ShowWindow (true);
		m_ctrl204.ShowWindow (true);
		m_ctrl206.ShowWindow (true);
		m_ctrl207.ShowWindow (true);
		m_ctrl208.ShowWindow (true);
		m_ctrl209.ShowWindow (true);
		m_ctrlListDate.ShowWindow (true);
		break;
	default:
		break;
	}	
	*pResult = 0;
}


⌨️ 快捷键说明

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