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/InterfaceCopyAsImagePolygon...

72 lines
1.5 KiB
C++

#include "stdafx.h"
#include "SigmaView.h"
#include "ItemCopyAsImagePolygon.h"
#include "Util.h"
static CItemCopyAsImagePolygon * getItemItemCopyAsImagePolygon(CSigmaView * pView)
{
if (pView == nullptr)
{
return nullptr;
}
CItem * pItem = pView->GetItem();
if (pItem == nullptr)
return nullptr;
CItemCopyAsImagePolygon * ciItem = dynamic_cast<CItemCopyAsImagePolygon *>(pItem);
return ciItem;
}
extern "C" __declspec(dllexport)
bool CopyAsImagePolygon_CopyRectToClipboard(CSigmaView * pView, double scaleFactor)
{
CItemCopyAsImagePolygon * pItem = getItemItemCopyAsImagePolygon(pView);
if (pItem == NULL)
return false;
return pItem->CopyRectToClipboard(scaleFactor);
}
extern "C" __declspec(dllexport)
void CopyAsImagePolygon_SetSelectedPolygon(CSigmaView * pView, POSITION pos)
{
CItemCopyAsImagePolygon * pItem = getItemItemCopyAsImagePolygon(pView);
if (pItem == NULL)
return;
COne *pOne = pItem->GetDoc()->GetDraw()->GetAt(pos);
if (pOne == nullptr)
{
return;
}
if (pOne->GetType() != DOUBLEFOX_CURVE)
{
return;
}
CCurveEx* pCurve = (CCurveEx*)pOne->value;
if (!IsPolygon(pCurve))
{
return;
}
pItem->SetPolygon(pCurve);
}
extern "C" __declspec(dllexport)
bool CopyAsImagePolygon_CopyPolygonToClipboard(CSigmaView * pView, double scaleFactor)
{
if (pView == NULL)
return false;
CItemCopyAsImageEx* pItem = getItemItemCopyAsImagePolygon(pView);
if (pItem == NULL)
return false;
return pItem->CopyRectToClipboard(scaleFactor);
}