diff --git a/LaiPuLaser/Camera.cpp b/LaiPuLaser/Camera.cpp index e153449..13be14f 100644 --- a/LaiPuLaser/Camera.cpp +++ b/LaiPuLaser/Camera.cpp @@ -348,9 +348,11 @@ void CCamera::Draw(CDC* pDC) void CCamera::SetCoord(Dbxy pt) { m_Coord = pt; + gDevicePropertieMgr.ChangePropertieByVal(&m_Coord.x, pt.x); + gDevicePropertieMgr.ChangePropertieByVal(&m_Coord.y, pt.y); //m_Coord2=pt+ //强制保存所有的属性到文件 - gDevicePropertieMgr.SaveAllPropertie(); + //gDevicePropertieMgr.SaveAllPropertie(); } //获取CCD 的中心点坐标(一般用来移动到CCD 观察) Dbxy CCamera::GetCenterPt() diff --git a/LaiPuLaser/DlgDnCutCamera.cpp b/LaiPuLaser/DlgDnCutCamera.cpp index 45c0403..d1b41a4 100644 --- a/LaiPuLaser/DlgDnCutCamera.cpp +++ b/LaiPuLaser/DlgDnCutCamera.cpp @@ -10,6 +10,7 @@ #include "CommonFlowMgr.h" #include "CameraHawkvis.h" #include "ProgramCutMgr.h" +#include "PropertieMgr.h" #include "SmartArchive.h" #include @@ -218,11 +219,13 @@ void DlgHawkvisCamera::OnBnClickedSetExpore() #ifdef __HAWKVIS_MINDVISION_CCD__ if (m_DlgCurCamIndex == 0) { - gCameraHawkvis->m_nCam1Expore = m_nExpore; + //gCameraHawkvis->m_nCam1Expore = m_nExpore; + gDevicePropertieMgr.ChangePropertieByVal(&gCameraHawkvis->m_nCam1Expore, m_nExpore); } else { - gCameraHawkvis->m_nCam2Expore = m_nExpore; + //gCameraHawkvis->m_nCam2Expore = m_nExpore; + gDevicePropertieMgr.ChangePropertieByVal(&gCameraHawkvis->m_nCam2Expore, m_nExpore); } m_HawkvisCtrl.MV_SetCameraExpTime(m_nExpore); #else diff --git a/LaiPuLaser/LaiPuLaser.rc b/LaiPuLaser/LaiPuLaser.rc index 440dd49..00943a3 100644 Binary files a/LaiPuLaser/LaiPuLaser.rc and b/LaiPuLaser/LaiPuLaser.rc differ diff --git a/LaiPuLaser/PaneDevicePar.h b/LaiPuLaser/PaneDevicePar.h index 3235dc2..8b39b3a 100644 --- a/LaiPuLaser/PaneDevicePar.h +++ b/LaiPuLaser/PaneDevicePar.h @@ -7,11 +7,12 @@ public: CPaneDevicePar(void); ~CPaneDevicePar(void); void SetComboSelNull(); + afx_msg void OnCbnSelPropertyChange(); protected: virtual void IniObjectCombo(); virtual void RemoveAllProperty(); afx_msg LRESULT OnPropertyChanged(WPARAM,LPARAM); - afx_msg void OnCbnSelPropertyChange(); + DECLARE_MESSAGE_MAP() }; diff --git a/LaiPuLaser/Propertie.h b/LaiPuLaser/Propertie.h index 0aad2c8..9a5853b 100644 --- a/LaiPuLaser/Propertie.h +++ b/LaiPuLaser/Propertie.h @@ -11,6 +11,7 @@ public: CPropertie(); ~CPropertie(); void SetpVal(void *pVal){m_pVal = pVal;}; + void * GetpVal() { return m_pVal; }; void SetType(PROPERTIE_TYPE Type){m_Type = Type;}; void SetpModule(CModule *pModule){m_pModule = pModule;}; void SetName(CString &Name){m_Name = Name;}; diff --git a/LaiPuLaser/PropertieMgr.cpp b/LaiPuLaser/PropertieMgr.cpp index 96e1250..bac78ec 100644 --- a/LaiPuLaser/PropertieMgr.cpp +++ b/LaiPuLaser/PropertieMgr.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "PropertieMgr.h" #include "Propertie.h" - +#include "GlobalFunction.h" CPropertieMgr gDevicePropertieMgr;//设备属性管理 CPropertieMgr gDrawPropertieMgr;//绘制属性管理 @@ -78,4 +78,55 @@ void CPropertieMgr::SaveAllPropertie() pPropertie->WriteRead(false); } } -} \ No newline at end of file +} + +bool CPropertieMgr::ChangePropertieByName(CString name, _variant_t newVal) +{ + auto iter = m_PropertieValMap.begin(); + auto iter_end = m_PropertieValMap.end(); + for (;iter != iter_end;iter++) + { + if ((iter->first)->GetName() == name) + { + iter->second->PropertyChangeVal(newVal); + gDevicePropertieMgr.UpdateDevicePropertyPage(); + return true; + } + } + return false; +} + +bool CPropertieMgr::ChangePropertieByVal(void * pVal, _variant_t newVal) +{ + auto iter = m_AllPropertieVec.begin(); + auto iter_end = m_AllPropertieVec.end(); + for (;iter != iter_end;iter++) + { + if ((*iter)->GetpVal() == pVal) + { + (*iter)->PropertyChangeVal(newVal); + gDevicePropertieMgr.UpdateDevicePropertyPage(); + return true; + } + } + return false; +} + +void CPropertieMgr::UpdateDevicePropertyPage() +{ + GetFrame()->m_PaneDevicePar.OnCbnSelPropertyChange(); +} +/* +CPropertie * CPropertieMgr::GetPropertie(void * pVal) +{ + auto iter = m_AllPropertieVec.begin(); + auto iter_end = m_AllPropertieVec.end(); + for (;iter != iter_end;iter++) + { + if ((*iter)->GetpVal() == pVal) + { + return *iter; + } + } + return NULL; +}*/ diff --git a/LaiPuLaser/PropertieMgr.h b/LaiPuLaser/PropertieMgr.h index f910771..d0c39f1 100644 --- a/LaiPuLaser/PropertieMgr.h +++ b/LaiPuLaser/PropertieMgr.h @@ -14,6 +14,12 @@ public: void DelAllPropertie(); void SaveAllPropertie(); void SetSaveAllPropertie(bool b){m_bSaveAllPropertie = b;}; + + bool ChangePropertieByName(CString name, _variant_t newVal); //根据在属性列表中的名 ,获取属性 + bool ChangePropertieByVal(void* pVal, _variant_t newVal); //根据变量地址,修改其数据并刷新到属性表 + + void UpdateDevicePropertyPage(); + private: void DelAllPropertieVec(); private: