658 lines
28 KiB
C++
658 lines
28 KiB
C++
//*****************************************************************************
|
|
//* _zModif.hpp *
|
|
//*****************************************************************************
|
|
//* *
|
|
//* This file contains the definitions of the modif classes *
|
|
//* *
|
|
//*****************************************************************************
|
|
//* Author : Alexis Vaisse *
|
|
//*****************************************************************************
|
|
|
|
|
|
// "standard" include
|
|
#include "stdafx.h"
|
|
#include "ACP_Base.h"
|
|
|
|
#include "TFA.h" // Family dll include
|
|
|
|
#include "..\Main\Inc\_EditID.h"
|
|
#include "ITF.h"
|
|
|
|
// personal include
|
|
#include "_zModif.hpp"
|
|
#include "_zObject.hpp"
|
|
#include "_zInterf.hpp"
|
|
#include "_zWList1.hpp"
|
|
#include "_zWList2.hpp"
|
|
#include "_zWEdit.hpp"
|
|
|
|
#include "OGD.h" // 3dGeom dll include
|
|
#include "OAC.h" // Actors dll include
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - constructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif::ZDx_Modif (ZDx_Object * _pZDxObject , char * ModifName)
|
|
: CPA_Modif (0 , ModifName , FALSE)
|
|
{
|
|
m_BackupName = NULL;
|
|
m_pBackupData = NULL;
|
|
m_bIsDoingUndo = FALSE;
|
|
SetZDxObject (_pZDxObject);
|
|
m_bFirstTime = TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - destructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif::~ZDx_Modif ()
|
|
{
|
|
if (m_BackupName) free (m_BackupName);
|
|
if (m_pBackupData) delete m_pBackupData;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - BackupSphereData
|
|
// Make a copy of all the parameters of a sphere ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::BackupSphereData ()
|
|
{
|
|
tdstBackupDataForSphere * pBackupData = new tdstBackupDataForSphere;
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Sphere3D * pSphere = (Sphere3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
|
|
pBackupData -> stCenter = pSphere -> GetCenter ();
|
|
pBackupData -> Radius = pSphere -> GetRadius ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_pBackupData = pBackupData;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - BackupBoxData
|
|
// Make a copy of all the parameters of a box ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::BackupBoxData ()
|
|
{
|
|
tdstBackupDataForBox * pBackupData = new tdstBackupDataForBox;
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Box3D * pBox = (Box3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
|
|
pBackupData -> stMinPoint = pBox -> GetMinPoint ();
|
|
pBackupData -> stMaxPoint = pBox -> GetMaxPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_pBackupData = pBackupData;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - BackupPointData
|
|
// Make a copy of all the parameters of a point ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::BackupPointData ()
|
|
{
|
|
tdstBackupDataForPoint * pBackupData = new tdstBackupDataForPoint;
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Point3D * pPoint = (Point3D *)((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
|
|
pBackupData -> stPoint = pPoint -> GetPoint ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_pBackupData = pBackupData;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - BackupConeData
|
|
// Make a copy of all the parameters of a cone ZDx object
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::BackupConeData ()
|
|
{
|
|
tdstBackupDataForCone * pBackupData = new tdstBackupDataForCone;
|
|
|
|
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Cone3D * pCone = (Cone3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
|
|
pBackupData -> stTopPoint = pCone -> GetTopPoint ();
|
|
pBackupData -> stBasePoint = pCone -> GetBasePoint ();
|
|
pBackupData -> Radius = pCone -> GetRadius ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
|
|
m_pBackupData = pBackupData;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - Set_ZDx_Object
|
|
// set the ZDx object which will be modified and make a copy of its
|
|
// actual parameters for the Undo
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::SetZDxObject (ZDx_Object * _pZDxObject)
|
|
{
|
|
if (m_bIsDoingUndo) return;
|
|
|
|
m_pZDxObject = _pZDxObject; // we keep a pointer to the ZDx object which will be modified
|
|
|
|
if (m_BackupName) free (m_BackupName);
|
|
m_BackupName = strdup (_pZDxObject -> GetZDxName ()); // we make a copy of the ZDx name
|
|
|
|
if (m_pBackupData) delete (m_pBackupData);
|
|
switch (_pZDxObject -> GetZDxGeometricType ()) // we make a copy of the data, depending of the type of the ZDx
|
|
{
|
|
case eSphere : BackupSphereData (); break;
|
|
case eBox : BackupBoxData (); break;
|
|
case ePoint : BackupPointData (); break;
|
|
case eCone : BackupConeData (); break;
|
|
default : ASSERT (0); break;
|
|
}
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - ExchangeBackupSphereData
|
|
// exchange the actual and backuped data for a ZDx of type sphere
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::ExchangeBackupSphereData ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Sphere3D * pSphere = (Sphere3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
tdstBackupDataForSphere * pBackupData = (tdstBackupDataForSphere *) m_pBackupData;
|
|
|
|
// exchange the center
|
|
MTH3D_tdstVector Center = pSphere -> GetCenter ();
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
pSphere -> SetCenter (& pBackupData -> stCenter);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
pBackupData -> stCenter = Center;
|
|
|
|
// exchange the radius
|
|
GLI_tdxValue Radius = pSphere -> GetRadius ();
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
pSphere -> SetRadius (& pBackupData -> Radius);
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
pBackupData -> Radius = Radius;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - ExchangeBackupBoxData
|
|
// exchange the actual and backuped data for a ZDx of type box
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::ExchangeBackupBoxData ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Box3D * pBox = (Box3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
tdstBackupDataForBox * pBackupData = (tdstBackupDataForBox *) m_pBackupData;
|
|
|
|
// exchange the min and the max point
|
|
MTH3D_tdstVector MinPoint = pBox -> GetMinPoint ();
|
|
MTH3D_tdstVector MaxPoint = pBox -> GetMaxPoint ();
|
|
MTH3D_tdstVector Dummy = pBackupData -> stMinPoint;
|
|
pBox -> SetMinPoint (& Dummy);
|
|
Dummy = pBackupData -> stMaxPoint;
|
|
pBox -> SetMaxPoint (& Dummy);
|
|
Dummy = pBackupData -> stMinPoint;
|
|
pBox -> SetMinPoint (& Dummy);
|
|
pBackupData -> stMinPoint = MinPoint;
|
|
pBackupData -> stMaxPoint = MaxPoint;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - ExchangeBackupPointData
|
|
// exchange the actual and backuped data for a ZDx of type point
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::ExchangeBackupPointData ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Point3D * pPoint = (Point3D *)((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
tdstBackupDataForPoint * pBackupData = (tdstBackupDataForPoint *) m_pBackupData;
|
|
|
|
// exchange the position of the point
|
|
MTH3D_tdstVector Point = pPoint -> GetPoint ();
|
|
pPoint -> SetPoint (& pBackupData -> stPoint);
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
// if (m_pZDxObject -> GetZDxType () == eTestPoint)
|
|
// ANNECY AV CLEAN_MEC {
|
|
// ((ZDx_Point *) m_pZDxObject -> GetZDxShape ()) -> UpdateTestPointPosition ();
|
|
// END ANNECY AV }
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
pBackupData -> stPoint = Point;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - ExchangeBackupConeData
|
|
// exchange the actual and backuped data for a ZDx of type cone
|
|
//-----------------------------------------------------------------------------
|
|
void ZDx_Modif::ExchangeBackupConeData ()
|
|
{
|
|
//ROMTEAM WorldEditor (Cristi Petrescu 12/97)
|
|
Cone3D * pCone = (Cone3D *)((ZDx_Shape *) m_pZDxObject -> GetZDxShape ()) -> GetGeometric3dObject ();
|
|
//ENDROMTEAM WorldEditor (Cristi Petrescu)
|
|
tdstBackupDataForCone * pBackupData = (tdstBackupDataForCone *) m_pBackupData;
|
|
|
|
// exchange the top and base point
|
|
MTH3D_tdstVector BasePoint = pCone -> GetBasePoint ();
|
|
MTH3D_tdstVector TopPoint = pCone -> GetTopPoint ();
|
|
MTH3D_tdstVector Dummy = pBackupData -> stBasePoint;
|
|
pCone -> SetBasePoint (& Dummy);
|
|
Dummy = pBackupData -> stTopPoint;
|
|
pCone -> SetTopPoint (& Dummy);
|
|
Dummy = pBackupData -> stBasePoint;
|
|
pCone -> SetBasePoint (& Dummy);
|
|
pBackupData -> stBasePoint = BasePoint;
|
|
pBackupData -> stTopPoint = TopPoint;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - Undo
|
|
// we cancel the modification by taking the previous datas which were saved
|
|
// in fact, we exchange the old and the actual datas (for the Redo)
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif::Undo (BOOL _bRefreshWindow)
|
|
{
|
|
m_bIsDoingUndo = TRUE;
|
|
|
|
ZDx_Interface * pZDxInterface = (ZDx_Interface *) m_pZDxObject -> GetEditor ();
|
|
pZDxInterface -> IWillRefreshDisplay (C_lModifZDx);
|
|
|
|
// we exchange old and actual ZDx names if they are different
|
|
if (strcmp (m_pZDxObject -> GetZDxName () , m_BackupName) != 0)
|
|
{
|
|
char TempString [255];
|
|
strcpy (TempString , m_BackupName);
|
|
free (m_BackupName);
|
|
m_BackupName = strdup (m_pZDxObject -> GetZDxName ());
|
|
m_pZDxObject -> SetZDxName (TempString);
|
|
}
|
|
|
|
switch (m_pZDxObject -> GetZDxGeometricType ())
|
|
{
|
|
case eSphere : ExchangeBackupSphereData (); break;
|
|
case eBox : ExchangeBackupBoxData (); break;
|
|
case ePoint : ExchangeBackupPointData (); break;
|
|
case eCone : ExchangeBackupConeData (); break;
|
|
default: ASSERT (0); break;
|
|
}
|
|
|
|
// Refresh the edit window if needed
|
|
if (_bRefreshWindow)
|
|
{
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
|
|
pZDxInterface -> GetList2Window () -> CreateBoundingVolume (pZDxInterface -> GetList2Window () -> GetActorSuperObject () , m_pZDxObject);
|
|
else
|
|
*/
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint)
|
|
pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (pZDxInterface -> GetList2Window () -> GetActorSuperObject () ,
|
|
pZDxInterface -> GetList2Window () -> GetListOfTestPoint () ,
|
|
TRUE);
|
|
else
|
|
*/
|
|
pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
|
|
// END ANNECY AV }
|
|
}
|
|
pZDxInterface -> RefreshDisplay (C_lModifZDx , _bRefreshWindow);
|
|
|
|
// We will have to save the geometric object
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint) pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
|
|
else
|
|
*/
|
|
m_pZDxObject -> fn_vNotifySave ();
|
|
// END ANNECY AV }
|
|
|
|
m_bIsDoingUndo = FALSE;
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - Undo
|
|
// The standard Undo : we refresh the window by default
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif::Undo ()
|
|
{
|
|
return Undo (TRUE);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif - Do
|
|
// Do and Undo are exactly the same thing in this case, so we just call the Undo method
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif::Do ()
|
|
{
|
|
if (m_bFirstTime)
|
|
{
|
|
m_bFirstTime = FALSE;
|
|
return Undo (!((ZDx_Interface *) m_pZDxObject->GetEditor())->GetList1Window()->IsEditingBoundingVolume());
|
|
}
|
|
else
|
|
return Undo (TRUE);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Exchange - constructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif_Exchange::ZDx_Modif_Exchange
|
|
(ZDx_Object * _pZDxObject1 , long _lIndexInList1 , EdtList * _pZDxList1 , CPA_SuperObject * _pActorSuperObject1 ,
|
|
ZDx_Object * _pZDxObject2 , long _lIndexInList2 , EdtList * _pZDxList2 , CPA_SuperObject * _pActorSuperObject2 ,
|
|
ZDx_Interface * _pZDxInterface)
|
|
: CPA_Modif (0 , "Exchange zones" , FALSE)
|
|
{
|
|
m_pZDxInterface = _pZDxInterface;
|
|
m_pZDxObject1 = _pZDxObject1;
|
|
m_pZDxObject2 = _pZDxObject2;
|
|
m_lIndexInList1 = _lIndexInList1;
|
|
m_lIndexInList2 = _lIndexInList2;
|
|
m_pZDxList1 = _pZDxList1;
|
|
m_pZDxList2 = _pZDxList2;
|
|
m_eTypeOfList1 = m_pZDxInterface -> ConvertListTypeToZDxType (m_pZDxList1 -> fn_csGetListType ());
|
|
m_eTypeOfList2 = m_pZDxInterface -> ConvertListTypeToZDxType (m_pZDxList2 -> fn_csGetListType ());
|
|
m_pActorSuperObject1 = _pActorSuperObject1;
|
|
m_pActorSuperObject2 = _pActorSuperObject2;
|
|
m_pActor1 = _pActorSuperObject1 -> GetObject ();
|
|
m_pActor2 = _pActorSuperObject2 -> GetObject ();
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Exchange - Do
|
|
// We exchange the two ZDx
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Exchange::Do ()
|
|
{
|
|
// Exchange the type of the ZDx objects
|
|
if (m_pZDxObject1) m_pZDxObject1 -> SetZDxType (m_eTypeOfList2);
|
|
if (m_pZDxObject2) m_pZDxObject2 -> SetZDxType (m_eTypeOfList1);
|
|
|
|
// Put the second object into the first list
|
|
m_pZDxInterface -> SetZDxObjectInList (m_pActor1 , m_eTypeOfList1 , m_lIndexInList1 , m_pZDxObject2);
|
|
|
|
// Now, look if the list has changed. If so, the list has been duplicated, so we must do the modification
|
|
// into the old and the new list.
|
|
EdtList * pNewList1 = m_pZDxInterface -> GetZDxList (m_pActor1 , m_eTypeOfList1);
|
|
if (pNewList1 != m_pZDxList1)
|
|
{
|
|
CPA_BaseObject * pActorUsingThisList = (CPA_BaseObject *) m_pActor1 -> GetEditor () ->
|
|
OnQueryAction (m_pZDxInterface , C_uiActor_GetFirstActorUsingThisList , (long) pNewList1);
|
|
m_pZDxInterface -> SetZDxObjectInList (pActorUsingThisList ,
|
|
m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject1 , eZDxModifyAllActors);
|
|
}
|
|
// Put the first object into the second list
|
|
m_pZDxInterface -> SetZDxObjectInList (m_pActor2 , m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject1 , eZDxModifyAllActors);
|
|
|
|
// Refresh the lists
|
|
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
|
|
if (m_pZDxObject1) m_pZDxInterface -> GetList2Window () -> SelectZDx (m_pZDxObject1);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Exchange - Undo
|
|
// We exchange the two ZDx
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Exchange::Undo ()
|
|
{
|
|
// Exchange the type of the ZDx objects
|
|
if (m_pZDxObject1) m_pZDxObject1 -> SetZDxType (m_eTypeOfList1);
|
|
if (m_pZDxObject2) m_pZDxObject2 -> SetZDxType (m_eTypeOfList2);
|
|
|
|
// Look if the list has changed. If so, we must delete the new list and put the old one
|
|
EdtList * pNewList1 = m_pZDxInterface -> GetZDxList (m_pActor1 , m_eTypeOfList1);
|
|
if (pNewList1 != m_pZDxList1)
|
|
{
|
|
m_pZDxInterface -> DeleteZDxList (m_pActor1 , m_eTypeOfList1);
|
|
m_pZDxInterface -> SetZDxList (m_pActor1 , m_eTypeOfList1 , m_pZDxList1);
|
|
}
|
|
EdtList * pNewList2 = m_pZDxInterface -> GetZDxList (m_pActor2 , m_eTypeOfList2);
|
|
if (pNewList2 != m_pZDxList2)
|
|
{
|
|
m_pZDxInterface -> DeleteZDxList (m_pActor2 , m_eTypeOfList2);
|
|
m_pZDxInterface -> SetZDxList (m_pActor2 , m_eTypeOfList2 , m_pZDxList2);
|
|
}
|
|
|
|
// Exchange the two ZDx objects
|
|
m_pZDxInterface -> SetZDxObjectInList (m_pActor1 , m_eTypeOfList1 , m_lIndexInList1 , m_pZDxObject1 , eZDxModifyAllActors);
|
|
m_pZDxInterface -> SetZDxObjectInList (m_pActor2 , m_eTypeOfList2 , m_lIndexInList2 , m_pZDxObject2 , eZDxModifyAllActors);
|
|
|
|
// Refresh the list
|
|
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
|
|
if (m_pZDxObject1) m_pZDxInterface -> GetList2Window () -> SelectZDx (m_pZDxObject1);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Delete - constructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif_Delete::ZDx_Modif_Delete
|
|
(CPA_SuperObject * _pZDxSuperObject , long _lIndexInList , EdtList * _pZDxList , CPA_SuperObject * _pModuleSuperObject ,
|
|
CPA_SuperObject * _pActorSuperObject , ZDx_Interface * _pZDxInterface)
|
|
: CPA_Modif (0 , "Delete zone" , FALSE)
|
|
{
|
|
// One and only one of the two pointers must be defined
|
|
ASSERT ((_pActorSuperObject != NULL) ^ (_pModuleSuperObject != NULL));
|
|
|
|
m_pZDxInterface = _pZDxInterface;
|
|
m_pZDxSuperObject = _pZDxSuperObject;
|
|
m_pZDxObject = (ZDx_Object *) _pZDxSuperObject -> GetObject ();
|
|
m_lIndexInList = _lIndexInList;
|
|
m_pZDxList = _pZDxList;
|
|
m_pActorSuperObject = _pActorSuperObject;
|
|
m_pActor = _pActorSuperObject ? _pActorSuperObject -> GetObject () : NULL;
|
|
m_pModuleSuperObject = _pModuleSuperObject;
|
|
m_pModule = (EditorPO *) (_pModuleSuperObject ? _pModuleSuperObject -> GetObject () : NULL);
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Delete - destructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif_Delete::~ZDx_Modif_Delete ()
|
|
{
|
|
// We do not delete the ZDx object, because it can be shared by several modules
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Delete - Do
|
|
// We delete the ZDx
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Delete::Do ()
|
|
{
|
|
m_pZDxInterface -> IWillRefreshDisplay (C_lModifDeleteDo);
|
|
|
|
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
|
|
{
|
|
// We get the family of the actor
|
|
CPA_Family * pFamily = (CPA_Family *) m_pActor -> GetOwner () -> GetOwner ();
|
|
// We set the reference of the bounding volume to NULL
|
|
pFamily -> mfn_vSetBoundingVolume (NULL);
|
|
|
|
// Remove the bounding volume from the hierarchy
|
|
m_pZDxInterface -> DeleteZDxObjectFromHierarchy (m_pZDxSuperObject);
|
|
|
|
m_pZDxInterface -> GetList2Window () -> CreateBoundingVolume (m_pActorSuperObject , NULL);
|
|
}
|
|
else
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint)
|
|
{
|
|
// We get the current list of test points
|
|
CPA_TestPointsList * pListOfTestPoint = m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint ();
|
|
ASSERT (pListOfTestPoint);
|
|
|
|
// We find the test point of the list that have this ZDx object
|
|
POSITION PosTestPoint = pListOfTestPoint -> m_oListOfTestPoints . GetHeadPosition ();
|
|
CPA_TestPointNode * pTestPoint;
|
|
while (PosTestPoint)
|
|
{
|
|
pTestPoint = pListOfTestPoint -> m_oListOfTestPoints . GetAt (PosTestPoint);
|
|
if (pTestPoint -> mfn_p_oGetZdxObject () == m_pZDxObject) break;
|
|
|
|
pListOfTestPoint -> m_oListOfTestPoints . GetNext (PosTestPoint);
|
|
}
|
|
ASSERT (PosTestPoint); // PosTestPoint == NULL --> not found -> error
|
|
|
|
// Remove the test point from the list but do not delete it
|
|
pListOfTestPoint -> m_oListOfTestPoints . RemoveAt (PosTestPoint);
|
|
|
|
m_pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (m_pActorSuperObject , pListOfTestPoint);
|
|
pListOfTestPoint -> fn_vNotifySave ();
|
|
}
|
|
else
|
|
*/
|
|
// END ANNECY AV }
|
|
{
|
|
// Remove the ZDx object from the list or from the physical object
|
|
if (m_pActor) m_pZDxInterface -> RemoveZDxFromList (m_pZDxList , m_pZDxObject , m_pActor , TRUE);
|
|
else m_pZDxInterface -> SetZDxOfPhysicalObject (m_pModule , NULL ,m_pZDxObject -> GetZDxType ());
|
|
|
|
// Delete the ZDx object from the hierarchy
|
|
m_pZDxInterface -> DeleteZDxObjectFromHierarchy (m_pZDxSuperObject);
|
|
|
|
// Refresh the list
|
|
m_pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
|
|
|
|
// We show the ZDx again
|
|
if (m_pActor) m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
|
|
else m_pZDxInterface -> ShowZDxOfModule (m_pModuleSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
|
|
}
|
|
|
|
// Say that the section of the graphic object must be deleted
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint) m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
|
|
else
|
|
*/
|
|
m_pZDxObject -> fn_vNotifyUnSave ();
|
|
// END ANNECY AV }
|
|
|
|
m_pZDxInterface -> RefreshDisplay (C_lModifDeleteDo);
|
|
Done ();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Delete - Undo
|
|
// We reinsert the ZDx
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Delete::Undo ()
|
|
{
|
|
m_pZDxInterface -> IWillRefreshDisplay (C_lModifDeleteUndo);
|
|
|
|
// Say that the section of the graphic object must not be deleted (must be done before it is inserted into the hierarchy)
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint) m_pZDxInterface -> GetList2Window () -> GetListOfTestPoint () -> fn_vNotifySave ();
|
|
else
|
|
*/
|
|
m_pZDxObject -> fn_vNotifyRestore ();
|
|
// END ANNECY AV }
|
|
|
|
if (m_pZDxObject -> GetZDxType () == eBoundingVolume)
|
|
{
|
|
// We get the family of the actor
|
|
CPA_Family * pFamily = (CPA_Family *) m_pActor -> GetOwner () -> GetOwner ();
|
|
// We set the reference to the new bounding volume
|
|
pFamily -> mfn_vSetBoundingVolume (m_pZDxObject);
|
|
|
|
// Show the bounding volume
|
|
// m_pZDxInterface -> ShowBoundingVolume (m_pActorSuperObject , m_pZDxObject , TRUE);
|
|
|
|
m_pZDxInterface -> GetList2Window () -> CreateBoundingVolume (m_pActorSuperObject , m_pZDxObject);
|
|
}
|
|
else
|
|
// ANNECY AV CLEAN_MEC {
|
|
/*
|
|
if (m_pZDxObject -> GetZDxType () == eTestPoint)
|
|
{
|
|
CPA_TestPointNode * pTestPoint = m_pZDxObject -> GetTestPoint ();
|
|
ASSERT (pTestPoint);
|
|
CPA_TestPointsList * pListOfTestPoint = pTestPoint -> mfn_p_oGetList ();
|
|
|
|
// Reinsert the test point into the list of test points
|
|
pListOfTestPoint -> m_oListOfTestPoints . AddTail (pTestPoint);
|
|
|
|
m_pZDxInterface -> GetList2Window () -> CreateListOfTestPoint (m_pActorSuperObject , pListOfTestPoint);
|
|
pListOfTestPoint -> fn_vNotifySave ();
|
|
}
|
|
else
|
|
*/
|
|
// END ANNECY AV }
|
|
{
|
|
// Reinsert the ZDx object into the hierarchy (must be done before it is inserted into the list (because of fn_bAcceptAsParent))
|
|
m_pZDxInterface -> InsertZDxObjectIntoHierarchy (m_pZDxSuperObject , m_pActorSuperObject ? m_pActorSuperObject : m_pModuleSuperObject);
|
|
|
|
// Reinsert the ZDx object into the list or into the physical object
|
|
if (m_pActor) m_pZDxInterface -> InsertZDxIntoList (m_pZDxList , m_pZDxObject , & m_lIndexInList , m_pActor , eZDxModifyAllActors);
|
|
else m_pZDxInterface -> SetZDxOfPhysicalObject (m_pModule , m_pZDxObject , m_pZDxObject -> GetZDxType ());
|
|
|
|
// Refresh the list
|
|
m_pZDxInterface -> GetList2Window () -> ReCreateListOfZDx (TRUE , FALSE);
|
|
|
|
// We show the ZDx again
|
|
if (m_pActorSuperObject) m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
|
|
else m_pZDxInterface -> ShowZDxOfModule (m_pModuleSuperObject , m_pZDxInterface -> GetList2Window () -> GetZDxTypeToShow ());
|
|
}
|
|
|
|
m_pZDxInterface -> RefreshDisplay (C_lModifDeleteUndo);
|
|
Undone ();
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Change_ZDx_List - constructor
|
|
//-----------------------------------------------------------------------------
|
|
ZDx_Modif_Change_ZDx_List::ZDx_Modif_Change_ZDx_List (ZDx_Interface * _pZDxInterface ,
|
|
CPA_SuperObject * _pActorSuperObject ,
|
|
tdeZDxType _eTypeOfList ,
|
|
EdtList * _pZDxList)
|
|
: CPA_Modif (0 , "Change list of zones" , FALSE)
|
|
{
|
|
m_pZDxInterface = _pZDxInterface;
|
|
m_pActorSuperObject = _pActorSuperObject;
|
|
m_pActor = _pActorSuperObject -> GetObject ();
|
|
m_eTypeOfList = _eTypeOfList;
|
|
m_pZDxList = _pZDxList;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Change_ZDx_List - Undo
|
|
// We exchange m_pZDxList and the current list
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Change_ZDx_List::Undo ()
|
|
{
|
|
// Hide the zone of the actor
|
|
m_pZDxInterface -> ShowZDxOfActor (m_pActorSuperObject , C_ucHideAllZDx);
|
|
|
|
// Exchange current and backuped ZDx list
|
|
EdtList * pCurrentList = m_pZDxInterface -> GetZDxList (m_pActor , m_eTypeOfList);
|
|
m_pZDxInterface -> SetZDxList (m_pActor , m_eTypeOfList , m_pZDxList);
|
|
m_pZDxList = pCurrentList;
|
|
|
|
// Refresh the lists
|
|
m_pZDxInterface -> GetList1Window () -> ReCreateCurrentList ();
|
|
m_pZDxInterface -> GetList2Window () -> SelectZDx (m_eTypeOfList , 0); // Select the first ZDx object of the same type as the list
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// class ZDx_Modif_Change_ZDx_List - Do
|
|
// Do and Undo are the same in this case, so we just call the Undo method
|
|
//-----------------------------------------------------------------------------
|
|
BOOL ZDx_Modif_Change_ZDx_List::Do ()
|
|
{
|
|
return Undo ();
|
|
}
|