|
|
|
|
#include "Stdafx.h"
|
|
|
|
|
#include "SigmaView.h"
|
|
|
|
|
#include "ItemSelect.h"
|
|
|
|
|
#include "ItemCutOut.h"
|
|
|
|
|
#include "ItemCutIn.h"
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int Cut_CutOutByRect(CSigmaView * pView)
|
|
|
|
|
{
|
|
|
|
|
if (pView == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CItemSelect * itemSelect = pView->m_pDoc->GetSelectItem();
|
|
|
|
|
if (itemSelect == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CRect8 rect = itemSelect->GetRect();
|
|
|
|
|
NItem::CItemCutOut itemCutOut(pView->m_pDoc);
|
|
|
|
|
itemCutOut.CutOutRectangle(rect);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int CutOut_GetCountOfPickup(CSigmaView * pView)
|
|
|
|
|
{
|
|
|
|
|
if (pView == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CItem * item = pView->GetItem();
|
|
|
|
|
if (item == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
NItem::CItemCutOut * itemCutOut = dynamic_cast<NItem::CItemCutOut *>(item);
|
|
|
|
|
if (itemCutOut == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return itemCutOut->GetCountOfPickup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int Cut_CutInByRect(CSigmaView * pView)
|
|
|
|
|
{
|
|
|
|
|
if (pView == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CItemSelect * itemSelect = pView->m_pDoc->GetSelectItem();
|
|
|
|
|
if (itemSelect == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CRect8 rect = itemSelect->GetRect();
|
|
|
|
|
NItem::CItemCutIn itemCutIn(pView->m_pDoc);
|
|
|
|
|
itemCutIn.CutInRectangle(rect);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int CutIn_GetCountOfPickup(CSigmaView * pView)
|
|
|
|
|
{
|
|
|
|
|
if (pView == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
CItem * item = pView->GetItem();
|
|
|
|
|
if (item == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
NItem::CItemCutIn * itemCutIn = dynamic_cast<NItem::CItemCutIn *>(item);
|
|
|
|
|
if (itemCutIn == NULL)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return itemCutIn->GetCountOfPickup();
|
|
|
|
|
}
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int CutOutFile(LPCTSTR rangeFile, LPCTSTR sourceFile, LPCTSTR destFile)
|
|
|
|
|
{
|
|
|
|
|
ImageCut cut;
|
|
|
|
|
return cut.CutOutFile(rangeFile, sourceFile, destFile);
|
|
|
|
|
}
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int CutOutFileByLine(BYTE * buffWellPath, int bufLen, LPCTSTR sourceFile, LPCTSTR destFile, int type)
|
|
|
|
|
{
|
|
|
|
|
ImageCut cut;
|
|
|
|
|
return cut.CutOutFileByLine(buffWellPath, bufLen, sourceFile, destFile, type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
int RecalculateMeshColor(CSigmaView* pView)
|
|
|
|
|
{
|
|
|
|
|
if (pView == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
POSITION pt = pView->m_pDoc->m_pXy->FindFirstElement(DOUBLEFOX_MESH);
|
|
|
|
|
if (pt == nullptr)
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
COne* pOne = pView->m_pDoc->m_pXy->GetAt(pt);
|
|
|
|
|
CMesh* pMesh = (CMesh*)pOne->GetValue();
|
|
|
|
|
|
|
|
|
|
CArray<CColorItem, CColorItem> colorList;
|
|
|
|
|
pMesh->color.GetColor(colorList);
|
|
|
|
|
int listCount = (int)colorList.GetSize();
|
|
|
|
|
|
|
|
|
|
double Zmin, Zmax;
|
|
|
|
|
pMesh->GetM(Zmin, Zmax);
|
|
|
|
|
|
|
|
|
|
double oldMin, oldMax;
|
|
|
|
|
pMesh->color.GetZRange(oldMin, oldMax);
|
|
|
|
|
if (fabs(oldMax - oldMin) < 1e-12) return 1;
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < listCount; i++)
|
|
|
|
|
{
|
|
|
|
|
double z = colorList[i].z;
|
|
|
|
|
double newZ = Zmin + (Zmax - Zmin) * (z - oldMin) / (oldMax - oldMin);
|
|
|
|
|
colorList[i].z = newZ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pMesh->color.SetColor(colorList);
|
|
|
|
|
pMesh->UpdateColorRuler();
|
|
|
|
|
pMesh->GetBitmap();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|