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.
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
#include "stdafx.h"
|
|
#include "SigmaView.h"
|
|
#include "SectionDoc.h"
|
|
#include "ItemMeshProcess.h"
|
|
|
|
static CCurveEx * GetCurveByPickup(CSigmaDoc * pDoc, int mouseX, int mouseY);
|
|
|
|
//mode 0--¹¹Ôìͼ 1--µÈºñͼ
|
|
extern "C" __declspec(dllexport)
|
|
int Surface_CalculateVolume(CSigmaView * pView, int mouseX, int mouseY, int mode, double * zOut, double * volumeOut)
|
|
{
|
|
*zOut = *volumeOut;
|
|
if (pView == 0)
|
|
return -1;
|
|
if (pView->m_pDoc == 0)
|
|
return -1;
|
|
if (mode != 0 && mode != 1)
|
|
return -1;
|
|
|
|
CCurveEx * pc = GetCurveByPickup(pView->m_pDoc, mouseX, mouseY);
|
|
CItemMeshProcess process(pView->m_pDoc);
|
|
if (process.CalculateVolume(pc, mode, *zOut, *volumeOut))
|
|
return 1;
|
|
|
|
return -1;
|
|
}
|
|
|
|
extern "C" __declspec(dllexport)
|
|
int Surface_SetZValue(CSigmaView * pView, int mouseX, int mouseY, int zMode, double zIn)
|
|
{
|
|
if (pView == 0)
|
|
return -1;
|
|
|
|
CSigmaDoc * pDoc = pView->m_pDoc;
|
|
if (pDoc == 0)
|
|
return -1;
|
|
|
|
CCurveEx * pc = GetCurveByPickup(pDoc, mouseX, mouseY);
|
|
CItemMeshProcess process(pDoc);
|
|
if (process.SetZOfSurface(pc, zMode, zIn))
|
|
return 1;
|
|
|
|
return -1;
|
|
}
|
|
|
|
extern "C" __declspec(dllexport)
|
|
int Surface_GetZRange(CSigmaView * pView, POSITION surfacePos, double& zMin, double& zMax)
|
|
{
|
|
if (pView == 0)
|
|
return -1;
|
|
CMesh* pMesh = (CMesh*)pView->m_pDoc->GetDraw()->GetAtValue(surfacePos);
|
|
pMesh->GetM(zMin, zMax);
|
|
return 1;
|
|
}
|
|
|
|
static CCurveEx * GetCurveByPickup(CSigmaDoc * pDoc, int mouseX, int mouseY)
|
|
{
|
|
CPoint ptInCanvas(mouseX, mouseY);
|
|
NBase::CPoint2D ptInModel = pDoc->GetDC().GetReal(ptInCanvas);
|
|
|
|
POSITION pos = pDoc->GetSelectedItem(ptInModel);
|
|
if (pos == 0)
|
|
return 0;
|
|
|
|
COne * pOne = pDoc->GetDraw()->GetAt(pos);
|
|
if (pOne == 0)
|
|
return 0;
|
|
if (pOne->GetType() != DOUBLEFOX_CURVE)
|
|
return 0;
|
|
|
|
CCurveEx * pc = (CCurveEx*)pDoc->GetDraw()->GetAtValue(pos);
|
|
return pc;
|
|
}
|
|
//bool NItem::CItemMeshProcess::SetZOfSurface(CCurveEx* pCurveRange, int zMode, double zIn)
|