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

207 lines
4.5 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "stdafx.h"
#include "SigmaView.h"
#include "SectionDoc.h"
#include "ItemProportion.h"
static CItemProportion * getItemProportion(CSigmaView * pView)
{
CItem * pItem = pView->GetItem();
if (pItem == NULL)
return NULL;
CItemProportion * proportionItem = dynamic_cast<CItemProportion *>(pItem);
return proportionItem;
}
extern "C" __declspec(dllexport)
int CreateProportion(CSigmaView * pView)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
pItem->InsertProportion();
return 1;
}
extern "C" __declspec(dllexport)
int Proportion_ChangeScale(CSigmaView * pView, double length)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeScale(length);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeScaleHeight(CSigmaView * pView, double height)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeScaleHeight(height);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeNumber(CSigmaView * pView, int number)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeNumber(number);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeShowMode(CSigmaView * pView, int mode)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeShowMode(mode);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeUnit(CSigmaView * pView, int unit)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeUnit(unit);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeColor(CSigmaView * pView, int r, int g, int b)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeColor(r, g, b);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeTextScale(CSigmaView * pView, double scale)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeTextScale(scale);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeAlign(CSigmaView * pView, int align)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeAlign(align);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeTextHeight(CSigmaView * pView, int height)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeTextHeight(height);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeTextWidth(CSigmaView * pView, int width)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeTextWidth(width);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeTextHeightAlone(CSigmaView * pView, int alone)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeTextHeightAlone(alone);
}
extern "C" __declspec(dllexport)
int Proportion_ChangeCoordinate(CSigmaView * pView, double x, double y)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->ChangeCoordinate(x, y);
}
extern "C" __declspec(dllexport)
int Proportion_Create(CSigmaView * pView)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->Add();
}
extern "C" __declspec(dllexport)
int Proportion_GetScale(CSigmaView * pView)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
return -1;
return pItem->GetScale();
}
extern "C" __declspec(dllexport)
void Proportion_SetParameter(CSigmaView * pView, struct ProportionData * data) {
CItemProportion * pItem = getItemProportion(pView);
if (pItem == nullptr) {
return;
}
pItem->SetParameter(data);
}
extern "C" __declspec(dllexport)
int Proportion_GetData(CSigmaView * pView, struct ProportionData * data)
{
CItemProportion * pItem = getItemProportion(pView);
if (pItem == NULL)
{
//data->ScaleFactor = pView->m_pDoc->GetDraw()->m_dScaleFactor;
CUnit cu;
double h = cu.Millimetres(pView->m_pDoc->GetDraw()->m_unit.cx); //<2F><><EFBFBD><EFBFBD>1<EFBFBD><31>ʵ<EFBFBD>ʵ<EFBFBD>λ<EFBFBD>ĺ<EFBFBD><C4BA>׳<EFBFBD><D7B3><EFBFBD>
//1<><31><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
double m_dScaleLength = pView->m_pDoc->GetDraw()->m_dScaleFactor / h;
//ת<><D7AA>Ϊ1<CEAA><31><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ʳ<EFBFBD><CAB3><EFBFBD>
m_dScaleLength *= 10;
m_dScaleLength = 2000;
data->ScaleLength = m_dScaleLength;
data->ColorR = 0;
data->ColorG = 0;
data->ColorB = 0;
data->Unit = 2;
data->TextSpace = 1;
data->TextAlign = 1;
data->TextScale = 1;
return -1;
}
pItem->GetData(data);
return 1;
}