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.
kev/Drawer/Module/GeoSigmaDraw/InterfaceRectangularNetGrid...

70 lines
1.6 KiB
C++

1 month ago
#include "stdafx.h"
#include "SigmaView.h"
#include "SectionDoc.h"
#include "ItemGrid.h"
#include "MxnFormat\AxisLayout.h"
using namespace NItem;
static CItemEditNet* GetItemEditNetGridFromView(CSigmaView * pView)
{
if (pView == NULL)
return 0;
CItem * pItem = pView->GetItem();
if (pItem == NULL)
return 0;
CItemEditNet* itemGrid = dynamic_cast<CItemEditNet*>(pItem);
if (itemGrid == NULL)
return 0;
return itemGrid;
}
extern "C" __declspec(dllexport)
int IsProjectionState(CSigmaView* pView)
{
return pView->IsProjectionState();
}
extern "C" __declspec(dllexport)
int RectangularNetGrid_GetStepAndRange(CSigmaView * pView, ItemEditNetData* pData)
{
CItemEditNet* pItem = GetItemEditNetGridFromView(pView);
if (pItem == NULL)
return -1;
return pItem->GetStepAndRange(pData);
}
extern "C" __declspec(dllexport)
int RectangularNetGrid_Create(CSigmaView * pView, ItemEditNetData* pData, HDC hdcMem)
{
CItemEditNet* pItem = GetItemEditNetGridFromView(pView);
if (pItem == NULL)
return -1;
CDC *pDC = CDC::FromHandle(hdcMem);
return pItem->Create(pData, pDC);
}
extern "C" __declspec(dllexport)
int NetGridGetStepAndRange(double left, double bottom, double right, double top, ItemEditNetData* pData)
{
if (pData == NULL)
return -1;
pData->left = left;
pData->top = top;
pData->right = right;
pData->bottom = bottom;
//<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><E3B2BD>
CAxisLayout al(left, right, 1);
TIntervalStep<double> sx = al.sd;
double step = min(sx.step, al.sd.step);
pData->stepX = pData->stepY = step;
pData->textHeight = step / 40.0;
pData->borderThickness = pData->textHeight / 2.0;
return 1;
}