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

76 lines
1.6 KiB
C++

#include "stdafx.h"
#include "SigmaView.h"
#include "SectionDoc.h"
#include "ItemExpression.h"
#include "ActionExchangeXYItem.h"
#include "ActionRotationItem.h"
extern "C" __declspec(dllexport)
int GeoSigma_ExchangeXY(CSigmaView * pView)
{
if (pView == 0)
return -1;
if (pView->m_pDoc == 0)
return -1;
pView->m_pDoc->GetDraw()->ExchangeXY();
pView->m_pDoc->SetActionItem(new CActionExchangeXYItem(pView->m_pDoc, IDS_STRING_EXCHANGE_XY));
pView->m_pDoc->Modified();
return 1;
}
extern "C" __declspec(dllexport)
int Coordinate_ChangeByExpression(CSigmaView * pView, int operationObjectKind, LPCTSTR xExpression, LPCTSTR yExpression, LPCTSTR zExpression, LPCTSTR lExpression)
{
if (pView == 0)
return -1;
if (pView->m_pDoc == 0)
return -1;
if (operationObjectKind != 0 && operationObjectKind != 1)
return -1;
CString xStr, yStr, zStr, lStr;
if (xExpression)
xStr = xExpression;
if (yExpression)
yStr = yExpression;
if (zExpression)
zStr = zExpression;
if (lExpression)
lStr = lExpression;
CItemExpression itemExpression(pView->m_pDoc);
itemExpression.Expression(operationObjectKind, xStr, yStr, zStr, lStr);
return 1;
}
/**
* 旋转
*
* \param pView 图件
* \param x 旋转的原点 x 坐标
* \param y 旋转的原点 y 坐标
* \param angle 旋转角度
* \return
*/
extern "C" __declspec(dllexport)
int Coordinate_Rotation(CSigmaView* pView, double x, double y, double angle)
{
if (pView == 0)
{
return -1;
}
if (pView->m_pDoc == 0)
{
return -1;
}
auto pAction = std::make_unique<CActionRotationItem>(pView->m_pDoc, 0, x, y, angle);
pView->m_pDoc->SetActionItem(pAction.release());
return 1;
}