You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
2.6 KiB
C++

#include "stdafx.h"
#include "ItemWellGroup.h"
#include "DCHelp.h"
#include "SigmaDoc.h"
#include "SigmaView.h"
NItem::CItemWellGroup::CItemWellGroup(CSigmaDoc * ppDoc)
: CItem(ppDoc)
, m_z(-1E101)
, m_pt(0,0,0)
{
this->SetType(ITEM_WELL_GROUP);
}
NItem::CItemWellGroup::~CItemWellGroup(void)
{
if (m_pWellGroupOne != nullptr) {
delete m_pWellGroupOne;
m_pWellGroupOne = nullptr;
}
}
void CItemWellGroup::UpdateDraw(CDC *pDC)
{
SetScreenDC(pDC);
CRect rect = m_client;
//CDC* pDC = m_pScreenDC;
DCHelp::ClearDC(pDC, m_BackColor);
pDC->BitBlt(0, 0, rect.Width(), rect.Height(), m_pBackGroundDC, 0, 0, SRCCOPY);
GetDC()->Create(pDC);
if (m_pWellGroupOne)
{
//CPointNameEx* pPoint = (CPointNameEx*)m_pWellGroupOne->GetValue();
//pPoint->x0 = m_pt.x0;
//pPoint->y0 = m_pt.y0;
//pPoint->z0 = m_pt.z0;
//pPoint->angle = m_angle;
//pPoint->SetName(m_pointName);
}
else {
m_pWellGroupOne = CreateOne();
}
m_pWellGroupOne->Draw(*GetDC());
}
void CItemWellGroup::DrawAssistant(CDC * pDC, int mouseX, int mouseY)
{
if (m_pWellGroupOne)
{
GetDC()->Create(pDC);
m_pWellGroupOne->Draw(*GetDC());
}
}
COne* CItemWellGroup::CreateOne()
{
CWellGroup* pWellGroup = new CWellGroup;
pWellGroup->x0 = m_pt.x0;
pWellGroup->y0 = m_pt.y0;
pWellGroup->z0 = m_z; // m_pt.z0;
//pWellGroup->angle = m_angle;
//pWellGroup->SetName(m_pointName);
COne* pOne = m_pDoc->GetDraw()->CreateOne(pWellGroup, WELL_GROUP);
return pOne;
}
void CItemWellGroup::OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk)
{
CPoint3D pt3D;
pt3D.x0 = point.x;
pt3D.y0 = point.y;
pt3D.z0 = m_z;
//m_pointName = _T("Point");
SetPoint(pt3D);
//GetDC()->Create(pDC);
SetScreenDC(pDC);
//this->m_pMemDC = GetView()->m_pImgDC;
//if (m_mode == POINT_MODE_SINGLE)
//{
//DrawSinglePoint(point);
//UpdateDraw();
//}
//else //POINT_CONTINUE
//{
// //OnBnClickedButtonPointNext();
// AddPoint(pt3D);
//}
}
void CItemWellGroup::ApplyData()
{
if (m_pWellGroupOne != nullptr) {
AddElement(m_pWellGroupOne->value, WELL_GROUP, false, true);
}
}
void CItemWellGroup::SetPoint(CPoint3D point)
{
CPoint2D pt = GetDC()->GetReal(point);
m_pt.x0 = pt.x0;
m_pt.y0 = pt.y0;
m_pt.z0 = point.z0;
}
void CItemWellGroup::SetWellPointZ(double pointZ)
{
m_z = pointZ;
}
void CItemWellGroup::SetData(BYTE* buffElement, int buffLen)
{
if (m_pWellGroupOne == nullptr) {
m_pWellGroupOne = CreateOne();
}
m_pWellGroupOne->ReadMemory(buffElement, 0, buffLen, 3);
}
bool CItemWellGroup::GetWellPoint(double * xOut, double * yOut, double * zOut)
{
*xOut = m_pt.x0;
*yOut = m_pt.y0;
*zOut = m_pt.z0;
return true;
}