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/InterfaceCopyAsImageEx.cpp

222 lines
5.3 KiB
C++

1 month ago
#include "stdafx.h"
#include "SigmaView.h"
//#include "SectionDoc.h"
#include "ItemCopyAsImageEx.h"
//#include "HSimpleTracker.h"
static CItemCopyAsImageEx * getItemItemCopyAsImageEx(CSigmaView * pView)
{
CItem * pItem = pView->GetItem();
if (pItem == NULL)
return NULL;
CItemCopyAsImageEx * ciItem = dynamic_cast<CItemCopyAsImageEx *>(pItem);
return ciItem;
}
extern "C" __declspec(dllexport)
bool CopyAsImageEx_CopyRectToClipboard(CSigmaView * pView, double scaleFactor)
{
if (pView == NULL)
return false;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return false;
return pItem->CopyRectToClipboard(scaleFactor);
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_SetProportionVisible(CSigmaView * pView, bool visible) {
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->SetProportionVisible(visible);
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_SetNetGridVisible(CSigmaView * pView, bool visible) {
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->SetNetGridVisible(visible);
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_SetNetGridParameter(CSigmaView * pView, RectangularCSGridData* pData)
{
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->SetNetGridParameter(pData);
}
extern "C" __declspec(dllexport)
int CopyAsImageEx_GetPropotion(CSigmaView * pView, struct ProportionData * pData)
{
if (pView == NULL)
return 0;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return 0;
pItem->GetPropotionData(pData);
return 1;
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_SetPropotion(CSigmaView * pView, ProportionData* pData)
{
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->SetPropotionData(pData);
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_Refresh(CSigmaView * pView, HDC hdc)
{
if (pView == NULL)
return;
CDC * pDC = CDC::FromHandle(hdc);
if (pDC == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->Refresh(pDC);
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_Clear(CSigmaView * pView) {
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
pItem->Clear();
}
extern "C" __declspec(dllexport)
int CopyAsImageEx_SetRange(CSigmaView * pView, int left, int right, int top, int bottom, HDC hdc)
{
if (pView == NULL)
return -1;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return -1;
CDC * pDC = CDC::FromHandle(hdc);
if (pDC == NULL)
return -1;
CRect rect;
rect.left = left;
rect.right = right;
rect.top = top;
rect.bottom = bottom;
if (pItem->SetRange(rect) == -1)
return -1;
return 1;
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_GetRange(CSigmaView * pView, double& left, double& right, double& top, double& bottom) {
if (pView == NULL) {
return;
}
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
CRect8 crRange;
pItem->GetRange(&crRange);
left = crRange.left;
right = crRange.right;
top = crRange.top;
bottom = crRange.bottom;
}
extern "C" __declspec(dllexport)
int CopyAsImageEx_TrackHandle(CSigmaView * pView, int handleIndex, int mouseX, int mouseY, HDC hdc) {
if (pView == NULL)
return -1;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return -1;
CDC * pDC = CDC::FromHandle(hdc);
if (pDC == NULL)
return -1;
pItem->TrackHandle(handleIndex, CPoint(mouseX, mouseY), pDC);
return 1;
}
extern "C" __declspec(dllexport)
void CopyAsImageEx_EraseTrackerForRange(CSigmaView * pView, HDC hdc)
{
if (pView == NULL)
return;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return;
CDC * pDC = CDC::FromHandle(hdc);
if (pDC == NULL)
return;
//CHSimpleTracker * tracker = pItem->GetTracker();
//if (tracker == NULL)
// return;
//tracker->Draw(pDC);
}
//0--<2D><><EFBFBD>¼<EFBFBD>ͷ 1--<2D><>ֱ<EFBFBD><D6B1>ͷ 2--<2D><><EFBFBD>¼<EFBFBD>ͷ 3--ˮƽ<CBAE><C6BD>ͷ
//4--<2D><>ת<EFBFBD><D7AA>ͷ 5--ˮƽ<CBAE><C6BD><EFBFBD>м<EFBFBD>ͷ 6--<2D><>ֱ<EFBFBD><D6B1><EFBFBD>м<EFBFBD>ͷ 7--ƽ<>Ƽ<EFBFBD>ͷ
//-1 <20><><EFBFBD><EFBFBD>
extern "C" __declspec(dllexport)
int CopyAsImageEx_GetTrackerHandleCursorType(CSigmaView * pView, int mouseX, int mouseY)
{
if (pView == NULL)
return -1;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return -1;
int nHandleType =pItem->HitTest(CPoint(mouseX, mouseY));
//HTRACKER_HANDLE_KIND handleKind = pItem->GetTracker()->HitTest(mouseX, mouseY);
//if (handleKind == HTRACKER_HANDLE_KIND_INVALID)
// return -1;
//if (handleKind == HTRACKER_HANDLE_KIND_CENTER)
// return 7;
return nHandleType;
}
extern "C" __declspec(dllexport)
int CopyAsImageEx_CopyWindow(CSigmaView * pView, int left, int right, int top, int bottom)
{
if (pView == NULL)
return -1;
CItemCopyAsImageEx * pItem = getItemItemCopyAsImageEx(pView);
if (pItem == NULL)
return -1;
CRect rect;
rect.left = left;
rect.right = right;
rect.top = top;
rect.bottom = bottom;
//pItem->CopyToClipboard(rect);
return 1;
}