#include "stdafx.h" #include "SigmaView.h" #include "SectionDoc.h" #include "ItemWellGroup.h" #include "ActionAddItem.h" extern "C" __declspec(dllexport) int AddWellGroupSetWellPointZ(CSigmaView * pView, double z) { CItem * pItem = pView->GetItem(); if (pItem == NULL) return 0; CItemWellGroup * itemWellGroup = dynamic_cast(pItem); if (itemWellGroup == NULL) return 0; itemWellGroup->SetWellPointZ(z); return 1; } extern "C" __declspec(dllexport) int XyWellGroupAdd(CXy* pXy, LPCTSTR layerName, BYTE* buffElement, int buffLen) { //CLayer * pLayer = pXy->FindAddLayer(layerName); CWellGroup* pWellGroup = new CWellGroup; int64_t oneID = pWellGroup->GetId(); TRACE("pWellGroup ID: %I64d\r\n", oneID); pWellGroup->x0 = 0; pWellGroup->y0 = 0; pWellGroup->z0 = 0; // m_pt.z0; //pWellGroup->angle = m_angle; //pWellGroup->SetName(m_pointName); COne* pOne = pXy->CreateOne(pWellGroup, WELL_GROUP); oneID = pOne->GetId(); TRACE("One ID: %I64d\r\n", oneID); pOne->ReadMemory(buffElement, 0, buffLen, 3); oneID = pOne->GetId(); TRACE("One ID: %I64d\r\n", oneID); POSITION pos = pXy->AddElement(pOne->value, WELL_GROUP); pXy->SetElementLayer(pos, layerName); //pOne->SetLayer(pLayer); //pOne->SetViewState(LAYER_ViewEdit); //POSITION pos = pXy->AddTailOne(pOne); return 1; } extern "C" __declspec(dllexport) int AddWellGroupSetData(CSigmaView * pView, BYTE* buffElement, int buffLen) { CItem * pItem = pView->GetItem(); if (pItem == NULL) return 0; CItemWellGroup * itemWellGroup = dynamic_cast(pItem); if (itemWellGroup == NULL) return 0; itemWellGroup->SetData(buffElement, buffLen); return 1; } extern "C" __declspec(dllexport) void AddWellGroup_ApplyData(CSigmaView * pView) { CItem * pItem = pView->GetItem(); if (pItem == NULL) return; CItemWellGroup * itemWellGroup = dynamic_cast(pItem); if (itemWellGroup == NULL) return; itemWellGroup->ApplyData(); } extern "C" __declspec(dllexport) void AddWellGroup_Update(CSigmaView * pView, HDC hdc) { CDC * pDC = CDC::FromHandle(hdc); if (pDC == 0) return; CItem * pItem = pView->GetItem(); if (pItem == NULL) return; CItemWellGroup * itemWellGroup = dynamic_cast(pItem); if (itemWellGroup == NULL) return; itemWellGroup->UpdateDraw(pDC); } extern "C" __declspec(dllexport) int GetWellGroupPointFromItem(CSigmaView* pView, double& x, double& y) { CItem * pItem = pView->GetItem(); if (pItem == NULL) return 0; CItemWellGroup * itemWellGroup = dynamic_cast(pItem); if (itemWellGroup == NULL) return 0; //double x = 0; //double y = 0; double z = 0; if (itemWellGroup->GetWellPoint(&x, &y, &z)) { return 1; } return -1; }