|
|
#undef min
|
|
|
#undef max
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include "SigmaView.h"
|
|
|
#include "ItemSelect.h"
|
|
|
#include "ItemSaveToMark.h"
|
|
|
#include "ItemMakeMark.h"
|
|
|
#include "ItemFocusRect.h"
|
|
|
#include "TinyXml\tinyxml.h"
|
|
|
#include "pystring.h"
|
|
|
#include "DrawOperator\FileUtility.h"
|
|
|
#include <deque>
|
|
|
#include ".\WellAndSection\WellPoleDoc.h"
|
|
|
#include ".\WellAndSection\WellPoleView.h"
|
|
|
|
|
|
CPoint2D c_down, c_last;
|
|
|
CStringList FileList;
|
|
|
CMap<int, int, CPoint, CPoint> maps;
|
|
|
double m_height;
|
|
|
double m_width;
|
|
|
CString xmlExport;
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImageFileMerge(CSigmaView* pView, LPCTSTR fileName, bool onBottom,
|
|
|
double locationX, double locationY, double endX, double endY, LPCTSTR layerName)
|
|
|
{
|
|
|
CXy* pxy = pView->m_pDoc->GetDraw();
|
|
|
POSITION pos = pxy->ReadImageRecognise(fileName);
|
|
|
COne* pOne = pxy->RemoveAtNoClear(pos);
|
|
|
pos = NULL;
|
|
|
switch (pOne->GetType())
|
|
|
{
|
|
|
case DOUBLEFOX_WMF:
|
|
|
{
|
|
|
CMetaFile* pmf = (CMetaFile*)pOne->GetValue();
|
|
|
pmf->x0 = locationX;
|
|
|
pmf->y0 = locationY;
|
|
|
pmf->m_size.cx = endX - locationX;
|
|
|
pmf->m_size.cy = endY - locationY;
|
|
|
|
|
|
//pos = pxy->AddHeadOne(pOne);
|
|
|
}
|
|
|
break;
|
|
|
case DOUBLEFOX_IMAGE:
|
|
|
{
|
|
|
CImageInsert* pImage = (CImageInsert*)pOne->GetValue();
|
|
|
pImage->x0 = locationX;
|
|
|
pImage->y0 = locationY;
|
|
|
pImage->m_size.cx = endX - locationX;
|
|
|
pImage->m_size.cy = endY - locationY;
|
|
|
//pos = pDoc->GetDraw()->AddTailOne(pOne);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
CLayer* pLayer = pxy->FindAddLayer(layerName);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
if (onBottom) {
|
|
|
pos = pxy->AddHeadOne(pOne);
|
|
|
}
|
|
|
else {
|
|
|
pos = pxy->AddTailOne(pOne);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileMerge(CSigmaView* pView, LPCTSTR fileName, bool onBottom)
|
|
|
{
|
|
|
//CRect8 rect(1e100, -1e100, -1e100, 1e100);
|
|
|
//pView->m_pDoc->m_pXy->GetRange(rect);
|
|
|
CString strExt;
|
|
|
CSplitPath sp(fileName);
|
|
|
strExt = sp.GetExtension();
|
|
|
strExt.MakeLower();
|
|
|
CXy* pxy = new CXy;
|
|
|
if (strExt == _T(".dfb") || strExt == _T(".dft"))
|
|
|
pView->m_pDoc->SerializeRead(pxy, fileName);
|
|
|
else if (strExt == _T(".dfd") || strExt == _T(".kev"))
|
|
|
{
|
|
|
CString path(fileName);
|
|
|
pxy->ReadWithExtension(path);
|
|
|
}
|
|
|
else if (!pxy->ReadOtherWithExtension(fileName)) //读取其它类型不成功时
|
|
|
{
|
|
|
pxy->ReadWithExtension(fileName);
|
|
|
}
|
|
|
if (!pxy->GetProjection().IsEmpty() && !pView->m_pDoc->GetDraw()->GetProjection().IsEmpty())
|
|
|
pxy->ChangeToProjection(pView->m_pDoc->GetDraw()->GetProjection());
|
|
|
CPositionList select;
|
|
|
if (onBottom == TRUE)
|
|
|
{
|
|
|
pView->m_pDoc->GetDraw()->MoveInBottom(pxy, select);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int flag = pView->m_pDoc->GetDraw()->MoveIn(pxy, select);
|
|
|
}
|
|
|
delete pxy;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void WellPoleFileMerge(CSigmaView* pView, LPCTSTR fileName, bool onBottom)
|
|
|
{
|
|
|
//CRect8 rect(1e100, -1e100, -1e100, 1e100);
|
|
|
//pView->m_pDoc->m_pXy->GetRange(rect);
|
|
|
|
|
|
CString filePath(fileName);
|
|
|
|
|
|
if (!filePath.IsEmpty())
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
CXyDC* pXyDC = &pView->m_pDoc->GetDC();
|
|
|
|
|
|
CRect8 srect = pXy->GetRange();
|
|
|
|
|
|
pXy->PCG_InsertWellOrSectionToMap(filePath, &pView->m_pDoc->GetDC());
|
|
|
|
|
|
WellExtentObjMoveToPoint(NULL, srect.left, srect.top, pXy->GetLatestReadOnes());
|
|
|
|
|
|
pView->m_pDoc->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void MultiWellSectionFileMerge(CSigmaView* pView, LPCTSTR fileName, bool onBottom)
|
|
|
{
|
|
|
//CRect8 rect(1e100, -1e100, -1e100, 1e100);
|
|
|
//pView->m_pDoc->m_pXy->GetRange(rect);
|
|
|
|
|
|
CString filePath(fileName);
|
|
|
|
|
|
if (!filePath.IsEmpty())
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
CRect8 srect = pXy->GetRange();
|
|
|
pXy->PCG_InsertWellOrSectionToMap(filePath, &pView->m_pDoc->GetDC());
|
|
|
|
|
|
WellExtentObjMoveToPoint(NULL, srect.left, srect.top, pXy->GetLatestReadOnes());
|
|
|
pView->m_pDoc->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileMergeBefore(CSigmaView* pView, LPCTSTR fileName, LPCTSTR layerName)
|
|
|
{
|
|
|
CString strExt;
|
|
|
CSplitPath sp(fileName);
|
|
|
strExt = sp.GetExtension();
|
|
|
strExt.MakeLower();
|
|
|
CXy* pxy = new CXy;
|
|
|
if (strExt == _T(".dfb") || strExt == _T(".dft"))
|
|
|
pView->m_pDoc->SerializeRead(pxy, fileName);
|
|
|
else if (!pView->m_pDoc->GetDraw()->ReadOtherWithExtension(fileName)) // 读取其它类型不成功时
|
|
|
pxy->ReadWithExtension(fileName);
|
|
|
if (!pxy->GetProjection().IsEmpty() && !pView->m_pDoc->GetDraw()->GetProjection().IsEmpty())
|
|
|
pxy->ChangeToProjection(pView->m_pDoc->GetDraw()->GetProjection());
|
|
|
|
|
|
CPositionList select;
|
|
|
pView->m_pDoc->GetDraw()->MoveInBefore(pxy, select, layerName);
|
|
|
delete pxy;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileMergeAfter(CSigmaView* pView, LPCTSTR fileName, LPCTSTR layerName)
|
|
|
{
|
|
|
CString strExt;
|
|
|
CSplitPath sp(fileName);
|
|
|
strExt = sp.GetExtension();
|
|
|
strExt.MakeLower();
|
|
|
CXy* pxy = new CXy;
|
|
|
if (strExt == _T(".dfb") || strExt == _T(".dft"))
|
|
|
pView->m_pDoc->SerializeRead(pxy, fileName);
|
|
|
else if (!pView->m_pDoc->GetDraw()->ReadOtherWithExtension(fileName)) // 读取其它类型不成功时
|
|
|
pxy->ReadWithExtension(fileName);
|
|
|
if (!pxy->GetProjection().IsEmpty() && !pView->m_pDoc->GetDraw()->GetProjection().IsEmpty())
|
|
|
pxy->ChangeToProjection(pView->m_pDoc->GetDraw()->GetProjection());
|
|
|
|
|
|
CPositionList select;
|
|
|
pView->m_pDoc->GetDraw()->MoveInAfter(pxy, select, layerName);
|
|
|
delete pxy;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveView(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteViewData(*(CFile*)&fw, CUR_VERSION);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveSelect(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CItemSelect* pItemSelect = pView->m_pDoc->GetSelectItem();
|
|
|
if (pItemSelect == NULL) return;
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_Write(*(CFile*)&fw, pItemSelect->m_selection);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
BOOL BtnEnable(CSigmaView* pView)
|
|
|
{
|
|
|
CItemSelect* pItem = pView->m_pDoc->GetSelectItem();
|
|
|
if (pItem == NULL)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
else if (pItem->GetSelectedCount() <= 0)
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSavePoint(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteSelectData(*(CFile*)&fw, DOUBLEFOX_POINT, CUR_VERSION);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveCurve(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteSelectData(*(CFile*)&fw, DOUBLEFOX_CURVE, CUR_VERSION);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveSolid(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteSelectPline(*(CFile*)&fw, CUR_VERSION, PLINE_SOLID, TRUE);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveText(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteSelectData(*(CFile*)&fw, DOUBLEFOX_TEXT, CUR_VERSION);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveCleanCurve(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WritePurePline(*(CFile*)&fw);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveToXyz(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CStdioFile fw;
|
|
|
if (!fw.Open(fileName, CFile::modeCreate | CFile::modeWrite))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->DFD_WriteXYZ(*(CFile*)&fw);
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void FileSaveToMark(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CItemSaveToMark* pItem = (CItemSaveToMark*)pView->m_pDoc->FindItem(ITEM_SAVE_TO_MARK);
|
|
|
if (pItem)
|
|
|
{
|
|
|
if (pView->m_pDoc->m_pItemMakeMark)
|
|
|
pItem->m_rect = pView->m_pDoc->m_pItemMakeMark->m_rect;
|
|
|
pView->m_pDoc->SetItem(pItem);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
CRect8 GetRect(void)
|
|
|
{
|
|
|
CRect8 rect(c_down.x0, c_down.y0, c_last.x0, c_last.y0);
|
|
|
/*if (m_bShiftDown)
|
|
|
{
|
|
|
int sf = 1;
|
|
|
if (c_last.x0 > c_down.x0)
|
|
|
{
|
|
|
if (c_last.y0 < c_down.y0)
|
|
|
sf = -1;
|
|
|
}
|
|
|
else if (c_last.y0 > c_down.y0)
|
|
|
sf = -1;
|
|
|
rect.bottom = rect.top + rect.Width()*sf;
|
|
|
}*/
|
|
|
rect.NormalizeRect();
|
|
|
return rect;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
BOOL OnLButtonUpOther(CSigmaView* pView, double firstX, double firstY, double lastX, double lastY, HDC hdc, int vk=0)
|
|
|
{
|
|
|
CPoint firstPt, lastPt;
|
|
|
firstPt.x = firstX;
|
|
|
firstPt.y = firstY;
|
|
|
lastPt.x = lastX;
|
|
|
lastPt.y = lastY;
|
|
|
CRect rect;
|
|
|
CXyDC* pDC = &pView->m_pDoc->GetDC();
|
|
|
rect = pView->GetClientRect(); //可能会出错
|
|
|
CPoint2D firstDp = pDC->GetReal(firstPt);
|
|
|
CPoint2D lastDp = pDC->GetReal(lastPt);
|
|
|
c_down = firstDp;
|
|
|
c_last = lastDp;
|
|
|
CDC* pCdc = CDC::FromHandle(hdc);
|
|
|
return pView->OnLButtonUpOther(pCdc, 0, lastPt, vk);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void BtnOkSaveMarkToFile(CSigmaView* pView, LPCTSTR fileName, LPCTSTR symbolName)
|
|
|
{
|
|
|
//CItemSelect * itemSelect = pView->m_pDoc->GetSelectItem();
|
|
|
//if (itemSelect == 0)
|
|
|
// return;
|
|
|
|
|
|
CRect8 rect = GetRect();
|
|
|
|
|
|
|
|
|
//CRect rect;
|
|
|
//CXyDC* pDC = &pView->m_pDoc->GetDC();
|
|
|
//rect = pView->GetClientRect(); //可能会出错
|
|
|
//CRect8 rt = pDC->GetReal(rect);
|
|
|
CList<POSITION, POSITION> select;
|
|
|
pView->m_pDoc->GetDraw()->IsInRange(rect, select);
|
|
|
if (select.GetCount() > 0)
|
|
|
{
|
|
|
CStdioFile sfw;
|
|
|
if (!sfw.Open(fileName, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate))
|
|
|
{
|
|
|
////::AfxMessageBox(IDS_STRING_OPEN_WRITE_ERROR);
|
|
|
//pView->m_pDoc->EnableDefaultTool();
|
|
|
return;
|
|
|
}
|
|
|
sfw.SeekToEnd();
|
|
|
|
|
|
CFile &fw = *(CFile*)&sfw;
|
|
|
CString str;
|
|
|
str.Format("New %s", symbolName);
|
|
|
AfxGetPublicFunction()->WriteLine(fw, str);
|
|
|
|
|
|
//GetDoc()->BeginProgress(IDS_STRING_WriteFile);
|
|
|
pView->m_pDoc->GetDraw()->DFD_Write(fw, select);
|
|
|
//GetDoc()->EndProgress();
|
|
|
|
|
|
AfxGetPublicFunction()->WriteLine(fw, "EndNew");
|
|
|
select.RemoveAll();
|
|
|
fw.Close();
|
|
|
}
|
|
|
|
|
|
pView->m_pDoc->ClearItems();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void BtnCancelSaveMarkToFile(CSigmaView* pView)
|
|
|
{
|
|
|
pView->m_pDoc->ClearItems();
|
|
|
}
|
|
|
|
|
|
void InsertChar(CString &line)
|
|
|
{
|
|
|
for (int i = 0; i < maps.GetCount(); i++)
|
|
|
{
|
|
|
if (line.GetLength() < maps[i].x) continue;
|
|
|
switch (maps[i].y)
|
|
|
{
|
|
|
case 0:
|
|
|
line.Insert(maps[i].x, ",");
|
|
|
break;
|
|
|
case 1:
|
|
|
line.Insert(maps[i].x, " ");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
line.Replace(",", " ");
|
|
|
}
|
|
|
|
|
|
CString LoadFile(CString name)
|
|
|
{
|
|
|
CString m_length;
|
|
|
CString m_data;
|
|
|
int rows = 0;
|
|
|
if (name.IsEmpty()) return "";
|
|
|
CStdioFile fr;
|
|
|
if (fr.Open(name, CFile::modeRead) == FALSE)return "";
|
|
|
m_length.Format("%.3lfK", fr.GetLength()*1.0 / 1024.0);
|
|
|
m_data.Empty();
|
|
|
CString str, line, strRowCount;
|
|
|
int count = 0;
|
|
|
char en[3]; en[0] = 13; en[1] = 10; en[2] = '\0';
|
|
|
//while (fr.ReadString(str) && ++count <= 400)
|
|
|
while (fr.ReadString(str))
|
|
|
{
|
|
|
rows++;
|
|
|
InsertChar(str);
|
|
|
line.Format("%3d |%s", count, str);
|
|
|
m_data += line;
|
|
|
m_data += en;
|
|
|
}
|
|
|
fr.Close();
|
|
|
//if (count > 400) m_data += "......";
|
|
|
strRowCount.Format(_T("%d"), rows);
|
|
|
m_data += "#" + strRowCount;
|
|
|
return m_data;
|
|
|
}
|
|
|
|
|
|
int GetParameter(CString cmd, CStringList &list)
|
|
|
{
|
|
|
if (cmd.IsEmpty()) return 0;
|
|
|
int i, j;
|
|
|
CString str;
|
|
|
char c[256];
|
|
|
i = 0;
|
|
|
j = 0;
|
|
|
BOOL bb = FALSE;
|
|
|
for (i = 0; i < cmd.GetLength(); i++)
|
|
|
{
|
|
|
if (bb)
|
|
|
{
|
|
|
if (cmd[i] == '\"')
|
|
|
{
|
|
|
c[j] = 0;
|
|
|
bb = FALSE;
|
|
|
list.AddTail(c);
|
|
|
j = 0;
|
|
|
continue;
|
|
|
}
|
|
|
c[j] = cmd[i];
|
|
|
}
|
|
|
if (cmd[i] == '\"')
|
|
|
{
|
|
|
bb = TRUE;
|
|
|
continue;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (cmd[i] == ' ' && bb == FALSE)
|
|
|
{
|
|
|
if (j > 0)
|
|
|
{
|
|
|
c[j] = 0;
|
|
|
list.AddTail(c);
|
|
|
j = 0;
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
c[j] = cmd[i];
|
|
|
}
|
|
|
j++;
|
|
|
}
|
|
|
if (j > 0)
|
|
|
{
|
|
|
c[j] = 0;
|
|
|
list.AddTail(c);
|
|
|
}
|
|
|
return (int)list.GetCount();
|
|
|
}
|
|
|
|
|
|
|
|
|
#define __MaxFileListString 409600
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int InputFile(CSigmaView* pView, LPCTSTR fileName, BYTE* Content)
|
|
|
{
|
|
|
CString fileContent;
|
|
|
FileList.RemoveAll();
|
|
|
GetParameter(fileName, FileList);
|
|
|
if (FileList.GetCount() > 0)
|
|
|
fileContent = LoadFile(FileList.GetHead());
|
|
|
int nLen = fileContent.GetLength();
|
|
|
memcpy(Content, fileContent.GetBuffer(0), nLen);
|
|
|
return nLen;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int GetFileLength(CSigmaView* pView, LPCTSTR fileName)
|
|
|
{
|
|
|
CString fileContent;
|
|
|
FileList.RemoveAll();
|
|
|
GetParameter(fileName, FileList);
|
|
|
if (FileList.GetCount() > 0)
|
|
|
fileContent = LoadFile(FileList.GetHead());
|
|
|
int nLen = fileContent.GetLength();
|
|
|
return nLen;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int InsertChar(CSigmaView* pView, int nCharIndex, int nb, BYTE* Content)
|
|
|
{
|
|
|
////UpdateData();
|
|
|
CPoint point, pt;
|
|
|
////CEdit m_ConData;
|
|
|
int m_insert = 1;
|
|
|
////int fvl = m_ConData.GetFirstVisibleLine();
|
|
|
////pt = m_ConData.GetCaretPos();
|
|
|
//pt.x = x;
|
|
|
//pt.y = y;
|
|
|
//int n = m_ConData.CharFromPos(pt);
|
|
|
//int nLineIndex = HIWORD(n);
|
|
|
//int nCharIndex = LOWORD(n);
|
|
|
//int nb = m_ConData.LineIndex();
|
|
|
point.x = nCharIndex - nb - 5;
|
|
|
//point.x = nCharIndex - nb;
|
|
|
|
|
|
if (point.x < 0) return -1;
|
|
|
point.y = m_insert;
|
|
|
for (int i = 0; i < maps.GetCount(); i++)
|
|
|
{
|
|
|
if (maps[i].x > point.x)
|
|
|
{
|
|
|
pt = maps[i];
|
|
|
pt.x += 1;
|
|
|
maps[i] = point;
|
|
|
point = pt;
|
|
|
}
|
|
|
}
|
|
|
maps[(int)maps.GetCount()] = point;
|
|
|
|
|
|
CString fileContent = LoadFile(FileList.GetHead());
|
|
|
int nLen = fileContent.GetLength();
|
|
|
memcpy(Content, fileContent.GetBuffer(0), nLen);
|
|
|
return nLen;
|
|
|
}
|
|
|
|
|
|
int CutString(CStringArray &m_type, CString str)
|
|
|
{
|
|
|
int i, j;
|
|
|
i = 1;
|
|
|
char s[256];
|
|
|
j = 0;
|
|
|
m_type.RemoveAll();
|
|
|
if (str.IsEmpty()) return 0;
|
|
|
for (i = 0; i < str.GetLength(); ++i)
|
|
|
{
|
|
|
if (str[i] < 33 && str[i] >= 0)
|
|
|
{
|
|
|
if (j)
|
|
|
{
|
|
|
s[j] = 0;
|
|
|
m_type.Add(s);
|
|
|
}
|
|
|
j = 0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
s[j] = str[i];
|
|
|
j++;
|
|
|
}
|
|
|
}
|
|
|
s[j] = 0;
|
|
|
m_type.Add(s);
|
|
|
return (int)m_type.GetSize();
|
|
|
}
|
|
|
|
|
|
BOOL IsDigit(CString& line)
|
|
|
{
|
|
|
return AfxGetPublicFunction()->IsDigit(line);
|
|
|
}
|
|
|
|
|
|
CStringArray* SplitString(CString string, char pattern)
|
|
|
{
|
|
|
CStringArray* strArray = new CStringArray();
|
|
|
CString strTemp;
|
|
|
strTemp = string;
|
|
|
int iPos = 0;
|
|
|
while (iPos != -1)
|
|
|
{
|
|
|
iPos = strTemp.Find(pattern);
|
|
|
if (iPos == -1)
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
strArray->Add(strTemp.Left(iPos));
|
|
|
strTemp = strTemp.Mid(iPos + 1, strTemp.GetLength());
|
|
|
}
|
|
|
|
|
|
strArray->Add(strTemp);
|
|
|
return strArray;
|
|
|
}
|
|
|
|
|
|
void ImportBasePoints(CSigmaView* pView, BYTE * buffCurve, int buffLen)
|
|
|
{
|
|
|
CXy* pXy = new CXy;
|
|
|
|
|
|
CMemFile mf(buffCurve, buffLen);
|
|
|
pXy->DML_Read2(mf);
|
|
|
CPtrList* pList = pXy->GetValueList();
|
|
|
POSITION pos;
|
|
|
COne* pOne;
|
|
|
pos = pList->GetHeadPosition();
|
|
|
while (pos)
|
|
|
{
|
|
|
pOne = (COne*)pList->GetNext(pos);
|
|
|
if (pOne->GetType() != DOUBLEFOX_POINT)continue;
|
|
|
CString LayerName = pOne->GetLayer()->GetPathName();
|
|
|
pView->m_pDoc->m_pXy->SetCurrentLayer(LayerName);
|
|
|
CPoint* pPoint = (CPoint*)pOne->GetValue();
|
|
|
pView->m_pDoc->m_pXy->AddElement(pPoint, DOUBLEFOX_POINT);
|
|
|
}
|
|
|
|
|
|
/*if (selectType == "PointClass")
|
|
|
{
|
|
|
point = new CPointNameEx;
|
|
|
point->x0 = x0;
|
|
|
point->y0 = y0;
|
|
|
point->z0 = z0;
|
|
|
point->SetName(CString(arrValue[pName - 1]));
|
|
|
pxy->AddElement(point, DOUBLEFOX_POINT);
|
|
|
}
|
|
|
else if (selectType == "ScatterPoint")
|
|
|
{
|
|
|
pxyz = new CPointXyz;
|
|
|
pxyz->x0 = x0;
|
|
|
pxyz->y0 = y0;
|
|
|
pxyz->z0 = z0;
|
|
|
pxyz->SetName();
|
|
|
pxy->AddElement(pxyz, DOUBLEFOX_POINT);
|
|
|
}*/
|
|
|
|
|
|
}
|
|
|
|
|
|
static void ImportData(const std::string& xml, std::function<void(TiXmlElement *)> cb)
|
|
|
{
|
|
|
TiXmlDocument xmlDoc;
|
|
|
xmlDoc.Parse(xml.c_str());
|
|
|
|
|
|
TiXmlElement* rootElement = xmlDoc.RootElement();
|
|
|
if (rootElement == nullptr)
|
|
|
{
|
|
|
std::cout << "Invalid XML format." << std::endl;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
TiXmlElement* pointElement = rootElement->FirstChildElement("Data");
|
|
|
while (pointElement != nullptr)
|
|
|
{
|
|
|
cb(pointElement);
|
|
|
pointElement = pointElement->NextSiblingElement("Data");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static const char* GetFirstChildElementText(TiXmlElement* element, const char *key)
|
|
|
{
|
|
|
TiXmlElement* child = element->FirstChildElement(key);
|
|
|
if (child == nullptr)
|
|
|
{
|
|
|
return nullptr;
|
|
|
}
|
|
|
return child->GetText();
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportFractionPoint(CSigmaView* pView, BYTE * buff, int buffLen)
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
std::string xml((char*)buff, buffLen);
|
|
|
|
|
|
auto cb = [pXy](TiXmlElement* pointElement)
|
|
|
{
|
|
|
const char* x = GetFirstChildElementText(pointElement, "X");
|
|
|
const char* y = GetFirstChildElementText(pointElement, "Y");
|
|
|
const char* numerator = GetFirstChildElementText(pointElement, "分子");
|
|
|
const char* denominator = GetFirstChildElementText(pointElement, "分母");
|
|
|
const char* layer = GetFirstChildElementText(pointElement, "图层");
|
|
|
|
|
|
CPointTwoName* pPoint = new CPointTwoName();
|
|
|
pPoint->x0 = std::stod(x);
|
|
|
pPoint->y0 = std::stod(y);
|
|
|
pPoint->m_name1.SetName(numerator);
|
|
|
pPoint->m_name2.SetName(denominator);
|
|
|
|
|
|
CLayer* pLayer = pXy->FindAddLayer(layer);
|
|
|
POSITION pos = pXy->AddElement(pPoint, DOUBLEFOX_TWOPOINT);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportCrossPoint(CSigmaView* pView, BYTE * buff, int buffLen)
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
std::string xml((char*)buff, buffLen);
|
|
|
|
|
|
auto cb = [pXy](TiXmlElement* pointElement)
|
|
|
{
|
|
|
const char* x = GetFirstChildElementText(pointElement, "X");
|
|
|
const char* y = GetFirstChildElementText(pointElement, "Y");
|
|
|
const char* z = GetFirstChildElementText(pointElement, "Z");
|
|
|
const char* layer = GetFirstChildElementText(pointElement, "图层");
|
|
|
|
|
|
const char* name1 = GetFirstChildElementText(pointElement, "第一象限");
|
|
|
const char* name2 = GetFirstChildElementText(pointElement, "第二象限");
|
|
|
const char* name3 = GetFirstChildElementText(pointElement, "第三象限");
|
|
|
const char* name4 = GetFirstChildElementText(pointElement, "第四象限");
|
|
|
|
|
|
CPointCrossName* pPoint = new CPointCrossName();
|
|
|
pPoint->x0 = std::stod(x);
|
|
|
pPoint->y0 = std::stod(y);
|
|
|
pPoint->m_name1.SetName(name1);
|
|
|
pPoint->m_name2.SetName(name2);
|
|
|
pPoint->m_name3.SetName(name3);
|
|
|
pPoint->m_name4.SetName(name4);
|
|
|
|
|
|
CLayer* pLayer = pXy->FindAddLayer(layer);
|
|
|
POSITION pos = pXy->AddElement(pPoint, DOUBLEFOX_CROSSPOINT);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导入普通点
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportNormalPoint(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
std::string xml((char*)buff, bufLen);
|
|
|
|
|
|
auto cb = [pXy](TiXmlElement* pointElement)
|
|
|
{
|
|
|
const char* name = GetFirstChildElementText(pointElement, "名称");
|
|
|
const char* x = GetFirstChildElementText(pointElement, "X");
|
|
|
const char* y = GetFirstChildElementText(pointElement, "Y");
|
|
|
const char* z = GetFirstChildElementText(pointElement, "Z");
|
|
|
const char* layer = GetFirstChildElementText(pointElement, "图层");
|
|
|
|
|
|
CPointNameEx* pPoint = new CPointNameEx();
|
|
|
pPoint->SetName(name);
|
|
|
pPoint->x0 = std::stod(x);
|
|
|
pPoint->y0 = std::stod(y);
|
|
|
if (z != nullptr)
|
|
|
{
|
|
|
pPoint->z0 = std::stod(z);
|
|
|
}
|
|
|
|
|
|
CLayer* pLayer = pXy->FindAddLayer(layer);
|
|
|
POSITION pos = pXy->AddElement(pPoint, DOUBLEFOX_POINT);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导入散点
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*
|
|
|
* 格式示例如下,Layer 也可能有多层
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportScatterPoint(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
std::string xml((char*)buff, bufLen);
|
|
|
|
|
|
auto cb = [pXy](TiXmlElement* pointElement)
|
|
|
{
|
|
|
const char* x = GetFirstChildElementText(pointElement, "X");
|
|
|
const char* y = GetFirstChildElementText(pointElement, "Y");
|
|
|
const char* z = GetFirstChildElementText(pointElement, "Z");
|
|
|
const char* layer = GetFirstChildElementText(pointElement, "图层");
|
|
|
|
|
|
CPointNameEx* pPoint = new CPointNameEx();
|
|
|
pPoint->x0 = std::stod(x);
|
|
|
pPoint->y0 = std::stod(y);
|
|
|
if (z != nullptr)
|
|
|
pPoint->z0 = std::stod(z);
|
|
|
|
|
|
CLayer* pLayer = pXy->FindAddLayer(layer);
|
|
|
POSITION pos = pXy->AddElement(pPoint, DOUBLEFOX_POINT);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
}
|
|
|
|
|
|
void AddCurve(CList<dfPoint, dfPoint> &dp, CString name, int HaveLocate, CXy* pxy)
|
|
|
{
|
|
|
if (dp.GetCount() < 0) return;
|
|
|
CCurveEx *curve;
|
|
|
curve = new CCurveEx;
|
|
|
curve->SetPoints(dp, HaveLocate);
|
|
|
curve->SetName(name);
|
|
|
//curve->width = 20;
|
|
|
dp.RemoveAll();
|
|
|
pxy->AddElement(curve, DOUBLEFOX_CURVE);
|
|
|
}
|
|
|
|
|
|
|
|
|
int OpenFile(CXy* pXy, BYTE * buffCurve, int bufLen)
|
|
|
{
|
|
|
CMemFile mf(buffCurve, bufLen);
|
|
|
pXy->DML_Read2(mf);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
struct LineEntry
|
|
|
{
|
|
|
double x;
|
|
|
double y;
|
|
|
double z;
|
|
|
double l;
|
|
|
CString name;
|
|
|
CString layer;
|
|
|
};
|
|
|
|
|
|
void ImportLinesClass(CSigmaView* pView, BYTE * buffCurve, int bufLen, BOOL is123)
|
|
|
{
|
|
|
std::string xml((char *)buffCurve, bufLen);
|
|
|
|
|
|
std::list<std::shared_ptr<LineEntry>> entries;
|
|
|
|
|
|
auto cb = [&entries](TiXmlElement* dataElement)
|
|
|
{
|
|
|
const char* x = GetFirstChildElementText(dataElement, "X");
|
|
|
const char* y = GetFirstChildElementText(dataElement, "Y");
|
|
|
const char* z = GetFirstChildElementText(dataElement, "Z");
|
|
|
const char* l = GetFirstChildElementText(dataElement, "L");
|
|
|
const char* name = GetFirstChildElementText(dataElement, "名称");
|
|
|
const char* layer = GetFirstChildElementText(dataElement, "图层");
|
|
|
|
|
|
if (x == nullptr || y == nullptr)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
std::shared_ptr<LineEntry> entry = std::make_shared<LineEntry>();
|
|
|
entry->x = std::stod(x);
|
|
|
entry->y = std::stod(y);
|
|
|
if (z != nullptr)
|
|
|
entry->z = std::stod(z);
|
|
|
if (l != nullptr)
|
|
|
entry->l = std::stod(l);
|
|
|
entry->name = name;
|
|
|
entry->layer = layer;
|
|
|
|
|
|
entries.push_back(entry);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
|
|
|
// 按拆图层拆分
|
|
|
std::map<CString, std::vector<std::shared_ptr<LineEntry>>> layerMap;
|
|
|
for (const auto& entry : entries)
|
|
|
{
|
|
|
layerMap[entry->layer].push_back(entry);
|
|
|
}
|
|
|
|
|
|
for (const auto& pair : layerMap)
|
|
|
{
|
|
|
CString layerName = pair.first;
|
|
|
const auto& lineEntries = pair.second;
|
|
|
|
|
|
using LineEntries = std::vector<std::shared_ptr<LineEntry>>;
|
|
|
std::deque<std::pair<CString, LineEntries>> lineStack;
|
|
|
|
|
|
// 内部再按名称拆分,这样就拆分出了不同的线,名称相同且连续的点表示是同一条线
|
|
|
for (const auto& lineEntry : lineEntries)
|
|
|
{
|
|
|
if (lineStack.empty() || lineStack.back().first != lineEntry->name)
|
|
|
{
|
|
|
lineStack.push_back({ lineEntry->name, { lineEntry } });
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
lineStack.back().second.push_back(lineEntry);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
CXy* pXy = pView->m_pDoc->GetDraw();
|
|
|
|
|
|
// 添加图层
|
|
|
CLayer* pLayer = pXy->FindAddLayer(layerName);
|
|
|
|
|
|
// 添加曲线
|
|
|
for (const auto& pair : lineStack)
|
|
|
{
|
|
|
CString lineName = pair.first;
|
|
|
const auto& lineEntries = pair.second; // 这里是一条线
|
|
|
|
|
|
CCurveEx* pCurve = new CCurveEx();
|
|
|
pCurve->SetName(lineName);
|
|
|
pCurve->Create((int)lineEntries.size());
|
|
|
pCurve->width = 1;
|
|
|
|
|
|
for (size_t i = 0; i < lineEntries.size(); i++)
|
|
|
{
|
|
|
const auto &line = lineEntries[i];
|
|
|
pCurve->x[i] = line->x;
|
|
|
pCurve->y[i] = line->y;
|
|
|
pCurve->z[i] = line->z;
|
|
|
pCurve->l[i] = line->l;
|
|
|
}
|
|
|
|
|
|
// 不管用户输不输入桩号,我们都重新计算一遍,用户给的桩号值有可能是错误的
|
|
|
pCurve->GetLocation();
|
|
|
|
|
|
POSITION pos = pXy->AddElement(pCurve, DOUBLEFOX_CURVE);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void WriteXy2DFD(CXy* pXy, BYTE*& buffData, int& bufLen)
|
|
|
{
|
|
|
pXy->WriteMemory(buffData, bufLen, 1);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void CreateXyFromDFD(BYTE* buffData, int bufLen, CXy*& pXy)
|
|
|
{
|
|
|
pXy = new CXy;
|
|
|
pXy->ReadMemory(buffData, bufLen, 1);
|
|
|
}
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportData(CSigmaView* pView, BYTE * buffCurve, int bufLen)
|
|
|
{
|
|
|
CMemFile mf(buffCurve, bufLen);
|
|
|
// pView->m_pDoc->m_pXy->DML_Read2(mf);
|
|
|
pView->m_pDoc->m_pXy->DML_ReadData(mf);
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportCurve(CSigmaView* pView, BYTE * buffFileContent, int bufLen, LPCTSTR selectType)
|
|
|
{
|
|
|
CString selType = selectType;
|
|
|
if (selType == "LinesClass")
|
|
|
{
|
|
|
ImportLinesClass(pView, buffFileContent, bufLen, false);
|
|
|
}
|
|
|
else if (selType == "LinesClass123")
|
|
|
{
|
|
|
ImportLinesClass(pView, buffFileContent, bufLen, true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
enum EImportTypeID
|
|
|
{
|
|
|
typePointBase = 1,
|
|
|
typePointXyz = 2,
|
|
|
typeCurveBase = 3,
|
|
|
typeCurve123 = 4,
|
|
|
typeWellOffset = 5,
|
|
|
typeWellAvgAngle1 = 6,
|
|
|
typeWellAvgAngle2 = 7,
|
|
|
typeWellMinCurvature = 8,
|
|
|
typeWellPositionCoordinate = 11,
|
|
|
typePointCross = 9,
|
|
|
typePointTwo = 10
|
|
|
};
|
|
|
|
|
|
// 井斜实体类
|
|
|
struct WellDeviationEntry
|
|
|
{
|
|
|
double x;
|
|
|
double y;
|
|
|
CString name; // 井名
|
|
|
CString layer; // 图层
|
|
|
double dx; // 横偏移
|
|
|
double dy; // 纵偏移
|
|
|
double bevel; // 井斜角
|
|
|
double azimuth; // 方位角
|
|
|
double xh; // 斜深
|
|
|
double vh; // 垂深
|
|
|
};
|
|
|
|
|
|
static std::shared_ptr<WellDeviationEntry> CreateWellDeviationEntry(TiXmlElement* dataElement)
|
|
|
{
|
|
|
auto entry = std::make_shared<WellDeviationEntry>();
|
|
|
memset(entry.get(), 0, sizeof(entry));
|
|
|
|
|
|
const char* x = GetFirstChildElementText(dataElement, "X");
|
|
|
const char* y = GetFirstChildElementText(dataElement, "Y");
|
|
|
const char* name = GetFirstChildElementText(dataElement, "名称");
|
|
|
const char* layer = GetFirstChildElementText(dataElement, "图层");
|
|
|
const char* dx = GetFirstChildElementText(dataElement, "DX");
|
|
|
const char* dy = GetFirstChildElementText(dataElement, "DY");
|
|
|
const char* bevel = GetFirstChildElementText(dataElement, "井斜角");
|
|
|
const char* azimuth = GetFirstChildElementText(dataElement, "方位角");
|
|
|
const char* xh = GetFirstChildElementText(dataElement, "斜深");
|
|
|
const char* vh = GetFirstChildElementText(dataElement, "垂深");
|
|
|
|
|
|
entry->x = std::stod(x);
|
|
|
entry->y = std::stod(y);
|
|
|
entry->name = name;
|
|
|
entry->layer = layer;
|
|
|
|
|
|
if (dx != nullptr && dy != nullptr)
|
|
|
{
|
|
|
entry->dx = std::stod(dx);
|
|
|
entry->dy = std::stod(dy);
|
|
|
}
|
|
|
|
|
|
if (bevel != nullptr)
|
|
|
{
|
|
|
entry->bevel = std::stod(bevel);
|
|
|
}
|
|
|
|
|
|
if (azimuth != nullptr)
|
|
|
{
|
|
|
entry->azimuth = std::stod(azimuth);
|
|
|
}
|
|
|
|
|
|
if (xh != nullptr)
|
|
|
{
|
|
|
entry->xh = std::stod(azimuth);
|
|
|
}
|
|
|
|
|
|
if (vh != nullptr)
|
|
|
{
|
|
|
entry->vh = std::stod(vh);
|
|
|
}
|
|
|
|
|
|
return entry;
|
|
|
}
|
|
|
|
|
|
static void FillTrackPointList(const std::vector<std::shared_ptr<WellDeviationEntry>>& entries, int nMode, CWellTrackPointList &arrPoints)
|
|
|
{
|
|
|
for (const auto& entry : entries)
|
|
|
{
|
|
|
CWellTrack::CWellTrackPoint wop;
|
|
|
|
|
|
wop.InitPoint();
|
|
|
wop.point.x0 = entry->x;
|
|
|
wop.point.y0 = entry->y;
|
|
|
|
|
|
switch (nMode)
|
|
|
{
|
|
|
case typeWellOffset:
|
|
|
wop.dx = entry->dx;
|
|
|
wop.dy = entry->dy;
|
|
|
break;
|
|
|
|
|
|
case typeWellMinCurvature:
|
|
|
case typeWellAvgAngle1:
|
|
|
wop.bevel = entry->bevel;
|
|
|
wop.azimuth = entry->azimuth;
|
|
|
wop.xh = entry->azimuth;
|
|
|
break;
|
|
|
|
|
|
case typeWellAvgAngle2:
|
|
|
wop.bevel = entry->bevel;
|
|
|
wop.azimuth = entry->azimuth;
|
|
|
wop.vh = entry->vh;
|
|
|
break;
|
|
|
case typeWellPositionCoordinate:
|
|
|
//pxy->SetCurrentLayer(layerName);
|
|
|
//AddCurve(dp, arrValue[0], HaveLocate, pxy);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
arrPoints.AddTail(wop);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void ImportWellDeviation(CSigmaView * pView, BYTE * buff, int bufLen, int nMode)
|
|
|
{
|
|
|
CXy *pXy = pView->m_pDoc->GetDraw();
|
|
|
std::string xml((char *)buff, bufLen);
|
|
|
|
|
|
// 按井名分类
|
|
|
std::map<CString, std::vector<std::shared_ptr<WellDeviationEntry>>> entryMap;
|
|
|
|
|
|
auto cb = [&entryMap](TiXmlElement* dataElement)
|
|
|
{
|
|
|
auto entry = CreateWellDeviationEntry(dataElement);
|
|
|
entryMap[entry->name].push_back(entry);
|
|
|
};
|
|
|
|
|
|
ImportData(xml, cb);
|
|
|
|
|
|
|
|
|
if (nMode == typeWellPositionCoordinate) // 如果是井位坐标,那就是已经算好了,不需要再进行计算了
|
|
|
{
|
|
|
for (auto& pair : entryMap)
|
|
|
{
|
|
|
CString name = pair.first;
|
|
|
const auto& line = pair.second;
|
|
|
|
|
|
CCurveEx* pCurve = new CCurveEx();
|
|
|
pCurve->SetName(name);
|
|
|
pCurve->width = 1;
|
|
|
pCurve->Create((int)line.size());
|
|
|
|
|
|
for (int i = 0; i < line.size(); i++)
|
|
|
{
|
|
|
pCurve->x[i] = line[i]->x;
|
|
|
pCurve->y[i] = line[i]->y;
|
|
|
}
|
|
|
|
|
|
CLayer *pLayer = pXy->FindAddLayer(line[0]->layer);
|
|
|
POSITION pos = pXy->AddElement(pCurve, DOUBLEFOX_CURVE);
|
|
|
COne* pOne = pXy->GetAt(pos);
|
|
|
pOne->SetLayer(pLayer);
|
|
|
}
|
|
|
}
|
|
|
else // 计算井斜轨迹
|
|
|
{
|
|
|
// 拆分成不同的线
|
|
|
for (auto& pair : entryMap)
|
|
|
{
|
|
|
CWellTrackPointList arrPoints;
|
|
|
FillTrackPointList(pair.second, nMode, arrPoints);
|
|
|
|
|
|
CWellTrack wellTrack;
|
|
|
CList<dfPoint, dfPoint> dp;
|
|
|
int HaveLocate = wellTrack.CreateTrack(arrPoints, dp, (CWellTrack::ETrackType)nMode);
|
|
|
if (HaveLocate > 0)
|
|
|
{
|
|
|
AddCurve(dp, pair.first, HaveLocate, pXy);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 偏移量法
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportOffestMethod(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
ImportWellDeviation(pView, buff, bufLen, typeWellOffset);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平均角法一
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportAverageFirstMethod(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
ImportWellDeviation(pView, buff, bufLen, typeWellAvgAngle1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 平均角法二
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportAverageSecondMethod(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
ImportWellDeviation(pView, buff, bufLen, typeWellAvgAngle2);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 井位坐标
|
|
|
*
|
|
|
* \param pView
|
|
|
* \param buff
|
|
|
* \param bufLen
|
|
|
*/
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void ImportWellPosition(CSigmaView * pView, BYTE * buff, int bufLen)
|
|
|
{
|
|
|
ImportWellDeviation(pView, buff, bufLen, typeWellPositionCoordinate);
|
|
|
}
|
|
|
|
|
|
CXyDC* GetDC(CSigmaView* pView)
|
|
|
{
|
|
|
if (pView->m_pDoc == NULL)
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
return &pView->m_pDoc->GetDC();// m_xyDC;
|
|
|
|
|
|
}
|
|
|
|
|
|
CMemoryDC* ExportImage(CSigmaView* pView, CSize sz, UINT bpp)
|
|
|
{
|
|
|
if (sz.cx <= 0 || sz.cy <= 0) return NULL;
|
|
|
CMemoryDC *pImageDC = new CMemoryDC;
|
|
|
if (!pImageDC->Create(sz, bpp))
|
|
|
{
|
|
|
delete pImageDC;
|
|
|
//::AfxMessageBox("Create Image error!");
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
CDC* pBakDC = GetDC(pView)->GetDC();
|
|
|
CRect BakRT = GetDC(pView)->GetViewRect();
|
|
|
pImageDC->Erase(RGB(255, 255, 255));
|
|
|
CRect rect(0, 0, sz.cx, sz.cy);
|
|
|
pView->m_pDoc->SetCDC(pImageDC);
|
|
|
pView->m_pDoc->GetDC().SetViewRect(rect);
|
|
|
pView->m_pDoc->OnDraw(pView->m_pDoc->GetDC());
|
|
|
pView->m_pDoc->SetCDC(pBakDC);
|
|
|
pView->m_pDoc->GetDC().SetViewRect(BakRT);
|
|
|
return pImageDC;
|
|
|
}
|
|
|
|
|
|
BOOL ExportWMF(CSigmaView* pView, LPCTSTR lpFileName, CSize sz)
|
|
|
{
|
|
|
CDC* pBakDC = GetDC(pView)->GetDC();
|
|
|
CRect BakRT = GetDC(pView)->GetViewRect();
|
|
|
|
|
|
CRect rect, rt;
|
|
|
rect.SetRect(0, 0, sz.cx, sz.cy);
|
|
|
|
|
|
//CFile::Remove(lpFileName);
|
|
|
DeleteFile(lpFileName);
|
|
|
|
|
|
CMetaFileDC wmf;
|
|
|
wmf.SetMapMode(MM_TEXT);
|
|
|
|
|
|
//由像素转换为0.01毫米单位
|
|
|
double HorzsizePerPixel = (double)(pBakDC->GetDeviceCaps(HORZSIZE)) / (double)pBakDC->GetDeviceCaps(HORZRES);//一个象素的宽度(单位:毫米/象素)
|
|
|
double VertsizePerPixel = (double)(pBakDC->GetDeviceCaps(VERTSIZE)) / (double)pBakDC->GetDeviceCaps(VERTRES);//一个光栅行(象素)的高度(单位:毫米/象素)
|
|
|
sz.cx = AfxGetPublicFunction()->FloatToLong(sz.cx*HorzsizePerPixel * 100); //单位为0.01毫米
|
|
|
sz.cy = AfxGetPublicFunction()->FloatToLong(sz.cy*VertsizePerPixel * 100); //单位为0.01毫米
|
|
|
//pDC->DPtoHIMETRIC(&sz);
|
|
|
rt.SetRect(0, 0, sz.cx, sz.cy);
|
|
|
|
|
|
if (!wmf.CreateEnhanced(pBakDC, lpFileName, rt, "DoubleFox sj\0\0")) return FALSE;
|
|
|
wmf.SetAttribDC(pBakDC->m_hAttribDC);
|
|
|
|
|
|
pView->m_pDoc->SetCDC(&wmf);
|
|
|
pView->m_pDoc->GetDC().SetViewRect(rect);
|
|
|
pView->m_pDoc->OnDraw(pView->m_pDoc->GetDC());
|
|
|
|
|
|
::DeleteEnhMetaFile(wmf.CloseEnhanced());
|
|
|
|
|
|
pView->m_pDoc->SetCDC(pBakDC);
|
|
|
pView->m_pDoc->GetDC().SetViewRect(BakRT);
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
void ExportImage(CSigmaView* pView, LPCTSTR lpFileName, CSize sz, UINT bpp)
|
|
|
{
|
|
|
CMemoryDC *pImageDC = ExportImage(pView, sz, bpp);
|
|
|
if (pImageDC == NULL)
|
|
|
return;
|
|
|
|
|
|
CImageInsert *pii = new CImageInsert;
|
|
|
CRect rect(0, 0, sz.cx, sz.cy);
|
|
|
CRect8 rt = pView->m_pDoc->GetDC().GetReal(rect);
|
|
|
pii->x0 = rt.left;
|
|
|
pii->y0 = rt.bottom;
|
|
|
pii->m_size = rt.GetSize();
|
|
|
//pii->m_size.SetSize(GetDC()->GetRealWidth(sz.cx), fabs(GetDC()->GetRealHeight(sz.cy)));
|
|
|
pii->m_pImage = new CImageBase;
|
|
|
//设置图像分辨率
|
|
|
//if (GetPreferences().WorkaroundSave.m_nExportModeDPI == 1) //自定义分辨率
|
|
|
//{
|
|
|
int dpi = 300;
|
|
|
pii->m_pImage->SetXDPI(dpi);
|
|
|
pii->m_pImage->SetYDPI(dpi);
|
|
|
//}
|
|
|
pii->m_pImage->CreateFromHBITMAP((HBITMAP)*pImageDC);
|
|
|
//pii->m_pImage->Attach(pImageDC->Detach());
|
|
|
//::AfxMessageBox(pii->m_pImage->GetLastError());
|
|
|
|
|
|
if (!pii->SaveAs(lpFileName))
|
|
|
//if(!pImageDC->Save(lpFileName))
|
|
|
|
|
|
|
|
|
//::AfxMessageBox("Save image Error");
|
|
|
delete pii;
|
|
|
delete pImageDC;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void GetShowSize(CSigmaView* pView, int* width, int* height)
|
|
|
{
|
|
|
//double width = 0;
|
|
|
//double height = 0;
|
|
|
//获得导出图件的大小
|
|
|
CRect8 rect(1e100, -1e100, -1e100, 1e100);
|
|
|
pView->m_pDoc->GetDrawRange(rect);
|
|
|
//CRect8 rect=GetDoc()->GetDraw()->m_range;
|
|
|
rect.left = pView->m_pDoc->GetDC().left;
|
|
|
rect.top = pView->m_pDoc->GetDC().top;
|
|
|
|
|
|
double dx = rect.Width();
|
|
|
double dy = rect.Height();
|
|
|
CSize sz(pView->m_pDoc->GetDC().GetScreenWidth(dx), abs(pView->m_pDoc->GetDC().GetScreenHeight(dy)));
|
|
|
//str.Format("%lf,%lf,%d,%d",dx,dy,sz.cx,sz.cy);::AfxMessageBox(str);
|
|
|
if (dx < -1e20) sz.cx = 630;
|
|
|
if (dy < -1e20) sz.cy = 470;
|
|
|
*width = sz.cx + 10;
|
|
|
*height = sz.cy + 10;
|
|
|
m_width = sz.cx + 10;
|
|
|
m_height = sz.cy + 10;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
int ExportFiles(CSigmaView* pView, LPCTSTR layerName, int nMode)
|
|
|
{
|
|
|
CList<POSITION, POSITION> select;
|
|
|
POSITION pos, pt;
|
|
|
pView->m_pDoc->GetDraw()->GetElement(layerName, select, TRUE);
|
|
|
if (select.IsEmpty())
|
|
|
{
|
|
|
//::AfxMessageBox("No data");
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
int total = 0;
|
|
|
total = select.GetCount();
|
|
|
pos = select.GetHeadPosition();
|
|
|
double ptX = 0;
|
|
|
double ptY = 0;
|
|
|
double ptZ = 0;
|
|
|
|
|
|
TiXmlPrinter printer;
|
|
|
string xmlstr;
|
|
|
TiXmlDocument *xmlDocument = new TiXmlDocument();
|
|
|
TiXmlDeclaration * decl = new TiXmlDeclaration("1.0", "UTF-8", "");
|
|
|
xmlDocument->LinkEndChild(decl);
|
|
|
// 根元素。
|
|
|
TiXmlElement *rootElement = new TiXmlElement("ROOT");
|
|
|
xmlDocument->LinkEndChild(rootElement);
|
|
|
CStdioFile fw;
|
|
|
|
|
|
int index = 0;
|
|
|
while (pos)
|
|
|
{
|
|
|
pt = select.GetNext(pos);
|
|
|
COne* pOne = pView->m_pDoc->GetDraw()->GetAt(pt);
|
|
|
int type = pOne->GetType();
|
|
|
int tmp = pOne->GetType();
|
|
|
if (pOne->GetType() == DOUBLEFOX_POINT || pOne->GetType() == DOUBLEFOX_CURVE)
|
|
|
{
|
|
|
if (nMode == DOUBLEFOX_POINT && tmp == nMode)
|
|
|
{
|
|
|
TiXmlElement *itemElement = new TiXmlElement("Item");
|
|
|
rootElement->LinkEndChild(itemElement);
|
|
|
TiXmlElement *WellElement = new TiXmlElement("WellName");
|
|
|
TiXmlElement *LayerElement = new TiXmlElement("Layer");
|
|
|
TiXmlElement *xElement = new TiXmlElement("X");
|
|
|
TiXmlElement *yElement = new TiXmlElement("Y");
|
|
|
TiXmlElement *zElement = new TiXmlElement("Z");
|
|
|
itemElement->LinkEndChild(WellElement);
|
|
|
itemElement->LinkEndChild(LayerElement);
|
|
|
itemElement->LinkEndChild(xElement);
|
|
|
itemElement->LinkEndChild(yElement);
|
|
|
itemElement->LinkEndChild(zElement);
|
|
|
CString name = pOne->GetName();
|
|
|
TiXmlText *wellValue = new TiXmlText(name);
|
|
|
WellElement->LinkEndChild(wellValue);
|
|
|
|
|
|
CString layer = pOne->GetLayer()->GetPathName();
|
|
|
TiXmlText *layerValue = new TiXmlText(layer);
|
|
|
LayerElement->LinkEndChild(layerValue);
|
|
|
CPointNameEx* pPoint = (CPointNameEx*)pOne->GetValue();
|
|
|
CString x;
|
|
|
AfxGetPublicFunction()->FloatToString(x, pPoint->x0, 3);
|
|
|
TiXmlText *xValue = new TiXmlText(x);
|
|
|
xElement->LinkEndChild(xValue);
|
|
|
CString y;
|
|
|
AfxGetPublicFunction()->FloatToString(y, pPoint->y0, 3);
|
|
|
TiXmlText *yValue = new TiXmlText(y);
|
|
|
yElement->LinkEndChild(yValue);
|
|
|
CString z;
|
|
|
AfxGetPublicFunction()->FloatToString(z, pPoint->z0, 3);
|
|
|
TiXmlText *zValue = new TiXmlText(z);
|
|
|
zElement->LinkEndChild(zValue);
|
|
|
}
|
|
|
else if (nMode == DOUBLEFOX_CURVE && tmp == nMode)
|
|
|
{
|
|
|
if (type == 1)
|
|
|
{
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
TiXmlElement *lineElement = new TiXmlElement("Line");
|
|
|
rootElement->LinkEndChild(lineElement);
|
|
|
|
|
|
|
|
|
CString txt;
|
|
|
CCurveEx* pCurve = (CCurveEx*)pOne->GetValue();
|
|
|
for (int i = 0; i < pCurve->num; i++)
|
|
|
{
|
|
|
TiXmlElement *itemElement = new TiXmlElement("Item");
|
|
|
lineElement->LinkEndChild(itemElement);
|
|
|
TiXmlElement *IDElement = new TiXmlElement("ID");
|
|
|
TiXmlElement *LayerElement = new TiXmlElement("Layer");
|
|
|
TiXmlElement *xElement = new TiXmlElement("X");
|
|
|
TiXmlElement *yElement = new TiXmlElement("Y");
|
|
|
TiXmlElement *zElement = new TiXmlElement("Z");
|
|
|
TiXmlElement *nameElement = new TiXmlElement("Name");
|
|
|
itemElement->LinkEndChild(IDElement);
|
|
|
itemElement->LinkEndChild(LayerElement);
|
|
|
itemElement->LinkEndChild(xElement);
|
|
|
itemElement->LinkEndChild(yElement);
|
|
|
itemElement->LinkEndChild(zElement);
|
|
|
itemElement->LinkEndChild(nameElement);
|
|
|
ptX = pCurve->x[i];
|
|
|
ptY = pCurve->y[i];
|
|
|
ptZ = pCurve->z[i];
|
|
|
txt.Format(_T("%.3lf"), ptX);
|
|
|
TiXmlText *xValue = new TiXmlText(txt);
|
|
|
xElement->LinkEndChild(xValue);
|
|
|
txt.Format(_T("%.4f"), ptY);
|
|
|
TiXmlText *yValue = new TiXmlText(txt);
|
|
|
yElement->LinkEndChild(yValue);
|
|
|
|
|
|
//判断是否有Z值
|
|
|
if (pCurve->nPoint >= 3)
|
|
|
{
|
|
|
txt.Format(_T("%g"), ptZ);
|
|
|
TiXmlText *zValue = new TiXmlText(txt);
|
|
|
zElement->LinkEndChild(zValue);
|
|
|
}
|
|
|
|
|
|
if (pCurve->name != NULL)
|
|
|
{
|
|
|
TiXmlText *nameValue = new TiXmlText(pCurve->name);
|
|
|
nameElement->LinkEndChild(nameValue);
|
|
|
}
|
|
|
|
|
|
txt = pOne->GetLayer()->GetPathName();
|
|
|
TiXmlText *layerValue = new TiXmlText(txt);
|
|
|
LayerElement->LinkEndChild(layerValue);
|
|
|
|
|
|
txt.Format("%d", index);
|
|
|
TiXmlText *IDValue = new TiXmlText(txt);
|
|
|
IDElement->LinkEndChild(IDValue);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
index++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
xmlDocument->Accept(&printer);
|
|
|
xmlstr = printer.CStr();
|
|
|
xmlExport = CString(xmlstr.c_str());
|
|
|
int len = xmlExport.GetLength();
|
|
|
delete xmlDocument;
|
|
|
return len;
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void MemoCopyExportXml(BYTE* xml)
|
|
|
{
|
|
|
int len = xmlExport.GetLength();
|
|
|
memcpy(xml, xmlExport.GetBuffer(0), len);
|
|
|
}
|
|
|
|
|
|
int GetUnitSel(int CurSel, int selectIndex)
|
|
|
{
|
|
|
switch (selectIndex)
|
|
|
{
|
|
|
default:
|
|
|
case 0://公里
|
|
|
case 1://米
|
|
|
case 2://分米
|
|
|
case 3://厘米
|
|
|
case 4://毫米
|
|
|
break;
|
|
|
case 5://英尺
|
|
|
case 6://英寸
|
|
|
case 7://英里
|
|
|
case 8://码
|
|
|
case 9://海里
|
|
|
case 10://象素
|
|
|
CurSel += 2;
|
|
|
break;
|
|
|
}
|
|
|
return CurSel;
|
|
|
}
|
|
|
|
|
|
long GetScreenW(CSigmaView* pView, CDC* pDC, double x, int unit_sel)
|
|
|
{
|
|
|
//一个象素的宽度(单位:毫米/象素)
|
|
|
double HorzsizePerPixel = (double)(GetDC(pView)->GetDC()->GetDeviceCaps(HORZSIZE)) / (double)GetDC(pView)->GetDC()->GetDeviceCaps(HORZRES);
|
|
|
CUnit cu;
|
|
|
x = cu.Millimetres(x, (CUnit::EType)unit_sel);//转换为毫米
|
|
|
return long(x / HorzsizePerPixel + 0.5);
|
|
|
}
|
|
|
|
|
|
long GetScreenH(CSigmaView* pView, CDC* pDC, double y, int unit_sel)
|
|
|
{
|
|
|
//一个光栅行(象素)的高度(单位:毫米/象素)
|
|
|
double VertsizePerPixel = (double)(GetDC(pView)->GetDC()->GetDeviceCaps(VERTSIZE)) / (double)GetDC(pView)->GetDC()->GetDeviceCaps(VERTRES);
|
|
|
CUnit cu;
|
|
|
y = cu.Millimetres(y, (CUnit::EType)unit_sel);//转换为毫米
|
|
|
return long(y / VertsizePerPixel + 0.5);
|
|
|
}
|
|
|
|
|
|
double GetRealW(CSigmaView* pView, CDC* pDC, long x, int unit_sel)
|
|
|
{
|
|
|
//一个象素的宽度(单位:毫米/象素)
|
|
|
double HorzsizePerPixel = (double)(GetDC(pView)->GetDC()->GetDeviceCaps(HORZSIZE)) / (double)GetDC(pView)->GetDC()->GetDeviceCaps(HORZRES);
|
|
|
CUnit cu;
|
|
|
return x * HorzsizePerPixel / cu.Millimetres(unit_sel);//转换为实际单位
|
|
|
}
|
|
|
double GetRealH(CSigmaView* pView, CDC* pDC, long y, int unit_sel)
|
|
|
{
|
|
|
//一个光栅行(象素)的高度(单位:毫米/象素)
|
|
|
double VertsizePerPixel = (double)(GetDC(pView)->GetDC()->GetDeviceCaps(VERTSIZE)) / (double)GetDC(pView)->GetDC()->GetDeviceCaps(VERTRES);
|
|
|
CUnit cu;
|
|
|
return y * VertsizePerPixel / cu.Millimetres(unit_sel);//转换为实际单位
|
|
|
}
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
void UnitChange(CSigmaView* pView, int selectIndex)
|
|
|
{
|
|
|
int sel = GetUnitSel(selectIndex, selectIndex);
|
|
|
//UpdateData();
|
|
|
//if (sel == GetUnitSel(m_unit)) return;
|
|
|
//((CComboBox*)GetDlgItem(IDC_COMBO_unit))->GetLBText(m_unit, m_unitW);
|
|
|
//((CComboBox*)GetDlgItem(IDC_COMBO_unit))->GetLBText(m_unit, m_unitH);
|
|
|
|
|
|
CUnit cu;
|
|
|
double ds, du;
|
|
|
if (GetDC(pView)->GetDC() != NULL)
|
|
|
{
|
|
|
if (sel == 12)
|
|
|
{
|
|
|
m_height = GetRealH(pView, GetDC(pView)->GetDC(), (long)m_height, GetUnitSel(selectIndex, selectIndex));
|
|
|
m_width = GetRealW(pView, GetDC(pView)->GetDC(), (long)m_width, GetUnitSel(selectIndex, selectIndex));
|
|
|
}
|
|
|
else if (GetUnitSel(selectIndex, selectIndex) == 12)
|
|
|
{
|
|
|
m_height = GetScreenH(pView, GetDC(pView)->GetDC(), m_height, sel);
|
|
|
m_width = GetScreenW(pView, GetDC(pView)->GetDC(), m_width, sel);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ds = cu.Millimetres(sel);
|
|
|
du = cu.Millimetres(GetUnitSel(selectIndex, selectIndex));
|
|
|
m_height = m_height * ds / du;
|
|
|
m_width = m_width * ds / du;
|
|
|
}
|
|
|
}
|
|
|
//UpdateData(FALSE);
|
|
|
}
|
|
|
|
|
|
|
|
|
|