// DIOS.Dev.FPDDeviceMould.cpp : 定义 DLL 应用程序的导出函数。 // #include "stdafx.h" #include #include "DIOS.Dev.COLLIMATORMould.hpp" #include "EasyJSONEncoder.hpp" #include "ResDataObject.h" #include "DIOSDICOMInfo.h" namespace DIOS { namespace Dev { namespace COLLIMATOR { //----------------------------------------------------------------------------- // CollimatorUnit //----------------------------------------------------------------------------- CollimatorUnit::CollimatorUnit(ICollimatorControl* pCollimatorDevice) { m_pCollimatorDevice = pCollimatorDevice; } CollimatorUnit:: ~CollimatorUnit() { } int CollimatorUnit::SetCollimatorSize(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); int xvalue = atoi(((string)json[0]).c_str()); int yvalue = atoi(((string)json[1]).c_str()); return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorSize(xvalue, yvalue); } int CollimatorUnit::SetCollimatorSID(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); int value = atoi(((string)json[0]).c_str()); return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorSID(value); } int CollimatorUnit::SetCollimatorFilter(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); int value = atoi(((string)json[0]).c_str()); return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorFilter(value); } int CollimatorUnit::SetCollimatorAngle(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); int value = atoi(((string)json[0]).c_str()); return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorAngle(value); } int CollimatorUnit::SetCollimatorMode(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); int value = atoi(((string)json[0]).c_str()); return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorMode(value); } int CollimatorUnit::SetTechParamsInfo(std::string in, std::string & out) { ResDataObject json; json.decode(in.c_str()); TECHPARAM_INFO info; info.SetVal(json[0].encode()); string strcollimatorwidth = info.m_CollimatorWidth; string strcollimatorheight = info.m_CollimatorHeight; string strcollimatorfilter = info.m_CollimatorFilter; string strSID = info.m_SID; DWORD Width = 0; DWORD Height = 0; DWORD dwFilter = 0; DWORD dwSID = 0; if (strcollimatorwidth.find("IN") != string::npos) { Width = (DWORD)(atof(strcollimatorwidth.substr(0, strcollimatorwidth.size() - 2).c_str())*2.54); } else { Width = (DWORD)(atoi(strcollimatorwidth.substr(0, strcollimatorwidth.size() - 2).c_str())); } if (strcollimatorheight.find("IN") != string::npos) { Height = (DWORD)(atof(strcollimatorheight.substr(0, strcollimatorheight.size() - 2).c_str())*2.54); } else { Height = (DWORD)(atoi(strcollimatorheight.substr(0, strcollimatorheight.size() - 2).c_str())); } if (Width != 0 && Height != 0) { return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorSize(Width, Height); } dwFilter = (DWORD)atoi(strcollimatorfilter.c_str()); if (dwFilter >= 0) { return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorFilter(dwFilter); } dwSID = (DWORD)atoi(strSID.c_str()); if (dwSID >= 0) { return ((ICollimatorControl *)m_pCollimatorDevice)->SetCollimatorSID(dwSID); } return 2; } //----------------------------------------------------------------------------- // ICollimatorControl //----------------------------------------------------------------------------- int ICollimatorControl::SetCollimatorSize(unsigned short xsize, unsigned short ysize) { return 1; } int ICollimatorControl::SetCollimatorSID(unsigned short sid) { return 1; } int ICollimatorControl::SetCollimatorFilter(unsigned short pParams) { return 1; } int ICollimatorControl::SetCollimatorAngle(unsigned short pParams) { return 1; } int ICollimatorControl::SetCollimatorMode(unsigned short pParams) { return 1; } } } }