3 #include "GEOMImpl_CopyDriver.hxx"
4 #include "GEOMImpl_ICopy.hxx"
5 #include "GEOMImpl_Types.hxx"
6 #include "GEOM_Function.hxx"
8 #include <BRep_Tool.hxx>
11 #include <TopoDS_Shape.hxx>
12 #include <TopoDS_Vertex.hxx>
14 #include <TNaming_CopyShape.hxx>
15 #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
17 //=======================================================================
20 //=======================================================================
21 const Standard_GUID& GEOMImpl_CopyDriver::GetID()
23 static Standard_GUID aCopyDriver("FF1BBB53-5D14-4df2-980B-3A668264EA16");
28 //=======================================================================
29 //function : GEOMImpl_CopyDriver
31 //=======================================================================
32 GEOMImpl_CopyDriver::GEOMImpl_CopyDriver()
36 //=======================================================================
39 //=======================================================================
40 Standard_Integer GEOMImpl_CopyDriver::Execute(TFunction_Logbook& log) const
42 if (Label().IsNull()) return 0;
43 Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
45 Standard_Integer aType = aFunction->GetType();
47 GEOMImpl_ICopy aCI (aFunction);
50 if(aType == COPY_WITH_REF) {
52 Handle(GEOM_Function) aRefFunction = aCI.GetOriginal();
53 if (aRefFunction.IsNull()) return 0;
54 TopoDS_Shape anOriginal = aRefFunction->GetValue();
56 TColStd_IndexedDataMapOfTransientTransient aMap;
58 TNaming_CopyShape::CopyTool(anOriginal, aMap, aCopy);
60 else if(aType == COPY_WITHOUT_REF) {
61 aCopy = aFunction->GetValue();
64 if (aCopy.IsNull()) return 0;
66 aFunction->SetValue(aCopy);
68 log.SetTouched(Label());
74 //=======================================================================
75 //function : GEOMImpl_CopyDriver_Type_
77 //=======================================================================
78 Standard_EXPORT Handle_Standard_Type& GEOMImpl_CopyDriver_Type_()
81 static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
82 if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
83 static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
84 if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
85 static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
86 if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
89 static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
90 static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CopyDriver",
91 sizeof(GEOMImpl_CopyDriver),
93 (Standard_Address)_Ancestors,
94 (Standard_Address)NULL);
99 //=======================================================================
100 //function : DownCast
102 //=======================================================================
103 const Handle(GEOMImpl_CopyDriver) Handle(GEOMImpl_CopyDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
105 Handle(GEOMImpl_CopyDriver) _anOtherObject;
107 if (!AnObject.IsNull()) {
108 if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_CopyDriver))) {
109 _anOtherObject = Handle(GEOMImpl_CopyDriver)((Handle(GEOMImpl_CopyDriver)&)AnObject);
113 return _anOtherObject ;