//***************************************************************************** //* _zObject.hpp * //***************************************************************************** //* * //* This file contains the definition of the ZDx_Object class * //* and its inherited classes * //* * //***************************************************************************** //* Author : Alexis Vaisse * //***************************************************************************** #ifndef __ZOBJECT_HPP__ #define __ZOBJECT_HPP__ #pragma once //----------------------------------------------------------------------------- // Include //----------------------------------------------------------------------------- // general include #include "IncITF.h" #include "OGD.h" // personal "include" //class Geometry3D; // the 3D geometric object (editor object) //class Shape3D; // the polimorfic 3d geometric object // ANNECY AV CLEAN_MEC { //class CPA_TestPointNode; // class of the Family tool dll // END ANNECY AV } class ZDx_Interface; class ZDx_Shape; //----------------------------------------------------------------------------- // Define //----------------------------------------------------------------------------- // type of ZDx // ANNECY AV CLEAN_MEC { typedef enum eZDxType_ { eZdd , eZde , eZdm , eZdr , eBoundingVolume /* , eTestPoint */ } tdeZDxType; // END ANNECY AV } // type of geometric object for ZDx (eItself means that the Zdx of the module is the module itself) typedef enum eZDxGeometricType_ { eBox , eSphere , ePoint , eCone } tdeZDxGeometricType; // type of display for ZDx typedef enum eZDxDisplayType_ { eNotDisplayed , eDisplayed} tdeZDxDisplayType; // name of ZDx #define C_szZddName "ZDD" #define C_szZdeName "ZDE" #define C_szZdmName "ZDM" #define C_szZdrName "ZDR" #define C_szBoundingVolumeName "BV" // ANNECY AV CLEAN_MEC { //#define C_szTestPointName "TestPoint" // END ANNECY AV} #define C_szZDxSphereName "Sphere" #define C_szZDxBoxName "Box" #define C_szZDxPointName "Point" #define C_szZDxConeName "Cone" //ROMTEAM WorldEditor (Cristi Petrescu 11/12/97) /* * Moved to OZO.h in the public directories. Needed for material checks * // public ID for the ZDx objects #define C_lZDD 18300 #define C_lZDE 18301 #define C_lZDM 18302 #define C_lZDR 18303 #define C_lBoundingVolume 18304 #define C_lTestPoint 18305 */ //ENDROMTEAM WorldEditor (Cristi Petrescu) //----------------------------------------------------------------------------- // Macros //----------------------------------------------------------------------------- #define M_bIsThisObjectAZDx(pObject) \ ((pObject) -> fn_bIsOfType (C_szZddName) \ || (pObject) -> fn_bIsOfType (C_szZdeName) \ || (pObject) -> fn_bIsOfType (C_szZdmName) \ || (pObject) -> fn_bIsOfType (C_szZdrName) \ || (pObject) -> fn_bIsOfType (C_szBoundingVolumeName)) // ANNECY AV CLEAN_MEC { // || (pObject) -> fn_bIsOfType (C_szTestPointName)) // END ANNECY AV } //----------------------------------------------------------------------------- // class ZDx_Object // // Definition of the ZDx object class //----------------------------------------------------------------------------- class ZDx_Object : public CPA_SaveObject , public CPA_EdMot { private: tdeZDxType m_eZDxType; // The type of the ZDx (zdd, zde, zdm or zdr) tdeZDxGeometricType m_eZDxGeometricType; // The geometric type of the ZDx (sphere, box...) tdeZDxDisplayType m_eDisplayType; // The display type of the ZDx BOOL m_bMotorDisplay; // TRUE if the ZDx must be showed when motor is running long m_lIndexInList; // The index (zero-based) of the zone inside the list of zones // ANNECY AV CLEAN_MEC { // CPA_TestPointNode * m_pTestPoint; // When the ZDx object is a test point, a pointor to the associated test point // END ANNECY AV } ZDx_Shape * m_pZDxShape; // A pointer to an instance of the shape class long GiveZDxID (tdeZDxType); // Give the ID of a ZDx object, depending on its type public: // --- Constructor --- //ROMTEAM WorldEditor (Cristi Petrescu 11/12/97) ZDx_Object (ZDx_Interface * , const CString _csZDxTypeName , tdeZDxType , tdeZDxGeometricType , const CString _csZDxName , CPA_BaseObject * _pOwner , Shape3D * /*, ACP_tdxHandleOfElement*/); //ENDROMTEAM WorldEditor (Cristi Petrescu) ZDx_Object (ZDx_Object & _pZDxObjectToCopy); // Copy constructor // --- Destructor --- ~ZDx_Object (); // Functions used by the CPA_EdMot class static void InitZDxObject (); static ACP_tdxHandleOfObject CreateZDxEngineStruct (); static void CopyZDxEngineStruct (ACP_tdxHandleOfObject , ACP_tdxHandleOfObject); static void DeleteZDxEngineStruct (ACP_tdxHandleOfObject); // Virtual functions of the base class long GetDataType (); void * GetData (); tdeMissingCriteria fn_eCheckUnicity (const CString csNewName); void fn_vNotifyRename (); // Called when one renames the ZDx : // we also rename the geometric object // --- Engine structure --- void * GetEngineStruct () { return GetStruct (); } void SetEngineStruct (void * pStruct) { SetStruct ((ACP_tdxHandleOfObject) pStruct); } // --- ZDx type --- tdeZDxType GetZDxType () { return m_eZDxType; } void SetZDxType (tdeZDxType _eType) { m_eZDxType = _eType; } char * GetZDxTypeName (); // --- ZDx geometric type --- tdeZDxGeometricType GetZDxGeometricType () { return m_eZDxGeometricType; } void SetZDxGeometricType (tdeZDxGeometricType _eZDxGeometricType) { m_eZDxGeometricType = _eZDxGeometricType; } //--- ZDx Name --- char * GetZDxName (); // return the name of the ZDx object BOOL SetZDxName (char *); // set the name of the ZDx object. Return FALSE if the name already exists //--- Display --- tdeZDxDisplayType GetDisplay () { return m_eDisplayType; } void SetDisplay (tdeZDxDisplayType _eDisplayType) { m_eDisplayType = _eDisplayType; } BOOL GetMotorDisplay () { return m_bMotorDisplay; } void SetMotorDisplay (BOOL _bMotorDisplay) { m_bMotorDisplay = _bMotorDisplay; } // Function to access the instance of the ZDxShape class ZDx_Shape * GetZDxShape () { return m_pZDxShape; } void SetZDxShape (ZDx_Shape * _pZDxShape) { m_pZDxShape = _pZDxShape; } // Index of the zone inside the list of zones long GetIndexInList () { return m_lIndexInList; } void SetIndexInList (long _lIndexInList) { m_lIndexInList = _lIndexInList; } // When the ZDx object is a test point : functions to access the test point // ANNECY AV CLEAN_MEC { /* CPA_TestPointNode * GetTestPoint () { return m_pTestPoint; } void SetTestPoint (CPA_TestPointNode * _pTestPoint) { m_pTestPoint = _pTestPoint; } */ // END ANNECY AV} // Object Save void fn_vNotifySave (); void fn_vNotifyUnSave (); void fn_vNotifyRestore (); CString fn_csComputeReferencedSectionName (const CString _csNewName); void static CallbackToCreateZDxFile (SCR_tdst_File_Description * _pFile , char * _szSectionName , void * _pData , SCR_tde_Ntfy_Action _eAction); long GetNumberOfModuleUsingThis (); // Get the number of modules using this ZDx object void RedrawZDxObject (); // redraw the object (in fact, redraw the whole world) }; //----------------------------------------------------------------------------- // class ZDx_Shape // // Definition of the base class for the diferent shape of ZDx // The inherited classes will contains methods to modify the geometric definition of the ZDx //----------------------------------------------------------------------------- class ZDx_Shape { protected: ZDx_Object * m_pZDxObject; //ROMTEAM WorldEditor (Cristi Petrescu 11/12/97) Shape3D *m_pGeometric3dObject; //ACP_tdxHandleOfElement m_hHandleOfElement; public: ZDx_Shape (ZDx_Object * , Shape3D * /*, ACP_tdxHandleOfElement*/); // Constructor Shape3D * GetGeometric3dObject () { return m_pGeometric3dObject; } //ACP_tdxHandleOfElement GetHandleOfElement () { return m_hHandleOfElement; } //ENDROMTEAM WorldEditor (Cristi Petrescu) void RefreshData (CPA_SuperObject *); // Recompute data (center, min point...) // from the position of the super object void RedrawZDxObject () { m_pZDxObject -> RedrawZDxObject (); } // redraw the object //ROMTEAM WorldEditor (Cristi Petrescu 11/12/97) MTH3D_tdstVector GetCenter () {return GetGeometric3dObject () -> GetCenter ();}; // Get the center of the object void SetCenter (MTH3D_tdstVector *_pCenter) {GetGeometric3dObject () -> SetCenter (_pCenter);}; // Set the center of the object //ENDROMTEAM WorldEditor (Cristi Petrescu) ZDx_Object * GetZDxObject () { return m_pZDxObject; } }; //ROMTEAM WorldEditor (Cristi Petrescu 11/12/97) /* //----------------------------------------------------------------------------- // class ZDx_Sphere // // Definition of the class to modify the geometric aspect of a ZDx of type sphere //----------------------------------------------------------------------------- class ZDx_Sphere : public ZDx_Shape { public: ZDx_Sphere (ZDx_Object * , Shape3D * , ACP_tdxHandleOfElement , ZDx_Sphere * _pZDxSphereToCopy = NULL); // Constructor MTH3D_tdstVector GetCenter (); // return the 3D coordinates of the center of the sphere void SetCenter (MTH3D_tdstVector *); // set the 3D coordinates of the center of the sphere void SetCenterX (GLI_tdxValue); void SetCenterY (GLI_tdxValue); void SetCenterZ (GLI_tdxValue); GLI_tdxValue GetRadius (); // return the radius of the sphere BOOL SetRadius (GLI_tdxValue * _Radius); // set the radius of the sphere // Return FALSE if the given value if not correct // (that is, negative. Radius is then set to 0). // The new radius is returned in * _Radius. }; //----------------------------------------------------------------------------- // class ZDx_Box // // Definition of the class to modify the geometric aspect of a ZDx of type box //----------------------------------------------------------------------------- class ZDx_Box : public ZDx_Shape { public: ZDx_Box (ZDx_Object * _pZDxObject , Shape3D * , ACP_tdxHandleOfElement , ZDx_Box * _pZDxBoxToCopy = NULL); // Constructor // All the Set functions return TRUE if the given value is correct, FALSE if not (for example, the given // MinPointX is greater than the actual MaxPointX. The MinPointX is then set to the MaxPointX) // In both case, the new value is returned MTH3D_tdstVector GetMinPoint (); // return the 3D coordinates of the point with the min coordinates BOOL SetMinPoint (MTH3D_tdstVector *); BOOL SetMinPointX (GLI_tdxValue *); BOOL SetMinPointY (GLI_tdxValue *); BOOL SetMinPointZ (GLI_tdxValue *); BOOL IncMinPointX (GLI_tdxValue *); BOOL IncMinPointY (GLI_tdxValue *); BOOL IncMinPointZ (GLI_tdxValue *); MTH3D_tdstVector GetMaxPoint (); // return the 3D coordinates of the point with the max coordinates BOOL SetMaxPoint (MTH3D_tdstVector *); BOOL SetMaxPointX (GLI_tdxValue *); BOOL SetMaxPointY (GLI_tdxValue *); BOOL SetMaxPointZ (GLI_tdxValue *); BOOL IncMaxPointX (GLI_tdxValue *); BOOL IncMaxPointY (GLI_tdxValue *); BOOL IncMaxPointZ (GLI_tdxValue *); MTH3D_tdstVector GetCenter (); // return the 3D coordinates of the center of the box // (in fact, it is the middle of the min point and the max point) GLI_tdxValue GetLength (); // return the length of the box GLI_tdxValue GetWidth (); // return the width of the box GLI_tdxValue GetHeight (); // return the height of the box void SetCenter (MTH3D_tdstVector *); // set the center of the box, dimensions are unchanged void SetCenterX (GLI_tdxValue); void SetCenterY (GLI_tdxValue); void SetCenterZ (GLI_tdxValue); BOOL SetLength (GLI_tdxValue *); BOOL SetWidth (GLI_tdxValue *); BOOL SetHeight (GLI_tdxValue *); }; //----------------------------------------------------------------------------- // class ZDx_Cone // // Definition of the class to modify the geometric aspect of a ZDx of type cone //----------------------------------------------------------------------------- class ZDx_Cone : public ZDx_Shape { public: ZDx_Cone (ZDx_Object * _pZDxObject , Shape3D * , ACP_tdxHandleOfElement , ZDx_Cone * _pZDxConeToCopy = NULL); // Constructor MTH3D_tdstVector GetBasePoint (); // Return the 3D coordinates of the base point MTH3D_tdstVector GetTopPoint (); // Return the 3D coordinates of the top point void SetBasePoint (MTH3D_tdstVector *); // Set the 3D coordinates of the base point void SetTopPoint (MTH3D_tdstVector *); // Set the 3D coordinates of the top point void SetBasePointX (GLI_tdxValue); void SetBasePointY (GLI_tdxValue); void SetBasePointZ (GLI_tdxValue); void SetTopPointX (GLI_tdxValue); void SetTopPointY (GLI_tdxValue); void SetTopPointZ (GLI_tdxValue); MTH3D_tdstVector GetCenter (); void SetCenter (MTH3D_tdstVector *); GLI_tdxValue GetRadius (); // Get the radius of the cone BOOL SetRadius (GLI_tdxValue *); // Set the radius of the cone. Return FALSE if value is not correct GLI_tdxValue GetAngle (); // Return the angle (in degrees) of the cone BOOL SetAngle (GLI_tdxValue *); // Set the angle (in degrees) of the cone. Return FALSE if value is not correct }; */ //----------------------------------------------------------------------------- // class ZDx_Point // // Definition of the class to modify the geometric aspect of a ZDx of type point //----------------------------------------------------------------------------- class ZDx_Point : public ZDx_Shape { public: ZDx_Point (ZDx_Object * _pZDxObject , Shape3D * /* ACP_tdxHandleOfElement */, ZDx_Point * _pZDxPointToCopy = NULL); // Constructor /* MTH3D_tdstVector GetPoint (); // return the 3D coordinates of the point void SetPoint (MTH3D_tdstVector *); // set the 3D coordinates of the point void SetPointX (GLI_tdxValue); void SetPointY (GLI_tdxValue); void SetPointZ (GLI_tdxValue); MTH3D_tdstVector GetCenter () { return ((Point3D *) GetGeometric3dObject ()) -> GetPoint (); } void SetCenter (MTH3D_tdstVector * _pCenter) { ((Point3D *) GetGeometric3dObject ()) -> SetPoint (_pCenter); } void SetColorOfPoint (BOOL _bSelected); // Set the color of the point : selected or not selected private: */ // ANNECY AV CLEAN_MEC { // void UpdateTestPointPosition (); // Set the position of the test point with the position of the point // END ANNECY AV } }; //ENDROMTEAM WorldEditor (Cristi Petrescu) #endif //__ZOBJECT_HPP__