Back to index

salome-geom  6.5.0
GEOMImpl_PartitionDriver.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include <Standard_Stream.hxx>
00024 
00025 #include <GEOMImpl_PartitionDriver.hxx>
00026 #include <GEOMImpl_IPartition.hxx>
00027 #include <GEOMImpl_Types.hxx>
00028 
00029 #include <GEOM_Object.hxx>
00030 #include <GEOM_Function.hxx>
00031 
00032 #include <GEOMAlgo_Splitter.hxx>
00033 
00034 #include <TDataStd_IntegerArray.hxx>
00035 #include <TNaming_CopyShape.hxx>
00036 
00037 //#include <BRepBuilderAPI_Copy.hxx>
00038 #include <BRep_Tool.hxx>
00039 #include <BRepAlgo.hxx>
00040 #include <BRepTools.hxx>
00041 
00042 #include <TopAbs.hxx>
00043 #include <TopExp.hxx>
00044 #include <TopoDS.hxx>
00045 #include <TopoDS_Shape.hxx>
00046 #include <TopoDS_Vertex.hxx>
00047 #include <TopoDS_Wire.hxx>
00048 #include <TopoDS_Iterator.hxx>
00049 #include <TopTools_MapOfShape.hxx>
00050 #include <TopTools_IndexedMapOfShape.hxx>
00051 #include <TopTools_ListIteratorOfListOfShape.hxx>
00052 #include <TopTools_DataMapOfShapeShape.hxx>
00053 
00054 #include <ShapeFix_ShapeTolerance.hxx>
00055 #include <ShapeFix_Shape.hxx>
00056 
00057 #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
00058 #include <TColStd_ListIteratorOfListOfInteger.hxx>
00059 #include <TColStd_ListOfInteger.hxx>
00060 #include <Standard_NullObject.hxx>
00061 #include <Precision.hxx>
00062 #include <gp_Pnt.hxx>
00063 
00064 //=======================================================================
00065 //function : GetID
00066 //purpose  :
00067 //=======================================================================
00068 const Standard_GUID& GEOMImpl_PartitionDriver::GetID()
00069 {
00070   static Standard_GUID aPartitionDriver("FF1BBB22-5D14-4df2-980B-3A668264EA16");
00071   return aPartitionDriver;
00072 }
00073 
00074 
00075 //=======================================================================
00076 //function : GEOMImpl_PartitionDriver
00077 //purpose  :
00078 //=======================================================================
00079 GEOMImpl_PartitionDriver::GEOMImpl_PartitionDriver()
00080 {
00081 }
00082 
00083 //=======================================================================
00084 //function : SimplifyCompound
00085 //purpose  :
00086 //=======================================================================
00087 static void PrepareShapes (const TopoDS_Shape&   theShape,
00088                            Standard_Integer      theType,
00089                            TopTools_ListOfShape& theSimpleList)
00090 {
00091   if (theType == PARTITION_NO_SELF_INTERSECTIONS ||
00092       theShape.ShapeType() != TopAbs_COMPOUND) {
00093     theSimpleList.Append(theShape);
00094     return;
00095   }
00096 
00097   // explode compound on simple shapes to allow their intersections
00098   TopoDS_Iterator It (theShape, Standard_True, Standard_True);
00099   TopTools_MapOfShape mapShape;
00100   for (; It.More(); It.Next()) {
00101     if (mapShape.Add(It.Value())) {
00102       TopoDS_Shape curSh = It.Value();
00103       PrepareShapes(curSh, theType, theSimpleList);
00104     }
00105   }
00106 }
00107 
00108 //=======================================================================
00109 //function : Execute
00110 //purpose  :
00111 //=======================================================================
00112 Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
00113 {
00114   if (Label().IsNull()) return 0;
00115   Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
00116 
00117   GEOMImpl_IPartition aCI (aFunction);
00118   Standard_Integer aType = aFunction->GetType();
00119 
00120   TopoDS_Shape aShape;
00121   //sklNMTAlgo_Splitter1 PS;
00122   GEOMAlgo_Splitter PS;
00123 
00124   TopTools_DataMapOfShapeShape aCopyMap;
00125   TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
00126 
00127   if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS)
00128   {
00129     Handle(TColStd_HSequenceOfTransient) aShapes  = aCI.GetShapes();
00130     Handle(TColStd_HSequenceOfTransient) aTools   = aCI.GetTools();
00131     Handle(TColStd_HSequenceOfTransient) aKeepIns = aCI.GetKeepIns();
00132     Handle(TColStd_HSequenceOfTransient) aRemIns  = aCI.GetRemoveIns();
00133     Handle(TColStd_HArray1OfInteger) aMaterials   = aCI.GetMaterials();
00134     //skl Standard_Boolean DoRemoveWebs = !aMaterials.IsNull();
00135 
00136     unsigned int ind;
00137     //unsigned int ind, nbshapes = 0;
00138     //nbshapes += aShapes->Length() + aTools->Length();
00139     //nbshapes += aKeepIns->Length() + aRemIns->Length();
00140     //TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes);
00141     TopTools_MapOfShape ShapesMap, ToolsMap;
00142 
00143     // add object shapes that are in ListShapes;
00144     for (ind = 1; ind <= aShapes->Length(); ind++) {
00145       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
00146       TopoDS_Shape aShape_i = aRefShape->GetValue();
00147       if (aShape_i.IsNull()) {
00148         Standard_NullObject::Raise("In Partition a shape is null");
00149       }
00150       //
00151       //BRepBuilderAPI_Copy aCopyTool (aShape_i);
00152       TopoDS_Shape aShape_i_copy;
00153       TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
00154       //if (aCopyTool.IsDone())
00155       //  aShape_i_copy = aCopyTool.Shape();
00156       //else
00157       //  Standard_NullObject::Raise("Bad shape detected");
00158       //
00159       // fill aCopyMap for history
00160       TopTools_IndexedMapOfShape aShape_i_inds;
00161       TopTools_IndexedMapOfShape aShape_i_copy_inds;
00162       TopExp::MapShapes(aShape_i, aShape_i_inds);
00163       TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
00164       Standard_Integer nbInds = aShape_i_inds.Extent();
00165       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00166         aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
00167       }
00168       //
00169       TopTools_ListOfShape aSimpleShapes;
00170       //PrepareShapes(aShape_i, aType, aSimpleShapes);
00171       PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
00172       TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
00173       for (; aSimpleIter.More(); aSimpleIter.Next()) {
00174         const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
00175         if (ShapesMap.Add(aSimpleSh)) {
00176           PS.AddShape(aSimpleSh);
00177           //skl if (DoRemoveWebs) {
00178           //skl if (aMaterials->Length() >= ind)
00179           //skl PS.SetMaterial(aSimpleSh, aMaterials->Value(ind));
00180           //skl }
00181         }
00182       }
00183     }
00184 
00185     // add tool shapes that are in ListTools and not in ListShapes;
00186     for (ind = 1; ind <= aTools->Length(); ind++) {
00187       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aTools->Value(ind));
00188       TopoDS_Shape aShape_i = aRefShape->GetValue();
00189       if (aShape_i.IsNull()) {
00190         Standard_NullObject::Raise("In Partition a tool shape is null");
00191       }
00192       //
00193       //BRepBuilderAPI_Copy aCopyTool (aShape_i);
00194       TopoDS_Shape aShape_i_copy;
00195       TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
00196       //if (aCopyTool.IsDone())
00197       //  aShape_i_copy = aCopyTool.Shape();
00198       //else
00199       //  Standard_NullObject::Raise("Bad shape detected");
00200       //
00201       // fill aCopyMap for history
00202       TopTools_IndexedMapOfShape aShape_i_inds;
00203       TopTools_IndexedMapOfShape aShape_i_copy_inds;
00204       TopExp::MapShapes(aShape_i, aShape_i_inds);
00205       TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
00206       Standard_Integer nbInds = aShape_i_inds.Extent();
00207       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00208         aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
00209       }
00210       //
00211       TopTools_ListOfShape aSimpleShapes;
00212       //PrepareShapes(aShape_i, aType, aSimpleShapes);
00213       PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
00214       TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
00215       for (; aSimpleIter.More(); aSimpleIter.Next()) {
00216         const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
00217         if (!ShapesMap.Contains(aSimpleSh) && ToolsMap.Add(aSimpleSh)) {
00218           PS.AddTool(aSimpleSh);
00219         }
00220       }
00221     }
00222 
00223     // add shapes that are in ListKeepInside, as object shapes;
00224     for (ind = 1; ind <= aKeepIns->Length(); ind++) {
00225       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aKeepIns->Value(ind));
00226       TopoDS_Shape aShape_i = aRefShape->GetValue();
00227       if (aShape_i.IsNull()) {
00228         Standard_NullObject::Raise("In Partition a Keep Inside shape is null");
00229       }
00230       //
00231       //BRepBuilderAPI_Copy aCopyTool (aShape_i);
00232       TopoDS_Shape aShape_i_copy;
00233       TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
00234       //if (aCopyTool.IsDone())
00235       //  aShape_i_copy = aCopyTool.Shape();
00236       //else
00237       //  Standard_NullObject::Raise("Bad shape detected");
00238       //
00239       // fill aCopyMap for history
00240       TopTools_IndexedMapOfShape aShape_i_inds;
00241       TopTools_IndexedMapOfShape aShape_i_copy_inds;
00242       TopExp::MapShapes(aShape_i, aShape_i_inds);
00243       TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
00244       Standard_Integer nbInds = aShape_i_inds.Extent();
00245       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00246         aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
00247       }
00248       //
00249       TopTools_ListOfShape aSimpleShapes;
00250       //PrepareShapes(aShape_i, aType, aSimpleShapes);
00251       PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
00252       TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
00253       for (; aSimpleIter.More(); aSimpleIter.Next()) {
00254         const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
00255         if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
00256           PS.AddShape(aSimpleSh);
00257       }
00258     }
00259 
00260     // add shapes that are in ListRemoveInside, as object shapes;
00261     for (ind = 1; ind <= aRemIns->Length(); ind++) {
00262       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRemIns->Value(ind));
00263       TopoDS_Shape aShape_i = aRefShape->GetValue();
00264       if (aShape_i.IsNull()) {
00265         Standard_NullObject::Raise("In Partition a Remove Inside shape is null");
00266       }
00267       //
00268       //BRepBuilderAPI_Copy aCopyTool (aShape_i);
00269       TopoDS_Shape aShape_i_copy;
00270       TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
00271       //if (aCopyTool.IsDone())
00272       //  aShape_i_copy = aCopyTool.Shape();
00273       //else
00274       //  Standard_NullObject::Raise("Bad shape detected");
00275       //
00276       // fill aCopyMap for history
00277       TopTools_IndexedMapOfShape aShape_i_inds;
00278       TopTools_IndexedMapOfShape aShape_i_copy_inds;
00279       TopExp::MapShapes(aShape_i, aShape_i_inds);
00280       TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
00281       Standard_Integer nbInds = aShape_i_inds.Extent();
00282       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00283         aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
00284       }
00285       //
00286       TopTools_ListOfShape aSimpleShapes;
00287       //PrepareShapes(aShape_i, aType, aSimpleShapes);
00288       PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
00289       TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
00290       for (; aSimpleIter.More(); aSimpleIter.Next()) {
00291         const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
00292         if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
00293           PS.AddShape(aSimpleSh);
00294       }
00295     }
00296 
00297     PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
00298     PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit());
00299     PS.Perform();
00300 
00301     //skl PS.Compute();
00302     //skl PS.SetRemoveWebs(!DoRemoveWebs);
00303     //skl PS.Build((TopAbs_ShapeEnum) aCI.GetLimit());
00304     /*skl
00305     // suppress result outside of shapes in KInsideMap
00306     for (ind = 1; ind <= aKeepIns->Length(); ind++) {
00307       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aKeepIns->Value(ind));
00308       TopoDS_Shape aShape_i = aRefShape->GetValue();
00309       PS.KeepShapesInside(aShape_i);
00310     }
00311 
00312     // suppress result inside of shapes in RInsideMap
00313     for (ind = 1; ind <= aRemIns->Length(); ind++) {
00314       Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aRemIns->Value(ind));
00315       TopoDS_Shape aShape_i = aRefShape->GetValue();
00316       PS.RemoveShapesInside(aShape_i);
00317     }
00318     */
00319   }
00320   else if (aType == PARTITION_HALF)
00321   {
00322     Handle(GEOM_Function) aRefShape = aCI.GetShape();
00323     Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
00324     TopoDS_Shape aShapeArg = aRefShape->GetValue();
00325     TopoDS_Shape aPlaneArg = aRefPlane->GetValue();
00326 
00327     if (aShapeArg.IsNull() || aPlaneArg.IsNull()) {
00328       Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
00329     }
00330 
00331     TopoDS_Shape aShapeArg_copy;
00332     TopoDS_Shape aPlaneArg_copy;
00333     {
00334       TNaming_CopyShape::CopyTool(aShapeArg, aMapTShapes, aShapeArg_copy);
00335       //BRepBuilderAPI_Copy aCopyTool (aShapeArg);
00336       //if (aCopyTool.IsDone())
00337       //  aShapeArg_copy = aCopyTool.Shape();
00338       //else
00339       //  Standard_NullObject::Raise("Bad shape detected");
00340       //
00341       // fill aCopyMap for history
00342       TopTools_IndexedMapOfShape aShapeArg_inds;
00343       TopTools_IndexedMapOfShape aShapeArg_copy_inds;
00344       TopExp::MapShapes(aShapeArg, aShapeArg_inds);
00345       TopExp::MapShapes(aShapeArg_copy, aShapeArg_copy_inds);
00346       Standard_Integer nbInds = aShapeArg_inds.Extent();
00347       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00348         aCopyMap.Bind(aShapeArg_inds.FindKey(ie), aShapeArg_copy_inds.FindKey(ie));
00349       }
00350     }
00351     {
00352       TNaming_CopyShape::CopyTool(aPlaneArg, aMapTShapes, aPlaneArg_copy);
00353       //BRepBuilderAPI_Copy aCopyTool (aPlaneArg);
00354       //if (aCopyTool.IsDone())
00355       //  aPlaneArg_copy = aCopyTool.Shape();
00356       //else
00357       //  Standard_NullObject::Raise("Bad shape detected");
00358       //
00359       // fill aCopyMap for history
00360       TopTools_IndexedMapOfShape aPlaneArg_inds;
00361       TopTools_IndexedMapOfShape aPlaneArg_copy_inds;
00362       TopExp::MapShapes(aPlaneArg, aPlaneArg_inds);
00363       TopExp::MapShapes(aPlaneArg_copy, aPlaneArg_copy_inds);
00364       Standard_Integer nbInds = aPlaneArg_inds.Extent();
00365       for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
00366         aCopyMap.Bind(aPlaneArg_inds.FindKey(ie), aPlaneArg_copy_inds.FindKey(ie));
00367       }
00368     }
00369 
00370     // add object shapes that are in ListShapes;
00371     PS.AddShape(aShapeArg_copy);
00372     //PS.AddShape(aShapeArg);
00373 
00374     // add tool shapes that are in ListTools and not in ListShapes;
00375     PS.AddTool(aPlaneArg_copy);
00376     //PS.AddTool(aPlaneArg);
00377 
00378     //skl PS.Compute();
00379     PS.Perform();
00380     //PS.SetRemoveWebs(Standard_False);
00381     //PS.Build(aShapeArg.ShapeType());
00382 
00383   } else {
00384   }
00385 
00386   aShape = PS.Shape();
00387   if (aShape.IsNull()) return 0;
00388 
00389   //Alternative case to check not valid partition IPAL21418
00390   TopoDS_Iterator It (aShape, Standard_True, Standard_True);
00391   int nbSubshapes=0;
00392   for (; It.More(); It.Next())
00393     nbSubshapes++;
00394   if (!nbSubshapes)
00395     Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
00396   //end of IPAL21418
00397 
00398   if (!BRepAlgo::IsValid(aShape)) {
00399     // 08.07.2008 added by skl during fixing bug 19761 from Mantis
00400     ShapeFix_ShapeTolerance aSFT;
00401     aSFT.LimitTolerance(aShape, Precision::Confusion(),
00402                         Precision::Confusion(), TopAbs_SHAPE);
00403     Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
00404     aSfs->Perform();
00405     aShape = aSfs->Shape();
00406     if (!BRepAlgo::IsValid(aShape))
00407       Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
00408   }
00409 
00410   aFunction->SetValue(aShape);
00411 
00412   // Fill history to be used by GetInPlace functionality
00413   TopTools_IndexedMapOfShape aResIndices;
00414   TopExp::MapShapes(aShape, aResIndices);
00415 
00416   // Map: source_shape/images of source_shape in Result
00417   const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
00418 
00419   // history for all argument shapes
00420   // be sure to use aCopyMap
00421   TDF_LabelSequence aLabelSeq;
00422   aFunction->GetDependency(aLabelSeq);
00423   Standard_Integer nbArg = aLabelSeq.Length();
00424 
00425   for (Standard_Integer iarg = 1; iarg <= nbArg; iarg++) {
00426 
00427     TDF_Label anArgumentRefLabel = aLabelSeq.Value(iarg);
00428 
00429     Handle(GEOM_Object) anArgumentObject = GEOM_Object::GetReferencedObject(anArgumentRefLabel);
00430     TopoDS_Shape anArgumentShape = anArgumentObject->GetValue();
00431 
00432     TopTools_IndexedMapOfShape anArgumentIndices;
00433     TopExp::MapShapes(anArgumentShape, anArgumentIndices);
00434     Standard_Integer nbArgumentEntities = anArgumentIndices.Extent();
00435 
00436     // Find corresponding label in history
00437     TDF_Label anArgumentHistoryLabel =
00438       aFunction->GetArgumentHistoryEntry(anArgumentRefLabel, Standard_True);
00439 
00440     for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
00441       TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
00442       // be sure to use aCopyMap here
00443       if (aCopyMap.IsBound(anEntity))
00444         anEntity = aCopyMap.Find(anEntity);
00445       //
00446       if (!aMR.Contains(anEntity)) continue;
00447 
00448       const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
00449       Standard_Integer nbModified = aModified.Extent();
00450 
00451       if (nbModified > 0) { // Mantis issue 0021182
00452         int ih = 1;
00453         TopTools_ListIteratorOfListOfShape itM (aModified);
00454         for (; itM.More() && nbModified > 0; itM.Next(), ++ih) {
00455           if (!aResIndices.Contains(itM.Value())) {
00456             nbModified = 0;
00457           }
00458         }
00459       }
00460       if (nbModified > 0) {
00461         TDF_Label aWhatHistoryLabel = anArgumentHistoryLabel.FindChild(ie, Standard_True);
00462         Handle(TDataStd_IntegerArray) anAttr =
00463           TDataStd_IntegerArray::Set(aWhatHistoryLabel, 1, nbModified);
00464 
00465         int ih = 1;
00466         TopTools_ListIteratorOfListOfShape itM (aModified);
00467         for (; itM.More(); itM.Next(), ++ih) {
00468           int id = aResIndices.FindIndex(itM.Value());
00469           anAttr->SetValue(ih, id);
00470         }
00471       }
00472     }
00473   }
00474 
00475   log.SetTouched(Label());
00476 
00477   return 1;
00478 }
00479 
00480 
00481 //=======================================================================
00482 //function :  GEOMImpl_PartitionDriver_Type_
00483 //purpose  :
00484 //=======================================================================
00485 Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_()
00486 {
00487   static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
00488   if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
00489   static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
00490   if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
00491   static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
00492   if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
00493 
00494   static Handle_Standard_Transient _Ancestors[] = {aType1,aType2,aType3,NULL};
00495   static Handle_Standard_Type _aType =
00496     new Standard_Type ("GEOMImpl_PartitionDriver", sizeof(GEOMImpl_PartitionDriver),
00497                        1, (Standard_Address)_Ancestors, (Standard_Address)NULL);
00498 
00499   return _aType;
00500 }
00501 
00502 //=======================================================================
00503 //function : DownCast
00504 //purpose  :
00505 //=======================================================================
00506 const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
00507 {
00508   Handle(GEOMImpl_PartitionDriver) _anOtherObject;
00509 
00510   if (!AnObject.IsNull()) {
00511      if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_PartitionDriver))) {
00512        _anOtherObject = Handle(GEOMImpl_PartitionDriver)((Handle(GEOMImpl_PartitionDriver)&)AnObject);
00513      }
00514   }
00515 
00516   return _anOtherObject;
00517 }