From c7ffbf7b4e278a70364de8238ed31121babf9033 Mon Sep 17 00:00:00 2001 From: eap Date: Mon, 17 Jun 2013 12:44:32 +0000 Subject: [PATCH] 0021684: EDF 2221 : Display the arguments and the name of the operations + virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); --- src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx | 72 ++++---- src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_ArcDriver.cxx | 79 +++++---- src/GEOMImpl/GEOMImpl_ArcDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx | 59 +++---- src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_BlockDriver.cxx | 128 ++++++++++---- src/GEOMImpl/GEOMImpl_BlockDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_BooleanDriver.cxx | 87 ++++++---- src/GEOMImpl/GEOMImpl_BooleanDriver.hxx | 86 +-------- src/GEOMImpl/GEOMImpl_BoxDriver.cxx | 65 ++++--- src/GEOMImpl/GEOMImpl_BoxDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_ChamferDriver.cxx | 120 +++++++++---- src/GEOMImpl/GEOMImpl_ChamferDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_CircleDriver.cxx | 78 +++++---- src/GEOMImpl/GEOMImpl_CircleDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_ConeDriver.cxx | 75 ++++---- src/GEOMImpl/GEOMImpl_ConeDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_CopyDriver.cxx | 84 +++++---- src/GEOMImpl/GEOMImpl_CopyDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_CylinderDriver.cxx | 73 ++++---- src/GEOMImpl/GEOMImpl_CylinderDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_DiskDriver.cxx | 78 ++++----- src/GEOMImpl/GEOMImpl_DiskDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx | 72 ++++---- src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx | 87 ++-------- src/GEOMImpl/GEOMImpl_EllipseDriver.cxx | 71 ++++---- src/GEOMImpl/GEOMImpl_EllipseDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_ExportDriver.cxx | 51 ++---- src/GEOMImpl/GEOMImpl_ExportDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_FaceDriver.cxx | 75 ++++---- src/GEOMImpl/GEOMImpl_FaceDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx | 73 ++++---- src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx | 90 ++-------- src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx | 72 ++++---- src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_FilletDriver.cxx | 100 ++++++----- src/GEOMImpl/GEOMImpl_FilletDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_FillingDriver.cxx | 77 +++++---- src/GEOMImpl/GEOMImpl_FillingDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_GlueDriver.cxx | 89 +++++----- src/GEOMImpl/GEOMImpl_GlueDriver.hxx | 92 ++-------- src/GEOMImpl/GEOMImpl_HealingDriver.cxx | 134 ++++++++++---- src/GEOMImpl/GEOMImpl_HealingDriver.hxx | 93 ++-------- src/GEOMImpl/GEOMImpl_ImportDriver.cxx | 64 +++---- src/GEOMImpl/GEOMImpl_ImportDriver.hxx | 93 ++-------- src/GEOMImpl/GEOMImpl_LineDriver.cxx | 75 ++++---- src/GEOMImpl/GEOMImpl_LineDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_MarkerDriver.cxx | 84 ++++----- src/GEOMImpl/GEOMImpl_MarkerDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_MeasureDriver.cxx | 79 +++++---- src/GEOMImpl/GEOMImpl_MeasureDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_MirrorDriver.cxx | 80 ++++----- src/GEOMImpl/GEOMImpl_MirrorDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_OffsetDriver.cxx | 92 +++++----- src/GEOMImpl/GEOMImpl_OffsetDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_PartitionDriver.cxx | 79 +++++---- src/GEOMImpl/GEOMImpl_PartitionDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_PipeDriver.cxx | 105 +++++++---- src/GEOMImpl/GEOMImpl_PipeDriver.hxx | 95 ++-------- src/GEOMImpl/GEOMImpl_PipePathDriver.cxx | 71 ++++---- src/GEOMImpl/GEOMImpl_PipePathDriver.hxx | 95 ++-------- src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx | 90 ++++++---- src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx | 84 ++------- src/GEOMImpl/GEOMImpl_PlaneDriver.cxx | 95 +++++----- src/GEOMImpl/GEOMImpl_PlaneDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_PointDriver.cxx | 133 ++++++++------ src/GEOMImpl/GEOMImpl_PointDriver.hxx | 91 +--------- src/GEOMImpl/GEOMImpl_PolylineDriver.cxx | 159 +++++++++-------- src/GEOMImpl/GEOMImpl_PolylineDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_PositionDriver.cxx | 81 ++++----- src/GEOMImpl/GEOMImpl_PositionDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_PrismDriver.cxx | 93 ++++++---- src/GEOMImpl/GEOMImpl_PrismDriver.hxx | 91 ++-------- src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx | 63 +++---- src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx | 71 ++++---- src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_RotateDriver.cxx | 95 ++++++---- src/GEOMImpl/GEOMImpl_RotateDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_ScaleDriver.cxx | 78 ++++----- src/GEOMImpl/GEOMImpl_ScaleDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_ShapeDriver.cxx | 118 ++++++++----- src/GEOMImpl/GEOMImpl_ShapeDriver.hxx | 91 ++-------- src/GEOMImpl/GEOMImpl_SketcherDriver.cxx | 81 +++++---- src/GEOMImpl/GEOMImpl_SketcherDriver.hxx | 92 +--------- .../GEOMImpl_SmoothingSurfaceDriver.cxx | 67 ++++--- .../GEOMImpl_SmoothingSurfaceDriver.hxx | 80 +-------- src/GEOMImpl/GEOMImpl_SphereDriver.cxx | 71 ++++---- src/GEOMImpl/GEOMImpl_SphereDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_SplineDriver.cxx | 163 ++++++++++-------- src/GEOMImpl/GEOMImpl_SplineDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx | 71 ++++---- src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx | 93 +--------- src/GEOMImpl/GEOMImpl_TorusDriver.cxx | 72 ++++---- src/GEOMImpl/GEOMImpl_TorusDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_TranslateDriver.cxx | 103 +++++++---- src/GEOMImpl/GEOMImpl_TranslateDriver.hxx | 92 +--------- src/GEOMImpl/GEOMImpl_VectorDriver.cxx | 106 ++++++------ src/GEOMImpl/GEOMImpl_VectorDriver.hxx | 91 +--------- 100 files changed, 2842 insertions(+), 6073 deletions(-) diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx index b44e43ce3..d4961a50f 100755 --- a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx @@ -323,45 +323,47 @@ Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) cons return 1; } - -//======================================================================= -//function : GEOMImpl_3DSketcherDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_3DSketcherDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_3DSketcherDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + GEOMImpl_I3DSketcher aCI( function ); + Standard_Integer aType = function->GetType(); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_3DSketcherDriver", - sizeof(GEOMImpl_3DSketcherDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + theOperationName = "3DSKETCH"; - return _aType; -} + if (aType == SKETCHER3D_COORDS) + { + theParams.resize( 1 ); + theParams[0].Set( "(X,Y,Z)" ); -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_3DSketcherDriver) Handle(GEOMImpl_3DSketcherDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_3DSketcherDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_3DSketcherDriver))) { - _anOtherObject = Handle(GEOMImpl_3DSketcherDriver)((Handle(GEOMImpl_3DSketcherDriver)&)AnObject); - } + Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); + int anArrayLength = aCoordsArray->Length(); + for (int i = 0; i <= (anArrayLength-3); i += 3) + theParams[0] << "( " + << aCoordsArray->Value(i+1) << ", " + << aCoordsArray->Value(i+2) << ", " + << aCoordsArray->Value(i+3) << " ) "; } - - return _anOtherObject ; + else if (aType == SKETCHER3D_COMMAND) + { + AddParam( theParams, "Command", aCI.GetCommand() ); + } + else { + return false; + } + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_3DSketcherDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT(GEOMImpl_3DSketcherDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx index 44372bb5b..18f513853 100755 --- a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx @@ -44,70 +44,12 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_3DSketcherDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_3DSketcherDriver); - -class Handle(GEOMImpl_3DSketcherDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_3DSketcherDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_3DSketcherDriver)(const Handle(GEOMImpl_3DSketcherDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_3DSketcherDriver)(const GEOMImpl_3DSketcherDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_3DSketcherDriver)& operator=(const Handle(GEOMImpl_3DSketcherDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_3DSketcherDriver)& operator=(const GEOMImpl_3DSketcherDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } +#include - GEOMImpl_3DSketcherDriver* operator->() - { - return (GEOMImpl_3DSketcherDriver *)ControlAccess(); - } +DEFINE_STANDARD_HANDLE( GEOMImpl_3DSketcherDriver, GEOM_BaseDriver ); - GEOMImpl_3DSketcherDriver* operator->() const - { - return (GEOMImpl_3DSketcherDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_3DSketcherDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_3DSketcherDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - -#ifndef _TFunction_Driver_HeaderFile -#include +#ifndef _GEOM_BaseDriver_HeaderFile +#include #endif #ifndef _TFunction_Logbook_HeaderFile #include @@ -116,26 +58,11 @@ class Handle(GEOMImpl_3DSketcherDriver) : public Handle(TFunction_Driver) { #include #endif -class TColStd_SequenceOfExtendedString; - -class GEOMImpl_3DSketcherDriver : public TFunction_Driver { +class GEOMImpl_3DSketcherDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC // Standard_EXPORT GEOMImpl_3DSketcherDriver(); @@ -145,14 +72,12 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_3DSketcherDriver() {}; +Standard_EXPORT virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_3DSketcherDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_3DSketcherDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_3DSketcherDriver) == AType || TFunction_Driver::IsKind(AType)); } - - + DEFINE_STANDARD_RTTI( GEOMImpl_3DSketcherDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx index 5d8f15211..f5aa56528 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.cxx @@ -162,45 +162,48 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_ArcDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArcDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ArcDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArcDriver", - sizeof(GEOMImpl_ArcDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IArc aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "ARC"; + + switch ( aType ) { + case CIRC_ARC_THREE_PNT: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + AddParam( theParams, "Point 3", aCI.GetPoint3() ); + break; + case CIRC_ARC_CENTER: + AddParam( theParams, "Center Point", aCI.GetPoint1() ); + AddParam( theParams, "Point Start", aCI.GetPoint2() ); + AddParam( theParams, "Point End", aCI.GetPoint3() ); + AddParam( theParams, "Reverse", aCI.GetSense() ); + break; + case ELLIPSE_ARC_CENTER_TWO_PNT: + AddParam( theParams, "Center Point", aCI.GetPoint1() ); + AddParam( theParams, "Point 1", aCI.GetPoint2() ); + AddParam( theParams, "Point 2", aCI.GetPoint3() ); + break; + default: + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ArcDriver) Handle(GEOMImpl_ArcDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ArcDriver) _anOtherObject; +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ArcDriver,GEOM_BaseDriver); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ArcDriver))) { - _anOtherObject = Handle(GEOMImpl_ArcDriver)((Handle(GEOMImpl_ArcDriver)&)AnObject); - } - } - - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ArcDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ArcDriver.hxx b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx index 1e4a6fef8..52cca4d0e 100644 --- a/src/GEOMImpl/GEOMImpl_ArcDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ArcDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ArcDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ArcDriver); - -class Handle(GEOMImpl_ArcDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ArcDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ArcDriver)(const Handle(GEOMImpl_ArcDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ArcDriver)(const GEOMImpl_ArcDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ArcDriver)& operator=(const Handle(GEOMImpl_ArcDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ArcDriver)& operator=(const GEOMImpl_ArcDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ArcDriver* operator->() - { - return (GEOMImpl_ArcDriver *)ControlAccess(); - } - - GEOMImpl_ArcDriver* operator->() const - { - return (GEOMImpl_ArcDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ArcDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ArcDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ArcDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ArcDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ArcDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ArcDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,10 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ArcDriver() {}; +Standard_EXPORT virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ArcDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ArcDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ArcDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ArcDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx index ceb145712..955caf300 100644 --- a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.cxx @@ -147,46 +147,33 @@ Standard_Integer GEOMImpl_ArchimedeDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_ArchimedeDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ArchimedeDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ArchimedeDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + GEOMImpl_IArchimede IA (function); + Standard_Integer aType = function->GetType(); + if (aType != ARCHIMEDE_TYPE) return 0; - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ArchimedeDriver", - sizeof(GEOMImpl_ArchimedeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + theOperationName = "ARCHIMEDE"; - return _aType; + AddParam( theParams, "Objects", IA.GetBasicShape() ); + AddParam( theParams, "Weight", IA.GetWeight() ); + AddParam( theParams, "Water Density", IA.GetDensity() ); + AddParam( theParams, "Meshing Deflect.", IA.GetDeflection() ); + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= - -const Handle(GEOMImpl_ArchimedeDriver) Handle(GEOMImpl_ArchimedeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ArchimedeDriver) _anOtherObject; +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ArchimedeDriver,GEOM_BaseDriver); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ArchimedeDriver))) { - _anOtherObject = Handle(GEOMImpl_ArchimedeDriver)((Handle(GEOMImpl_ArchimedeDriver)&)AnObject); - } - } - - return _anOtherObject; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ArchimedeDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx index 190117df3..b32282749 100644 --- a/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ArchimedeDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ArchimedeDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ArchimedeDriver); - -class Handle(GEOMImpl_ArchimedeDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ArchimedeDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ArchimedeDriver)(const Handle(GEOMImpl_ArchimedeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ArchimedeDriver)(const GEOMImpl_ArchimedeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ArchimedeDriver)& operator=(const Handle(GEOMImpl_ArchimedeDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ArchimedeDriver)& operator=(const GEOMImpl_ArchimedeDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ArchimedeDriver* operator->() - { - return (GEOMImpl_ArchimedeDriver *)ControlAccess(); - } - - GEOMImpl_ArchimedeDriver* operator->() const - { - return (GEOMImpl_ArchimedeDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ArchimedeDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ArchimedeDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ArchimedeDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ArchimedeDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ArchimedeDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ArchimedeDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,10 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ArchimedeDriver() {}; +Standard_EXPORT virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ArchimedeDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ArchimedeDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ArchimedeDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ArchimedeDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx index 19aec6cec..a13dd628c 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.cxx @@ -1063,45 +1063,99 @@ void GEOMImpl_BlockDriver::MultiTransformate2D (const TopoDS_Shape& theBlock, theResult = aCompound; } -//======================================================================= -//function : GEOMImpl_BlockDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_BlockDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_BlockDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + Standard_Integer aType = function->GetType(); + GEOMImpl_IBlocks aCI1 (function); + GEOMImpl_IBlockTrsf aCI2 (function); + Handle(TColStd_HSequenceOfTransient) aShapes = aCI1.GetShapes(); + + switch ( aType ) { + case BLOCK_FACE_FOUR_EDGES: + theOperationName = "Q_FACE"; + AddParam( theParams, "Edge 1", aShapes->Value(1) ); + AddParam( theParams, "Edge 2", aShapes->Value(2) ); + AddParam( theParams, "Edge 3", aShapes->Value(3) ); + AddParam( theParams, "Edge 4", aShapes->Value(4) ); + break; + case BLOCK_FACE_TWO_EDGES: + theOperationName = "Q_FACE"; + AddParam( theParams, "Edge 1", aShapes->Value(1) ); + AddParam( theParams, "Edge 2", aShapes->Value(2) ); + break; + case BLOCK_FACE_FOUR_PNT: + theOperationName = "Q_FACE"; + AddParam( theParams, "Point 1", aShapes->Value(1) ); + AddParam( theParams, "Point 2", aShapes->Value(2) ); + AddParam( theParams, "Point 3", aShapes->Value(3) ); + AddParam( theParams, "Point 4", aShapes->Value(4) ); + break; + case BLOCK_SIX_FACES: + theOperationName = "HEX_SOLID"; + AddParam( theParams, "Face 1", aShapes->Value(1) ); + AddParam( theParams, "Face 2", aShapes->Value(2) ); + AddParam( theParams, "Face 3", aShapes->Value(3) ); + AddParam( theParams, "Face 4", aShapes->Value(4) ); + AddParam( theParams, "Face 5", aShapes->Value(5) ); + AddParam( theParams, "Face 6", aShapes->Value(6) ); + break; + case BLOCK_TWO_FACES: + theOperationName = "HEX_SOLID"; + AddParam( theParams, "Face 1", aShapes->Value(1) ); + AddParam( theParams, "Face 2", aShapes->Value(2) ); + break; + case BLOCK_COMPOUND_GLUE: + theOperationName = "MakeBlockCompound"; + AddParam( theParams, "Compound", aShapes->Value(1) ); + break; + case BLOCK_REMOVE_EXTRA: + theOperationName = "REMOVE_EXTRA_EDGES"; + AddParam( theParams, "Selected shape", aCI2.GetOriginal() ); + AddParam( theParams, "Union faces", aCI2.GetOptimumNbFaces() == 0); + break; + case BLOCK_COMPOUND_IMPROVE: + theOperationName = "CHECK_COMPOUND"; + AddParam( theParams, "Selected shape", aCI2.GetOriginal() ); + break; + case BLOCK_MULTI_TRANSFORM_1D: + theOperationName = "MUL_TRANSFORM"; + AddParam( theParams, "Main Object", aCI2.GetOriginal() ); + AddParam( theParams, "Face 1", aCI2.GetFace1U() ); + AddParam( theParams, "Face 2", aCI2.GetFace2U() ); + AddParam( theParams, "Nb. Times", aCI2.GetNbIterU() ); + break; + case BLOCK_MULTI_TRANSFORM_2D: + theOperationName = "MUL_TRANSFORM"; + AddParam( theParams, "Main Object", aCI2.GetOriginal() ); + AddParam( theParams, "Face 1 U", aCI2.GetFace1U() ); + AddParam( theParams, "Face 2 U", aCI2.GetFace2U() ); + AddParam( theParams, "Nb. Times V", aCI2.GetNbIterV() ); + AddParam( theParams, "Face 1 V", aCI2.GetFace1V() ); + AddParam( theParams, "Face 2 V", aCI2.GetFace2V() ); + AddParam( theParams, "Nb. Times V", aCI2.GetNbIterV() ); + break; + case BLOCK_UNION_FACES: + theOperationName = "UNION_FACES"; + AddParam( theParams, "Selected shape", aCI2.GetOriginal() ); + break; + default: + return false; + } - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BlockDriver", - sizeof(GEOMImpl_BlockDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_BlockDriver) Handle(GEOMImpl_BlockDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_BlockDriver) _anOtherObject; +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_BlockDriver,GEOM_BaseDriver); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BlockDriver))) { - _anOtherObject = Handle(GEOMImpl_BlockDriver)((Handle(GEOMImpl_BlockDriver)&)AnObject); - } - } - - return _anOtherObject; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_BlockDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_BlockDriver.hxx b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx index 0f5a07832..c35aba151 100644 --- a/src/GEOMImpl/GEOMImpl_BlockDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BlockDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_BlockDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BlockDriver); - -class Handle(GEOMImpl_BlockDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_BlockDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_BlockDriver)(const Handle(GEOMImpl_BlockDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_BlockDriver)(const GEOMImpl_BlockDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_BlockDriver)& operator=(const Handle(GEOMImpl_BlockDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_BlockDriver)& operator=(const GEOMImpl_BlockDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_BlockDriver* operator->() - { - return (GEOMImpl_BlockDriver *)ControlAccess(); - } - - GEOMImpl_BlockDriver* operator->() const - { - return (GEOMImpl_BlockDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_BlockDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_BlockDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -123,22 +61,13 @@ class Handle(GEOMImpl_BlockDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_BlockDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_BlockDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_BlockDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -149,12 +78,8 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_BlockDriver() {}; - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BlockDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BlockDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BlockDriver) == AType || TFunction_Driver::IsKind(AType)); } +Standard_EXPORT virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); private: void MultiTransformate1D (const TopoDS_Shape& theBlock, @@ -172,6 +97,8 @@ private: const Standard_Integer theNbIterV, TopoDS_Shape& theResult) const; +DEFINE_STANDARD_RTTI( GEOMImpl_BlockDriver ) + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 8cc9f8bfd..e1dccd8d0 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -510,42 +510,63 @@ TopoDS_Shape GEOMImpl_BooleanDriver::performOperation return aShape; } -//======================================================================= -//function : GEOMImpl_BooleanDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_BooleanDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BooleanDriver", - sizeof(GEOMImpl_BooleanDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_BooleanDriver) Handle(GEOMImpl_BooleanDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_BooleanDriver) _anOtherObject; + GEOMImpl_IBoolean aCI (function); + Standard_Integer aType = function->GetType(); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BooleanDriver))) { - _anOtherObject = Handle(GEOMImpl_BooleanDriver)((Handle(GEOMImpl_BooleanDriver)&)AnObject); - } + switch ( aType ) { + case BOOLEAN_COMMON: + theOperationName = "COMMON"; + AddParam( theParams, "Object 1", aCI.GetShape1() ); + AddParam( theParams, "Object 2", aCI.GetShape2() ); + break; + case BOOLEAN_CUT: + theOperationName = "CUT"; + AddParam( theParams, "Main Object", aCI.GetShape1() ); + AddParam( theParams, "Tool Object", aCI.GetShape2() ); + break; + case BOOLEAN_FUSE: + theOperationName = "FUSE"; + AddParam( theParams, "Object 1", aCI.GetShape1() ); + AddParam( theParams, "Object 2", aCI.GetShape2() ); + break; + case BOOLEAN_SECTION: + theOperationName = "SECTION"; + AddParam( theParams, "Object 1", aCI.GetShape1() ); + AddParam( theParams, "Object 2", aCI.GetShape2() ); + break; + case BOOLEAN_COMMON_LIST: + theOperationName = "COMMON"; + AddParam( theParams, "Selected objects", aCI.GetShapes() ); + break; + case BOOLEAN_FUSE_LIST: + theOperationName = "FUSE"; + AddParam( theParams, "Selected objects", aCI.GetShapes() ); + break; + case BOOLEAN_CUT_LIST: + theOperationName = "CUT"; + AddParam( theParams, "Main Object", aCI.GetShape1() ); + AddParam( theParams, "Tool Objects", aCI.GetShapes() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_BooleanDriver,GEOM_BaseDriver); + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_BooleanDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx index 6bc1af7f2..041a391e0 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.hxx @@ -47,10 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - #ifndef _TopoDS_Shape_HeaderFile #include #endif @@ -61,58 +57,7 @@ class Handle_Standard_Type; class Handle(TFunction_Driver); class GEOMImpl_BooleanDriver; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BooleanDriver); - -class Handle(GEOMImpl_BooleanDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_BooleanDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_BooleanDriver)(const Handle(GEOMImpl_BooleanDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_BooleanDriver)(const GEOMImpl_BooleanDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_BooleanDriver)& operator=(const Handle(GEOMImpl_BooleanDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_BooleanDriver)& operator=(const GEOMImpl_BooleanDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_BooleanDriver* operator->() - { - return (GEOMImpl_BooleanDriver *)ControlAccess(); - } - - GEOMImpl_BooleanDriver* operator->() const - { - return (GEOMImpl_BooleanDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_BooleanDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_BooleanDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; + #ifndef _TFunction_Driver_HeaderFile #include @@ -127,22 +72,13 @@ class Handle(GEOMImpl_BooleanDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_BooleanDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_BooleanDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_BooleanDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -153,13 +89,8 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_BooleanDriver() {}; - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BooleanDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BooleanDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BooleanDriver) == AType || TFunction_Driver::IsKind(AType)); } - +Standard_EXPORT virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& params); private: @@ -167,6 +98,7 @@ private: const TopoDS_Shape theShape2, const Standard_Integer theType) const; +DEFINE_STANDARD_RTTI( GEOMImpl_BooleanDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx index 40dffa9f8..f2b580fe1 100644 --- a/src/GEOMImpl/GEOMImpl_BoxDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.cxx @@ -121,45 +121,42 @@ Standard_Integer GEOMImpl_BoxDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_BoxDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_BoxDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_BoxDriver::GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - + GEOMImpl_IBox aBI (aFunction); + Standard_Integer aType = aFunction->GetType(); - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_BoxDriver", - sizeof(GEOMImpl_BoxDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + theOperationName = "BOX"; - return _aType; + if (aType == BOX_DX_DY_DZ) + { + AddParam( theParams, "Dx", aBI.GetDX() ); + AddParam( theParams, "Dy", aBI.GetDY() ); + AddParam( theParams, "Dz", aBI.GetDZ() ); + } + else if (aType == BOX_TWO_PNT) + { + AddParam( theParams, "Point 1", aBI.GetRef1() ); + AddParam( theParams, "Point 2", aBI.GetRef2() ); + } + else { + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_BoxDriver) Handle(GEOMImpl_BoxDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_BoxDriver) _anOtherObject; - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_BoxDriver))) { - _anOtherObject = Handle(GEOMImpl_BoxDriver)((Handle(GEOMImpl_BoxDriver)&)AnObject); - } - } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_BoxDriver,GEOM_BaseDriver); - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_BoxDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_BoxDriver.hxx b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx index fdb50a03e..23a645c45 100644 --- a/src/GEOMImpl/GEOMImpl_BoxDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_BoxDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_BoxDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_BoxDriver); - -class Handle(GEOMImpl_BoxDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_BoxDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_BoxDriver)(const Handle(GEOMImpl_BoxDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_BoxDriver)(const GEOMImpl_BoxDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_BoxDriver)& operator=(const Handle(GEOMImpl_BoxDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_BoxDriver)& operator=(const GEOMImpl_BoxDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_BoxDriver* operator->() - { - return (GEOMImpl_BoxDriver *)ControlAccess(); - } - - GEOMImpl_BoxDriver* operator->() const - { - return (GEOMImpl_BoxDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_BoxDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_BoxDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_BoxDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_BoxDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_BoxDriver, GEOM_BaseDriver ); + +class GEOMImpl_BoxDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -148,14 +77,12 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_BoxDriver() {}; - - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_BoxDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_BoxDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_BoxDriver) == AType || TFunction_Driver::IsKind(AType)); } + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationNameName, + std::vector& params); +DEFINE_STANDARD_RTTI( GEOMImpl_BoxDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx index d0aff9a4f..9afdb9adb 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.cxx @@ -286,43 +286,91 @@ Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_ChamferDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ChamferDriver", - sizeof(GEOMImpl_ChamferDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ChamferDriver) Handle(GEOMImpl_ChamferDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ChamferDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_ChamferDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ChamferDriver))) { - _anOtherObject = Handle(GEOMImpl_ChamferDriver)((Handle(GEOMImpl_ChamferDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IChamfer aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "CHAMFER"; + + switch ( aType ) { + case CHAMFER_SHAPE_ALL: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected Edges", "all" ); + AddParam( theParams, "D", aCI.GetD() ); + break; + case CHAMFER_SHAPE_EDGE: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Face 1", aCI.GetFace1() ); + AddParam( theParams, "Face 2", aCI.GetFace2() ); + AddParam( theParams, "D1", aCI.GetD1() ); + AddParam( theParams, "D2", aCI.GetD2() ); + break; + case CHAMFER_SHAPE_EDGE_AD: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Face 1", aCI.GetFace1() ); + AddParam( theParams, "Face 2", aCI.GetFace2() ); + AddParam( theParams, "D", aCI.GetD() ); + AddParam( theParams, "Angle", aCI.GetAngle() ); + break; + case CHAMFER_SHAPE_FACES: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected Faces" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " faces: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + theParams[1] << aCI.GetFace(i) << " "; + AddParam( theParams, "D1", aCI.GetD1() ); + AddParam( theParams, "D2", aCI.GetD2() ); + break; + case CHAMFER_SHAPE_FACES_AD: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected Faces" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " faces: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + theParams[1] << aCI.GetFace(i) << " "; + AddParam( theParams, "D", aCI.GetD() ); + AddParam( theParams, "Angle", aCI.GetAngle() ); + break; + case CHAMFER_SHAPE_EDGES: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected Edges" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " edges: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + theParams[1] << aCI.GetEdge(i) << " "; + AddParam( theParams, "D1", aCI.GetD1() ); + AddParam( theParams, "D2", aCI.GetD2() ); + break; + case CHAMFER_SHAPE_EDGES_AD: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected Edges" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " edges: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + theParams[1] << aCI.GetFace(i) << " "; + AddParam( theParams, "D", aCI.GetD() ); + AddParam( theParams, "Angle", aCI.GetAngle() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ChamferDriver,GEOM_BaseDriver); + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ChamferDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx index b52356811..d2160c269 100644 --- a/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ChamferDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ChamferDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ChamferDriver); - -class Handle(GEOMImpl_ChamferDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ChamferDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ChamferDriver)(const Handle(GEOMImpl_ChamferDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ChamferDriver)(const GEOMImpl_ChamferDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ChamferDriver)& operator=(const Handle(GEOMImpl_ChamferDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ChamferDriver)& operator=(const GEOMImpl_ChamferDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ChamferDriver* operator->() - { - return (GEOMImpl_ChamferDriver *)ControlAccess(); - } - - GEOMImpl_ChamferDriver* operator->() const - { - return (GEOMImpl_ChamferDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ChamferDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ChamferDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ChamferDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ChamferDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ChamferDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ChamferDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ChamferDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ChamferDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ChamferDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ChamferDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ChamferDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx index 0cf7a12c3..9336c64b5 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.cxx @@ -192,45 +192,47 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_CircleDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_CircleDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CircleDriver", - sizeof(GEOMImpl_CircleDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICircle aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "CIRCLE"; + + switch ( aType ) { + case CIRCLE_PNT_VEC_R: + AddParam( theParams, "Center Point", aCI.GetCenter(), "Origin" ); + AddParam( theParams, "Vector", aCI.GetVector(), "Z axis" ); + AddParam( theParams, "Radius", aCI.GetRadius() ); + break; + case CIRCLE_CENTER_TWO_PNT: + AddParam( theParams, "Center Point", aCI.GetPoint1() ); + AddParam( theParams, "Point 1", aCI.GetPoint2() ); + AddParam( theParams, "Point 2", aCI.GetPoint3() ); + break; + case CIRCLE_THREE_PNT: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + AddParam( theParams, "Point 3", aCI.GetPoint3() ); + break; + default: + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_CircleDriver) Handle(GEOMImpl_CircleDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_CircleDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CircleDriver))) { - _anOtherObject = Handle(GEOMImpl_CircleDriver)((Handle(GEOMImpl_CircleDriver)&)AnObject); - } - } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_CircleDriver,GEOM_BaseDriver); - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_CircleDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_CircleDriver.hxx b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx index d07441c46..63abd3ae3 100644 --- a/src/GEOMImpl/GEOMImpl_CircleDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CircleDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_CircleDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CircleDriver); - -class Handle(GEOMImpl_CircleDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_CircleDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_CircleDriver)(const Handle(GEOMImpl_CircleDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_CircleDriver)(const GEOMImpl_CircleDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_CircleDriver)& operator=(const Handle(GEOMImpl_CircleDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_CircleDriver)& operator=(const GEOMImpl_CircleDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_CircleDriver* operator->() - { - return (GEOMImpl_CircleDriver *)ControlAccess(); - } - - GEOMImpl_CircleDriver* operator->() const - { - return (GEOMImpl_CircleDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_CircleDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_CircleDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_CircleDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_CircleDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_CircleDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_CircleDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_CircleDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CircleDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CircleDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CircleDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_CircleDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.cxx b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx index d75bb5212..21c3d7e58 100644 --- a/src/GEOMImpl/GEOMImpl_ConeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.cxx @@ -143,45 +143,44 @@ Standard_Integer GEOMImpl_ConeDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_ConeDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ConeDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ConeDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ConeDriver", - sizeof(GEOMImpl_ConeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICone aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "CONE"; + + switch ( aType ) { + case CONE_R1_R2_H: + AddParam( theParams, "Radius 1", aCI.GetR1() ); + AddParam( theParams, "Radius 2", aCI.GetR2() ); + AddParam( theParams, "Height", aCI.GetH() ); + break; + case CONE_PNT_VEC_R1_R2_H: + AddParam( theParams, "Base Point", aCI.GetPoint() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Radius 1", aCI.GetR1() ); + AddParam( theParams, "Radius 2", aCI.GetR2() ); + AddParam( theParams, "Height", aCI.GetH() ); + break; + default: + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ConeDriver) Handle(GEOMImpl_ConeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ConeDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ConeDriver))) { - _anOtherObject = Handle(GEOMImpl_ConeDriver)((Handle(GEOMImpl_ConeDriver)&)AnObject); - } - } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ConeDriver,GEOM_BaseDriver); - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ConeDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ConeDriver.hxx b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx index 811bd7707..55b86ae1e 100644 --- a/src/GEOMImpl/GEOMImpl_ConeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ConeDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ConeDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ConeDriver); - -class Handle(GEOMImpl_ConeDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ConeDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ConeDriver)(const Handle(GEOMImpl_ConeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ConeDriver)(const GEOMImpl_ConeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ConeDriver)& operator=(const Handle(GEOMImpl_ConeDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ConeDriver)& operator=(const GEOMImpl_ConeDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ConeDriver* operator->() - { - return (GEOMImpl_ConeDriver *)ControlAccess(); - } - - GEOMImpl_ConeDriver* operator->() const - { - return (GEOMImpl_ConeDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ConeDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ConeDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ConeDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ConeDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ConeDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ConeDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ConeDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ConeDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ConeDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ConeDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ConeDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx index b34279823..e7d5cda44 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.cxx @@ -20,12 +20,11 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include - -#include -#include -#include -#include +#include "GEOMImpl_CopyDriver.hxx" +#include "GEOMImpl_ICopy.hxx" +#include "GEOMImpl_Types.hxx" +#include "GEOM_Function.hxx" +#include "GEOM_Object.hxx" #include #include @@ -92,45 +91,44 @@ Standard_Integer GEOMImpl_CopyDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_CopyDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_CopyDriver_Type_() +bool GEOMImpl_CopyDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CopyDriver", - sizeof(GEOMImpl_CopyDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICopy aCI( function ); + Standard_Integer aType = function->GetType(); + + + switch ( aType ) { + case COPY_WITH_REF: + theOperationName = "MakeCopy"; + AddParam( theParams, "Original", aCI.GetOriginal() ); + break; + case COPY_WITHOUT_REF: + { + theOperationName = "RestoreShape"; + TDF_Label label = Label(); + Handle(GEOM_Object) obj = GEOM_Object::GetObject(label); + if ( !obj.IsNull() && obj->GetType() == GEOM_FREE_BOUNDS ) + theOperationName = "CHECK_FREE_BNDS"; + break; + } + default: + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_CopyDriver) Handle(GEOMImpl_CopyDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_CopyDriver) _anOtherObject; +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_CopyDriver,GEOM_BaseDriver); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CopyDriver))) { - _anOtherObject = Handle(GEOMImpl_CopyDriver)((Handle(GEOMImpl_CopyDriver)&)AnObject); - } - } - - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_CopyDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx index 94fb0e69a..ed8be218a 100644 --- a/src/GEOMImpl/GEOMImpl_CopyDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CopyDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_CopyDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CopyDriver); - -class Handle(GEOMImpl_CopyDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_CopyDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_CopyDriver)(const Handle(GEOMImpl_CopyDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_CopyDriver)(const GEOMImpl_CopyDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_CopyDriver)& operator=(const Handle(GEOMImpl_CopyDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_CopyDriver)& operator=(const GEOMImpl_CopyDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_CopyDriver* operator->() - { - return (GEOMImpl_CopyDriver *)ControlAccess(); - } - - GEOMImpl_CopyDriver* operator->() const - { - return (GEOMImpl_CopyDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_CopyDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_CopyDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_CopyDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_CopyDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_CopyDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_CopyDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_CopyDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CopyDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CopyDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CopyDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_CopyDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx index f9a39ea9f..b17ee2ea3 100644 --- a/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.cxx @@ -126,45 +126,42 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_CylinderDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_CylinderDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_CylinderDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CylinderDriver", - sizeof(GEOMImpl_CylinderDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ICylinder aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "CYLINDER"; + + switch ( aType ) { + case CYLINDER_R_H: + AddParam( theParams, "Radius", aCI.GetR() ); + AddParam( theParams, "Height", aCI.GetH() ); + break; + case CONE_PNT_VEC_R1_R2_H: + AddParam( theParams, "Base Point", aCI.GetPoint() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Radius", aCI.GetR() ); + AddParam( theParams, "Height", aCI.GetH() ); + break; + default: + return false; + } + + return true; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_CylinderDriver) Handle(GEOMImpl_CylinderDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_CylinderDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CylinderDriver))) { - _anOtherObject = Handle(GEOMImpl_CylinderDriver)((Handle(GEOMImpl_CylinderDriver)&)AnObject); - } - } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_CylinderDriver,GEOM_BaseDriver); - return _anOtherObject ; -} +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_CylinderDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx index e3d601023..1061b3f24 100644 --- a/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_CylinderDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_CylinderDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_CylinderDriver); - -class Handle(GEOMImpl_CylinderDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_CylinderDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_CylinderDriver)(const Handle(GEOMImpl_CylinderDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_CylinderDriver)(const GEOMImpl_CylinderDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_CylinderDriver)& operator=(const Handle(GEOMImpl_CylinderDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_CylinderDriver)& operator=(const GEOMImpl_CylinderDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_CylinderDriver* operator->() - { - return (GEOMImpl_CylinderDriver *)ControlAccess(); - } - - GEOMImpl_CylinderDriver* operator->() const - { - return (GEOMImpl_CylinderDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_CylinderDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_CylinderDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_CylinderDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_CylinderDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_CylinderDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_CylinderDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_CylinderDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_CylinderDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_CylinderDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_CylinderDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_CylinderDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx index 49a004a67..a06706685 100755 --- a/src/GEOMImpl/GEOMImpl_DiskDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.cxx @@ -159,45 +159,45 @@ Standard_Integer GEOMImpl_DiskDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_DiskDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_DiskDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DiskDriver", - sizeof(GEOMImpl_DiskDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_DiskDriver) Handle(GEOMImpl_DiskDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_DiskDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_DiskDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_DiskDriver))) { - _anOtherObject = Handle(GEOMImpl_DiskDriver)((Handle(GEOMImpl_DiskDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IDisk aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "DISK"; + + switch ( aType ) { + case DISK_PNT_VEC_R: + AddParam( theParams, "Center Point", aCI.GetCenter() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Radius", aCI.GetRadius() ); + break; + case DISK_THREE_PNT: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + AddParam( theParams, "Point 3", aCI.GetPoint3() ); + break; + case DISK_R: + AddParam( theParams, "Radius", aCI.GetRadius() ); + AddParam( theParams, "Orientation", aCI.GetOrientation() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_DiskDriver,GEOM_BaseDriver); + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DiskDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_DiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx index 19a758833..a5d8b5af6 100755 --- a/src/GEOMImpl/GEOMImpl_DiskDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_DiskDriver.hxx @@ -44,68 +44,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_DiskDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DiskDriver); - -class Handle(GEOMImpl_DiskDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_DiskDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_DiskDriver)(const Handle(GEOMImpl_DiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_DiskDriver)(const GEOMImpl_DiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_DiskDriver)& operator=(const Handle(GEOMImpl_DiskDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_DiskDriver)& operator=(const GEOMImpl_DiskDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_DiskDriver* operator->() - { - return (GEOMImpl_DiskDriver *)ControlAccess(); - } - - GEOMImpl_DiskDriver* operator->() const - { - return (GEOMImpl_DiskDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_DiskDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_DiskDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -119,22 +57,13 @@ class Handle(GEOMImpl_DiskDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_DiskDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_DiskDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_DiskDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -145,14 +74,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_DiskDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DiskDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_DiskDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_DiskDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_DiskDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx index c1d0da36f..8a756d56c 100644 --- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.cxx @@ -485,41 +485,43 @@ TopoDS_Shape GEOMImpl_DividedDiskDriver::WPlaneTransform(TopoDS_Shape theShape, return aTransformation.Shape(); } -//======================================================================= -//function : GEOMImpl_DividedDiskDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_DividedDiskDriver", - sizeof(GEOMImpl_DividedDiskDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_DividedDiskDriver) Handle(GEOMImpl_DividedDiskDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_DividedDiskDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_DividedDiskDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_DividedDiskDriver))) { - _anOtherObject = Handle(GEOMImpl_DividedDiskDriver)((Handle(GEOMImpl_DividedDiskDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IDividedDisk aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "DIVIDEDDISK"; + + switch ( aType ) { + case DIVIDEDDISK_R_RATIO: + AddParam( theParams, "Radius", aCI.GetR() ); + AddParam( theParams, "Ratio", aCI.GetRatio() ); + AddParam( theParams, "Orientation", aCI.GetOrientation() ); + AddParam( theParams, "Division pattern", aCI.GetType() ); + break; + case DIVIDEDDISK_R_VECTOR_PNT: + AddParam( theParams, "Center Point", aCI.GetCenter() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Radius", aCI.GetR() ); + AddParam( theParams, "Division pattern", aCI.GetType() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx index bb2810329..8f6755a80 100644 --- a/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_DividedDiskDriver.hxx @@ -33,73 +33,13 @@ class gp_Pnt; class gp_Dir; class gp_Ax3; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_DividedDiskDriver); +#include "GEOM_BaseDriver.hxx" -class Handle(GEOMImpl_DividedDiskDriver) : public Handle(TFunction_Driver) { -public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_DividedDiskDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_DividedDiskDriver)(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - {} - - Handle(GEOMImpl_DividedDiskDriver)(const GEOMImpl_DividedDiskDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - {} - - Handle(GEOMImpl_DividedDiskDriver)& operator=(const Handle(GEOMImpl_DividedDiskDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_DividedDiskDriver)& operator=(const GEOMImpl_DividedDiskDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_DividedDiskDriver* operator->() - { - return (GEOMImpl_DividedDiskDriver *)ControlAccess(); - } - - GEOMImpl_DividedDiskDriver* operator->() const - { - return (GEOMImpl_DividedDiskDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_DividedDiskDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_DividedDiskDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; +DEFINE_STANDARD_HANDLE( GEOMImpl_DividedDiskDriver, GEOM_BaseDriver ); -class GEOMImpl_DividedDiskDriver : public TFunction_Driver { +class GEOMImpl_DividedDiskDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_DividedDiskDriver(); Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; @@ -110,25 +50,18 @@ public: } Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {}; - - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_DividedDiskDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { - return STANDARD_TYPE(GEOMImpl_DividedDiskDriver); - } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { - return (STANDARD_TYPE(GEOMImpl_DividedDiskDriver) == AType || TFunction_Driver::IsKind(AType)); - } - + + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); private: TopoDS_Shape TransformShape (TopoDS_Shape aShape, int theOrientation) const; TopoDS_Shape TransformShape (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const; TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const; TopoDS_Shell MakeDiskHexagon (double R, double Ratio) const; TopoDS_Shape MakeDiskSquare (double R, double Ratio) const; + + DEFINE_STANDARD_RTTI( GEOMImpl_DividedDiskDriver ) }; #endif // _GEOMImpl_DividedDiskDriver_HXX diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx index beb4ef111..4cadef824 100644 --- a/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.cxx @@ -159,45 +159,38 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_EllipseDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_EllipseDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_EllipseDriver", - sizeof(GEOMImpl_EllipseDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_EllipseDriver) Handle(GEOMImpl_EllipseDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_EllipseDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_EllipseDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_EllipseDriver))) { - _anOtherObject = Handle(GEOMImpl_EllipseDriver)((Handle(GEOMImpl_EllipseDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IEllipse aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "ELLIPSE"; + + switch ( aType ) { + case ELLIPSE_PNT_VEC_RR: + AddParam( theParams, "Center", aCI.GetCenter(), "Origin" ); + AddParam( theParams, "Vector", aCI.GetVector(), "Z axis" ); + AddParam( theParams, "Major Axis", aCI.GetVectorMajor(), "X axis"); + AddParam( theParams, "Major radius", aCI.GetRMajor() ); + AddParam( theParams, "Minor radius", aCI.GetRMinor() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_EllipseDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_EllipseDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx index 47fdf0212..0faded4e4 100644 --- a/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_EllipseDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_EllipseDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_EllipseDriver); - -class Handle(GEOMImpl_EllipseDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_EllipseDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_EllipseDriver)(const Handle(GEOMImpl_EllipseDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_EllipseDriver)(const GEOMImpl_EllipseDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_EllipseDriver)& operator=(const Handle(GEOMImpl_EllipseDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_EllipseDriver)& operator=(const GEOMImpl_EllipseDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_EllipseDriver* operator->() - { - return (GEOMImpl_EllipseDriver *)ControlAccess(); - } - - GEOMImpl_EllipseDriver* operator->() const - { - return (GEOMImpl_EllipseDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_EllipseDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_EllipseDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_EllipseDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_EllipseDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_EllipseDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_EllipseDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_EllipseDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_EllipseDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_EllipseDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_EllipseDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_EllipseDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx index d1c5eab3b..618bcdee4 100644 --- a/src/GEOMImpl/GEOMImpl_ExportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.cxx @@ -126,45 +126,18 @@ Standard_Integer GEOMImpl_ExportDriver::Execute(TFunction_Logbook& log) const return res; } - -//======================================================================= -//function : GEOMImpl_ExportDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ExportDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ExportDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ExportDriver", - sizeof(GEOMImpl_ExportDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; + return false; } -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ExportDriver) Handle(GEOMImpl_ExportDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ExportDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ExportDriver))) { - _anOtherObject = Handle(GEOMImpl_ExportDriver)((Handle(GEOMImpl_ExportDriver)&)AnObject); - } - } - - return _anOtherObject ; -} +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ExportDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ExportDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ExportDriver.hxx b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx index d1dd9b98a..2f1040e98 100644 --- a/src/GEOMImpl/GEOMImpl_ExportDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ExportDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ExportDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ExportDriver); - -class Handle(GEOMImpl_ExportDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ExportDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ExportDriver)(const Handle(GEOMImpl_ExportDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ExportDriver)(const GEOMImpl_ExportDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ExportDriver)& operator=(const Handle(GEOMImpl_ExportDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ExportDriver)& operator=(const GEOMImpl_ExportDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ExportDriver* operator->() - { - return (GEOMImpl_ExportDriver *)ControlAccess(); - } - - GEOMImpl_ExportDriver* operator->() const - { - return (GEOMImpl_ExportDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ExportDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ExportDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ExportDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ExportDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ExportDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ExportDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ExportDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ExportDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ExportDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ExportDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ExportDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx index 197a03764..76ec52055 100755 --- a/src/GEOMImpl/GEOMImpl_FaceDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.cxx @@ -123,45 +123,48 @@ Standard_Integer GEOMImpl_FaceDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_FaceDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_FaceDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_FaceDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FaceDriver", - sizeof(GEOMImpl_FaceDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + GEOMImpl_IFace aCI( function ); + Standard_Integer aType = function->GetType(); - return _aType; -} + theOperationName = "RECTANGLE"; -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_FaceDriver) Handle(GEOMImpl_FaceDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_FaceDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FaceDriver))) { - _anOtherObject = Handle(GEOMImpl_FaceDriver)((Handle(GEOMImpl_FaceDriver)&)AnObject); - } + switch ( aType ) { + case FACE_OBJ_H_W: + { + Handle(GEOM_Function) aRefFunct = aCI.GetRef1(); + TopoDS_Shape aRefShape = aRefFunct->GetValue(); + if (aRefShape.ShapeType() == TopAbs_EDGE) + AddParam( theParams, "Edge", aRefFunct ); + else + AddParam( theParams, "Face", aRefFunct ); + AddParam( theParams, "Height", aCI.GetH() ); + AddParam( theParams, "Width", aCI.GetW() ); + break; } - - return _anOtherObject ; + case FACE_H_W: + AddParam( theParams, "Height", aCI.GetH() ); + AddParam( theParams, "Width", aCI.GetW() ); + AddParam( theParams, "Orientation", aCI.GetOrientation() ); + break; + default: + return false; + } + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_FaceDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_FaceDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_FaceDriver.hxx b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx index 499b50e0f..a7dd0769e 100755 --- a/src/GEOMImpl/GEOMImpl_FaceDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FaceDriver.hxx @@ -44,68 +44,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_FaceDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FaceDriver); - -class Handle(GEOMImpl_FaceDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_FaceDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_FaceDriver)(const Handle(GEOMImpl_FaceDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_FaceDriver)(const GEOMImpl_FaceDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_FaceDriver)& operator=(const Handle(GEOMImpl_FaceDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_FaceDriver)& operator=(const GEOMImpl_FaceDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_FaceDriver* operator->() - { - return (GEOMImpl_FaceDriver *)ControlAccess(); - } - - GEOMImpl_FaceDriver* operator->() const - { - return (GEOMImpl_FaceDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_FaceDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_FaceDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -119,22 +57,13 @@ class Handle(GEOMImpl_FaceDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_FaceDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_FaceDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_FaceDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -145,14 +74,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_FaceDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FaceDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FaceDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FaceDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_FaceDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx index 657d8a205..57768c160 100644 --- a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.cxx @@ -367,44 +367,41 @@ bool GEOMImpl_Fillet1dDriver::MakeFillet(const TopoDS_Wire& aWire, return isAllStepsOk; } - - -//======================================================================= -//function : GEOMImpl_Fillet1dDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet1dDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Fillet1dDriver", - sizeof(GEOMImpl_Fillet1dDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_Fillet1dDriver) Handle(GEOMImpl_Fillet1dDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_Fillet1dDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_Fillet1dDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Fillet1dDriver))) { - _anOtherObject = Handle(GEOMImpl_Fillet1dDriver)((Handle(GEOMImpl_Fillet1dDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFillet1d aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "FILLET_1D"; + + switch ( aType ) { + case GEOM_FILLET_1D: + AddParam( theParams, "Wire", aCI.GetShape() ); + AddParam( theParams, "Vertexes"); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " vertexes: "; + for (int i = 1; i <= aCI.GetLength(); ++i ) + theParams[1] << aCI.GetVertex( i ) << " "; + AddParam( theParams, "Radius", aCI.GetR() ); + AddParam( theParams, "Fuse collinear edges", aCI.GetFlag() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_Fillet1dDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_Fillet1dDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx index b5f96467c..e98b64084 100644 --- a/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_Fillet1dDriver.hxx @@ -44,10 +44,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - #include #include @@ -56,58 +52,7 @@ class Handle_Standard_Type; class Handle(TFunction_Driver); class GEOMImpl_Fillet1dDriver; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Fillet1dDriver); - -class Handle(GEOMImpl_Fillet1dDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_Fillet1dDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_Fillet1dDriver)(const Handle(GEOMImpl_Fillet1dDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_Fillet1dDriver)(const GEOMImpl_Fillet1dDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_Fillet1dDriver)& operator=(const Handle(GEOMImpl_Fillet1dDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_Fillet1dDriver)& operator=(const GEOMImpl_Fillet1dDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_Fillet1dDriver* operator->() - { - return (GEOMImpl_Fillet1dDriver *)ControlAccess(); - } - - GEOMImpl_Fillet1dDriver* operator->() const - { - return (GEOMImpl_Fillet1dDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_Fillet1dDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_Fillet1dDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; + #ifndef _TFunction_Driver_HeaderFile #include @@ -122,24 +67,15 @@ class Handle(GEOMImpl_Fillet1dDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_Fillet1dDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" + +DEFINE_STANDARD_HANDLE( GEOMImpl_Fillet1dDriver, GEOM_BaseDriver ); + +class GEOMImpl_Fillet1dDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_Fillet1dDriver(); Standard_EXPORT ~GEOMImpl_Fillet1dDriver() {}; @@ -150,19 +86,15 @@ public: Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {} Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; } - // Type management - // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Fillet1dDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { return STANDARD_TYPE(GEOMImpl_Fillet1dDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { return (STANDARD_TYPE(GEOMImpl_Fillet1dDriver) == AType || TFunction_Driver::IsKind(AType)); } - + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); private: Standard_EXPORT bool MakeFillet(const TopoDS_Wire&, const TopTools_ListOfShape&, const Standard_Real, bool, TopoDS_Wire&) const; +DEFINE_STANDARD_RTTI( GEOMImpl_Fillet1dDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx index f107de8e6..a6440f7bb 100755 --- a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.cxx @@ -179,44 +179,40 @@ Standard_Integer GEOMImpl_Fillet2dDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_Fillet2dDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_Fillet2dDriver", - sizeof(GEOMImpl_Fillet2dDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_Fillet2dDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_Fillet2dDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Fillet2dDriver))) { - _anOtherObject = Handle(GEOMImpl_Fillet2dDriver)((Handle(GEOMImpl_Fillet2dDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFillet2d aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "FILLET_2D"; + + switch ( aType ) { + case FILLET_2D_SHAPE_VERTEXES: + AddParam( theParams, "Face", aCI.GetShape() ); + AddParam( theParams, "Vertexes"); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " vertexes: "; + for (int i = 1; i <= aCI.GetLength(); ++i ) + theParams[1] << aCI.GetVertex( i ) << " "; + AddParam( theParams, "Radius", aCI.GetR() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_Fillet2dDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_Fillet2dDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx index 1a24255cb..dbb8e29bb 100755 --- a/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_Fillet2dDriver.hxx @@ -44,68 +44,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_Fillet2dDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Fillet2dDriver); - -class Handle(GEOMImpl_Fillet2dDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_Fillet2dDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_Fillet2dDriver)(const Handle(GEOMImpl_Fillet2dDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_Fillet2dDriver)(const GEOMImpl_Fillet2dDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_Fillet2dDriver)& operator=(const Handle(GEOMImpl_Fillet2dDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_Fillet2dDriver)& operator=(const GEOMImpl_Fillet2dDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_Fillet2dDriver* operator->() - { - return (GEOMImpl_Fillet2dDriver *)ControlAccess(); - } - - GEOMImpl_Fillet2dDriver* operator->() const - { - return (GEOMImpl_Fillet2dDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_Fillet2dDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_Fillet2dDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -119,22 +57,13 @@ class Handle(GEOMImpl_Fillet2dDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_Fillet2dDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_Fillet2dDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_Fillet2dDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -145,14 +74,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_Fillet2dDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_Fillet2dDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_Fillet2dDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_Fillet2dDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx index dad8f968e..40d4f016c 100644 --- a/src/GEOMImpl/GEOMImpl_FilletDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.cxx @@ -157,45 +157,67 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_FilletDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_FilletDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FilletDriver", - sizeof(GEOMImpl_FilletDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_FilletDriver) Handle(GEOMImpl_FilletDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_FilletDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_FilletDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FilletDriver))) { - _anOtherObject = Handle(GEOMImpl_FilletDriver)((Handle(GEOMImpl_FilletDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFillet aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "FILLET"; + + switch ( aType ) { + case FILLET_SHAPE_ALL: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected edges", "all" ); + break; + case FILLET_SHAPE_EDGES: + case FILLET_SHAPE_EDGES_2R: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected edges" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " edges: "; + for (int i = 1; i <= aCI.GetLength(); ++i ) + theParams[1] << aCI.GetEdge( i ) << " "; + if ( aType == FILLET_SHAPE_EDGES ) { + AddParam( theParams, "Radius", aCI.GetR() ); + } + else { + AddParam( theParams, "R1", aCI.GetR1() ); + AddParam( theParams, "R2", aCI.GetR2() ); + } + break; + case FILLET_SHAPE_FACES: + case FILLET_SHAPE_FACES_2R: + AddParam( theParams, "Main Object", aCI.GetShape() ); + AddParam( theParams, "Selected faces" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " faces: "; + for (int i = 1; i <= aCI.GetLength(); ++i ) + theParams[1] << aCI.GetFace( i ) << " "; + if ( aType == FILLET_SHAPE_FACES ) { + AddParam( theParams, "Radius", aCI.GetR() ); + } + else { + AddParam( theParams, "R1", aCI.GetR1() ); + AddParam( theParams, "R2", aCI.GetR2() ); + } + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_FilletDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_FilletDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_FilletDriver.hxx b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx index f85583b3b..f2c69a70e 100644 --- a/src/GEOMImpl/GEOMImpl_FilletDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FilletDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_FilletDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FilletDriver); - -class Handle(GEOMImpl_FilletDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_FilletDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_FilletDriver)(const Handle(GEOMImpl_FilletDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_FilletDriver)(const GEOMImpl_FilletDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_FilletDriver)& operator=(const Handle(GEOMImpl_FilletDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_FilletDriver)& operator=(const GEOMImpl_FilletDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_FilletDriver* operator->() - { - return (GEOMImpl_FilletDriver *)ControlAccess(); - } - - GEOMImpl_FilletDriver* operator->() const - { - return (GEOMImpl_FilletDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_FilletDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_FilletDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_FilletDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_FilletDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_FilletDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_FilletDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_FilletDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FilletDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FilletDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FilletDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_FilletDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx index 1907c7e53..77d229540 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.cxx @@ -386,44 +386,47 @@ Standard_Integer GEOMImpl_FillingDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_FillingDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_FillingDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_FillingDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_FillingDriver", - sizeof(GEOMImpl_FillingDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_FillingDriver) Handle(GEOMImpl_FillingDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_FillingDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_FillingDriver))) { - _anOtherObject = Handle(GEOMImpl_FillingDriver)((Handle(GEOMImpl_FillingDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IFilling aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "FILLING"; + + switch ( aType ) { + case BASIC_FILLING: + { + AddParam( theParams, "Input compound", aCI.GetShape() ); + AddParam( theParams, "Method", aCI.GetMethod() ); + const char* method[3] = + { "Standard", "Use edges orientation", "Correct edges orientation" }; + if ( 0 <= aCI.GetMethod() && aCI.GetMethod() < 3 ) + theParams[1] << " = " << method[ aCI.GetMethod() ]; + AddParam( theParams, "Min deg", aCI.GetMinDeg() ); + AddParam( theParams, "Max deg", aCI.GetMaxDeg() ); + AddParam( theParams, "Nb. Iter", aCI.GetNbIter() ); + AddParam( theParams, "Tol. 2D", aCI.GetTol2D() ); + AddParam( theParams, "Tol. 3D", aCI.GetTol3D() ); + AddParam( theParams, "Approximation", aCI.GetApprox() ); + break; + } + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_FillingDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_FillingDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_FillingDriver.hxx b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx index c5ddff99d..c047acb03 100644 --- a/src/GEOMImpl/GEOMImpl_FillingDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_FillingDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_FillingDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_FillingDriver); - -class Handle(GEOMImpl_FillingDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_FillingDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_FillingDriver)(const Handle(GEOMImpl_FillingDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_FillingDriver)(const GEOMImpl_FillingDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_FillingDriver)& operator=(const Handle(GEOMImpl_FillingDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_FillingDriver)& operator=(const GEOMImpl_FillingDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_FillingDriver* operator->() - { - return (GEOMImpl_FillingDriver *)ControlAccess(); - } - - GEOMImpl_FillingDriver* operator->() const - { - return (GEOMImpl_FillingDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_FillingDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_FillingDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_FillingDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_FillingDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_FillingDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_FillingDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_FillingDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_FillingDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_FillingDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_FillingDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_FillingDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx index bd4ca1b1b..3f4aa4352 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.cxx @@ -456,7 +456,7 @@ TopoDS_Shape GEOMImpl_GlueDriver::GlueWithWarnings (const TopoDS_Shape& theShape const TopTools_ListOfShape& aLSS = aIDMSS.FindFromIndex(i); aItLS.Initialize(aLSS); for (; aItLS.More(); aItLS.Next()) { - const TopoDS_Shape& aSs = aItLS.Value(); + const TopoDS_Shape& aSs = aItLS.Value(); } } */ @@ -756,8 +756,7 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aFace = aRefSh->GetValue(); if (aFace.IsNull()) continue; - if (!aFaces.Contains(aFace)) - aFaces.Add(aFace); + aFaces.Add(aFace); } Standard_Boolean aGlueAllEdges = Standard_False; @@ -781,44 +780,54 @@ Standard_Integer GEOMImpl_GlueDriver::Execute(TFunction_Logbook& log) const return 1; } -//======================================================================= -//function : GEOMImpl_GlueDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_GlueDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_GlueDriver", - sizeof(GEOMImpl_GlueDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_GlueDriver) Handle(GEOMImpl_GlueDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +bool GEOMImpl_GlueDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_GlueDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_GlueDriver))) { - _anOtherObject = Handle(GEOMImpl_GlueDriver)((Handle(GEOMImpl_GlueDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IGlue aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case GLUE_FACES: + theOperationName = "GLUE_FACES"; + AddParam( theParams, "Selected shape", aCI.GetBase() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() ); + break; + case GLUE_EDGES: + theOperationName = "GLUE_EDGES"; + AddParam( theParams, "Selected shape", aCI.GetBase() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + break; + case GLUE_FACES_BY_LIST: + theOperationName = "GLUE_FACES"; + AddParam( theParams, "Selected shape", aCI.GetBase() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + AddParam( theParams, "Faces", aCI.GetFaces() ); + AddParam( theParams, "To keep non solids", aCI.GetKeepNonSolids() ); + AddParam( theParams, "To glue all edges", aCI.GetGlueAllEdges() ); + break; + case GLUE_EDGES_BY_LIST: + theOperationName = "GLUE_EDGES"; + AddParam( theParams, "Selected shape", aCI.GetBase() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + AddParam( theParams, "Edges", aCI.GetFaces() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_GlueDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_GlueDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx index cc5ede3e2..1e1a3100e 100644 --- a/src/GEOMImpl/GEOMImpl_GlueDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_GlueDriver.hxx @@ -47,69 +47,8 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_GlueDriver; - #include -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_GlueDriver); - -class Handle(GEOMImpl_GlueDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_GlueDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_GlueDriver)(const Handle(GEOMImpl_GlueDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_GlueDriver)(const GEOMImpl_GlueDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_GlueDriver)& operator=(const Handle(GEOMImpl_GlueDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_GlueDriver)& operator=(const GEOMImpl_GlueDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_GlueDriver* operator->() - { - return (GEOMImpl_GlueDriver *)ControlAccess(); - } - - GEOMImpl_GlueDriver* operator->() const - { - return (GEOMImpl_GlueDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_GlueDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_GlueDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; #ifndef _TFunction_Driver_HeaderFile #include @@ -126,22 +65,13 @@ class Handle(GEOMImpl_GlueDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_GlueDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_GlueDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_GlueDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -152,6 +82,10 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_GlueDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); + Standard_EXPORT static TopoDS_Shape GlueFaces (const TopoDS_Shape& theShape, const Standard_Real theTolerance, const Standard_Boolean doKeepNonSolids = Standard_True); @@ -179,13 +113,7 @@ Standard_EXPORT static TopoDS_Shape GlueByList (const TopoDS_Shape& theShape, const Standard_Boolean doGlueAllEdges); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_GlueDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_GlueDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_GlueDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_GlueDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 7010b0e33..644b8a835 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -812,45 +812,105 @@ Standard_Boolean GEOMImpl_HealingDriver::AreEdgesC1 (const TopoDS_Edge& E1, cons return Standard_False; } -//======================================================================= -//function : GEOMImpl_HealingDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_HealingDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_HealingDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_HealingDriver", - sizeof(GEOMImpl_HealingDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= - -const Handle(GEOMImpl_HealingDriver) Handle(GEOMImpl_HealingDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_HealingDriver) _anOtherObject; + GEOMImpl_IHealing aCI( function ); + Standard_Integer aType = function->GetType(); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_HealingDriver))) { - _anOtherObject = Handle(GEOMImpl_HealingDriver)((Handle(GEOMImpl_HealingDriver)&)AnObject); - } + switch ( aType ) { + case SHAPE_PROCESS: + { + theOperationName = "SHAPE_PROCESS"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + Handle(TColStd_HArray1OfExtendedString) anOperators = aCI.GetOperators(); + Handle(TColStd_HArray1OfExtendedString) aParams = aCI.GetParameters(); + Handle(TColStd_HArray1OfExtendedString) aValues = aCI.GetValues(); + for ( int i = anOperators->Lower(), nb = anOperators->Upper(); i <= nb; ++i ) + { + const TCollection_ExtendedString& op = anOperators->Value(i); + AddParam( theParams, "Operation", op ); + for ( int iP = aParams->Lower(), nbP = aParams->Upper(); iP <= nbP; ++iP ) + { + const TCollection_ExtendedString& par = aParams->Value(i); + TCollection_AsciiString parAscii( par ); + if ( par.Search( op ) == 1 && parAscii.Value( op.Length() + 1 ) == '.' ) + { + GEOM_Param& p = AddParam( theParams, parAscii.ToCString() ); + if ( iP <= aValues->Upper() ) + p << aValues->Value( iP ); + } + } + } + break; } - - return _anOtherObject; + case SUPPRESS_FACES: + theOperationName = "SUPPRESS_FACES"; + AddParam( theParams, "Selected Shape", aCI.GetOriginal() ); + AddParam( theParams, "Faces to remove", aCI.GetFaces() ); + break; + case CLOSE_CONTOUR: + theOperationName = "CLOSE_CONTOUR"; + AddParam( theParams, "Selected Shape", aCI.GetOriginal() ); + AddParam( theParams, "Contour to close", aCI.GetWires() ); + AddParam( theParams, "Close by common vertex", aCI.GetIsCommonVertex() ); + break; + case REMOVE_INT_WIRES: + theOperationName = "SUPPRESS_INT_WIRES"; + AddParam( theParams, "Selected face", aCI.GetOriginal() ); + AddParam( theParams, "Wires to remove", aCI.GetWires(), "all" ); + break; + case FILL_HOLES: + theOperationName = "SUPPERSS_HOLES"; + AddParam( theParams, "Selected shape", aCI.GetOriginal() ); + AddParam( theParams, "Wires to remove", aCI.GetWires(), "all" ); + break; + case SEWING: + case SEWING_NON_MANIFOLD: + theOperationName = "SEWING"; + AddParam( theParams, "Selected shape", aCI.GetOriginal() ); + AddParam( theParams, "Allow Non Manifold", ( aType == SEWING_NON_MANIFOLD )); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + break; + case DIVIDE_EDGE: + theOperationName = "POINT_ON_EDGE"; + if ( aCI.GetIndex() > 0 ) + AddParam( theParams, "Edge", "#" ) << aCI.GetIndex() << " of " << aCI.GetOriginal(); + else + AddParam( theParams, "Edge", aCI.GetOriginal() ); + AddParam( theParams, "By parameter", aCI.GetIsByParameter() ); + AddParam( theParams, "Value", aCI.GetDevideEdgeValue() ); + break; + case CHANGE_ORIENTATION: + theOperationName = "CHANGE_ORIENTATION"; + AddParam( theParams, "Selected shape", aCI.GetOriginal() ); + break; + case LIMIT_TOLERANCE: + theOperationName = "LIMIT_TOLERANCE"; + AddParam( theParams, "Selected shape", aCI.GetOriginal() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + break; + case FUSE_COLLINEAR_EDGES: + theOperationName = "FUSE_EDGES"; + AddParam( theParams, "Wire", aCI.GetOriginal() ); + AddParam( theParams, "Vertexes", aCI.GetShapes() ); + break; + default: + return false; + } + + return true; } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_HealingDriver,GEOM_BaseDriver); + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_HealingDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx index 83dacd6fa..821dff71a 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.hxx @@ -46,72 +46,10 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_HealingDriver; - -class GEOMImpl_IHealing; #include #include #include -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_HealingDriver); - -class Handle(GEOMImpl_HealingDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_HealingDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_HealingDriver)(const Handle(GEOMImpl_HealingDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_HealingDriver)(const GEOMImpl_HealingDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_HealingDriver)& operator=(const Handle(GEOMImpl_HealingDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_HealingDriver)& operator=(const GEOMImpl_HealingDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_HealingDriver* operator->() - { - return (GEOMImpl_HealingDriver *)ControlAccess(); - } - - GEOMImpl_HealingDriver* operator->() const - { - return (GEOMImpl_HealingDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_HealingDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_HealingDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; #ifndef _TFunction_Driver_HeaderFile #include @@ -123,27 +61,18 @@ class Handle(GEOMImpl_HealingDriver) : public Handle(TFunction_Driver) { #include #endif -class TColStd_SequenceOfExtendedString; +class GEOMImpl_IHealing; + +#include "GEOM_BaseDriver.hxx" -class GEOMImpl_HealingDriver : public TFunction_Driver { +DEFINE_STANDARD_HANDLE( GEOMImpl_HealingDriver, GEOM_BaseDriver ); + +class GEOMImpl_HealingDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_HealingDriver(); Standard_EXPORT ~GEOMImpl_HealingDriver() {}; @@ -158,12 +87,14 @@ public: Standard_EXPORT static void FuseCollinearEdges (const TopoDS_Shape&, const Handle(TColStd_HSequenceOfTransient)&, TopoDS_Shape&); + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_HealingDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_HealingDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_HealingDriver) == AType || TFunction_Driver::IsKind(AType)); } +DEFINE_STANDARD_RTTI( GEOMImpl_HealingDriver ) + private: Standard_Boolean ShapeProcess ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const; diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx index 2122e643e..16a8b8ce5 100644 --- a/src/GEOMImpl/GEOMImpl_ImportDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.cxx @@ -183,46 +183,36 @@ TCollection_AsciiString GEOMImpl_ImportDriver::ReadValue(const TCollection_Ascii return aValue; } - -//======================================================================= -//function : GEOMImpl_ImportDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ImportDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ImportDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ImportDriver", - sizeof(GEOMImpl_ImportDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); + GEOMImpl_IImportExport aCI( function ); + Standard_Integer aType = function->GetType(); - return _aType; -} + theOperationName = "IMPORT"; -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ImportDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ImportDriver))) { - _anOtherObject = Handle(GEOMImpl_ImportDriver)((Handle(GEOMImpl_ImportDriver)&)AnObject); - } + switch ( aType ) { + case IMPORT_SHAPE: + AddParam( theParams, "File name", aCI.GetFileName() ); + AddParam( theParams, "Format", aCI.GetFormatName() ); + AddParam( theParams, "Plugin name", aCI.GetPluginName() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ImportDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ImportDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx index b1ba6dc72..4f177b866 100644 --- a/src/GEOMImpl/GEOMImpl_ImportDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ImportDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ImportDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ImportDriver); - -class Handle(GEOMImpl_ImportDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ImportDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ImportDriver)(const Handle(GEOMImpl_ImportDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ImportDriver)(const GEOMImpl_ImportDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ImportDriver)& operator=(const Handle(GEOMImpl_ImportDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ImportDriver)& operator=(const GEOMImpl_ImportDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ImportDriver* operator->() - { - return (GEOMImpl_ImportDriver *)ControlAccess(); - } - - GEOMImpl_ImportDriver* operator->() const - { - return (GEOMImpl_ImportDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ImportDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ImportDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -124,22 +62,13 @@ class Handle(GEOMImpl_ImportDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ImportDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ImportDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ImportDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -150,19 +79,17 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ImportDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); + // Static method Standard_EXPORT static TCollection_AsciiString ReadValue (const TCollection_AsciiString& theFileName, const TCollection_AsciiString& theLibName, const TCollection_AsciiString& theParameterName, TCollection_AsciiString& theError); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ImportDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ImportDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ImportDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ImportDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.cxx b/src/GEOMImpl/GEOMImpl_LineDriver.cxx index 73d6bbb95..06f984bda 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.cxx @@ -182,46 +182,43 @@ Standard_Integer GEOMImpl_LineDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_LineDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_LineDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_LineDriver", - sizeof(GEOMImpl_LineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_LineDriver) Handle(GEOMImpl_LineDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_LineDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_LineDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_LineDriver))) { - _anOtherObject = Handle(GEOMImpl_LineDriver)((Handle(GEOMImpl_LineDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ILine aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "LINE"; + + switch ( aType ) { + case LINE_TWO_PNT: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + break; + case LINE_TWO_FACES: + AddParam( theParams, "Face 1", aCI.GetFace1() ); + AddParam( theParams, "Face 2", aCI.GetFace2() ); + break; + case LINE_PNT_DIR: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Vector", aCI.GetPoint2() ); + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_LineDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_LineDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_LineDriver.hxx b/src/GEOMImpl/GEOMImpl_LineDriver.hxx index d68092215..2d81bfae1 100644 --- a/src/GEOMImpl/GEOMImpl_LineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_LineDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_LineDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_LineDriver); - -class Handle(GEOMImpl_LineDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_LineDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_LineDriver)(const Handle(GEOMImpl_LineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_LineDriver)(const GEOMImpl_LineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_LineDriver)& operator=(const Handle(GEOMImpl_LineDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_LineDriver)& operator=(const GEOMImpl_LineDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_LineDriver* operator->() - { - return (GEOMImpl_LineDriver *)ControlAccess(); - } - - GEOMImpl_LineDriver* operator->() const - { - return (GEOMImpl_LineDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_LineDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_LineDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_LineDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_LineDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_LineDriver, GEOM_BaseDriver ); + +class GEOMImpl_LineDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -148,13 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_LineDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_LineDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_LineDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_LineDriver) == AType || TFunction_Driver::IsKind(AType)); } - +DEFINE_STANDARD_RTTI( GEOMImpl_LineDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx index 266ad0bd6..9301a0ddd 100644 --- a/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.cxx @@ -162,46 +162,50 @@ Standard_Integer GEOMImpl_MarkerDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_MarkerDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_MarkerDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MarkerDriver", - sizeof(GEOMImpl_MarkerDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_MarkerDriver) Handle(GEOMImpl_MarkerDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_MarkerDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_MarkerDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MarkerDriver))) { - _anOtherObject = Handle(GEOMImpl_MarkerDriver)((Handle(GEOMImpl_MarkerDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IMarker aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "LOCAL_CS"; + + switch ( aType ) { + case MARKER_CS: + { + double OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ; + aCI.GetOrigin(OX, OY, OZ); + aCI.GetXDir(XDX, XDY, XDZ); + aCI.GetYDir(YDX, YDY, YDZ); + AddParam( theParams, "Coordinates of origin" ) << OX << ", " << OY << ", " << OZ; + AddParam( theParams, "X axis direction" ) << XDX << ", " << XDY << ", " << XDZ; + AddParam( theParams, "Y axis direction" ) << YDX << ", " << YDY << ", " << YDZ; + break; } - - return _anOtherObject ; + case MARKER_SHAPE: + AddParam( theParams, "Object", aCI.GetShape() ); + break; + case MARKER_PNT2VEC: + AddParam( theParams, "Point", aCI.GetOrigin() ); + AddParam( theParams, "X axis direction", aCI.GetXVec() ); + AddParam( theParams, "Y axis direction", aCI.GetYVec() ); + break; + default: + return false; + } + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_MarkerDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_MarkerDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx index 1ca7b7fdf..013afcbc4 100644 --- a/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MarkerDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_MarkerDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MarkerDriver); - -class Handle(GEOMImpl_MarkerDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_MarkerDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_MarkerDriver)(const Handle(GEOMImpl_MarkerDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_MarkerDriver)(const GEOMImpl_MarkerDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_MarkerDriver)& operator=(const Handle(GEOMImpl_MarkerDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_MarkerDriver)& operator=(const GEOMImpl_MarkerDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_MarkerDriver* operator->() - { - return (GEOMImpl_MarkerDriver *)ControlAccess(); - } - - GEOMImpl_MarkerDriver* operator->() const - { - return (GEOMImpl_MarkerDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_MarkerDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_MarkerDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_MarkerDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_MarkerDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_MarkerDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_MarkerDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,13 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_MarkerDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MarkerDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MarkerDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MarkerDriver) == AType || TFunction_Driver::IsKind(AType)); } - +DEFINE_STANDARD_RTTI( GEOMImpl_MarkerDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx index 5e77d9502..b23bf35a1 100644 --- a/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.cxx @@ -322,45 +322,48 @@ Standard_Integer GEOMImpl_MeasureDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_MeasureDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_MeasureDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_MeasureDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MeasureDriver", - sizeof(GEOMImpl_MeasureDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_MeasureDriver) Handle(GEOMImpl_MeasureDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_MeasureDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MeasureDriver))) { - _anOtherObject = Handle(GEOMImpl_MeasureDriver)((Handle(GEOMImpl_MeasureDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IMeasure aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case CDG_MEASURE: + theOperationName = "MASS_CENTER"; + AddParam( theParams, "Object", aCI.GetBase() ); + break; + case BND_BOX_MEASURE: + case BND_BOX_MEASURE_PRECISE: + theOperationName = "BND_BOX"; + AddParam( theParams, "Object", aCI.GetBase() ); + break; + case VERTEX_BY_INDEX: + theOperationName = "GetVertexByIndex"; + AddParam( theParams, "Object", aCI.GetBase() ); + AddParam( theParams, "Index", aCI.GetIndex() ); + break; + case VECTOR_FACE_NORMALE: + theOperationName = "NORMALE"; + AddParam( theParams, "Face", aCI.GetBase() ); + AddParam( theParams, "Point", aCI.GetPoint(), "face center" ); + break; + default: + return false; } - return _anOtherObject ; + return true; } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_MeasureDriver,GEOM_BaseDriver); + +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_MeasureDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx index 8a7702931..551c70db6 100644 --- a/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MeasureDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_MeasureDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MeasureDriver); - -class Handle(GEOMImpl_MeasureDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_MeasureDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_MeasureDriver)(const Handle(GEOMImpl_MeasureDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_MeasureDriver)(const GEOMImpl_MeasureDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_MeasureDriver)& operator=(const Handle(GEOMImpl_MeasureDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_MeasureDriver)& operator=(const GEOMImpl_MeasureDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_MeasureDriver* operator->() - { - return (GEOMImpl_MeasureDriver *)ControlAccess(); - } - - GEOMImpl_MeasureDriver* operator->() const - { - return (GEOMImpl_MeasureDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_MeasureDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_MeasureDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_MeasureDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_MeasureDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_MeasureDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_MeasureDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_MeasureDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MeasureDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MeasureDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MeasureDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_MeasureDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx index 3a7c98f91..920d7738d 100644 --- a/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.cxx @@ -161,46 +161,46 @@ Standard_Integer GEOMImpl_MirrorDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_MirrorDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_MirrorDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_MirrorDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_MirrorDriver", - sizeof(GEOMImpl_MirrorDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= - -const Handle(GEOMImpl_MirrorDriver) Handle(GEOMImpl_MirrorDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_MirrorDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_MirrorDriver))) { - _anOtherObject = Handle(GEOMImpl_MirrorDriver)((Handle(GEOMImpl_MirrorDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IMirror aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "MIRROR"; + + switch ( aType ) { + case MIRROR_PLANE: + case MIRROR_PLANE_COPY: + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Plane Mirror", aCI.GetPlane() ); + break; + case MIRROR_AXIS: + case MIRROR_AXIS_COPY: + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Axis Mirror", aCI.GetAxis() ); + break; + case MIRROR_POINT: + case MIRROR_POINT_COPY: + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Point Mirror", aCI.GetPoint() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_MirrorDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_MirrorDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx index 3f6e10141..e6f4100b0 100644 --- a/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_MirrorDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_MirrorDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_MirrorDriver); - -class Handle(GEOMImpl_MirrorDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_MirrorDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_MirrorDriver)(const Handle(GEOMImpl_MirrorDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_MirrorDriver)(const GEOMImpl_MirrorDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_MirrorDriver)& operator=(const Handle(GEOMImpl_MirrorDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_MirrorDriver)& operator=(const GEOMImpl_MirrorDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_MirrorDriver* operator->() - { - return (GEOMImpl_MirrorDriver *)ControlAccess(); - } - - GEOMImpl_MirrorDriver* operator->() const - { - return (GEOMImpl_MirrorDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_MirrorDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_MirrorDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_MirrorDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_MirrorDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_MirrorDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_MirrorDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_MirrorDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_MirrorDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_MirrorDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_MirrorDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_MirrorDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx index 2c870d03c..393c8a133 100644 --- a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx @@ -81,20 +81,20 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; - + Handle(GEOM_Function) aRefShape = aCI.GetShape(); TopoDS_Shape aShapeBase = aRefShape->GetValue(); Standard_Real anOffset = aCI.GetValue(); Standard_Real aTol = Precision::Confusion(); - + if (Abs(anOffset) < aTol) { - TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value ("); - aMsg += TCollection_AsciiString(aTol); - aMsg += ")"; - StdFail_NotDone::Raise(aMsg.ToCString()); + TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value ("); + aMsg += TCollection_AsciiString(aTol); + aMsg += ")"; + StdFail_NotDone::Raise(aMsg.ToCString()); } - if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) { + if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) { BRepOffsetAPI_MakeOffsetShape MO (aShapeBase, aCI.GetValue(), aTol); @@ -118,7 +118,7 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const else { StdFail_NotDone::Raise("Offset construction failed"); } - } + } else if (aType == OFFSET_THICKENING || aType == OFFSET_THICKENING_COPY) { BRepClass3d_SolidClassifier aClassifier = BRepClass3d_SolidClassifier(aShapeBase); @@ -132,13 +132,13 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin, Standard_False, Standard_False, GeomAbs_Intersection, Standard_True); - + if (!myOffsetShape.IsDone()) { StdFail_NotDone::Raise("Thickening construction failed"); } aShape = myOffsetShape.Shape(); - + // Control the solid orientation. This is mostly done to fix a bug in case of extrusion // of a circle. The built solid is then badly oriented BRepClass3d_SolidClassifier anotherClassifier = BRepClass3d_SolidClassifier(aShape); @@ -158,45 +158,41 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_OffsetDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_OffsetDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_OffsetDriver", - sizeof(GEOMImpl_OffsetDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_OffsetDriver) Handle(GEOMImpl_OffsetDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +bool GEOMImpl_OffsetDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_OffsetDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_OffsetDriver))) { - _anOtherObject = Handle(GEOMImpl_OffsetDriver)((Handle(GEOMImpl_OffsetDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IOffset aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case OFFSET_SHAPE: + case OFFSET_SHAPE_COPY: + theOperationName = "OFFSET"; + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Offset", aCI.GetValue() ); + break; + case OFFSET_THICKENING: + case OFFSET_THICKENING_COPY: + theOperationName = "MakeThickening"; + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Offset", aCI.GetValue() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_OffsetDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_OffsetDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx index 056bfe44b..e8690e7ce 100644 --- a/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_OffsetDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_OffsetDriver); - -class Handle(GEOMImpl_OffsetDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_OffsetDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_OffsetDriver)(const Handle(GEOMImpl_OffsetDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_OffsetDriver)(const GEOMImpl_OffsetDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_OffsetDriver)& operator=(const Handle(GEOMImpl_OffsetDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_OffsetDriver)& operator=(const GEOMImpl_OffsetDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_OffsetDriver* operator->() - { - return (GEOMImpl_OffsetDriver *)ControlAccess(); - } - - GEOMImpl_OffsetDriver* operator->() const - { - return (GEOMImpl_OffsetDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_OffsetDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_OffsetDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_OffsetDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_OffsetDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_OffsetDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_OffsetDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_OffsetDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_OffsetDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_OffsetDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_OffsetDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_OffsetDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx index 04363aba5..13fcd8114 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.cxx @@ -478,41 +478,54 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_PartitionDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PartitionDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[] = {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = - new Standard_Type ("GEOMImpl_PartitionDriver", sizeof(GEOMImpl_PartitionDriver), - 1, (Standard_Address)_Ancestors, (Standard_Address)NULL); - - return _aType; -} + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_PartitionDriver) _anOtherObject; + GEOMImpl_IPartition aCI( function ); + Standard_Integer aType = function->GetType(); - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PartitionDriver))) { - _anOtherObject = Handle(GEOMImpl_PartitionDriver)((Handle(GEOMImpl_PartitionDriver)&)AnObject); - } - } + theOperationName = "PARTITION"; - return _anOtherObject; + switch ( aType ) { + case PARTITION_PARTITION: + case PARTITION_NO_SELF_INTERSECTIONS: + AddParam( theParams, "Objects", aCI.GetShapes() ); + AddParam( theParams, "Tool objects", aCI.GetTools() ); + { + Handle(TColStd_HSequenceOfTransient) objSeq = aCI.GetKeepIns(); + if ( !objSeq.IsNull() && objSeq->Length() > 0 ) + AddParam( theParams, "Objects to keep inside", objSeq ); + objSeq = aCI.GetRemoveIns(); + if ( !objSeq.IsNull() && objSeq->Length() > 0 ) + AddParam( theParams, "Objects to remove inside", objSeq ); + Handle(TColStd_HArray1OfInteger) intSeq = aCI.GetMaterials(); + if ( !intSeq.IsNull() && intSeq->Length() > 0 ) + AddParam( theParams, "Materials", aCI.GetMaterials() ); + } + AddParam( theParams, "Resulting type", (TopAbs_ShapeEnum) aCI.GetLimit()); + AddParam( theParams, "Keep shapes of lower type", aCI.GetKeepNonlimitShapes()); + AddParam( theParams, "No object intersections", ( aType == PARTITION_NO_SELF_INTERSECTIONS )); + break; + case PARTITION_HALF: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Plane", aCI.GetPlane() ); + break; + default: + return false; + } + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PartitionDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PartitionDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx index 2c2d7c60e..2bcda9636 100644 --- a/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PartitionDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PartitionDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PartitionDriver); - -class Handle(GEOMImpl_PartitionDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PartitionDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PartitionDriver)(const Handle(GEOMImpl_PartitionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PartitionDriver)(const GEOMImpl_PartitionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PartitionDriver)& operator=(const Handle(GEOMImpl_PartitionDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PartitionDriver)& operator=(const GEOMImpl_PartitionDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PartitionDriver* operator->() - { - return (GEOMImpl_PartitionDriver *)ControlAccess(); - } - - GEOMImpl_PartitionDriver* operator->() const - { - return (GEOMImpl_PartitionDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PartitionDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PartitionDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_PartitionDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PartitionDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_PartitionDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_PartitionDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PartitionDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PartitionDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PartitionDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_PartitionDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 50160d3bc..de0958f1f 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -2502,42 +2502,75 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const return 1; } -//======================================================================= -//function : GEOMImpl_PipeDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeDriver", - sizeof(GEOMImpl_PipeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PipeDriver) Handle(GEOMImpl_PipeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PipeDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_PipeDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeDriver))) { - _anOtherObject = Handle(GEOMImpl_PipeDriver)((Handle(GEOMImpl_PipeDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case PIPE_BASE_PATH: + { + theOperationName = "PIPE"; + GEOMImpl_IPipe aCI( function ); + AddParam( theParams, "Base Object", aCI.GetBase() ); + AddParam( theParams, "Path Object", aCI.GetPath() ); + break; } - - return _anOtherObject; + case PIPE_BI_NORMAL_ALONG_VECTOR: + { + theOperationName = "PIPE"; + GEOMImpl_IPipeBiNormal aCI( function ); + AddParam( theParams, "Base Object", aCI.GetBase() ); + AddParam( theParams, "Path Object", aCI.GetPath() ); + AddParam( theParams, "BiNormal", aCI.GetVector() ); + break; + } + case PIPE_DIFFERENT_SECTIONS: + { + theOperationName = "PIPE"; + GEOMImpl_IPipeDiffSect aCI( function ); + AddParam( theParams, "Bases", aCI.GetBases() ); + AddParam( theParams, "Locations", aCI.GetLocations() ); + AddParam( theParams, "Path", aCI.GetPath() ); + AddParam( theParams, "With contact", aCI.GetWithContactMode() ); + AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + break; + } + case PIPE_SHELL_SECTIONS: + { + theOperationName = "PIPE"; + GEOMImpl_IPipeShellSect aCI( function ); + AddParam( theParams, "Bases", aCI.GetBases() ); + AddParam( theParams, "Sub-Bases", aCI.GetSubBases() ); + AddParam( theParams, "Locations", aCI.GetLocations() ); + AddParam( theParams, "Path", aCI.GetPath() ); + AddParam( theParams, "With contact", aCI.GetWithContactMode() ); + AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + break; + } + case PIPE_SHELLS_WITHOUT_PATH: + { + theOperationName = "PIPE"; // MakePipeShellsWithoutPath + GEOMImpl_IPipeShellSect aCI( function ); + AddParam( theParams, "Bases", aCI.GetBases() ); + AddParam( theParams, "Locations", aCI.GetLocations() ); + break; + } + default: + return false; + } + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipeDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx index 38975b64b..6db6a0c7e 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -47,69 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PipeDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeDriver); - -class Handle(GEOMImpl_PipeDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PipeDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PipeDriver)(const Handle(GEOMImpl_PipeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PipeDriver)(const GEOMImpl_PipeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PipeDriver)& operator=(const Handle(GEOMImpl_PipeDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PipeDriver)& operator=(const GEOMImpl_PipeDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PipeDriver* operator->() - { - return (GEOMImpl_PipeDriver *)ControlAccess(); - } - - GEOMImpl_PipeDriver* operator->() const - { - return (GEOMImpl_PipeDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PipeDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PipeDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -127,24 +64,15 @@ class Handle(GEOMImpl_PipeDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PipeDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" + +DEFINE_STANDARD_HANDLE( GEOMImpl_PipeDriver, GEOM_BaseDriver ); + +class GEOMImpl_PipeDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_PipeDriver(); Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; @@ -161,15 +89,14 @@ public: const Standard_Boolean theWithContact, const Standard_Boolean theWithCorrect); + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { return STANDARD_TYPE(GEOMImpl_PipeDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { return (STANDARD_TYPE(GEOMImpl_PipeDriver) == AType || - TFunction_Driver::IsKind(AType)); } +DEFINE_STANDARD_RTTI( GEOMImpl_PipeDriver ) + }; diff --git a/src/GEOMImpl/GEOMImpl_PipePathDriver.cxx b/src/GEOMImpl/GEOMImpl_PipePathDriver.cxx index 91962183d..9566aa62f 100644 --- a/src/GEOMImpl/GEOMImpl_PipePathDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipePathDriver.cxx @@ -202,42 +202,41 @@ Standard_Integer GEOMImpl_PipePathDriver::Execute (TFunction_Logbook& log) const return 1; } -//======================================================================= -//function : GEOMImpl_PipePathDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipePathDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PipePathDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipePathDriver", - sizeof(GEOMImpl_PipePathDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PipePathDriver) Handle(GEOMImpl_PipePathDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_PipePathDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipePathDriver))) { - _anOtherObject = Handle(GEOMImpl_PipePathDriver)((Handle(GEOMImpl_PipePathDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPipePath aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "PIPE_PATH"; + + switch ( aType ) { + case PIPE_PATH_TWO_BASES: + AddParam( theParams, "Pipe-like object", aCI.GetShape() ); + AddParam( theParams, "First base", aCI.GetBase1() ); + AddParam( theParams, "Second base", aCI.GetBase2() ); + break; + case PIPE_PATH_TWO_SEQS: + AddParam( theParams, "Pipe-like object", aCI.GetShape() ); + AddParam( theParams, "First bases", aCI.GetBaseSeq1() ); + AddParam( theParams, "Second bases", aCI.GetBaseSeq2() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipePathDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipePathDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PipePathDriver.hxx b/src/GEOMImpl/GEOMImpl_PipePathDriver.hxx index 3cefc6ff5..67bc80444 100644 --- a/src/GEOMImpl/GEOMImpl_PipePathDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipePathDriver.hxx @@ -47,69 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PipePathDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipePathDriver); - -class Handle(GEOMImpl_PipePathDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PipePathDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PipePathDriver)(const Handle(GEOMImpl_PipePathDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PipePathDriver)(const GEOMImpl_PipePathDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PipePathDriver)& operator=(const Handle(GEOMImpl_PipePathDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PipePathDriver)& operator=(const GEOMImpl_PipePathDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PipePathDriver* operator->() - { - return (GEOMImpl_PipePathDriver *)ControlAccess(); - } - - GEOMImpl_PipePathDriver* operator->() const - { - return (GEOMImpl_PipePathDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PipePathDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PipePathDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -127,24 +64,15 @@ class Handle(GEOMImpl_PipePathDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PipePathDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" + +DEFINE_STANDARD_HANDLE( GEOMImpl_PipePathDriver, GEOM_BaseDriver ); + +class GEOMImpl_PipePathDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_PipePathDriver(); Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; @@ -154,14 +82,13 @@ public: Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PipePathDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipePathDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { return STANDARD_TYPE(GEOMImpl_PipePathDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { return (STANDARD_TYPE(GEOMImpl_PipePathDriver) == AType || - TFunction_Driver::IsKind(AType)); } +DEFINE_STANDARD_RTTI( GEOMImpl_PipePathDriver ) + }; diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx index 7a36593ca..4446e8343 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.cxx @@ -616,41 +616,61 @@ Standard_Integer GEOMImpl_PipeTShapeDriver::Execute (TFunction_Logbook& log) con return 1; } -//======================================================================= -//function : GEOMImpl_PipeTShapeDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PipeTShapeDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PipeTShapeDriver", - sizeof(GEOMImpl_PipeTShapeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PipeTShapeDriver) Handle(GEOMImpl_PipeTShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_PipeTShapeDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PipeTShapeDriver))) { - _anOtherObject = Handle(GEOMImpl_PipeTShapeDriver)((Handle(GEOMImpl_PipeTShapeDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPipeTShape aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "PIPETSHAPE"; + + switch ( aType ) { + case TSHAPE_BASIC: + AddParam( theParams, "Main radius", aCI.GetR1() ); + AddParam( theParams, "Main width", aCI.GetW1() ); + AddParam( theParams, "Main half-length", aCI.GetL1() ); + AddParam( theParams, "Incident pipe radius", aCI.GetR2() ); + AddParam( theParams, "Incident pipe width", aCI.GetW2() ); + AddParam( theParams, "Incident pipe half-length", aCI.GetL2() ); + AddParam( theParams, "For hex mesh", aCI.GetHexMesh() ); + break; + case TSHAPE_CHAMFER: + AddParam( theParams, "Main radius", aCI.GetR1() ); + AddParam( theParams, "Main width", aCI.GetW1() ); + AddParam( theParams, "Main half-length", aCI.GetL1() ); + AddParam( theParams, "Incident pipe radius", aCI.GetR2() ); + AddParam( theParams, "Incident pipe width", aCI.GetW2() ); + AddParam( theParams, "Incident pipe half-length", aCI.GetL2() ); + AddParam( theParams, "Chamfer height", aCI.GetH() ); + AddParam( theParams, "Chamfer width", aCI.GetW() ); + AddParam( theParams, "For hex mesh", aCI.GetHexMesh() ); + break; + case TSHAPE_FILLET: + AddParam( theParams, "Main radius", aCI.GetR1() ); + AddParam( theParams, "Main width", aCI.GetW1() ); + AddParam( theParams, "Main half-length", aCI.GetL1() ); + AddParam( theParams, "Incident pipe radius", aCI.GetR2() ); + AddParam( theParams, "Incident pipe width", aCI.GetW2() ); + AddParam( theParams, "Incident pipe half-length", aCI.GetL2() ); + AddParam( theParams, "Fillet radius", aCI.GetRF() ); + AddParam( theParams, "For hex mesh", aCI.GetHexMesh() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx index 0179b9121..39396262c 100644 --- a/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeTShapeDriver.hxx @@ -36,73 +36,15 @@ class Handle_Standard_Type; class GEOMImpl_PipeTShapeDriver; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PipeTShapeDriver); -class Handle(GEOMImpl_PipeTShapeDriver) : public Handle(TFunction_Driver) { -public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PipeTShapeDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PipeTShapeDriver)(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - {} - Handle(GEOMImpl_PipeTShapeDriver)(const GEOMImpl_PipeTShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - {} +#include "GEOM_BaseDriver.hxx" - Handle(GEOMImpl_PipeTShapeDriver)& operator=(const Handle(GEOMImpl_PipeTShapeDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PipeTShapeDriver)& operator=(const GEOMImpl_PipeTShapeDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PipeTShapeDriver* operator->() - { - return (GEOMImpl_PipeTShapeDriver *)ControlAccess(); - } - - GEOMImpl_PipeTShapeDriver* operator->() const - { - return (GEOMImpl_PipeTShapeDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PipeTShapeDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PipeTShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; +DEFINE_STANDARD_HANDLE( GEOMImpl_PipeTShapeDriver, GEOM_BaseDriver ); -class GEOMImpl_PipeTShapeDriver : public TFunction_Driver { +class GEOMImpl_PipeTShapeDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_PipeTShapeDriver(); Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; @@ -114,17 +56,13 @@ public: Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PipeTShapeDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { - return STANDARD_TYPE(GEOMImpl_PipeTShapeDriver); - } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { - return (STANDARD_TYPE(GEOMImpl_PipeTShapeDriver) == AType || TFunction_Driver::IsKind(AType)); - } +DEFINE_STANDARD_RTTI( GEOMImpl_PipeTShapeDriver ) + private: /*! @@ -187,9 +125,9 @@ private: // along OX and OZ //======================================================================= void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape, - TopAbs_ShapeEnum theShapeType, + TopAbs_ShapeEnum theShapeType, double r, double r2, - Handle(TopTools_HSequenceOfShape)& commonShapes) const; + Handle(TopTools_HSequenceOfShape)& commonShapes) const; }; diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx index 16878565c..c557d8205 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.cxx @@ -247,45 +247,62 @@ Standard_Integer GEOMImpl_PlaneDriver::Execute(TFunction_Logbook& log) const } -//======================================================================= -//function : GEOMImpl_PlaneDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PlaneDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PlaneDriver", - sizeof(GEOMImpl_PlaneDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PlaneDriver) Handle(GEOMImpl_PlaneDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PlaneDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_PlaneDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PlaneDriver))) { - _anOtherObject = Handle(GEOMImpl_PlaneDriver)((Handle(GEOMImpl_PlaneDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPlane aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "PLANE"; + + switch ( aType ) { + case PLANE_PNT_VEC: + AddParam( theParams, "Point", aCI.GetPoint() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + case PLANE_THREE_PNT: + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + AddParam( theParams, "Point 3", aCI.GetPoint3() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + case PLANE_FACE: + AddParam( theParams, "Face", aCI.GetFace() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + case PLANE_TANGENT_FACE: + AddParam( theParams, "Face", aCI.GetFace() ); + AddParam( theParams, "Parameter U", aCI.GetParameterU() ); + AddParam( theParams, "Parameter V", aCI.GetParameterV() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + case PLANE_2_VEC: + AddParam( theParams, "Vector 1", aCI.GetVector1() ); + AddParam( theParams, "Vector 2", aCI.GetVector2() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + case PLANE_LCS: + AddParam( theParams, "Local coordinate system", aCI.GetLCS() ); + AddParam( theParams, "Orientation", aCI.GetOrientation() ); + AddParam( theParams, "Size of plane", aCI.GetSize() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PlaneDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PlaneDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx index 54baf0982..9c459c9e5 100644 --- a/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PlaneDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PlaneDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PlaneDriver); - -class Handle(GEOMImpl_PlaneDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PlaneDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PlaneDriver)(const Handle(GEOMImpl_PlaneDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PlaneDriver)(const GEOMImpl_PlaneDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PlaneDriver)& operator=(const Handle(GEOMImpl_PlaneDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PlaneDriver)& operator=(const GEOMImpl_PlaneDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PlaneDriver* operator->() - { - return (GEOMImpl_PlaneDriver *)ControlAccess(); - } - - GEOMImpl_PlaneDriver* operator->() const - { - return (GEOMImpl_PlaneDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PlaneDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PlaneDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_PlaneDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PlaneDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_PlaneDriver, GEOM_BaseDriver ); + +class GEOMImpl_PlaneDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -148,13 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PlaneDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PlaneDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PlaneDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PlaneDriver) == AType || TFunction_Driver::IsKind(AType)); } - +DEFINE_STANDARD_RTTI( GEOMImpl_PlaneDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index e08547a8e..6fef626e5 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -153,16 +153,16 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const TopoDS_Iterator It(aRefShape, Standard_False, Standard_False); TopoDS_Vertex aVertex; if ( It.More() ) { - TopoDS_Shape aShape = It.Value(); - if ( !aShape.IsNull() ) - aVertex = TopoDS::Vertex( aShape ); + TopoDS_Shape aShape = It.Value(); + if ( !aShape.IsNull() ) + aVertex = TopoDS::Vertex( aShape ); } if ( !aVertex.IsNull() ) { - aPnt = BRep_Tool::Pnt( aVertex ); + aPnt = BRep_Tool::Pnt( aVertex ); } else { - Standard_TypeMismatch::Raise - ("Point On Curve creation aborted : null curve"); + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : null curve"); } } } @@ -234,8 +234,8 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const gp_Pnt P2 = EdgeCurve->Value(par2); if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) { - ReOrientedCurve = EdgeCurve->Reversed(); - UFirst = EdgeCurve->ReversedParameter(ULast); + ReOrientedCurve = EdgeCurve->Reversed(); + UFirst = EdgeCurve->ReversedParameter(ULast); } // Get the point by length @@ -249,16 +249,16 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const TopoDS_Iterator It(aRefEdge, Standard_False, Standard_False); TopoDS_Vertex aVertex; if ( It.More() ) { - TopoDS_Shape aShape = It.Value(); - if ( !aShape.IsNull() ) - aVertex = TopoDS::Vertex( aShape ); + TopoDS_Shape aShape = It.Value(); + if ( !aShape.IsNull() ) + aVertex = TopoDS::Vertex( aShape ); } if ( !aVertex.IsNull() ) { - aPnt = BRep_Tool::Pnt( aVertex ); + aPnt = BRep_Tool::Pnt( aVertex ); } else { - Standard_TypeMismatch::Raise - ("Point On Curve creation aborted : null curve"); + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : null curve"); } } } @@ -360,46 +360,75 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_PointDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PointDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PointDriver", - sizeof(GEOMImpl_PointDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= - -const Handle(GEOMImpl_PointDriver) Handle(GEOMImpl_PointDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +bool GEOMImpl_PointDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_PointDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PointDriver))) { - _anOtherObject = Handle(GEOMImpl_PointDriver)((Handle(GEOMImpl_PointDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPoint aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "POINT"; + + switch ( aType ) { + case POINT_XYZ: + AddParam( theParams, "X", aCI.GetX() ); + AddParam( theParams, "Y", aCI.GetY() ); + AddParam( theParams, "Z", aCI.GetZ() ); + break; + case POINT_XYZ_REF: + AddParam( theParams, "Point", aCI.GetRef() ); + AddParam( theParams, "Dx", aCI.GetX() ); + AddParam( theParams, "Dy", aCI.GetY() ); + AddParam( theParams, "Dz", aCI.GetZ() ); + break; + case POINT_CURVE_PAR: + AddParam( theParams, "Edge", aCI.GetCurve() ); + AddParam( theParams, "Parameter", aCI.GetParameter() ); + break; + case POINT_CURVE_COORD: + AddParam( theParams, "X", aCI.GetX() ); + AddParam( theParams, "Y", aCI.GetY() ); + AddParam( theParams, "Z", aCI.GetZ() ); + AddParam( theParams, "Edge", aCI.GetCurve() ); + break; + case POINT_CURVE_LENGTH: + AddParam( theParams, "Edge", aCI.GetCurve() ); + AddParam( theParams, "Start Point", aCI.GetRef(), "First Vertex" ); + AddParam( theParams, "Length", aCI.GetLength() ); + break; + case POINT_SURFACE_PAR: + AddParam( theParams, "Face", aCI.GetSurface() ); + AddParam( theParams, "U-Parameter", aCI.GetParameter() ); + AddParam( theParams, "V-Parameter", aCI.GetParameter2() ); + break; + case POINT_SURFACE_COORD: + AddParam( theParams, "X", aCI.GetX() ); + AddParam( theParams, "Y", aCI.GetY() ); + AddParam( theParams, "Z", aCI.GetZ() ); + AddParam( theParams, "Face", aCI.GetSurface() ); + break; + case POINT_FACE_ANY: + AddParam( theParams, "Face", aCI.GetSurface() ); + break; + case POINT_LINES_INTERSECTION: + AddParam( theParams, "Line 1", aCI.GetLine1() ); + AddParam( theParams, "Line 2", aCI.GetLine2() ); + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PointDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PointDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.hxx b/src/GEOMImpl/GEOMImpl_PointDriver.hxx index 132307c87..e61a83852 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PointDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PointDriver); - -class Handle(GEOMImpl_PointDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PointDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PointDriver)(const Handle(GEOMImpl_PointDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PointDriver)(const GEOMImpl_PointDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PointDriver)& operator=(const Handle(GEOMImpl_PointDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PointDriver)& operator=(const GEOMImpl_PointDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PointDriver* operator->() - { - return (GEOMImpl_PointDriver *)ControlAccess(); - } - - GEOMImpl_PointDriver* operator->() const - { - return (GEOMImpl_PointDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PointDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PointDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_PointDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PointDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_PointDriver, GEOM_BaseDriver ); + +class GEOMImpl_PointDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -148,13 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PointDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PointDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PointDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PointDriver) == AType || TFunction_Driver::IsKind(AType)); } - +DEFINE_STANDARD_RTTI( GEOMImpl_PointDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx index c2c893879..38bfefb46 100644 --- a/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.cxx @@ -20,25 +20,24 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include +#include "GEOMImpl_PolylineDriver.hxx" -#include -#include -#include -#include +#include "GEOMImpl_ICurveParametric.hxx" +#include "GEOMImpl_IPolyline.hxx" +#include "GEOMImpl_Types.hxx" +#include "GEOM_Function.hxx" -#include -#include #include +#include #include +#include +#include +#include +#include #include #include #include #include -#include -#include - -#include #include //======================================================================= @@ -82,9 +81,9 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates(); int anArrayLength = aCoordsArray->Length(); for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) { - gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); - points.SetValue(j,aPnt); - j++; + gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); + points.SetValue(j,aPnt); + j++; } } @@ -94,39 +93,39 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const for (; ind <= aLen; ind++) { if(useCoords) { - aMakePoly.Add(BRepBuilderAPI_MakeVertex(points.Value(ind))); + aMakePoly.Add(BRepBuilderAPI_MakeVertex(points.Value(ind))); } else { - Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); - TopoDS_Shape aShapePnt = aRefPoint->GetValue(); - if (aShapePnt.ShapeType() != TopAbs_VERTEX) { - Standard_TypeMismatch::Raise - ("Polyline creation aborted : arguments are not a vertexes"); - return 0; - } - if (aShapePnt.ShapeType() == TopAbs_VERTEX) { - aMakePoly.Add(TopoDS::Vertex(aShapePnt)); - //if (!aMakePoly.Added()) return 0; - } + Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() != TopAbs_VERTEX) { + Standard_TypeMismatch::Raise + ("Polyline creation aborted : arguments are not a vertexes"); + return 0; + } + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + aMakePoly.Add(TopoDS::Vertex(aShapePnt)); + //if (!aMakePoly.Added()) return 0; + } } } // Compare first and last point coordinates and close polyline if it's the same. if ( aLen > 2 ) { TopoDS_Vertex aV1; if( useCoords ) { - aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); + aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); } else { - Handle(GEOM_Function) aFPoint = aCI.GetPoint(1); - TopoDS_Shape aFirstPnt = aFPoint->GetValue(); - aV1 = TopoDS::Vertex(aFirstPnt); + Handle(GEOM_Function) aFPoint = aCI.GetPoint(1); + TopoDS_Shape aFirstPnt = aFPoint->GetValue(); + aV1 = TopoDS::Vertex(aFirstPnt); } TopoDS_Vertex aV2; if( useCoords ) { - aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); + aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); } else { - Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen); - TopoDS_Shape aLastPnt = aLPoint->GetValue(); - aV2 = TopoDS::Vertex(aLastPnt); + Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen); + TopoDS_Shape aLastPnt = aLPoint->GetValue(); + aV2 = TopoDS::Vertex(aLastPnt); } if ( (!aV1.IsNull() && !aV2.IsNull() && aV1.IsSame(aV2)) || @@ -150,45 +149,69 @@ Standard_Integer GEOMImpl_PolylineDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_PolylineDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_() +bool GEOMImpl_PolylineDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PolylineDriver", - sizeof(GEOMImpl_PolylineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} + GEOMImpl_IPolyline aCI( function ); + GEOMImpl_ICurveParametric aIP( function ); + Standard_Integer aType = function->GetType(); -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PolylineDriver) Handle(GEOMImpl_PolylineDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_PolylineDriver) _anOtherObject; + theOperationName = "CURVE"; - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PolylineDriver))) { - _anOtherObject = Handle(GEOMImpl_PolylineDriver)((Handle(GEOMImpl_PolylineDriver)&)AnObject); - } + switch ( aType ) { + case POLYLINE_POINTS: + AddParam( theParams, "Type", "Polyline"); + if ( aIP.HasData() ) + { + AddParam( theParams, "X(t) equation", aIP.GetExprX() ); + AddParam( theParams, "Y(t) equation", aIP.GetExprY() ); + AddParam( theParams, "Z(t) equation", aIP.GetExprZ() ); + AddParam( theParams, "Min t", aIP.GetParamMin() ); + AddParam( theParams, "Max t", aIP.GetParamMax() ); + if ( aIP.GetParamNbStep() ) + AddParam( theParams, "Number of steps", aIP.GetParamNbStep() ); + else + AddParam( theParams, "t step", aIP.GetParamStep() ); + } + else + { + GEOM_Param& pntParam = AddParam( theParams, "Points"); + if ( aCI.GetConstructorType() == COORD_CONSTRUCTOR ) + { + Handle(TColStd_HArray1OfReal) coords = aCI.GetCoordinates(); + if ( coords->Length() > 3 ) + pntParam << ( coords->Length() ) / 3 << " points: "; + for ( int i = coords->Lower(), nb = coords->Upper(); i <= nb; ) + pntParam << "( " << coords->Value( i++ ) + << ", " << coords->Value( i++ ) + << ", " << coords->Value( i++ ) << " ) "; + } + else + { + if ( aCI.GetLength() > 1 ) + pntParam << aCI.GetLength() << " points: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + pntParam << aCI.GetPoint( i ) << " "; + } + AddParam( theParams, "Is closed", aCI.GetIsClosed() ); + } + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PolylineDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PolylineDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx index b14bbc84d..2577858ea 100644 --- a/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PolylineDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PolylineDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PolylineDriver); - -class Handle(GEOMImpl_PolylineDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PolylineDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PolylineDriver)(const Handle(GEOMImpl_PolylineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PolylineDriver)(const GEOMImpl_PolylineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PolylineDriver)& operator=(const Handle(GEOMImpl_PolylineDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PolylineDriver)& operator=(const GEOMImpl_PolylineDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PolylineDriver* operator->() - { - return (GEOMImpl_PolylineDriver *)ControlAccess(); - } - - GEOMImpl_PolylineDriver* operator->() const - { - return (GEOMImpl_PolylineDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PolylineDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PolylineDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_PolylineDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PolylineDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_PolylineDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_PolylineDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PolylineDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PolylineDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PolylineDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PolylineDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_PolylineDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx index 63ab02291..c33dd1c89 100644 --- a/src/GEOMImpl/GEOMImpl_PositionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.cxx @@ -219,45 +219,48 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_PositionDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PositionDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PositionDriver", - sizeof(GEOMImpl_PositionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PositionDriver) Handle(GEOMImpl_PositionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PositionDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_PositionDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PositionDriver))) { - _anOtherObject = Handle(GEOMImpl_PositionDriver)((Handle(GEOMImpl_PositionDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPosition aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "MODIFY_LOCATION"; + + switch ( aType ) { + case POSITION_SHAPE: + case POSITION_SHAPE_COPY: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Start LCS", aCI.GetStartLCS() ); + AddParam( theParams, "End LCS", aCI.GetEndLCS() ); + break; + case POSITION_SHAPE_FROM_GLOBAL: + case POSITION_SHAPE_FROM_GLOBAL_COPY: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "End LCS", aCI.GetEndLCS() ); + break; + case POSITION_ALONG_PATH: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Path", aCI.GetPath() ); + AddParam( theParams, "Distance", aCI.GetDistance() ); + AddParam( theParams, "Reverse Direction", aCI.GetReverse() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PositionDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PositionDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PositionDriver.hxx b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx index 0b774ed61..e8bc6553f 100644 --- a/src/GEOMImpl/GEOMImpl_PositionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PositionDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PositionDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PositionDriver); - -class Handle(GEOMImpl_PositionDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PositionDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PositionDriver)(const Handle(GEOMImpl_PositionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PositionDriver)(const GEOMImpl_PositionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PositionDriver)& operator=(const Handle(GEOMImpl_PositionDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PositionDriver)& operator=(const GEOMImpl_PositionDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PositionDriver* operator->() - { - return (GEOMImpl_PositionDriver *)ControlAccess(); - } - - GEOMImpl_PositionDriver* operator->() const - { - return (GEOMImpl_PositionDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PositionDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PositionDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_PositionDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PositionDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_PositionDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_PositionDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_PositionDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PositionDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PositionDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PositionDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_PositionDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index ca12bbc66..9055015b3 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -495,44 +495,63 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitS return aShape; } - -//======================================================================= -//function : GEOMImpl_PrismDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_PrismDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PrismDriver", - sizeof(GEOMImpl_PrismDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_PrismDriver) Handle(GEOMImpl_PrismDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_PrismDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_PrismDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PrismDriver))) { - _anOtherObject = Handle(GEOMImpl_PrismDriver)((Handle(GEOMImpl_PrismDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IPrism aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "EXTRUSION"; + + switch ( aType ) { + case PRISM_BASE_VEC_H: + case PRISM_BASE_VEC_H_2WAYS: + AddParam( theParams, "Base", aCI.GetBase() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Height", aCI.GetH() ); + AddParam( theParams, "Both Directions", aType == PRISM_BASE_VEC_H_2WAYS ); + AddParam( theParams, "Scale base-opposite face", aCI.GetScale() ); + break; + case PRISM_BASE_TWO_PNT: + case PRISM_BASE_TWO_PNT_2WAYS: + AddParam( theParams, "Base", aCI.GetBase() ); + AddParam( theParams, "Point 1", aCI.GetFirstPoint() ); + AddParam( theParams, "Point 2", aCI.GetLastPoint() ); + AddParam( theParams, "Both Directions", aType == PRISM_BASE_VEC_H_2WAYS ); + AddParam( theParams, "Scale base-opposite face", aCI.GetScale() ); + break; + case PRISM_BASE_DXDYDZ: + case PRISM_BASE_DXDYDZ_2WAYS: + AddParam( theParams, "Base", aCI.GetBase() ); + AddParam( theParams, "Dx", aCI.GetDX() ); + AddParam( theParams, "Dy", aCI.GetDY() ); + AddParam( theParams, "Dz", aCI.GetDZ() ); + AddParam( theParams, "Both Directions", aType == PRISM_BASE_VEC_H_2WAYS ); + AddParam( theParams, "Scale base-opposite face", aCI.GetScale() ); + break; + case DRAFT_PRISM_FEATURE: + theOperationName = aCI.GetFuseFlag() ? "EXTRUDED_BOSS" : "EXTRUDED_CUT"; + AddParam( theParams, "Initial shape", aCI.GetInitShape() ); + AddParam( theParams, "Profile", aCI.GetBase() ); + AddParam( theParams, "Height", aCI.GetH() ); + AddParam( theParams, "Draft angle", aCI.GetDraftAngle() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PrismDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PrismDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.hxx b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx index c900fca38..606836ec6 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_PrismDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_PrismDriver); - -class Handle(GEOMImpl_PrismDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_PrismDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_PrismDriver)(const Handle(GEOMImpl_PrismDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_PrismDriver)(const GEOMImpl_PrismDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_PrismDriver)& operator=(const Handle(GEOMImpl_PrismDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_PrismDriver)& operator=(const GEOMImpl_PrismDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_PrismDriver* operator->() - { - return (GEOMImpl_PrismDriver *)ControlAccess(); - } - - GEOMImpl_PrismDriver* operator->() const - { - return (GEOMImpl_PrismDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_PrismDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_PrismDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -126,24 +64,15 @@ class Handle(GEOMImpl_PrismDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_PrismDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" + +DEFINE_STANDARD_HANDLE( GEOMImpl_PrismDriver, GEOM_BaseDriver ); + +class GEOMImpl_PrismDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC Standard_EXPORT GEOMImpl_PrismDriver(); Standard_EXPORT ~GEOMImpl_PrismDriver() {}; @@ -166,12 +95,14 @@ public: bool isProtrusion, const TopoDS_Shape& theSupport); + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_PrismDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_PrismDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_PrismDriver) == AType || TFunction_Driver::IsKind(AType)); } +DEFINE_STANDARD_RTTI( GEOMImpl_PrismDriver ) + }; diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx index 7fa97753a..fcfd852c9 100644 --- a/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx @@ -220,46 +220,35 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(TFunction_Logbook& log) cons return 1; } - -//======================================================================= -//function : GEOMImpl_ProjectionDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ProjectionDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ProjectionDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ProjectionDriver", - sizeof(GEOMImpl_ProjectionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= + GEOMImpl_IMirror aCI( function ); + Standard_Integer aType = function->GetType(); -const Handle(GEOMImpl_ProjectionDriver) Handle(GEOMImpl_ProjectionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ProjectionDriver) _anOtherObject; + theOperationName = "PROJECTION"; - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ProjectionDriver))) { - _anOtherObject = Handle(GEOMImpl_ProjectionDriver)((Handle(GEOMImpl_ProjectionDriver)&)AnObject); - } + switch ( aType ) { + case PROJECTION_COPY: + AddParam( theParams, "Source object", aCI.GetOriginal() ); + AddParam( theParams, "Target face", aCI.GetPlane() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ProjectionDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ProjectionDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx index 9ee1d9407..34b4d8e9d 100644 --- a/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ProjectionDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ProjectionDriver); - -class Handle(GEOMImpl_ProjectionDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ProjectionDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ProjectionDriver)(const Handle(GEOMImpl_ProjectionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ProjectionDriver)(const GEOMImpl_ProjectionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ProjectionDriver)& operator=(const Handle(GEOMImpl_ProjectionDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ProjectionDriver)& operator=(const GEOMImpl_ProjectionDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ProjectionDriver* operator->() - { - return (GEOMImpl_ProjectionDriver *)ControlAccess(); - } - - GEOMImpl_ProjectionDriver* operator->() const - { - return (GEOMImpl_ProjectionDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ProjectionDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ProjectionDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ProjectionDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ProjectionDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ProjectionDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ProjectionDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ProjectionDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ProjectionDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ProjectionDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ProjectionDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ProjectionDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx index 8b3b25827..abb7efbc3 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.cxx @@ -138,45 +138,38 @@ Standard_Integer GEOMImpl_RevolutionDriver::Execute(TFunction_Logbook& log) cons return 1; } - -//======================================================================= -//function : GEOMImpl_RevolutionDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_RevolutionDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RevolutionDriver", - sizeof(GEOMImpl_RevolutionDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_RevolutionDriver) Handle(GEOMImpl_RevolutionDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_RevolutionDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_RevolutionDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_RevolutionDriver))) { - _anOtherObject = Handle(GEOMImpl_RevolutionDriver)((Handle(GEOMImpl_RevolutionDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IRevolution aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "REVOLUTION"; + + switch ( aType ) { + case REVOLUTION_BASE_AXIS_ANGLE: + case REVOLUTION_BASE_AXIS_ANGLE_2WAYS: + AddParam( theParams, "Object", aCI.GetBase() ); + AddParam( theParams, "Axis", aCI.GetAxis() ); + AddParam( theParams, "Angle", aCI.GetAngle() ); + AddParam( theParams, "Both Directions", aType == REVOLUTION_BASE_AXIS_ANGLE_2WAYS ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_RevolutionDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_RevolutionDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx index 296d87e3e..0496f85dc 100644 --- a/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_RevolutionDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_RevolutionDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_RevolutionDriver); - -class Handle(GEOMImpl_RevolutionDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_RevolutionDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_RevolutionDriver)(const Handle(GEOMImpl_RevolutionDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_RevolutionDriver)(const GEOMImpl_RevolutionDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_RevolutionDriver)& operator=(const Handle(GEOMImpl_RevolutionDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_RevolutionDriver)& operator=(const GEOMImpl_RevolutionDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_RevolutionDriver* operator->() - { - return (GEOMImpl_RevolutionDriver *)ControlAccess(); - } - - GEOMImpl_RevolutionDriver* operator->() const - { - return (GEOMImpl_RevolutionDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_RevolutionDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_RevolutionDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_RevolutionDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_RevolutionDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_RevolutionDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_RevolutionDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_RevolutionDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_RevolutionDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_RevolutionDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_RevolutionDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_RevolutionDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx index fc6c7ebda..4c4bcd18b 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.cxx @@ -316,43 +316,66 @@ Standard_Integer GEOMImpl_RotateDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_RotateDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_RotateDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_RotateDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_RotateDriver", - sizeof(GEOMImpl_RotateDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_RotateDriver) Handle(GEOMImpl_RotateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_RotateDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_RotateDriver))) { - _anOtherObject = Handle(GEOMImpl_RotateDriver)((Handle(GEOMImpl_RotateDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IRotate aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case ROTATE: + case ROTATE_COPY: + theOperationName = "ROTATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Axis", aCI.GetAxis() ); + AddParam( theParams, "Angle", aCI.GetAngle() ); + break; + case ROTATE_THREE_POINTS: + case ROTATE_THREE_POINTS_COPY: + theOperationName = "ROTATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Central Point", aCI.GetCentPoint() ); + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + break; + case ROTATE_1D: + theOperationName = "MUL_ROTATION"; + AddParam( theParams, "Main Object", aCI.GetOriginal() ); + AddParam( theParams, "Axis", aCI.GetAxis(), "DZ" ); + AddParam( theParams, "Nb. Times", aCI.GetNbIter1() ); + break; + case ROTATE_1D_STEP: + theOperationName = "MUL_ROTATION"; + AddParam( theParams, "Main Object", aCI.GetOriginal() ); + AddParam( theParams, "Axis", aCI.GetAxis(), "DZ" ); + AddParam( theParams, "Angular step", aCI.GetAngle() ); + AddParam( theParams, "Nb. Times", aCI.GetNbIter1() ); + break; + case ROTATE_2D: + theOperationName = "MUL_ROTATION"; + AddParam( theParams, "Main Object", aCI.GetOriginal() ); + AddParam( theParams, "Axis", aCI.GetAxis(), "DZ" ); + AddParam( theParams, "Angular step", aCI.GetAngle() ); + AddParam( theParams, "Angular Nb. Times", aCI.GetNbIter1() ); + AddParam( theParams, "Radial step", aCI.GetStep() ); + AddParam( theParams, "Radial Nb. Times", aCI.GetNbIter2() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_RotateDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_RotateDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_RotateDriver.hxx b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx index 38907c425..a332544cb 100644 --- a/src/GEOMImpl/GEOMImpl_RotateDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_RotateDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_RotateDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_RotateDriver); - -class Handle(GEOMImpl_RotateDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_RotateDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_RotateDriver)(const Handle(GEOMImpl_RotateDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_RotateDriver)(const GEOMImpl_RotateDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_RotateDriver)& operator=(const Handle(GEOMImpl_RotateDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_RotateDriver)& operator=(const GEOMImpl_RotateDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_RotateDriver* operator->() - { - return (GEOMImpl_RotateDriver *)ControlAccess(); - } - - GEOMImpl_RotateDriver* operator->() const - { - return (GEOMImpl_RotateDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_RotateDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_RotateDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_RotateDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_RotateDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_RotateDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_RotateDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_RotateDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_RotateDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_RotateDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_RotateDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_RotateDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx index 667d36767..af19b09b3 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.cxx @@ -196,45 +196,45 @@ Standard_Integer GEOMImpl_ScaleDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_ScaleDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ScaleDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ScaleDriver", - sizeof(GEOMImpl_ScaleDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ScaleDriver) Handle(GEOMImpl_ScaleDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ScaleDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_ScaleDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ScaleDriver))) { - _anOtherObject = Handle(GEOMImpl_ScaleDriver)((Handle(GEOMImpl_ScaleDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IScale aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "SCALE"; + + switch ( aType ) { + case SCALE_SHAPE: + case SCALE_SHAPE_COPY: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Central Point", aCI.GetPoint(), "origin" ); + AddParam( theParams, "Scale Factor", aCI.GetFactor() ); + break; + case SCALE_SHAPE_AXES: + case SCALE_SHAPE_AXES_COPY: + AddParam( theParams, "Object", aCI.GetShape() ); + AddParam( theParams, "Central Point", aCI.GetPoint(), "origin" ); + AddParam( theParams, "Scale Factor X", aCI.GetFactorX() ); + AddParam( theParams, "Scale Factor Y", aCI.GetFactorY() ); + AddParam( theParams, "Scale Factor Z", aCI.GetFactorZ() ); + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ScaleDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ScaleDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx index 1fd8280d5..cfdf114e6 100644 --- a/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ScaleDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ScaleDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ScaleDriver); - -class Handle(GEOMImpl_ScaleDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ScaleDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ScaleDriver)(const Handle(GEOMImpl_ScaleDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ScaleDriver)(const GEOMImpl_ScaleDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ScaleDriver)& operator=(const Handle(GEOMImpl_ScaleDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ScaleDriver)& operator=(const GEOMImpl_ScaleDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ScaleDriver* operator->() - { - return (GEOMImpl_ScaleDriver *)ControlAccess(); - } - - GEOMImpl_ScaleDriver* operator->() const - { - return (GEOMImpl_ScaleDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ScaleDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ScaleDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_ScaleDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ScaleDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ScaleDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_ScaleDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ScaleDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ScaleDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ScaleDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ScaleDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ScaleDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 6dee4254b..e89a67fd8 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -93,7 +93,7 @@ //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f //static // void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, -// const Handle(TopTools_HSequenceOfShape)& aWires); +// const Handle(TopTools_HSequenceOfShape)& aWires); //modified by NIZNHY-PKV Wed Dec 28 13:48:23 2011t //======================================================================= @@ -974,48 +974,88 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire, return ResEdge; } -//======================================================================= -//function : GEOMImpl_ShapeDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ShapeDriver", - sizeof(GEOMImpl_ShapeDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ShapeDriver) Handle(GEOMImpl_ShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +bool GEOMImpl_ShapeDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_ShapeDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ShapeDriver))) { - _anOtherObject = Handle(GEOMImpl_ShapeDriver)((Handle(GEOMImpl_ShapeDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IShapes aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case WIRE_EDGES: + theOperationName = "WIRE"; + AddParam( theParams, "Wires/edges", aCI.GetShapes() ); + AddParam( theParams, "Tolerance", aCI.GetTolerance() ); + break; + case FACE_WIRE: + theOperationName = "FACE"; + AddParam( theParams, "Wire/edge", aCI.GetBase() ); + AddParam( theParams, "Is planar wanted", aCI.GetIsPlanar() ); + break; + case FACE_WIRES: + theOperationName = "FACE"; + AddParam( theParams, "Wires/edges", aCI.GetShapes() ); + AddParam( theParams, "Is planar wanted", aCI.GetIsPlanar() ); + break; + case SHELL_FACES: + theOperationName = "SHELL"; + AddParam( theParams, "Objects", aCI.GetShapes() ); + break; + case SOLID_SHELL: + case SOLID_SHELLS: + theOperationName = "SOLID"; + AddParam( theParams, "Objects", aCI.GetShapes() ); + break; + case COMPOUND_SHAPES: + theOperationName = "COMPOUND"; + AddParam( theParams, "Objects", aCI.GetShapes() ); + break; + case EDGE_WIRE: + theOperationName = "EDGE"; + AddParam( theParams, "Wire", aCI.GetBase() ); + AddParam( theParams, "Linear Tolerance", aCI.GetTolerance() ); + AddParam( theParams, "Angular Tolerance", aCI.GetAngularTolerance() ); + break; + case EDGE_CURVE_LENGTH: + theOperationName = "EDGE"; + { + GEOMImpl_IVector aCI( function ); + AddParam( theParams, "Edge", aCI.GetPoint1() ); + AddParam( theParams, "Start point", aCI.GetPoint2() ); + AddParam( theParams, "Length", aCI.GetParameter() ); + } + break; + case SHAPES_ON_SHAPE: + { + theOperationName = "GetShapesOnShapeAsCompound"; + Handle(TColStd_HSequenceOfTransient) shapes = aCI.GetShapes(); + if ( !shapes.IsNull() && shapes->Length() > 0 ) + AddParam( theParams, "Check shape", shapes->Value(1) ); + if ( !shapes.IsNull() && shapes->Length() > 1 ) + AddParam( theParams, "Shape", shapes->Value(2) ); + AddParam( theParams, "Shape type", TopAbs_ShapeEnum( aCI.GetSubShapeType() )); + AddParam( theParams, "State", TopAbs_State( aCI.GetTolerance() )); + break; + } + default: + return false; } - return _anOtherObject; + return true; } +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ShapeDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ShapeDriver,GEOM_BaseDriver); + //modified by NIZNHY-PKV Wed Dec 28 13:48:31 2011f #include #include @@ -1031,7 +1071,7 @@ const Handle(GEOMImpl_ShapeDriver) Handle(GEOMImpl_ShapeDriver)::DownCast(const //======================================================================= /* void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, - const Handle(TopTools_HSequenceOfShape)& aWires) + const Handle(TopTools_HSequenceOfShape)& aWires) { Standard_Integer aNbWires, aNbEdges; // @@ -1070,7 +1110,7 @@ void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, for (j=1; j<=aNbEdges; ++j) { const TopoDS_Shape& aE=aEdges->Value(j); if (aMEx.Contains(aE)) { - aBB.Add(aWy, aE); + aBB.Add(aWy, aE); } } // diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx index 7c1fcd1de..650a16948 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ShapeDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ShapeDriver); - -class Handle(GEOMImpl_ShapeDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ShapeDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ShapeDriver)(const Handle(GEOMImpl_ShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ShapeDriver)(const GEOMImpl_ShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ShapeDriver)& operator=(const Handle(GEOMImpl_ShapeDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ShapeDriver)& operator=(const GEOMImpl_ShapeDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ShapeDriver* operator->() - { - return (GEOMImpl_ShapeDriver *)ControlAccess(); - } - - GEOMImpl_ShapeDriver* operator->() const - { - return (GEOMImpl_ShapeDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ShapeDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -127,24 +65,15 @@ class Handle(GEOMImpl_ShapeDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ShapeDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" + +DEFINE_STANDARD_HANDLE( GEOMImpl_ShapeDriver, GEOM_BaseDriver ); + +class GEOMImpl_ShapeDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_ShapeDriver(); Standard_EXPORT ~GEOMImpl_ShapeDriver() {}; @@ -161,12 +90,14 @@ public: Standard_EXPORT static TopoDS_Wire MakeWireFromEdges (const Handle(TColStd_HSequenceOfTransient)& theEdgesFuncs, const Standard_Real theTolerance); + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ShapeDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ShapeDriver) ; } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ShapeDriver) == AType || TFunction_Driver::IsKind(AType)); } +DEFINE_STANDARD_RTTI( GEOMImpl_ShapeDriver ) + }; diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx index 7209552d5..750770800 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.cxx @@ -131,45 +131,50 @@ Standard_Integer GEOMImpl_SketcherDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_SketcherDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_SketcherDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_SketcherDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SketcherDriver", - sizeof(GEOMImpl_SketcherDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_SketcherDriver) Handle(GEOMImpl_SketcherDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_SketcherDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SketcherDriver))) { - _anOtherObject = Handle(GEOMImpl_SketcherDriver)((Handle(GEOMImpl_SketcherDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISketcher aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "SKETCH"; + + switch ( aType ) { + case SKETCHER_NINE_DOUBLS: + AddParam( theParams, "Command", aCI.GetCommand() ); + AddParam( theParams, "Origin") + << aCI.GetWorkingPlane(1) << " " + << aCI.GetWorkingPlane(2) << " " + << aCI.GetWorkingPlane(3); + AddParam( theParams, "OZ") + << aCI.GetWorkingPlane(4) << " " + << aCI.GetWorkingPlane(5) << " " + << aCI.GetWorkingPlane(6); + AddParam( theParams, "OX") + << aCI.GetWorkingPlane(7) << " " + << aCI.GetWorkingPlane(8) << " " + << aCI.GetWorkingPlane(9); + break; + case SKETCHER_PLANE: + AddParam( theParams, "Command", aCI.GetCommand() ); + AddParam( theParams, "Working plane", aCI.GetWorkingPlane(), "XOY" ); + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SketcherDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SketcherDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx index e824610ea..6df338cc8 100644 --- a/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SketcherDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_SketcherDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SketcherDriver); - -class Handle(GEOMImpl_SketcherDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_SketcherDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_SketcherDriver)(const Handle(GEOMImpl_SketcherDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_SketcherDriver)(const GEOMImpl_SketcherDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_SketcherDriver)& operator=(const Handle(GEOMImpl_SketcherDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_SketcherDriver)& operator=(const GEOMImpl_SketcherDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_SketcherDriver* operator->() - { - return (GEOMImpl_SketcherDriver *)ControlAccess(); - } - - GEOMImpl_SketcherDriver* operator->() const - { - return (GEOMImpl_SketcherDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_SketcherDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_SketcherDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_SketcherDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_SketcherDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_SketcherDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_SketcherDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_SketcherDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SketcherDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SketcherDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SketcherDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_SketcherDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx index 02c4f5695..af1629504 100644 --- a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.cxx @@ -193,41 +193,38 @@ Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log return 1; } -//======================================================================= -//function : GEOMImpl_SmoothingSurfaceDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_() -{ - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SmoothingSurfaceDriver", - sizeof(GEOMImpl_SmoothingSurfaceDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_SmoothingSurfaceDriver) Handle(GEOMImpl_SmoothingSurfaceDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_SmoothingSurfaceDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_SmoothingSurfaceDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver))) { - _anOtherObject = Handle(GEOMImpl_SmoothingSurfaceDriver)((Handle(GEOMImpl_SmoothingSurfaceDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISmoothingSurface aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "SMOOTHINGSURFACE"; + + switch ( aType ) { + case SMOOTHINGSURFACE_LPOINTS: + AddParam( theParams, "Points" ); + if ( aCI.GetLength() > 1 ) + theParams[1] << aCI.GetLength() << " points: "; + for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i ) + theParams[0] << aCI.GetPoint( i ) << " "; + break; + default: + return false; } - - return _anOtherObject; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx index 2d8a4d4aa..3559fcc45 100644 --- a/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SmoothingSurfaceDriver.hxx @@ -37,73 +37,15 @@ class Handle_Standard_Type; class GEOMImpl_SmoothingSurfaceDriver; -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver); -class Handle(GEOMImpl_SmoothingSurfaceDriver) : public Handle(TFunction_Driver) { -public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_SmoothingSurfaceDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_SmoothingSurfaceDriver)(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - {} - Handle(GEOMImpl_SmoothingSurfaceDriver)(const GEOMImpl_SmoothingSurfaceDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - {} +#include "GEOM_BaseDriver.hxx" - Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const Handle(GEOMImpl_SmoothingSurfaceDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_SmoothingSurfaceDriver)& operator=(const GEOMImpl_SmoothingSurfaceDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_SmoothingSurfaceDriver* operator->() - { - return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess(); - } - - GEOMImpl_SmoothingSurfaceDriver* operator->() const - { - return (GEOMImpl_SmoothingSurfaceDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_SmoothingSurfaceDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_SmoothingSurfaceDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; +DEFINE_STANDARD_HANDLE( GEOMImpl_SmoothingSurfaceDriver, GEOM_BaseDriver ); -class GEOMImpl_SmoothingSurfaceDriver : public TFunction_Driver { +class GEOMImpl_SmoothingSurfaceDriver : public GEOM_BaseDriver { public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - // Methods PUBLIC + // Methods PUBLIC // Standard_EXPORT GEOMImpl_SmoothingSurfaceDriver(); Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const; @@ -115,17 +57,13 @@ public: Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_SmoothingSurfaceDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); // Type management // - Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SmoothingSurfaceDriver_Type_(); - Standard_EXPORT const Handle(Standard_Type)& DynamicType() const - { - return STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver); - } - Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const - { - return (STANDARD_TYPE(GEOMImpl_SmoothingSurfaceDriver) == AType || TFunction_Driver::IsKind(AType)); - } +DEFINE_STANDARD_RTTI( GEOMImpl_SmoothingSurfaceDriver ) + private: TopoDS_Shape MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const; }; diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.cxx b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx index d00ba25ef..678ae0b3d 100644 --- a/src/GEOMImpl/GEOMImpl_SphereDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.cxx @@ -102,45 +102,38 @@ Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_SphereDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_SphereDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SphereDriver", - sizeof(GEOMImpl_SphereDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_SphereDriver) Handle(GEOMImpl_SphereDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_SphereDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_SphereDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SphereDriver))) { - _anOtherObject = Handle(GEOMImpl_SphereDriver)((Handle(GEOMImpl_SphereDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISphere aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "SPHERE"; + + switch ( aType ) { + case SPHERE_R: + AddParam( theParams, "Radius", aCI.GetR() ); + break; + case SPHERE_PNT_R: + AddParam( theParams, "Center", aCI.GetPoint() ); + AddParam( theParams, "Radius", aCI.GetR() ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SphereDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SphereDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_SphereDriver.hxx b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx index d9e239d26..5c583e7eb 100644 --- a/src/GEOMImpl/GEOMImpl_SphereDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SphereDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_SphereDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SphereDriver); - -class Handle(GEOMImpl_SphereDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_SphereDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_SphereDriver)(const Handle(GEOMImpl_SphereDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_SphereDriver)(const GEOMImpl_SphereDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_SphereDriver)& operator=(const Handle(GEOMImpl_SphereDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_SphereDriver)& operator=(const GEOMImpl_SphereDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_SphereDriver* operator->() - { - return (GEOMImpl_SphereDriver *)ControlAccess(); - } - - GEOMImpl_SphereDriver* operator->() const - { - return (GEOMImpl_SphereDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_SphereDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_SphereDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_SphereDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_SphereDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_SphereDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_SphereDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_SphereDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SphereDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SphereDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SphereDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_SphereDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx index af164fe7f..137884356 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.cxx @@ -20,13 +20,14 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include +#include "GEOMImpl_SplineDriver.hxx" -#include -#include +#include "GEOMImpl_ISpline.hxx" +#include "GEOMImpl_Types.hxx" +#include "GEOMImpl_ICurveParametric.hxx" -#include -#include +#include "GEOM_Function.hxx" +#include "GEOMUtils.hxx" #include #include @@ -40,7 +41,6 @@ #include #include -//#include #include #include @@ -50,8 +50,6 @@ #include #include -#include - #include //======================================================================= @@ -112,9 +110,9 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const if (useCoords) { int anArrayLength = aCoordsArray->Length(); for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) { - gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); - points.SetValue(j, aPnt); - j++; + gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3)); + points.SetValue(j, aPnt); + j++; } } @@ -123,22 +121,22 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const if (aType == SPLINE_BEZIER && aCI.GetIsClosed()) { TopoDS_Vertex aV1; if (useCoords) { - aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); + aV1 = BRepBuilderAPI_MakeVertex(points.Value(1)); } else { - Handle(GEOM_Function) aFPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(1)); - TopoDS_Shape aFirstPnt = aFPoint->GetValue(); - aV1 = TopoDS::Vertex(aFirstPnt); + Handle(GEOM_Function) aFPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(1)); + TopoDS_Shape aFirstPnt = aFPoint->GetValue(); + aV1 = TopoDS::Vertex(aFirstPnt); } TopoDS_Vertex aV2; if (useCoords) { - aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); + aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen)); } else { - Handle(GEOM_Function) aLPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(aLen)); - TopoDS_Shape aLastPnt = aLPoint->GetValue(); - aV2 = TopoDS::Vertex(aLastPnt); + Handle(GEOM_Function) aLPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(aLen)); + TopoDS_Shape aLastPnt = aLPoint->GetValue(); + aV2 = TopoDS::Vertex(aLastPnt); } if (!aV1.IsNull() && !aV2.IsNull() && !aV1.IsSame(aV2)) { @@ -154,7 +152,7 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const for (ind = 1; ind <= aLen; ind++) { gp_Pnt aP; if (useCoords) { - aP = points.Value(ind); + aP = points.Value(ind); if (!isSeveral && ind > 1) { if (aP.Distance(aPrevP) > Precision::Confusion()) { isSeveral = Standard_True; @@ -164,18 +162,18 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const aPrevP = aP; } else { - Handle(GEOM_Function) aRefPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(ind)); - TopoDS_Shape aShapePnt = aRefPoint->GetValue(); - if (aShapePnt.ShapeType() == TopAbs_VERTEX) { - aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); - if (!isSeveral && ind > 1) { - if (aP.Distance(aPrevP) > Precision::Confusion()) { - isSeveral = Standard_True; - } - } - CurvePoints.SetValue(ind, aP); - aPrevP = aP; - } + Handle(GEOM_Function) aRefPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(ind)); + TopoDS_Shape aShapePnt = aRefPoint->GetValue(); + if (aShapePnt.ShapeType() == TopAbs_VERTEX) { + aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); + if (!isSeveral && ind > 1) { + if (aP.Distance(aPrevP) > Precision::Confusion()) { + isSeveral = Standard_True; + } + } + CurvePoints.SetValue(ind, aP); + aPrevP = aP; + } } } @@ -268,45 +266,72 @@ Standard_Integer GEOMImpl_SplineDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_SplineDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_SplineDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_SplineDriver", - sizeof(GEOMImpl_SplineDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_SplineDriver) Handle(GEOMImpl_SplineDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +bool GEOMImpl_SplineDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_SplineDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_SplineDriver))) { - _anOtherObject = Handle(GEOMImpl_SplineDriver)((Handle(GEOMImpl_SplineDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ISpline aCI( function ); + GEOMImpl_ICurveParametric aPI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "CURVE"; + + switch ( aType ) { + case SPLINE_BEZIER: + case SPLINE_INTERPOLATION: + case SPLINE_INTERPOL_TANGENTS: + + AddParam( theParams, "Type", ( aType == SPLINE_BEZIER ? "Bezier" : "Interpolation")); + + if ( aPI.HasData() ) + { + AddParam( theParams, "X(t) equation", aPI.GetExprX() ); + AddParam( theParams, "Y(t) equation", aPI.GetExprY() ); + AddParam( theParams, "Z(t) equation", aPI.GetExprZ() ); + AddParam( theParams, "Min t", aPI.GetParamMin() ); + AddParam( theParams, "Max t", aPI.GetParamMax() ); + if ( aPI.GetParamNbStep() ) + AddParam( theParams, "Number of steps", aPI.GetParamNbStep() ); + else + AddParam( theParams, "t step", aPI.GetParamStep() ); + } + else + { + if ( aCI.GetConstructorType() == COORD_CONSTRUCTOR ) + { + Handle(TColStd_HArray1OfReal) coords = aCI.GetCoordinates(); + GEOM_Param& pntParam = AddParam( theParams, "Points"); + pntParam << ( coords->Length() ) / 3 << " points: "; + for ( int i = coords->Lower(), nb = coords->Upper(); i <= nb; ) + pntParam << "( " << coords->Value( i++ ) + << ", " << coords->Value( i++ ) + << ", " << coords->Value( i++ ) << " ) "; + } + else + { + AddParam( theParams, "Points", aCI.GetPoints() ); + } + Handle(GEOM_Function) v1 = aCI.GetFirstVector(); + Handle(GEOM_Function) v2 = aCI.GetLastVector(); + if ( !v1.IsNull() ) AddParam( theParams, "First tangent vector", v1 ); + if ( !v2.IsNull() ) AddParam( theParams, "Last tangent vector", v2 ); + } + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SplineDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SplineDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_SplineDriver.hxx b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx index 9413dcaaa..3212e1850 100644 --- a/src/GEOMImpl/GEOMImpl_SplineDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_SplineDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_SplineDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_SplineDriver); - -class Handle(GEOMImpl_SplineDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_SplineDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_SplineDriver)(const Handle(GEOMImpl_SplineDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_SplineDriver)(const GEOMImpl_SplineDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_SplineDriver)& operator=(const Handle(GEOMImpl_SplineDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_SplineDriver)& operator=(const GEOMImpl_SplineDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_SplineDriver* operator->() - { - return (GEOMImpl_SplineDriver *)ControlAccess(); - } - - GEOMImpl_SplineDriver* operator->() const - { - return (GEOMImpl_SplineDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_SplineDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_SplineDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_SplineDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_SplineDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_SplineDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_SplineDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_SplineDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_SplineDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_SplineDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_SplineDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_SplineDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx index 3a63ca30c..c9e343442 100644 --- a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.cxx @@ -154,45 +154,38 @@ Standard_Integer GEOMImpl_ThruSectionsDriver::Execute(TFunction_Logbook& log) co return 1; } - -//======================================================================= -//function : GEOMImpl_ThruSectionsDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_ThruSectionsDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_ThruSectionsDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_ThruSectionsDriver", - sizeof(GEOMImpl_ThruSectionsDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_ThruSectionsDriver) Handle(GEOMImpl_ThruSectionsDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_ThruSectionsDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_ThruSectionsDriver))) { - _anOtherObject = Handle(GEOMImpl_ThruSectionsDriver)((Handle(GEOMImpl_ThruSectionsDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IThruSections aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "MakeThruSections"; + + switch ( aType ) { + case THRUSECTIONS_RULED: + case THRUSECTIONS_SMOOTHED: + AddParam( theParams, "Sections", aCI.GetSections() ); + AddParam( theParams, "Is solid", aCI.GetSolidMode() ); + AddParam( theParams, "Precision", aCI.GetPrecision() ); + AddParam( theParams, "Is ruled", aType == THRUSECTIONS_RULED ); + break; + default: + return false; } - - return _anOtherObject ; + + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_ThruSectionsDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_ThruSectionsDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx index d6dc91730..5477729af 100644 --- a/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ThruSectionsDriver.hxx @@ -50,69 +50,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_ThruSectionsDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_ThruSectionsDriver); - -class Handle(GEOMImpl_ThruSectionsDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_ThruSectionsDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_ThruSectionsDriver)(const Handle(GEOMImpl_ThruSectionsDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_ThruSectionsDriver)(const GEOMImpl_ThruSectionsDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_ThruSectionsDriver)& operator=(const Handle(GEOMImpl_ThruSectionsDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_ThruSectionsDriver)& operator=(const GEOMImpl_ThruSectionsDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_ThruSectionsDriver* operator->() - { - return (GEOMImpl_ThruSectionsDriver *)ControlAccess(); - } - - GEOMImpl_ThruSectionsDriver* operator->() const - { - return (GEOMImpl_ThruSectionsDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_ThruSectionsDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_ThruSectionsDriver) DownCast(const Handle(Standard_Transient)& AnObject); - -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -126,22 +63,13 @@ class Handle(GEOMImpl_ThruSectionsDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_ThruSectionsDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_ThruSectionsDriver, GEOM_BaseDriver ); + +class GEOMImpl_ThruSectionsDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -152,14 +80,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_ThruSectionsDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_ThruSectionsDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_ThruSectionsDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_ThruSectionsDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_ThruSectionsDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.cxx b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx index cf77d8d52..56df50c2d 100644 --- a/src/GEOMImpl/GEOMImpl_TorusDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.cxx @@ -120,45 +120,41 @@ Standard_Integer GEOMImpl_TorusDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_TorusDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_TorusDriver_Type_() +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_TorusDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TorusDriver", - sizeof(GEOMImpl_TorusDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_TorusDriver) Handle(GEOMImpl_TorusDriver)::DownCast(const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_TorusDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_TorusDriver))) { - _anOtherObject = Handle(GEOMImpl_TorusDriver)((Handle(GEOMImpl_TorusDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ITorus aCI( function ); + Standard_Integer aType = function->GetType(); + + theOperationName = "TORUS"; + + switch ( aType ) { + case TORUS_RR: + AddParam( theParams, "Radius 1", aCI.GetRMajor() ); + AddParam( theParams, "Radius 2", aCI.GetRMinor() ); + break; + case TORUS_PNT_VEC_RR: + AddParam( theParams, "Base Point", aCI.GetCenter() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Radius 1", aCI.GetRMajor() ); + AddParam( theParams, "Radius 2", aCI.GetRMinor() ); + break; + default: + return false; } - return _anOtherObject ; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_TorusDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_TorusDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_TorusDriver.hxx b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx index 40cf9f5b5..a3469e1b2 100644 --- a/src/GEOMImpl/GEOMImpl_TorusDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_TorusDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_TorusDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_TorusDriver); - -class Handle(GEOMImpl_TorusDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_TorusDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_TorusDriver)(const Handle(GEOMImpl_TorusDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_TorusDriver)(const GEOMImpl_TorusDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_TorusDriver)& operator=(const Handle(GEOMImpl_TorusDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_TorusDriver)& operator=(const GEOMImpl_TorusDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_TorusDriver* operator->() - { - return (GEOMImpl_TorusDriver *)ControlAccess(); - } - - GEOMImpl_TorusDriver* operator->() const - { - return (GEOMImpl_TorusDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_TorusDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_TorusDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_TorusDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_TorusDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_TorusDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_TorusDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_TorusDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_TorusDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_TorusDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_TorusDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_TorusDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx index a76af8900..693111163 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.cxx @@ -277,44 +277,73 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const return 1; } - -//======================================================================= -//function : GEOMImpl_TranslateDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_() -{ - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_TranslateDriver", - sizeof(GEOMImpl_TranslateDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_TranslateDriver) Handle(GEOMImpl_TranslateDriver)::DownCast(const Handle(Standard_Transient)& AnObject) +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ + +bool GEOMImpl_TranslateDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - Handle(GEOMImpl_TranslateDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_TranslateDriver))) { - _anOtherObject = Handle(GEOMImpl_TranslateDriver)((Handle(GEOMImpl_TranslateDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_ITranslate aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case TRANSLATE_TWO_POINTS: + case TRANSLATE_TWO_POINTS_COPY: + theOperationName = "TRANSLATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + break; + case TRANSLATE_VECTOR: + case TRANSLATE_VECTOR_COPY: + theOperationName = "TRANSLATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + break; + case TRANSLATE_VECTOR_DISTANCE: + theOperationName = "TRANSLATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Vector", aCI.GetVector() ); + AddParam( theParams, "Distance", aCI.GetDistance() ); + break; + case TRANSLATE_XYZ: + case TRANSLATE_XYZ_COPY: + theOperationName = "TRANSLATION"; + AddParam( theParams, "Object", aCI.GetOriginal() ); + AddParam( theParams, "Dx", aCI.GetDX() ); + AddParam( theParams, "Dy", aCI.GetDY() ); + AddParam( theParams, "Dz", aCI.GetDZ() ); + break; + case TRANSLATE_1D: + theOperationName = "MUL_TRANSLATION"; + AddParam( theParams, "Main Object", aCI.GetOriginal() ); + AddParam( theParams, "Vector", aCI.GetVector(), "DX" ); + AddParam( theParams, "Step", aCI.GetStep1() ); + AddParam( theParams, "Nb. Times", aCI.GetNbIter1() ); + break; + case TRANSLATE_2D: + theOperationName = "MUL_TRANSLATION"; + AddParam( theParams, "Main Object", aCI.GetOriginal() ); + AddParam( theParams, "Vector U", aCI.GetVector(), "DX" ); + AddParam( theParams, "Vector V", aCI.GetVector2(), "DY" ); + AddParam( theParams, "Step U", aCI.GetStep1() ); + AddParam( theParams, "Nb. Times U", aCI.GetNbIter1() ); + AddParam( theParams, "Step V", aCI.GetStep2() ); + AddParam( theParams, "Nb. Times V", aCI.GetNbIter2() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_TranslateDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_TranslateDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx index eb8ca0efe..d9a45534e 100644 --- a/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_TranslateDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_TranslateDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_TranslateDriver); - -class Handle(GEOMImpl_TranslateDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_TranslateDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_TranslateDriver)(const Handle(GEOMImpl_TranslateDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_TranslateDriver)(const GEOMImpl_TranslateDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_TranslateDriver)& operator=(const Handle(GEOMImpl_TranslateDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_TranslateDriver)& operator=(const GEOMImpl_TranslateDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_TranslateDriver* operator->() - { - return (GEOMImpl_TranslateDriver *)ControlAccess(); - } - - GEOMImpl_TranslateDriver* operator->() const - { - return (GEOMImpl_TranslateDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_TranslateDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_TranslateDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_TranslateDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_TranslateDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_TranslateDriver, GEOM_BaseDriver ); - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +class GEOMImpl_TranslateDriver : public GEOM_BaseDriver { + +public: // Methods PUBLIC // @@ -148,14 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_TranslateDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_TranslateDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_TranslateDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_TranslateDriver) == AType || TFunction_Driver::IsKind(AType)); } - - +DEFINE_STANDARD_RTTI( GEOMImpl_TranslateDriver ) }; #endif diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.cxx b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx index f691fdfa3..23895d05d 100644 --- a/src/GEOMImpl/GEOMImpl_VectorDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.cxx @@ -20,28 +20,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include +#include "GEOMImpl_VectorDriver.hxx" -#include -#include -#include -#include +#include "GEOMImpl_IVector.hxx" +#include "GEOMImpl_Types.hxx" +#include "GEOM_Function.hxx" +#include "GEOM_Object.hxx" -#include #include - +#include +#include +#include +#include #include #include #include #include #include #include - #include -#include -#include #include -#include + #include //======================================================================= @@ -156,46 +155,55 @@ Standard_Integer GEOMImpl_VectorDriver::Execute(TFunction_Logbook& log) const return 1; } +//================================================================================ +/*! + * \brief Returns a name of creation operation and names and values of creation parameters + */ +//================================================================================ -//======================================================================= -//function : GEOMImpl_VectorDriver_Type_ -//purpose : -//======================================================================= -Standard_EXPORT Handle_Standard_Type& GEOMImpl_VectorDriver_Type_() +bool GEOMImpl_VectorDriver:: +GetCreationInformation(std::string& theOperationName, + std::vector& theParams) { - - static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver); - if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver); - static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared); - if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared); - static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient); - if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient); - - - static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL}; - static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_VectorDriver", - sizeof(GEOMImpl_VectorDriver), - 1, - (Standard_Address)_Ancestors, - (Standard_Address)NULL); - - return _aType; -} - -//======================================================================= -//function : DownCast -//purpose : -//======================================================================= -const Handle(GEOMImpl_VectorDriver) Handle(GEOMImpl_VectorDriver)::DownCast - (const Handle(Standard_Transient)& AnObject) -{ - Handle(GEOMImpl_VectorDriver) _anOtherObject; - - if (!AnObject.IsNull()) { - if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_VectorDriver))) { - _anOtherObject = Handle(GEOMImpl_VectorDriver)((Handle(GEOMImpl_VectorDriver)&)AnObject); - } + if (Label().IsNull()) return 0; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + GEOMImpl_IVector aCI( function ); + Standard_Integer aType = function->GetType(); + + switch ( aType ) { + case VECTOR_DX_DY_DZ: + theOperationName = "VECTOR"; + AddParam( theParams, "Dx", aCI.GetDX() ); + AddParam( theParams, "Dy", aCI.GetDY() ); + AddParam( theParams, "Dz", aCI.GetDZ() ); + break; + case VECTOR_TWO_PNT: { + TDF_Label label = Label(); + Handle(GEOM_Object) obj = GEOM_Object::GetObject( label ); + if ( !obj.IsNull() && obj->GetType() == GEOM_EDGE ) + theOperationName = "EDGE"; + else + theOperationName = "VECTOR"; + AddParam( theParams, "Point 1", aCI.GetPoint1() ); + AddParam( theParams, "Point 2", aCI.GetPoint2() ); + break; + } + case VECTOR_TANGENT_CURVE_PAR: + theOperationName = "MakeTangentOnCurve"; + AddParam( theParams, "Curve", aCI.GetCurve() ); + AddParam( theParams, "Parameter", aCI.GetParameter() ); + break; + case VECTOR_REVERSE: + theOperationName = "CHANGE_ORIENTATION"; + AddParam( theParams, "Vector", aCI.GetCurve() ); + break; + default: + return false; } - return _anOtherObject; + return true; } + +IMPLEMENT_STANDARD_HANDLE (GEOMImpl_VectorDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_VectorDriver,GEOM_BaseDriver); diff --git a/src/GEOMImpl/GEOMImpl_VectorDriver.hxx b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx index cb3c535a4..c8bcc9dd4 100644 --- a/src/GEOMImpl/GEOMImpl_VectorDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_VectorDriver.hxx @@ -47,68 +47,6 @@ #include #endif -#ifndef _Handle_TFunction_Driver_HeaderFile -#include -#endif - -class Standard_Transient; -class Handle_Standard_Type; -class Handle(TFunction_Driver); -class GEOMImpl_VectorDriver; - -Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_VectorDriver); - -class Handle(GEOMImpl_VectorDriver) : public Handle(TFunction_Driver) { - public: - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - - Handle(GEOMImpl_VectorDriver)():Handle(TFunction_Driver)() {} - Handle(GEOMImpl_VectorDriver)(const Handle(GEOMImpl_VectorDriver)& aHandle) : Handle(TFunction_Driver)(aHandle) - { - } - - Handle(GEOMImpl_VectorDriver)(const GEOMImpl_VectorDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem) - { - } - - Handle(GEOMImpl_VectorDriver)& operator=(const Handle(GEOMImpl_VectorDriver)& aHandle) - { - Assign(aHandle.Access()); - return *this; - } - - Handle(GEOMImpl_VectorDriver)& operator=(const GEOMImpl_VectorDriver* anItem) - { - Assign((Standard_Transient *)anItem); - return *this; - } - - GEOMImpl_VectorDriver* operator->() - { - return (GEOMImpl_VectorDriver *)ControlAccess(); - } - - GEOMImpl_VectorDriver* operator->() const - { - return (GEOMImpl_VectorDriver *)ControlAccess(); - } - - Standard_EXPORT ~Handle(GEOMImpl_VectorDriver)() {}; - - Standard_EXPORT static const Handle(GEOMImpl_VectorDriver) DownCast(const Handle(Standard_Transient)& AnObject); -}; - #ifndef _TFunction_Driver_HeaderFile #include #endif @@ -122,22 +60,13 @@ class Handle(GEOMImpl_VectorDriver) : public Handle(TFunction_Driver) { class TColStd_SequenceOfExtendedString; -class GEOMImpl_VectorDriver : public TFunction_Driver { +#include "GEOM_BaseDriver.hxx" -public: +DEFINE_STANDARD_HANDLE( GEOMImpl_VectorDriver, GEOM_BaseDriver ); + +class GEOMImpl_VectorDriver : public GEOM_BaseDriver { - inline void* operator new(size_t,void* anAddress) - { - return anAddress; - } - inline void* operator new(size_t size) - { - return Standard::Allocate(size); - } - inline void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } +public: // Methods PUBLIC // @@ -148,13 +77,11 @@ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { r Standard_EXPORT static const Standard_GUID& GetID(); Standard_EXPORT ~GEOMImpl_VectorDriver() {}; + Standard_EXPORT virtual + bool GetCreationInformation(std::string& theOperationName, + std::vector& params); - // Type management - // -Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_VectorDriver_Type_(); -Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_VectorDriver) ; } -Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_VectorDriver) == AType || TFunction_Driver::IsKind(AType)); } - +DEFINE_STANDARD_RTTI( GEOMImpl_VectorDriver ) }; #endif -- 2.30.2