/*============================================================================= * * Filename: CPATstPt.cpp * Version: 2.0 (VSS5) * Date: 28/07/97 * Author: Marc Trabucato * * Description: implementation of CPA_TestPoint class * *===========================================================================*/ #ifdef ACTIVE_EDITOR #include "stdafx.h" // ALX #include "ACP_Base.h" #include "TFA.h" #include "DPT.h" #include "x:\cpa\main\inc\_EditID.h" /*============================================================================= * class CPA_TestPointNode: =============================================================================*/ DeclareTemplateStatic(tdxHandleToTestPointNode); void delnode(tdxHandleToTestPointNode h) {} void CPA_TestPointNode::Init() { CPA_EdMot::Init(fn_hCreateTestPointNode,NULL,delnode); } /*----------------------------------------------------------------------------- * Description : constructor *---------------------------------------------------------------------------*/ CPA_TestPointNode::CPA_TestPointNode( CPA_TestPointsList *_p_oList, tdxHandleToTestPointNode _hTestPointNode /*=NULL*/ ) :CPA_EdMot(_hTestPointNode) { ASSERT( _p_oList ); SetOwnerList( _p_oList ); SetZdxObject( NULL ); // add point on editor list if( _hTestPointNode == NULL ) SetStruct( fn_hCreateTestPointNode() ); // and on engine list only if created point _p_oList -> m_oListOfTestPoints . AddTail( this, ( _hTestPointNode == NULL ) ); } /*----------------------------------------------------------------------------- * Description : destructor *---------------------------------------------------------------------------*/ CPA_TestPointNode::~CPA_TestPointNode(void) { } /*============================================================================= * class CPA_TestPointsList: =============================================================================*/ DeclareTemplateStatic(tdxHandleToTestPointsList); void dellist(tdxHandleToTestPointsList h) {} /*----------------------------------------------------------------------------- * Description : *---------------------------------------------------------------------------*/ void CPA_TestPointsList::Init() { CPA_EdMot::Init(fn_hCreateTestPointsList,NULL,dellist); } /*----------------------------------------------------------------------------- * Description : constructor *---------------------------------------------------------------------------*/ CPA_TestPointsList::CPA_TestPointsList(CPA_EditorBase *_p_oDLL, CPA_BaseObject *_p_oOwnerFamily, tdxHandleToTestPointsList _hTestPointsList /*=NULL*/, CString _csListName /*=""*/) :CPA_SaveObject(_p_oDLL, C_szTestPointsListTypeName, E_ss_Responsible, _p_oOwnerFamily, FALSE, fn_szGetFamiliesDataPath(), CPA_TestPointsList::fn_vCallBackSave), CPA_EdMot(_hTestPointsList) { // Section init & File Section Init char *p_szFamilyName = _p_oOwnerFamily -> fn_p_szGetName(); char szFileName[SCR_CV_ui_Cfg_MaxLenName]; char szReferencedSectionName[SCR_CV_ui_Cfg_MaxLenName]; sprintf( szFileName, "%s\\%s.tpe", p_szFamilyName, p_szFamilyName ); SCR_fn_v_RdL0_ComputeSectionName( szReferencedSectionName, szFileName, "TestPointsList", NULL); SetReferencedSectionName( szReferencedSectionName ); SetSectionData( this ); SetExistingSection( _hTestPointsList != NULL ); // data if( _hTestPointsList == NULL ) SetStruct( fn_hCreateTestPointsList() ); // Name if( fn_eRename( _csListName ) != E_mc_None ) SetDefaultValidName(); fn_vUpdateSectionName(); // data m_oListOfTestPoints . SetEngineAnchor( GetStruct() ? & GetStruct() -> hForTestPointArray : NULL ); if( _hTestPointsList == NULL ) { fn_vNotifySave(); } else { // fill TPList List CPA_TestPointNode *p_oNode; tdxHandleToTestPointNode hNode; int iIndex = 0; LST2_M_StaticForEachElementOf( & GetStruct() -> hForTestPointArray, hNode, iIndex) { p_oNode = new CPA_TestPointNode( this, hNode ); } // construct ZdxObject CPA_EditorBase *p_oZDxEditor = GetMainWorld() -> GetObjectDLLWithName( C_szDLLZDxName ); if( p_oZDxEditor ) p_oZDxEditor -> OnQueryAction( GetEditor(), C_uiQueryCreateZDxTestPoints, (long)this ); } ((CPA_Family *) _p_oOwnerFamily) -> mfn_vAddTestPointsList( this ); } /*----------------------------------------------------------------------------- * Description : destructor *---------------------------------------------------------------------------*/ CPA_TestPointsList::~CPA_TestPointsList(void) { } /*----------------------------------------------------------------------------- * Description : save TestPointsList *---------------------------------------------------------------------------*/ void CPA_TestPointsList::fn_vCallBackSave( SCR_tdst_File_Description *_p_stFile, char *_p_szSectionName, void *_p_vData, SCR_tde_Ntfy_Action _eAction) { // ANNECY AV CLEAN_MEC { /* CPA_TestPointsList *p_oList = (CPA_TestPointsList*)_p_vData; CPA_TestPointNode *p_oNode = NULL; char szActionName[SCR_CV_ui_Cfg_MaxLenName]; char szIdName[SCR_CV_ui_Cfg_MaxLenName]; char szSectionName[SCR_CV_ui_Cfg_MaxLenName]; POSITION xPos; MTH3D_tdstVector stPosition; switch ( _eAction ) { case SCR_EA_Ntfy_AddSection: case SCR_EA_Ntfy_RebuildSection: // construct section name SCR_fn_v_RdL0_SplitSectionName( _p_szSectionName, NULL, szActionName, szIdName ); SCR_fn_v_RdL0_ComputeSectionName( szSectionName, NULL, szActionName, szIdName ); // save begin section SCR_M_SvL0_SaveBeginSection( _p_stFile, szSectionName, SCR_CC_C_Cfg_EOL ); // entries xPos = p_oList -> m_oListOfTestPoints . GetHeadPosition(); while ( xPos ) { p_oNode = p_oList -> m_oListOfTestPoints . GetNext( xPos ); p_oNode -> mfn_vGetPosition( & stPosition ); SCR_M_SvL0_SaveEntry( _p_stFile, "AddTestPoint", SCR_CC_C_Cfg_NoChar ); SCR_fn_v_SvL0_SaveParameters_MP(_p_stFile, SCR_EF_SvL0_Scanf, 1, "%.6f,%.6f,%.6f,%s" ,MTH3D_M_xGetXofVector( &stPosition ) ,MTH3D_M_xGetYofVector( &stPosition ) ,MTH3D_M_xGetZofVector( &stPosition ) ,(char*)(LPCTSTR)p_oList -> GetKindOfPointName( p_oNode -> mfn_eGetKindOfPoint() ) ); } // End Section SCR_M_SvL0_SaveEndSection( _p_stFile, SCR_CC_C_Cfg_EOL ) ; SCR_M_SvL0_SaveBlankLine( _p_stFile ) ; // update Section name p_oList -> fn_vSectionSaved(); break; case SCR_EA_Ntfy_DeleteSection: p_oList -> fn_vSectionDeleted(); break; } */ // END ANNECY AV } } #endif // ACTIVE_EDITOR