#include "stdafx.h" #include #include //#include "WellPoleDoc.h" //#include "WellPoleView.h" #include "WellPoleLib/WellBaseObj.h" #include "WellPoleLib/InTrackDepthSegment.h" #include "WellPoleLib/TrackObj.h" #include "WellPoleLib/InclinedTrack.h" #include "WellPoleLib/InTrackLith.h" #include "WellPoleLib/InTrackSymbol.h" #include "WellPoleLib/InTrackResult.h" #include "WellPoleLib/InTrackTextRange.h" #include "WellPoleLib/TrackGroup.h" #include "WellPoleLib/WellPole.h" #include "WellPoleLib/TrackDepth.h" #include "WellPoleLib/TrackCurve.h" #include "WellPoleLib/TrackSymbol.h" #include "WellPoleLib/TrackResult.h" #include "WellPoleLib/TrackLith.h" #include "WellPoleLib/TrackText.h" #include "WellPoleLib/WellObjExtendInfo.h" #include "WellPoleLib/WellMarkNamesList.h" #include "WellPoleLib/WellPole.h" #include "ItemSingleWell.h" #include "WellPoleLib/Data/WellData_FaultPoints.h" #include "WellPoleLib/Data/WellData_ReservesLayer.h" #include "WellPoleLib/Data/WellData_SandSet.h" #include "CPlusCallBack.h" #include "WellObjectAttributesJson.h" #include "WellObjectAttributesXml.h" #include "DrawOperator/Encoding.h" #include "MultiWellSectionLib/SectionWellObj.h" #include "MultiWellSectionLib/BendObj.h" #include "MultiWellSectionLib/FaultObj.h" #include "MultiWellSectionLib/WellSection.h" #include "./WellSection/ItemWcsTrack.h" #include "./WellSection/ItemSectionWell.h" #include "./WellSection/ItemAddFault.h" #include "./WellSection/ItemBend.h" #include "./WellSection/ItemFault.h" #include "./WellSection/MultiWellSectionDoc.h" #include "./WellSection/MultiWellSectionlView.h" extern "C" __declspec(dllexport) CMultiWellSectionView* CreateWellSectionView() { CMultiWellSectionView* pWellSectionView = new CMultiWellSectionView(); return pWellSectionView; } extern "C" __declspec(dllexport) BOOL SetBendsSmooth(CMultiWellSectionView * pView) { return pView->OnSetBendSmooth(); } extern "C" __declspec(dllexport) BOOL IsSelectedWellSection(CMultiWellSectionView * pView) { CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; BOOL b = FALSE; if (pItem->GetType() == ITEM_WELLSECTION) b = TRUE; return b; } extern "C" __declspec(dllexport) BOOL IsWellSectionBendsSmooth(CMultiWellSectionView * pView) { CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; BOOL b = FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = pItemWellSection->GetWellSection(); b = pSection->IsStratumSmooth(); } return b; } extern "C" __declspec(dllexport) int WellSectionFlatternStyle(CMultiWellSectionView * pView) { int rt = 0; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return rt; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = pItemWellSection->GetWellSection(); rt = pSection->m_nLayerFlatten; } return rt; } extern "C" __declspec(dllexport) BOOL SetWellSectionFlatternStyle(CMultiWellSectionView * pView , int style) {//层拉平方式 0真是位置,1层顶拉平,2层底拉平,3井顶拉平,4井底拉平 BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(); CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (style == 1) { pSection->m_nLayerFlatten = style; double topValue = 0.0; POSITION pos = pItemWellSection->m_WellObjSelectlist.GetHeadPosition(); while (pos != NULL) { CWellBaseObj* pObj = pItemWellSection->m_WellObjSelectlist.GetNext(pos); if (pObj->GetType() == KEP_SECTIONBEND) { CBendObj* pBend = (CBendObj*)pObj; pSection->FlatLayer(pBend, FALSE); } } pSection->SetRealLevel(TRUE); b = TRUE; } else if (style == 2) { pSection->m_nLayerFlatten = style; POSITION pos = pItemWellSection->m_WellObjSelectlist.GetHeadPosition(); while (pos != NULL) { CWellBaseObj* pObj = pItemWellSection->m_WellObjSelectlist.GetNext(pos); if (pObj->GetType() == KEP_SECTIONBEND) { CBendObj* pBend = (CBendObj*)pObj; pSection->FlatLayer(pBend, TRUE); } } pSection->SetRealLevel(TRUE); b = TRUE; } else if (style == 3) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->m_nLayerFlatten = style; pSection->FlatWell(TRUE); pSection->SetRealLevel(TRUE); b = TRUE; } else if (style == 4) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->m_nLayerFlatten = style; pSection->FlatWell(FALSE); pSection->SetRealLevel(TRUE); b = TRUE; } else if (style == 0) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->m_nLayerFlatten = style; pSection->FlatRealPosition(); pSection->SetRealLevel(FALSE); b = TRUE; } } return b; } extern "C" __declspec(dllexport) int SectionWellShowStyle(CMultiWellSectionView * pView) { // 1 =简单样式 ,2= 完整样式 , 3= 分割线样式 int rt = 0; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return rt; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = pItemWellSection->GetWellSection(); if (pSection->GetFeature()->IsWellStyleComplete()) rt = 2; else if (pSection->GetFeature()->IsWellStyleDividLine()) rt = 3; else if (pSection->GetFeature()->IsWellStyleSimple()) rt = 1; } return rt; } extern "C" __declspec(dllexport) BOOL SetSectionWellShowStyle(CMultiWellSectionView * pView, int style) { // 1 =简单样式 ,2= 完整样式 , 3= 分割线样式 BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(); CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (style == 1) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->GetFeature()->SetWellStyleSimple(TRUE); b = TRUE; } else if (style == 2) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->GetFeature()->SetWellStyleComplete(TRUE); b = TRUE; } else if (style == 3) { CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pSection->GetFeature()->SetWellStyleDividLine(TRUE); b = TRUE; } } return b; } extern "C" __declspec(dllexport) BOOL WellSectionConnectAllLayers(CMultiWellSectionView * pView) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(); CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pItemWellSection->CreateLayers(); } return b; } extern "C" __declspec(dllexport) BOOL WellSectionBreakAllBends(CMultiWellSectionView * pView) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(); CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); pItemWellSection->BreakLayers(); } return b; } extern "C" __declspec(dllexport) int WellSectionBendLinkStyle(CMultiWellSectionView * pView) { //=1 井柱外, =2 井柱中心 3= 地层道 ,4=小层道 int rt = 0; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (pSection->GetFeature()->IsWellLinkOut()) rt = 1; else if (pSection->GetFeature()->IsWellLinkCenter()) rt = 2; else if (pSection->GetFeature()->IsWellLinkStratiBounds()) rt = 3; else if (pSection->GetFeature()->IsWellLinkLayerBounds()) rt = 4; } return rt; } extern "C" __declspec(dllexport) BOOL SetWellSectionBendLinkStyle(CMultiWellSectionView * pView, int style) { //=1 井柱外, =2 井柱中心 3= 地层道 ,4=小层道 BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (style == 1) { pView->OnLinkStyleOut(); b = TRUE; } else if (style == 2) { pView->OnLinkStyleCenter(); b = TRUE; } else if (style == 3) { pView->OnLinkStyleStratumBound(); b = TRUE; } else if (style == 4) { pView->OnLinkStyleResultBound(); b = TRUE; } } return b; } extern "C" __declspec(dllexport) int WellSectionBendLeftExtendStyle(CMultiWellSectionView * pView) {//=1 不延伸 =2水平延伸,3=趋势延伸 int rt = 0; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (!pSection->GetFeature()->IsBendExtendLeftLevel() && !pSection->GetFeature()->IsBendExtendLeftTrend()) rt = 1; else if (pSection->GetFeature()->IsBendExtendLeftLevel()) rt = 2; else if (pSection->GetFeature()->IsBendExtendLeftTrend()) rt = 3; } return rt; } extern "C" __declspec(dllexport) BOOL SetWellSectionBendLeftExtendStyle(CMultiWellSectionView * pView, int style) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (style == 1) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendLeftLevel(FALSE); pSection->GetFeature()->SetBendExtendLeftTrend(FALSE); b = TRUE; } else if (style == 2) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendLeftLevel(TRUE); b = TRUE; } else if (style == 3) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendLeftTrend(TRUE); b = TRUE; } if (b) { CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetHead(); POSITION pos = pSection->m_BendList.GetHeadPosition(); while (pos) { CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos); if (pBend->m_pWellLeft == pWell || pBend->m_pWellRight == pWell) { pBend->CreateBendLines(); pBend->CreateBendFills(); } } } } return b; } extern "C" __declspec(dllexport) int WellSectionBendRightExtendStyle(CMultiWellSectionView * pView) {//=1 不延伸 =2水平延伸,3=趋势延伸 int rt = 0; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (!pSection->GetFeature()->IsBendExtendRightLevel() && !pSection->GetFeature()->IsBendExtendRightTrend()) rt = 1; else if (pSection->GetFeature()->IsBendExtendRightLevel()) rt = 2; else if (pSection->GetFeature()->IsBendExtendRightTrend()) rt = 3; } return rt; } extern "C" __declspec(dllexport) BOOL SetWellSectionBendRightExtendStyle(CMultiWellSectionView * pView, int style) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)pItemWellSection->GetWellSection(); if (style == 1) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendRightLevel(FALSE); pSection->GetFeature()->SetBendExtendRightTrend(FALSE); b = TRUE; } else if (style == 2) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendRightLevel(TRUE); b = TRUE; } else if (style == 3) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); pSection->GetFeature()->SetBendExtendRightTrend(TRUE); b = TRUE; } if (b) { CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetTail(); POSITION pos = pSection->m_BendList.GetHeadPosition(); while (pos) { CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos); if (pBend->m_pWellLeft == pWell || pBend->m_pWellRight == pWell) { pBend->CreateBendLines(); pBend->CreateBendFills(); } } } } return b; } extern "C" __declspec(dllexport) BOOL SetWellSectionDrawAddFaultItem(CMultiWellSectionView * pView) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return b; if (pItem->GetType() == ITEM_WELLSECTION) { BOOL bFind = FALSE; CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; if (pItemWellSection->GetItem() != NULL) { if (pItemWellSection->GetItem()->GetType() == ITEM_ADDFAULT) { bFind = TRUE; } } if (!bFind) { CItemAddFault* pItemFault = new CItemAddFault(pDoc); if (NULL != pItemWellSection) { pItemWellSection->SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2); } pItemFault->SetItemSection(pItem); pItemWellSection->SetItem(pItemFault); pItemWellSection->SetState(TRUE); b = TRUE; } else { pItemWellSection->SetItem(NULL); } } return b; } extern "C" __declspec(dllexport) BOOL WellSectionAddDepthRuler(CMultiWellSectionView * pView) { return pView->OnAddRuler(); } extern "C" __declspec(dllexport) BOOL WellSectionIsAddBendLayerPoint(CMultiWellSectionView * pView) { CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemSection = (CItemWellSection*)pItem; return pItemSection->IsAddBendLayerPoint(); } else return FALSE; } extern "C" __declspec(dllexport) BOOL WellSectionAddBendLayerPoint(CMultiWellSectionView* pView) { return pView->OnAddBendLayerPoint(); } extern "C" __declspec(dllexport) BOOL WellSectionDeleteBendLayerPoint(CMultiWellSectionView* pView) { return pView->OnDeleteLayerPoint(); } extern "C" __declspec(dllexport) BOOL WellSectionIsAddFaultPoint(CMultiWellSectionView * pView) { CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem *pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemSection = (CItemWellSection*)pItem; return pItemSection->IsAddFaultPoint(); } else return FALSE; } extern "C" __declspec(dllexport) BOOL WellSectionAddFaultPoint(CMultiWellSectionView* pView) { return pView->OnAddFaultPoint(); } extern "C" __declspec(dllexport) BOOL WellSectionDeleteFaultPoint(CMultiWellSectionView* pView) { return pView->OnDeleteFaultPoint(); } extern "C" __declspec(dllexport) BOOL WellSectionBreakLeftBend(CMultiWellSectionView* pView) { return pView->OnBreakLeftBend(); } extern "C" __declspec(dllexport) BOOL WellSectionBreakRightBend(CMultiWellSectionView* pView) { return pView->OnBreakRightBend(); } extern "C" __declspec(dllexport) BOOL WellSectionConnectLeftLayer(CMultiWellSectionView* pView) { return pView->OnNameConnectLeft(); } extern "C" __declspec(dllexport) BOOL WellSectionConnectRightLayer(CMultiWellSectionView* pView) { return pView->OnNameConnectRight(); } extern "C" __declspec(dllexport) BOOL WellSectionConnectLeftRightLayer(CMultiWellSectionView* pView) { return pView->OnNameConnectAll(); } extern "C" __declspec(dllexport) CWellSection* CreateWellSection(CMultiWellSectionView* pView, LPCTSTR title, double depthScale, double levelScale, double horizonScale) { return pView->GetDocument()->CreateNewWellSection(title,depthScale,levelScale,horizonScale); } extern "C" __declspec(dllexport) BOOL WellSectionAddNewWell(CMultiWellSectionView* pView, LPCSTR wellName, double depthScale, double top, double bottom,double x,double y,double bushingLevel, LPCTSTR wellTemplateFile ,ULONGLONG & wellHandle) { BOOL b = FALSE; CWellPole* pWell = pView->GetDocument()->AddNewWell(wellName, depthScale, top, bottom,x,y,bushingLevel, wellTemplateFile); if (pWell) { wellHandle = (ULONGLONG)(pWell); b = TRUE; } return b; } extern "C" __declspec(dllexport) BOOL WellSectionReSetAllWellsPosition(CMultiWellSectionView* pView, BOOL bNeedComputedDepth,double topExtent,double bottomExtent) { BOOL b = TRUE; pView->GetDocument()->WellSectionReSetAllWellsPosition(bNeedComputedDepth,topExtent,bottomExtent); return b; } extern "C" __declspec(dllexport) BOOL WellSectionConnectLayers(CMultiWellSectionView* pView, LPCSTR layersTrackStrBuf) { BOOL b = TRUE; CString str = layersTrackStrBuf; CStringArray strTrackTypeArr; nsWellPoleFunc::MakeStrToArr1(str, strTrackTypeArr, ";"); pView->GetDocument()->WellSectionConnectLayers(strTrackTypeArr); return b; } extern "C" __declspec(dllexport) BOOL SetWellSectionStratificationJson(CWellSection* pSection, LPCSTR str) { BOOL b = FALSE; CString strJson = str; b = pSection->SetWellStratification(strJson); CWellPole* pWell = NULL; POSITION pos = pSection->m_WellList.GetHeadPosition(); while (pos) { pWell = (CWellPole*)pSection->m_WellList.GetNext(pos); pWell->m_WellStratiTree = pSection->m_WellStratiTree; } return b; } extern "C" __declspec(dllexport) BOOL SetWellSectionStratumDivisionJson(CWellSection* pSection, LPCSTR str) { BOOL b = FALSE; CString strJson = str; b = pSection->SetStratumDivision(strJson); CWellPole* pWell = NULL; POSITION pos = pSection->m_WellList.GetHeadPosition(); while (pos) { pWell = (CWellPole*)pSection->m_WellList.GetNext(pos); pWell->m_StratumDivisionTree = pSection->m_StratumDivisionTree; } return b; } extern "C" __declspec(dllexport) BOOL WellSectionApplyingTemplateFileForWell(CMultiWellSectionView* pView, LPCSTR filePath, ULONGLONG wellHandle) { BOOL b = FALSE; b = pView->ApplyingTemplateFileForWell(filePath, wellHandle); return b; } extern "C" __declspec(dllexport) BOOL WellSectionApplyingTemplateFileForSection(CMultiWellSectionView* pView, LPCSTR filePath) { BOOL b = FALSE; b = pView->ApplyingTemplateFileForSection(filePath); return b; } extern "C" __declspec(dllexport) BOOL WellSectionApplyingWellTemplateForSection(CMultiWellSectionView* pView, ULONGLONG wellHandle) { BOOL b = FALSE; b = pView->ApplyingWellTemplateForSection(wellHandle); return b; } extern "C" __declspec(dllexport) BOOL WellSectionGetLinkTracksTypes(ULONGLONG sectionHandle,BYTE*& strTracks, int& dataLen) { BOOL b = FALSE; strTracks = NULL; dataLen = 0; CWellSection* pSection = (CWellSection*)sectionHandle; CString strTotal; std::set tracksTypesSet; CWellObjExtendInfo typeInfo; POSITION pos = pSection->m_BendList.GetHeadPosition(); while (pos) { CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos); if (pBend->m_pLayerLeft != NULL) { CTrackObj* pTrack = (CTrackObj*)pBend->m_pLayerLeft->GetParent(); int type = pTrack->GetTrackType(); CWellObjExtendInfoMgr::GetInstance()->GetTypeInfo(type, typeInfo); tracksTypesSet.insert(typeInfo.m_cTypeStr); } if (pBend->m_pLayerRight != NULL) { CTrackObj* pTrack = (CTrackObj*)pBend->m_pLayerRight->GetParent(); int type = pTrack->GetTrackType(); CWellObjExtendInfoMgr::GetInstance()->GetTypeInfo(type, typeInfo); tracksTypesSet.insert(typeInfo.m_cTypeStr); } } std::set::iterator it = tracksTypesSet.begin(); for (; it != tracksTypesSet.end(); it++) { strTotal =strTotal+ "|"+ (*it); } strTotal.TrimLeft("|"); strTracks = (new BYTE[strTotal.GetLength()]); memcpy((char*)strTracks, strTotal.GetBuffer(), strTotal.GetLength()); dataLen = strTotal.GetLength(); b = TRUE; return b; } extern "C" __declspec(dllexport) BOOL WellSectionBreakBends(CMultiWellSectionView* pView,ULONGLONG sectionHandle, LPCSTR strTrackTypes) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem* pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; CWellSection* pSection = (CWellSection*)sectionHandle; CString str = strTrackTypes; CStringArray strArr; nsWellPoleFunc::MakeStrToArr1(str, strArr, "|"); std::settypeSets; std::vector infos = CWellObjExtendInfoMgr::GetInstance()->GetWellTrackInfos(); for (int i = 0; i < strArr.GetSize(); i++) { for (int k = 0; k < infos.size(); k++) { if (strArr[i] == infos[k]->m_cTypeStr && infos[k]->m_mtype == KEP_TRACK) { typeSets.insert(infos[k]->m_type); break; } } } if (typeSets.size() > 0) { if (NULL != pItemWellSection) pItemWellSection->SetReUnDoAction(); POSITION pos = pSection->m_BendList.GetHeadPosition(); while (pos) { CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos); if (pBend->m_pLayerLeft != NULL) { CTrackObj* pTrack = (CTrackObj*)pBend->m_pLayerLeft->GetParent(); int type = pTrack->GetTrackType(); if (typeSets.find(type) != typeSets.end()) { pSection->DeleteBend(pBend); } } } } } b = TRUE; return b; } extern "C" __declspec(dllexport) BOOL WellSectionGetWellStratumTracksTypes(ULONGLONG sectionHandle, BYTE*& strTracks, int& dataLen) { BOOL b = FALSE; strTracks = NULL; dataLen = 0; CWellSection* pSection = (CWellSection*)sectionHandle; CString strTotal; std::set tracksTypesSet; CWellObjExtendInfo typeInfo; POSITION pos = pSection->m_WellList.GetHeadPosition(); while (pos) { CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetNext(pos); TRACKLIST trackList; pWell->GetAllTrack(&trackList); TRACKLIST::iterator it = trackList.begin(); for (; it != trackList.end(); it++) { int type = (*it)->GetTrackType(); if (type == Track_Result || type == Track_Stratum || type == Track_SandLayer || type == Track_OilLayerGroup) { CWellObjExtendInfoMgr::GetInstance()->GetTypeInfo(type, typeInfo); tracksTypesSet.insert(typeInfo.m_cTypeStr); } } } std::set::iterator it = tracksTypesSet.begin(); for (; it != tracksTypesSet.end(); it++) { strTotal = strTotal + "|" + (*it); } strTotal.TrimLeft("|"); strTracks = (new BYTE[strTotal.GetLength()]); memcpy((char*)strTracks, strTotal.GetBuffer(), strTotal.GetLength()); dataLen = strTotal.GetLength(); b = TRUE; return b; } extern "C" __declspec(dllexport) BOOL WellSectionSetWellRealDistance(CMultiWellSectionView* pView) { BOOL b = FALSE; CMultiWellSectionDoc* pDoc = pView->GetDocument(); CItem* pItem = pDoc->GetItem(); if (NULL == pItem) return FALSE; if (pItem->GetType() == ITEM_WELLSECTION) { CItemWellSection* pItemWellSection = (CItemWellSection*)pItem; pItemWellSection->SetReUnDoAction(); CWellSection* pSection = pItemWellSection->GetWellSection(); pSection->ReSetWellRealDistance(FALSE); b = TRUE; } return b; } extern "C" __declspec(dllexport) BOOL WellSectionGetTotalWellsDistance(ULONGLONG sectionHandle, int& wellNums, double* totalDistance) { BOOL b = TRUE; CWellSection* pSection = (CWellSection*)sectionHandle; wellNums = pSection->m_WellList.GetCount(); *totalDistance = 0; BOOL bFirst = TRUE; double fX, fY, fDistance; POSITION pos = pSection->m_WellList.GetHeadPosition(); while (pos) { CSectionWellObj* pWellSectionObj = (CSectionWellObj*)pSection->m_WellList.GetNext(pos); pWellSectionObj->m_tOldPos = pWellSectionObj->GetRect(); if (bFirst) { bFirst = FALSE; } else { fDistance = sqrt((fX - pWellSectionObj->m_fX)*(fX - pWellSectionObj->m_fX) + (fY - pWellSectionObj->m_fY)*(fY - pWellSectionObj->m_fY)); (*totalDistance) += fDistance; } fX = pWellSectionObj->m_fX; fY = pWellSectionObj->m_fY; } return b; } extern "C" __declspec(dllexport) BOOL WellSectionSetWellsDistance(ULONGLONG sectionHandle, double distance) { BOOL b = TRUE; CWellSection* pSection = (CWellSection*)sectionHandle; pSection->ReSetWellRealDistance(TRUE, distance); return b; } extern "C" __declspec(dllexport) BOOL WellSectionAddWellsMap(CMultiWellSectionView* pView, LPCTSTR symbolPath) { return pView->OnWellsMap(symbolPath); }