// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-#include <Standard_Stream.hxx>
+#include "GEOM_SubShapeDriver.hxx"
-#include <GEOM_SubShapeDriver.hxx>
-#include <GEOM_ISubShape.hxx>
-#include <GEOM_Function.hxx>
-#include <GEOM_Object.hxx>
+#include "GEOM_ISubShape.hxx"
+#include "GEOM_Function.hxx"
+#include "GEOM_Object.hxx"
#include <BRep_Builder.hxx>
-
#include <TopExp.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopTools_MapOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TDataStd_Integer.hxx>
#include <Standard_NullObject.hxx>
return 1;
}
-//=======================================================================
-//function : GEOM_SubShapeDriver_Type_
-//purpose :
-//=======================================================================
-Standard_EXPORT Handle_Standard_Type& GEOM_SubShapeDriver_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);
-
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("GEOM_SubShapeDriver",
- sizeof(GEOM_SubShapeDriver),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-//=======================================================================
-//function : DownCast
-//purpose :
-//=======================================================================
-const Handle(GEOM_SubShapeDriver) Handle(GEOM_SubShapeDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+bool GEOM_SubShapeDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
{
- Handle(GEOM_SubShapeDriver) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(GEOM_SubShapeDriver))) {
- _anOtherObject = Handle(GEOM_SubShapeDriver)((Handle(GEOM_SubShapeDriver)&)AnObject);
- }
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+ GEOM_ISubShape aCI( function );
+
+ enum { GEOM_SUBSHAPE = 28, GEOM_GROUP = 37 };
+
+ TDF_Label aLabel = function->GetOwnerEntry();
+ if (aLabel.IsRoot()) return false;
+ Handle(GEOM_Object) obj = GEOM_Object::GetObject( aLabel );
+ if ( obj.IsNull() ) return false;
+
+ switch ( obj->GetType() ) {
+ case GEOM_SUBSHAPE:
+ theOperationName = "EXPLODE";
+ AddParam( theParams, "Main Object", aCI.GetMainShape() );
+ AddParam( theParams, "Index", aCI.GetIndices() );
+ break;
+ case GEOM_GROUP:
+ {
+ theOperationName = "GROUP_CREATE";
+ TopAbs_ShapeEnum type = TopAbs_SHAPE;
+ {
+ TDF_Label aFreeLabel = obj->GetFreeLabel();
+ Handle(TDataStd_Integer) anAttrib;
+ if(aFreeLabel.FindAttribute(TDataStd_Integer::GetID(), anAttrib))
+ type = (TopAbs_ShapeEnum) anAttrib->Get();
+ }
+ AddParam( theParams, "Shape Type", type );
+ AddParam( theParams, "Main Shape", aCI.GetMainShape() );
+ AddParam( theParams, "Indices", aCI.GetIndices() );
+ break;
}
-
- return _anOtherObject;
+ default:
+ return false;
+ }
+
+ return true;
}
+IMPLEMENT_STANDARD_HANDLE (GEOM_SubShapeDriver,GEOM_BaseDriver);
+
+IMPLEMENT_STANDARD_RTTIEXT (GEOM_SubShapeDriver,GEOM_BaseDriver);
#ifndef _GEOM_SubShapeDriver_HeaderFile
#define _GEOM_SubShapeDriver_HeaderFile
-#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
-#include <TColStd_SequenceOfExtendedString.hxx>
-#endif
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
-#ifndef _Handle_TFunction_Driver_HeaderFile
-#include <Handle_TFunction_Driver.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(TFunction_Driver);
-class GEOM_SubShapeDriver;
-
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_SubShapeDriver);
-
-class Handle(GEOM_SubShapeDriver) : 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(GEOM_SubShapeDriver)():Handle(TFunction_Driver)() {}
- Handle(GEOM_SubShapeDriver)(const Handle(GEOM_SubShapeDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
- {
- }
-
- Handle(GEOM_SubShapeDriver)(const GEOM_SubShapeDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
- {
- }
-
- Handle(GEOM_SubShapeDriver)& operator=(const Handle(GEOM_SubShapeDriver)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(GEOM_SubShapeDriver)& operator=(const GEOM_SubShapeDriver* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- GEOM_SubShapeDriver* operator->()
- {
- return (GEOM_SubShapeDriver *)ControlAccess();
- }
-
- GEOM_SubShapeDriver* operator->() const
- {
- return (GEOM_SubShapeDriver *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(GEOM_SubShapeDriver)() {};
-
- Standard_EXPORT static const Handle(GEOM_SubShapeDriver) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-
#ifndef _TFunction_Driver_HeaderFile
#include <TFunction_Driver.hxx>
#endif
#ifndef _TFunction_Logbook_HeaderFile
#include <TFunction_Logbook.hxx>
#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-class TColStd_SequenceOfExtendedString;
+#include "GEOM_BaseDriver.hxx"
+DEFINE_STANDARD_HANDLE( GEOM_SubShapeDriver, GEOM_BaseDriver );
-class GEOM_SubShapeDriver : public TFunction_Driver {
+class GEOM_SubShapeDriver : 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 GEOM_SubShapeDriver();
Standard_EXPORT ~GEOM_SubShapeDriver() {};
- // Type management
- //
-Standard_EXPORT friend Handle_Standard_Type& GEOM_SubShapeDriver_Type_();
-Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_SubShapeDriver) ; }
-Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_SubShapeDriver) == AType || TFunction_Driver::IsKind(AType)); }
+ Standard_EXPORT virtual
+ bool GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& params);
+DEFINE_STANDARD_RTTI( GEOM_SubShapeDriver )
};