|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
#include "SigmaView.h"
|
|
|
|
|
|
#include "SigmaProjectionParameter.h"
|
|
|
|
|
|
#include "ProjectionParameterAssistant.h"
|
|
|
|
|
|
#include "ActionProjectionItem.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_GetParameter(CSigmaView* pView, SigmaProjectionParameter * parameter)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
CString projStr = pView->m_pDoc->GetDraw()->GetProjection();
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
if (assistant->ParseParameterFromString(projStr) == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_GetDefaultParameter(CSigmaView* pView, SigmaProjectionParameter * parameter)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
CString projStr = pView->m_pDoc->GetDraw()->GetProjection();
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
assistant->InitParameter();
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_SetParameter(CSigmaView* pView, SigmaProjectionParameter parameter)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
//TODO:<3A><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͬ <20><>ͬ<EFBFBD>Ļ<EFBFBD> ֱ<>ӷ<EFBFBD><D3B7><EFBFBD>
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
assistant->SetParameter(¶meter);
|
|
|
|
|
|
|
|
|
|
|
|
std::string projectStr;
|
|
|
|
|
|
int ret = assistant->GetProjectStr(projectStr);
|
|
|
|
|
|
if (ret == -1) {
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CString oldProjection = pView->m_pDoc->GetDraw()->GetProjection();
|
|
|
|
|
|
CString newProjection = projectStr.c_str();
|
|
|
|
|
|
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->SetProjection(newProjection);
|
|
|
|
|
|
|
|
|
|
|
|
pView->m_pDoc->SetActionItem(new CActionProjectionItem(pView->m_pDoc, 0, oldProjection, newProjection));
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_Change(CSigmaView* pView, SigmaProjectionParameter * parameter)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
|
|
|
|
|
|
std::string projectStr;
|
|
|
|
|
|
int ret = assistant->GetProjectStr(projectStr);
|
|
|
|
|
|
if (ret == -1)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
CString oldProjection = pView->m_pDoc->GetDraw()->GetProjection();
|
|
|
|
|
|
CString newProjection = projectStr.c_str();
|
|
|
|
|
|
|
|
|
|
|
|
pView->m_pDoc->GetDraw()->ChangeToProjection(newProjection);
|
|
|
|
|
|
|
|
|
|
|
|
pView->m_pDoc->SetActionItem(new CActionProjectionItem(pView->m_pDoc, 0, oldProjection, newProjection));
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
//Լ<><D4BC>other<65>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>Ϊ512
|
|
|
|
|
|
int Projection_GetOtherStr(CSigmaView* pView, SigmaProjectionParameter * parameter, BYTE* other)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
|
|
|
|
|
|
std::string otherStr;
|
|
|
|
|
|
if (assistant->GenerateOtherString(otherStr) == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
other[0] = '\0';
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t count = otherStr.size();
|
|
|
|
|
|
if (count >= 512)
|
|
|
|
|
|
count = 511;
|
|
|
|
|
|
memcpy(other, otherStr.data(), count);
|
|
|
|
|
|
other[count] = '\0';
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
//Լ<><D4BC>other<65>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>Ϊ512
|
|
|
|
|
|
int Projection_GetProjectString(CSigmaView* pView, SigmaProjectionParameter * parameter, BYTE* projByts)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
|
|
|
|
|
|
std::string projStr;
|
|
|
|
|
|
if (assistant->GetProjectStr(projStr) == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
projByts[0] = '\0';
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
size_t count = projStr.size();
|
|
|
|
|
|
if (count >= 512)
|
|
|
|
|
|
count = 511;
|
|
|
|
|
|
memcpy(projByts, projStr.data(), count);
|
|
|
|
|
|
projByts[count] = '\0';
|
|
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_FillOtherParameter(CSigmaView* pView, SigmaProjectionParameter * parameter, LPCTSTR otherStr)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == 0 || parameter == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
if (pView->m_pDoc == 0)
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
std::string str(otherStr);
|
|
|
|
|
|
ProjectionParameterAssistant * assistant = ProjectionParameterAssistant::GetInstance();
|
|
|
|
|
|
assistant->SetParameter(parameter);
|
|
|
|
|
|
if (assistant->FillOtherParameter(str))
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" __declspec(dllexport)
|
|
|
|
|
|
int Projection_IsEmpty(CSigmaView* pView)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (pView == NULL)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 1; //ͶӰ<CDB6><D3B0><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool bEmpty = pView->m_pDoc->GetDraw()->GetProjection().IsEmpty();
|
|
|
|
|
|
|
|
|
|
|
|
return bEmpty ? 1 : 0;
|
|
|
|
|
|
}
|