0027104: DownCast() cannot return null for mismatched handle
authorabv <abv@opencascade.com>
Mon, 25 Jan 2016 07:14:20 +0000 (10:14 +0300)
committerabv <abv@opencascade.com>
Sat, 20 Feb 2016 07:10:15 +0000 (10:10 +0300)
Method DownCast() is made template, to be available only when argument is actually a pointer or handle to a base class.

For compatibility with existing code, method DownCast() that can be used for the same type, derived, or unrelated class (i.e. where there is no actual down casting) is still available, its use shall cause "deprecated" compiler warning.

OCCT code is updated to remove meaningless DownCast()s; a few places where DownCast() was used with argument of unrelated type are corrected.

DRAW command QAHandleCast is removed (it was useful only during redesign of handles).

65 files changed:
dox/dev_guides/upgrade/upgrade.md
src/AIS/AIS_AttributeFilter.cxx
src/AIS/AIS_InteractiveContext_1.cxx
src/AIS/AIS_LocalContext.cxx
src/BRepAlgo/BRepAlgo_NormalProjection.cxx
src/BRepFeat/BRepFeat_MakeLinearForm.cxx
src/BRepFeat/BRepFeat_MakeRevolutionForm.cxx
src/BRepFeat/BRepFeat_RibSlot.cxx
src/BRepFill/BRepFill_ACRLaw.cxx
src/BRepFill/BRepFill_Evolved.cxx
src/BinTObjDrivers/BinTObjDrivers_ReferenceDriver.cxx
src/ChFi2d/ChFi2d_Builder.cxx
src/ChFi2d/ChFi2d_Builder_0.cxx
src/DDocStd/DDocStd.cxx
src/DDocStd/DDocStd_DrawDocument.cxx
src/DrawDim/DrawDim_PlanarDistance.cxx
src/Geom/Geom_OffsetSurface.cxx
src/Geom/Geom_RectangularTrimmedSurface.cxx
src/Geom2dConvert/Geom2dConvert.cxx
src/GeomAdaptor/GeomAdaptor_Surface.cxx
src/GeomConvert/GeomConvert.cxx
src/GeomPlate/GeomPlate_BuildPlateSurface.cxx
src/GeomliteTest/GeomliteTest_CurveCommands.cxx
src/IGESAppli/IGESAppli_Node.cxx
src/IGESControl/IGESControl_IGESBoundary.cxx
src/IGESSelect/IGESSelect.cxx
src/IGESToBRep/IGESToBRep_IGESBoundary.cxx
src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx
src/IntPatch/IntPatch_Intersection.cxx
src/MAT2d/MAT2d_Tool2d.cxx
src/Message/Message_Messenger.cxx
src/QABugs/QABugs_PresentableObject.cxx
src/QANCollection/QANCollection_Handle.cxx
src/RWStepGeom/RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve.cxx
src/RWStepGeom/RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface.cxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/STEPSelections/STEPSelections_Counter.cxx
src/STEPSelections/STEPSelections_SelectInstances.cxx
src/SelectMgr/SelectMgr_SelectionManager.cxx
src/ShapeBuild/ShapeBuild_Edge.cxx
src/ShapeConstruct/ShapeConstruct.cxx
src/ShapeCustom/ShapeCustom_BSplineRestriction.cxx
src/ShapeFix/ShapeFix_Face.cxx
src/ShapeFix/ShapeFix_Shape.cxx
src/ShapeFix/ShapeFix_Wire.cxx
src/ShapeProcess/ShapeProcess_OperLibrary.cxx
src/ShapeUpgrade/ShapeUpgrade_ConvertCurve2dToBezier.cxx
src/ShapeUpgrade/ShapeUpgrade_ConvertCurve3dToBezier.cxx
src/ShapeUpgrade/ShapeUpgrade_SplitSurface.cxx
src/Standard/Standard_Handle.hxx
src/StdObjMgt/StdObjMgt_ReadData.hxx
src/StdSelect/StdSelect_ViewerSelector3d.cxx
src/StepAP209/StepAP209_Construct.cxx
src/StepToGeom/StepToGeom.cxx
src/StepToGeom/StepToGeom_MakeBSplineCurve.pxx
src/TCollection/TCollection_HExtendedString.cxx
src/TObj/TObj_Object.cxx
src/TObj/TObj_TReference.cxx
src/TestTopOpe/TestTopOpe_HDSCommands.cxx
src/TestTopOpeDraw/TestTopOpeDraw_Displayer.cxx
src/ViewerTest/ViewerTest.cxx
src/VrmlData/VrmlData_Scene.cxx
src/XSDRAWSTLVRML/XSDRAWSTLVRML.cxx
src/XmlTObjDrivers/XmlTObjDrivers_ReferenceDriver.cxx

index 518f591..0a3cb46 100644 (file)
@@ -322,6 +322,30 @@ os << aLine; // in OCCT 6.9.0, resolves to operator << (void*)
 
 Call method <i>get()</i> explicitly to output the address of the Handle.
 
+#### Method DownCast for non-base types
+
+Method *DownCast()* in OCCT 7.0 is made templated; if it is used with argument which is not a base class, "deprecated" compiler warning is generated.
+This is done to prevent possible unintended errors like this:
+
+~~~~~
+Handle(Geom_Surface) aSurf = ;
+Handle(Geom_Line) aLine = 
+  Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x
+~~~~~
+
+The places where this cast has been used should be corrected manually.
+
+If down casting is used in a template context where argument can have the same or unrelated type so that *DownCast()* may be not available in all cases, use C++ *dynamic_cast<>* instead, e.g.: 
+
+~~~~~
+template <class T>
+bool CheckLine (const Handle(T) theArg)
+{
+  Handle(Geom_Line) aLine = dynamic_cast<Geom_Line> (theArg.get());
+  ...
+}
+~~~~~
+
 @subsubsection upgrade_occt700_cdl_runtime Possible runtime problems
 
 Here is the list of known possible problems at run time after the upgrade to OCCT 7.0.
@@ -330,6 +354,7 @@ Here is the list of known possible problems at run time after the upgrade to OCC
 
 In previous versions, the compiler was able to detect the situation when a local variable of a "reference to a Handle" type is initialized by temporary object, and ensured that lifetime of that object is longer than that of the variable. 
 In OCCT 7.0 with default options, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately.
+
 This problem does not appear if macro *OCCT_HANDLE_NOCAST* is used during compilation, see below.
 
 Example:
index e19e8a7..3419c44 100644 (file)
@@ -47,10 +47,10 @@ Standard_Boolean AIS_AttributeFilter::IsOk(const Handle(SelectMgr_EntityOwner)&
   
   Standard_Boolean okstat = Standard_True;
   if( hasC && aSelectable->HasColor() )
-    okstat =  (myCol == Handle(AIS_InteractiveObject)::DownCast (anObj)->Color());
+    okstat = (myCol == aSelectable->Color());
 
   if( hasW && aSelectable->HasWidth() )
-    okstat =  (myWid == Handle(AIS_InteractiveObject)::DownCast (anObj)->Width()) && okstat;
+    okstat = (myWid == aSelectable->Width()) && okstat;
 
   return okstat;
 }
index 894dfe2..9b80e59 100644 (file)
@@ -389,8 +389,7 @@ AIS_StatusOfPick AIS_InteractiveContext::Select (const TColgp_Array1OfPnt2d& the
 
   for (aSelector->Init(); aSelector->More(); aSelector->Next())
   {
-    const Handle(SelectMgr_EntityOwner) anOwner =
-      Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+    const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
     if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
       continue;
 
@@ -527,7 +526,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const Standard_Integer the
   AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
   for (aSelector->Init(); aSelector->More(); aSelector->Next())
   {
-    const Handle(SelectMgr_EntityOwner) anOwner =  Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+    const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
     if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
       continue;
 
@@ -578,7 +577,7 @@ AIS_StatusOfPick AIS_InteractiveContext::ShiftSelect (const TColgp_Array1OfPnt2d
   AIS_Selection::SetCurrentSelection (myCurrentName.ToCString());
   for (aSelector->Init(); aSelector->More(); aSelector->Next())
   {
-    const Handle(SelectMgr_EntityOwner) anOwner =  Handle(SelectMgr_EntityOwner)::DownCast (aSelector->Picked());
+    const Handle(SelectMgr_EntityOwner) anOwner = aSelector->Picked();
     if (anOwner.IsNull() || !anOwner->HasSelectable() || !myFilters->IsOk (anOwner))
       continue;
 
index 367df8f..2f1ccd9 100644 (file)
@@ -1006,8 +1006,10 @@ void AIS_LocalContext::ClearObjects()
 //       myMainPM->Clear(SO,CurAtt->DisplayMode());}
       }
       else {
-       if (CurAtt->IsSubIntensityOn()){
-         myCTX->SubIntensityOff(Handle(AIS_InteractiveObject)::DownCast(SO));}
+       if (CurAtt->IsSubIntensityOn())
+        {
+          myCTX->SubIntensityOff(SO);
+        }
        Standard_Integer DiMo = SO->HasDisplayMode()?
          SO->DisplayMode():myCTX->DisplayMode();
        if(CurAtt->DisplayMode()!=-1 &&
index 3ffb47a..6e676f4 100644 (file)
@@ -396,7 +396,7 @@ void BRepAlgo_NormalProjection::SetDefaultParams()
             // points has less diameter than the tolerance 3D
               Degenerated = Standard_True;
               Standard_Real Dist;
-              Handle(Geom_BSplineCurve) BS3d  = Handle(Geom_BSplineCurve)::DownCast( appr.Curve3d());
+              Handle(Geom_BSplineCurve) BS3d = appr.Curve3d();
               gp_Pnt P1(0.,0.,0.),PP; // skl : I change "P" to "PP"
               Standard_Integer NbPoint,ii ; // skl : I change "i" to "ii"
               Standard_Real Par,DPar;
index c89defa..bc72f95 100644 (file)
@@ -432,10 +432,8 @@ void BRepFeat_MakeLinearForm::Init(const TopoDS_Shape& Sbase,
          pt = myLastPnt;
          Standard_Real fpar = IntPar(cc, myFirstPnt);
          Standard_Real lpar = IntPar(cc, pt);
-         Handle(Geom_Curve) ccc;
          if(fpar > lpar) {
-           ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
-           cc = ccc;
+           cc = cc->Reversed();
          }
        }
        TopoDS_Edge ee1;
index 5844407..c22947e 100644 (file)
@@ -552,10 +552,8 @@ void BRepFeat_MakeRevolutionForm::Init(const TopoDS_Shape& Sbase,
          pt = myLastPnt;
          Standard_Real fpar = IntPar(cc, myFirstPnt);
          Standard_Real lpar = IntPar(cc, pt);
-         Handle(Geom_Curve) ccc;
          if(fpar > lpar) {
-           ccc = Handle(Geom_Curve)::DownCast(cc->Reversed());
-           cc = ccc;
+           cc = cc->Reversed();
          }
        }
        TopoDS_Edge ee1;
index 38f14f9..006329e 100644 (file)
@@ -1577,7 +1577,7 @@ Standard_Boolean BRepFeat_RibSlot::SlidingProfile(TopoDS_Face& Prof,
     Standard_Real lpar = IntPar(FirstCurve, myLastPnt);
     Handle(Geom_Curve) c;
     if(fpar > lpar) 
-      c = Handle(Geom_Curve)::DownCast(FirstCurve->Reversed());
+      c = FirstCurve->Reversed();
     else 
       c = FirstCurve;
     
index 8c8368a..2b91200 100644 (file)
@@ -88,7 +88,7 @@ BRepFill_ACRLaw::BRepFill_ACRLaw(const TopoDS_Wire& Path,
       Standard_Real t1 = OrigParam->Value(ipath-1);
       Standard_Real t2 = OrigParam->Value(ipath);
       Handle(GeomFill_LocationGuide) Loc;
-      Loc = Handle(GeomFill_LocationGuide)::DownCast(theLaw);
+      Loc = theLaw;
       Loc->SetOrigine(t1,t2);
 
       myLaws->SetValue(ipath, Loc->Copy());
index 7f9007e..4986b5e 100644 (file)
@@ -3077,10 +3077,7 @@ void CutEdgeProf (const TopoDS_Edge&                  E,
 
   // project it in the plane and return the associated PCurve 
   gp_Dir Normal = Plane->Pln().Axis().Direction();
-  C = 
-    Handle(Geom_Curve)::DownCast(GeomProjLib::ProjectOnPlane(CT,Plane,
-    Normal,
-    Standard_False));
+  C = GeomProjLib::ProjectOnPlane (CT, Plane, Normal, Standard_False);
   C2d = GeomProjLib::Curve2d(C,Plane);
 
   // Calculate the extrema with the straight line
index b230205..cbc1ce3 100644 (file)
@@ -76,8 +76,7 @@ Standard_Boolean BinTObjDrivers_ReferenceDriver::Paste
   {
     TCollection_AsciiString aName;
     if (! (theSource >> aName)) return Standard_False;
-    Handle(TObj_Model) aModel = Handle(TObj_Model)::DownCast
-      ( TObj_Assistant::FindModel( aName.ToCString() ));
+    Handle(TObj_Model) aModel = TObj_Assistant::FindModel (aName.ToCString());
     if (aModel.IsNull())
     {
       TCollection_AsciiString anEntry;
@@ -133,8 +132,7 @@ void BinTObjDrivers_ReferenceDriver::Paste
   if (! isSameDoc)
   {
     TCollection_AsciiString aName;
-    Handle(TObj_Model) aModel =
-      Handle(TObj_Model)::DownCast( aLObject->GetModel() );
+    Handle(TObj_Model) aModel = aLObject->GetModel();
     aName = TCollection_AsciiString( aModel->GetModelName()->String() );
     theTarget << aName;
   }
index e0e4e31..868ecce 100644 (file)
@@ -774,14 +774,14 @@ TopoDS_Edge ChFi2d_Builder::BuildFilletEdge(const TopoDS_Vertex& V,
   Handle(Geom2d_Curve) basisC1,basisC2; 
   Handle(Geom2d_TrimmedCurve) T1 = Handle(Geom2d_TrimmedCurve)::DownCast(C1);
   if (!T1.IsNull())
-    basisC1 = Handle(Geom2d_Curve)::DownCast(T1->BasisCurve());
+    basisC1 = T1->BasisCurve();
   else
-    basisC1 = Handle(Geom2d_Curve)::DownCast(C1);
+    basisC1 = C1;
   Handle(Geom2d_TrimmedCurve) T2 = Handle(Geom2d_TrimmedCurve)::DownCast(C2);
   if (!T2.IsNull())
-    basisC2 = Handle(Geom2d_Curve)::DownCast(T2->BasisCurve());
+    basisC2 = T2->BasisCurve();
   else
-    basisC2 = Handle(Geom2d_Curve)::DownCast(C2);
+    basisC2 = C2;
 
   if (basisC1->DynamicType() == STANDARD_TYPE(Geom2d_Circle)) {
     Handle(Geom2d_Circle) CC1 = Handle(Geom2d_Circle)::DownCast(basisC1);
@@ -1132,9 +1132,9 @@ Standard_Boolean IsLineOrCircle(const TopoDS_Edge& E,
   Handle(Geom2d_Curve) basisC; 
   Handle(Geom2d_TrimmedCurve) TC = Handle(Geom2d_TrimmedCurve)::DownCast(C);
   if (!TC.IsNull())
-    basisC = Handle(Geom2d_Curve)::DownCast(TC->BasisCurve());
+    basisC = TC->BasisCurve();
   else
-    basisC = Handle(Geom2d_Curve)::DownCast(C);
+    basisC = C;
 
   if ( basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
       || basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line) ) {
index a3d0c6e..657ba0c 100644 (file)
@@ -777,9 +777,9 @@ Standard_Boolean IsLineOrCircle(const TopoDS_Edge& E,
   Handle(Geom2d_Curve) basisC; 
   Handle(Geom2d_TrimmedCurve) TC = Handle(Geom2d_TrimmedCurve)::DownCast(C);
   if (!TC.IsNull())
-    basisC = Handle(Geom2d_Curve)::DownCast(TC->BasisCurve());
+    basisC = TC->BasisCurve();
   else
-    basisC = Handle(Geom2d_Curve)::DownCast(C);
+    basisC = C;
 
   if ( basisC->DynamicType() == STANDARD_TYPE(Geom2d_Circle)
       || basisC->DynamicType() == STANDARD_TYPE(Geom2d_Line) ) {
index db28c4f..31114a1 100644 (file)
@@ -66,7 +66,7 @@ Standard_Boolean DDocStd::GetDocument (Standard_CString&         Name,
     if (Complain) cout << Name << " is not a Document" << endl; 
     return Standard_False;
   }
-  Handle(TDocStd_Document) STDDOC =  Handle(TDocStd_Document)::DownCast(DD->GetDocument());
+  Handle(TDocStd_Document) STDDOC = DD->GetDocument();
   if (!STDDOC.IsNull()) {
     DOC = STDDOC;
     return Standard_True;
index c0f1442..51794e2 100644 (file)
@@ -83,7 +83,7 @@ Handle(Draw_Drawable3D) DDocStd_DrawDocument::Copy() const
 
 void DDocStd_DrawDocument::Dump (Standard_OStream& S) const
 {
-  Handle(TDocStd_Document) STDDOC =  Handle(TDocStd_Document)::DownCast(myDocument);
+  Handle(TDocStd_Document) STDDOC = myDocument;
   if (!STDDOC.IsNull()) {
     S << "TDocStd_Document\n";
     DDF_Data::Dump(S);
index 4e09571..3013316 100644 (file)
@@ -42,7 +42,7 @@ void DrawDim_PlanarDistance::Draw
 {    
   Standard_Real f,l;
   Handle(Geom_Curve) line = BRep_Tool::Curve(edge,f,l);
-  GeomAPI_ProjectPointOnCurve pj (point,Handle(Geom_Curve)::DownCast(line));
+  GeomAPI_ProjectPointOnCurve pj (point, line);
   if (pj.NbPoints() == 1) { 
     gp_Pnt first = point;
     gp_Pnt last = pj.Point(1);
index 9eda42e..ac6c3cd 100644 (file)
@@ -685,7 +685,7 @@ Standard_Boolean Geom_OffsetSurface::IsUClosed () const
     Handle(Geom_RectangularTrimmedSurface) St = 
       Handle(Geom_RectangularTrimmedSurface)::DownCast(SBasis);
 
-    Handle(Geom_Surface) S = Handle(Geom_Surface)::DownCast(St->BasisSurface());
+    Handle(Geom_Surface) S = St->BasisSurface();
     if (S->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) {
       UClosed = SBasis->IsUClosed();
     }
@@ -737,7 +737,7 @@ Standard_Boolean Geom_OffsetSurface::IsVClosed () const
     Handle(Geom_RectangularTrimmedSurface) St = 
       Handle(Geom_RectangularTrimmedSurface)::DownCast(SBasis);
 
-    Handle(Geom_Surface) S = Handle(Geom_Surface)::DownCast(St->BasisSurface());
+    Handle(Geom_Surface) S = St->BasisSurface();
     if (S->IsKind (STANDARD_TYPE(Geom_ElementarySurface))) {
       VClosed = SBasis->IsVClosed();
     }
index a024e31..fc2ba15 100644 (file)
@@ -118,8 +118,7 @@ const Standard_Boolean          VSense)
   {
     Handle(Geom_RectangularTrimmedSurface) S2 = 
            new Geom_RectangularTrimmedSurface( O->BasisSurface(),U1,U2, V1, V2, USense, VSense);
-    Handle(Geom_OffsetSurface) OS = new Geom_OffsetSurface(S2, O->Offset());
-    basisSurf = Handle(Geom_Surface)::DownCast(OS);
+    basisSurf = new Geom_OffsetSurface(S2, O->Offset());
   }  
 
   SetTrim( U1, U2, V1, V2, USense, VSense);
@@ -154,8 +153,7 @@ Geom_RectangularTrimmedSurface::Geom_RectangularTrimmedSurface (
   {
     Handle(Geom_RectangularTrimmedSurface) S2 = 
            new Geom_RectangularTrimmedSurface( O->BasisSurface(),Param1,Param2, UTrim, Sense);
-    Handle(Geom_OffsetSurface) OS = new Geom_OffsetSurface(S2, O->Offset());
-    basisSurf = Handle(Geom_Surface)::DownCast(OS);
+    basisSurf = new Geom_OffsetSurface(S2, O->Offset());
   }  
 
   SetTrim(Param1, Param2, UTrim, Sense);
index 9a7208c..8b952ac 100644 (file)
@@ -1112,7 +1112,7 @@ void  Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve&           ArrayOf
           NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
        Curve1= new Geom2d_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
      }
-     Geom2dConvert_CompCurveToBSplineCurve   C(Handle(Geom2d_BSplineCurve)::DownCast(Curve2));
+     Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
      fusion=C.Add(Curve1,
                  local_tolerance(j-1));          //fusion de deux courbes adjacentes               
      if (fusion==Standard_False)
@@ -1139,7 +1139,7 @@ void  Geom2dConvert::ConcatG1(TColGeom2d_Array1OfBSplineCurve&           ArrayOf
        if (index==j)                                      //initialisation en debut de groupe
         ArrayOfConcatenated->SetValue(i,Curve1);
        else{
-        Geom2dConvert_CompCurveToBSplineCurve  C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+        Geom2dConvert_CompCurveToBSplineCurve  C(ArrayOfConcatenated->Value(i));
         fusion=C.Add(Curve1,ArrayOfToler(j-1));          //fusion de deux courbes adjacentes               
         if (fusion==Standard_False)
           Standard_ConstructionError::Raise("Geom2dConvert Concatenation Error") ;
@@ -1351,7 +1351,7 @@ void  Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve&           ArrayOf
         }
         Curve1= new Geom2d_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
        }
-       Geom2dConvert_CompCurveToBSplineCurve   C(Handle(Geom2d_BSplineCurve)::DownCast(Curve2));
+       Geom2dConvert_CompCurveToBSplineCurve C(Curve2);
        fusion=C.Add(Curve1,
                    local_tolerance(j-1));          //fusion de deux courbes adjacentes               
        if (fusion==Standard_False)
@@ -1395,7 +1395,7 @@ void  Geom2dConvert::ConcatC1(TColGeom2d_Array1OfBSplineCurve&           ArrayOf
        if (index==j)                                      //initialisation en debut de groupe
         ArrayOfConcatenated->SetValue(i,Curve1);
        else{
-        Geom2dConvert_CompCurveToBSplineCurve  C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+        Geom2dConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
         fusion=C.Add(Curve1,ArrayOfToler(j-1));          //fusion de deux courbes adjacentes               
         if (fusion==Standard_False)
           Standard_ConstructionError::Raise("Geom2dConvert Concatenation Error") ;
@@ -1469,8 +1469,7 @@ void Geom2dConvert::C0BSplineToC1BSplineCurve(Handle(Geom2d_BSplineCurve)& BS,
                           closed_flag,
                           tolerance);
     
-   Geom2dConvert_CompCurveToBSplineCurve   
-     C(Handle(Geom2d_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(0)));
+   Geom2dConvert_CompCurveToBSplineCurve C(ArrayOfConcatenated->Value(0));
    if (ArrayOfConcatenated->Length()>=2){
      for (i=1;i<ArrayOfConcatenated->Length();i++){
        fusion=C.Add(ArrayOfConcatenated->Value(i),tolerance);
index 11723d6..dc479cc 100644 (file)
@@ -161,11 +161,10 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S,
           Handle(Geom_SurfaceOfRevolution)::DownCast(mySurface);
       // Create nested adaptor for base curve
       Handle(Geom_Curve) aBaseCurve = myRevSurf->BasisCurve();
-      Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+      Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
       // Create corresponding evaluator
-      myNestedEvaluator = new GeomEvaluator_SurfaceOfRevolution(
-          Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor),
-          myRevSurf->Direction(), myRevSurf->Location());
+      myNestedEvaluator = 
+        new GeomEvaluator_SurfaceOfRevolution (aBaseAdaptor, myRevSurf->Direction(), myRevSurf->Location());
     }
     else if ( TheType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))
     {
@@ -174,10 +173,10 @@ void GeomAdaptor_Surface::load(const Handle(Geom_Surface)& S,
           Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(mySurface);
       // Create nested adaptor for base curve
       Handle(Geom_Curve) aBaseCurve = myExtSurf->BasisCurve();
-      Handle(GeomAdaptor_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
+      Handle(Adaptor3d_HCurve) aBaseAdaptor = new GeomAdaptor_HCurve(aBaseCurve);
       // Create corresponding evaluator
-      myNestedEvaluator = new GeomEvaluator_SurfaceOfExtrusion(
-          Handle(Adaptor3d_HCurve)::DownCast(aBaseAdaptor), myExtSurf->Direction());
+      myNestedEvaluator =
+        new GeomEvaluator_SurfaceOfExtrusion (aBaseAdaptor, myExtSurf->Direction());
     }
     else if (TheType == STANDARD_TYPE(Geom_BezierSurface))
     {
index e131641..10d59c8 100644 (file)
@@ -937,7 +937,7 @@ private:
           NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
        Curve1= new Geom_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
      }
-     GeomConvert_CompCurveToBSplineCurve   C(Handle(Geom_BSplineCurve)::DownCast(Curve2));
+     GeomConvert_CompCurveToBSplineCurve C (Curve2);
      fusion=C.Add(Curve1,
                  local_tolerance(j-1));                //merge of two consecutive curves               
      if (fusion==Standard_False)
@@ -964,7 +964,7 @@ private:
        if (index==j)                                        //initialisation at the begining of the loop
         ArrayOfConcatenated->SetValue(i,Curve1);
        else{
-        GeomConvert_CompCurveToBSplineCurve   C(Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+        GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
         fusion=C.Add(Curve1,ArrayOfToler(j-1));            //merge of two consecutive curves               
         if (fusion==Standard_False)
           Standard_ConstructionError::Raise("GeomConvert Concatenation Error") ;
@@ -1172,7 +1172,7 @@ void  GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve&           ArrayOfCurv
             NewPoles(ii).SetCoord(jj,NewPoles(ii).Coord(jj)/NewWeights(ii));
         Curve1= new Geom_BSplineCurve(NewPoles,NewWeights,KnotC1,KnotC1Mults,2*Curve1->Degree());
        }
-       GeomConvert_CompCurveToBSplineCurve   C(Handle(Geom_BSplineCurve)::DownCast(Curve2));
+       GeomConvert_CompCurveToBSplineCurve C (Curve2);
        fusion=C.Add(Curve1,
                    local_tolerance(j-1));          //merge of two consecutive curves               
        if (fusion==Standard_False)
@@ -1218,7 +1218,7 @@ void  GeomConvert::ConcatC1(TColGeom_Array1OfBSplineCurve&           ArrayOfCurv
        else
        {
          // Merge of two consecutive curves.
-         GeomConvert_CompCurveToBSplineCurve   C(Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(i)));
+         GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(i));
          fusion=C.Add(Curve1, local_tolerance(j-1), Standard_True);
          if (fusion==Standard_False)
            Standard_ConstructionError::Raise("GeomConvert Concatenation Error");
@@ -1246,8 +1246,7 @@ void GeomConvert::C0BSplineToC1BSplineCurve(Handle(Geom_BSplineCurve)& BS,
   GeomConvert::C0BSplineToArrayOfC1BSplineCurve(BS, ArrayOfConcatenated, 
                                                AngularTol, tolerance);
     
-  GeomConvert_CompCurveToBSplineCurve   C
-    (Handle(Geom_BSplineCurve)::DownCast(ArrayOfConcatenated->Value(0)));
+  GeomConvert_CompCurveToBSplineCurve C (ArrayOfConcatenated->Value(0));
   if (ArrayOfConcatenated->Length()>=2){
     Standard_Integer i;
     for (i=1;i<ArrayOfConcatenated->Length();i++){
index 9bdd064..80e4185 100644 (file)
@@ -767,8 +767,7 @@ EcartContraintesMil  ( const Standard_Integer c,
          }
        break;
       case 2 :
-       Handle(Geom_Surface) Splate;
-       Splate = Handle(Geom_Surface)::DownCast(myGeomPlateSurface);
+       Handle(Geom_Surface) Splate (myGeomPlateSurface);
        LocalAnalysis_SurfaceContinuity CG2;
        for (i=1; i<NbPt; i++)
          { U = ( myParCont->Value(c).Value(i) + 
@@ -2532,8 +2531,7 @@ void GeomPlate_BuildPlateSurface::
            Ang = M_PI -Ang;
          break;
        case 2 :
-         Handle(Geom_Surface) Splate;
-         Splate = Handle(Geom_Surface)::DownCast(myGeomPlateSurface);
+         Handle(Geom_Surface) Splate (myGeomPlateSurface);
          LocalAnalysis_SurfaceContinuity CG2;
          P2d = PntCont->Pnt2dOnSurf();
          GeomLProp_SLProps Prop (Splate, P2d.Coord(1), P2d.Coord(2), 
index 9325f31..180bae2 100644 (file)
@@ -1751,7 +1751,7 @@ static Standard_Integer splitc12d(Draw_Interpretor& di,
    tolerance=Draw::Atof(c[3]);
  if (n==5) 
    angular_tolerance = Draw::Atof(c[4]) ;
- Handle(Geom2d_Curve) ACurve = Handle(Geom2d_Curve)::DownCast(DrawTrSurf::GetCurve2d(c[1])) ;
+ Handle(Geom2d_Curve) ACurve = DrawTrSurf::GetCurve2d(c[1]);
  
  Standard_Real f = ACurve->FirstParameter();
  Standard_Real l = ACurve->LastParameter();
@@ -1805,7 +1805,7 @@ static Standard_Integer canceldenom(Draw_Interpretor& ,
    udirection=Standard_True;
  if (voption)
    vdirection=Standard_True;
- Handle(Geom_BSplineSurface) BSurf = Handle(Geom_BSplineSurface)::DownCast(DrawTrSurf::GetBSplineSurface(c[1]));
+ Handle(Geom_BSplineSurface) BSurf = DrawTrSurf::GetBSplineSurface(c[1]);
  GeomLib::CancelDenominatorDerivative(BSurf,udirection,vdirection);
  DrawTrSurf::Set(c[1],BSurf);
  return 0;
index 4cae056..4ba0822 100644 (file)
@@ -47,7 +47,7 @@ IGESAppli_Node::IGESAppli_Node ()    {  }
     Handle(IGESData_TransfEntity)  IGESAppli_Node::System () const
 {
   //if Null, Global Cartesian Coordinate System
-  return GetCasted(IGESData_TransfEntity,theSystem);
+  return Handle(IGESData_TransfEntity)(theSystem);
 }
 
     Standard_Integer  IGESAppli_Node::SystemType () const
index 9ba8c9c..5579001 100644 (file)
@@ -236,8 +236,7 @@ static Standard_Boolean Connect (const Handle(ShapeAnalysis_Wire)& theSAW,
   }
   else if (!GTranslate3d && GTranslate2d) {
     for (Standard_Integer i = curves2d->Lower(); i <= curves2d->Upper(); i++) {
-      TopoDS_Shape Sh = TC.Transfer2dTopoCurve (Handle(IGESData_IGESEntity)::DownCast (curves2d->Value (i)),
-                                               myface, mytrsf, myuFact);
+      TopoDS_Shape Sh = TC.Transfer2dTopoCurve (curves2d->Value (i), myface, mytrsf, myuFact);
       if (!Sh.IsNull()) Gsewd2d->Add (Sh);
     }
     if (toreverse2d) {
index 759ad05..6ce0302 100644 (file)
@@ -41,7 +41,7 @@ Standard_Integer  IGESSelect::WhatIges
   (const Handle(IGESData_IGESEntity)& ent, const Interface_Graph& G,
    Handle(IGESData_IGESEntity)& /* sup */, Standard_Integer& /* index */)
 {
-  DeclareAndCast(IGESData_IGESEntity,igesent,ent);
+  Handle(IGESData_IGESEntity) igesent = ent;
   if (igesent.IsNull()) return Standard_False;
 //  Standard_Integer igt = igesent->TypeNumber();
   DeclareAndCast(IGESData_IGESModel,model,G.Model());
index 3dc90d4..b6f023a 100644 (file)
@@ -201,8 +201,7 @@ IGESToBRep_IGESBoundary::IGESToBRep_IGESBoundary(const IGESToBRep_CurveAndSurfac
   }
   else if (!GTranslate3d && GTranslate2d) {
     for (Standard_Integer i = curves2d->Lower(); i <= curves2d->Upper(); i++) {
-      TopoDS_Shape Sh = TC.Transfer2dTopoCurve (Handle(IGESData_IGESEntity)::DownCast (curves2d->Value (i)),
-                                               myface, mytrsf, myuFact);
+      TopoDS_Shape Sh = TC.Transfer2dTopoCurve (curves2d->Value (i), myface, mytrsf, myuFact);
       if (!Sh.IsNull()) Gsewd2d->Add (Sh);
     }
     if (toreverse2d)
index f2275f3..e6a0597 100644 (file)
@@ -57,7 +57,7 @@ IVtkDraw_HighlightAndSelectionPipeline::IVtkDraw_HighlightAndSelectionPipeline (
   IVtkOCC_Shape::Handle anIVtkShape = new IVtkOCC_Shape (theShape);
   anIVtkShape->SetId (theShapeID);
   vtkSmartPointer<IVtkTools_ShapeDataSource> aDataSource = vtkSmartPointer<IVtkTools_ShapeDataSource>::New();
-  aDataSource->SetShape (IVtkOCC_Shape::Handle::DownCast (anIVtkShape) );
+  aDataSource->SetShape (anIVtkShape);
 
   IVtkTools_DisplayModeFilter*
     aDMFilter = IVtkTools_DisplayModeFilter::SafeDownCast (myFilterMap.Find(Filter_DM_Shape));
index c557f70..d5e6296 100644 (file)
@@ -554,10 +554,8 @@ static void FUN_PL_Intersection(const Handle(Adaptor3d_HSurface)& S1,
   Handle(Geom_Curve) C2Prj =
     GeomProjLib::ProjectOnPlane(C2,GPln,gp_Dir(DV),Standard_True);
   if(C1Prj.IsNull() || C2Prj.IsNull()) return;
-  Handle(Geom2d_Curve) C1Prj2d =
-    GeomProjLib::Curve2d(C1Prj,Handle(Geom_Surface)::DownCast (GPln));
-  Handle(Geom2d_Curve) C2Prj2d =
-    GeomProjLib::Curve2d(C2Prj,Handle(Geom_Surface)::DownCast (GPln));
+  Handle(Geom2d_Curve) C1Prj2d = GeomProjLib::Curve2d (C1Prj,GPln);
+  Handle(Geom2d_Curve) C2Prj2d = GeomProjLib::Curve2d (C2Prj,GPln);
   Geom2dAPI_InterCurveCurve ICC(C1Prj2d,C2Prj2d,1.0e-7);
   if(ICC.NbPoints() > 0 )
   {
@@ -1286,8 +1284,8 @@ void IntPatch_Intersection::ParamParamPerfom(const Handle(Adaptor3d_HSurface)&
         for(Standard_Integer ip = 1; ip <= sop.Length(); ip++)
         {
           gp_Lin lin(sop.Value(ip),gp_Dir(v));
-          Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False);
-          slin.Append(Handle(IntPatch_Line)::DownCast (gl));
+          Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False);
+          slin.Append(gl);
         }
 
         done = Standard_True;
@@ -1470,8 +1468,8 @@ void IntPatch_Intersection::
         for(Standard_Integer ip = 1; ip <= sop.Length(); ip++)
         {
           gp_Lin lin(sop.Value(ip),gp_Dir(v));
-          Handle(IntPatch_GLine) gl = new IntPatch_GLine(lin,Standard_False);
-          slin.Append(Handle(IntPatch_Line)::DownCast (gl));
+          Handle(IntPatch_Line) gl = new IntPatch_GLine(lin,Standard_False);
+          slin.Append(gl);
         }
 
         done = Standard_True;
index f3d8c16..96e6e84 100644 (file)
@@ -503,9 +503,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   if (Affich) cout<<"TRIM de "<<abisector->BisectorNumber()<<endl;
 #endif
 
-  Handle(Geom2d_TrimmedCurve) 
-    bisector = Handle(Geom2d_TrimmedCurve)
-    ::DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue());
+  Handle(Geom2d_TrimmedCurve) bisector = 
+    ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
 
   if(bisector->BasisCurve()->IsPeriodic() && param == Precision::Infinite()) {
     param = bisector->FirstParameter() + 2*M_PI;
@@ -528,9 +527,8 @@ Standard_Boolean MAT2d_Tool2d::TrimBisector
   const Standard_Integer      apoint)
 {
   Standard_Real Param;
-  Handle(Geom2d_TrimmedCurve)
-    Bisector = Handle(Geom2d_TrimmedCurve)::
-    DownCast(ChangeGeomBis(abisector->BisectorNumber()).ChangeValue());
+  Handle(Geom2d_TrimmedCurve) Bisector =
+    ChangeGeomBis(abisector->BisectorNumber()).ChangeValue();
 
   Handle(Bisector_Curve) Bis = Handle(Bisector_Curve)::
     DownCast(Bisector->BasisCurve());
@@ -763,13 +761,11 @@ Standard_Real MAT2d_Tool2d::IntersectBisector (
   Standard_Boolean SolutionValide;
   gp_Pnt2d         PointSolution;
 
-  Handle(Geom2d_TrimmedCurve)
-    Bisector1 = Handle(Geom2d_TrimmedCurve)
-    ::DownCast(ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue());
+  Handle(Geom2d_TrimmedCurve) Bisector1 =
+    ChangeGeomBis(BisectorOne->BisectorNumber()).ChangeValue();
 
-  Handle(Geom2d_TrimmedCurve) 
-    Bisector2 = Handle(Geom2d_TrimmedCurve)
-    ::DownCast(ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue());
+  Handle(Geom2d_TrimmedCurve) Bisector2 =
+    ChangeGeomBis(BisectorTwo->BisectorNumber()).ChangeValue();
 
   if(Bisector1.IsNull() || Bisector2.IsNull()) return Precision::Infinite();
 
@@ -1159,8 +1155,8 @@ void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1,
   Handle(Geom2d_TrimmedCurve) Bisector1;
   Handle(Geom2d_TrimmedCurve) Bisector2;
 
-  Bisector1 = Handle(Geom2d_TrimmedCurve)::DownCast(GeomBis(I1).Value());
-  Bisector2 = Handle(Geom2d_TrimmedCurve)::DownCast(GeomBis(I2).Value());
+  Bisector1 = GeomBis(I1).Value();
+  Bisector2 = GeomBis(I2).Value();
   UF1       = Bisector1->FirstParameter();
   UL1       = Bisector1->LastParameter();
 
@@ -1184,7 +1180,7 @@ void MAT2d_Tool2d::BisecFusion(const Standard_Integer I1,
     Bis.Perform(BCC1->Curve(2), BCC1->Curve(1), P2, VBid, VBid, 
                theDirection, theJoinType, Tolerance, Standard_False); 
 
-    Bisector1 = Handle(Geom2d_TrimmedCurve)::DownCast(Bis.Value());
+    Bisector1 = Bis.Value();
     BCC1      = Handle(Bisector_BisecCC)   ::DownCast(Bisector1->BasisCurve());        
     UF1       = BCC1->FirstParameter();
     UL1       = BCC1->Parameter(P1);
@@ -1246,8 +1242,7 @@ static void SetTrim(Bisector_Bisec& Bis, const Handle(Geom2d_Curve)& Line1)
   Geom2dInt_GInter Intersect; 
   Standard_Real    Distance;  
   Standard_Real    Tolerance = MAT2d_TOLCONF;  
-  Handle(Geom2d_TrimmedCurve) Bisector = 
-    Handle(Geom2d_TrimmedCurve)::DownCast(Bis.ChangeValue());
+  Handle(Geom2d_TrimmedCurve) Bisector = Bis.ChangeValue();
 
   IntRes2d_Domain  Domain1   = Domain(Bisector,Tolerance);
   Standard_Real    UB1       = Bisector->FirstParameter();
index 3f7e4d6..ec95858 100644 (file)
@@ -105,7 +105,7 @@ void Message_Messenger::Send (const Standard_CString theString,
   Standard_Integer nb = myPrinters.Length();
   for (Standard_Integer i = 1; i <= nb; i++)
   {
-    Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+    Handle(Message_Printer) aPrinter = myPrinters(i);
     if ( ! aPrinter.IsNull() ) 
       aPrinter->Send ( theString, theGravity, putEndl );
   }
@@ -123,7 +123,7 @@ void Message_Messenger::Send (const TCollection_AsciiString& theString,
   Standard_Integer nb = myPrinters.Length();
   for (Standard_Integer i = 1; i <= nb; i++)
   {
-    Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+    Handle(Message_Printer) aPrinter = myPrinters(i);
     if ( ! aPrinter.IsNull() ) 
       aPrinter->Send ( theString, theGravity, putEndl );
   }
@@ -141,7 +141,7 @@ void Message_Messenger::Send (const TCollection_ExtendedString& theString,
   Standard_Integer nb = myPrinters.Length();
   for (Standard_Integer i = 1; i <= nb; i++)
   {
-    Handle(Message_Printer) aPrinter = Handle(Message_Printer)::DownCast ( myPrinters(i) );
+    Handle(Message_Printer) aPrinter = myPrinters(i);
     if ( ! aPrinter.IsNull() ) 
       aPrinter->Send ( theString, theGravity, putEndl );
   }
index a77c79d..6dff125 100644 (file)
@@ -38,7 +38,7 @@ void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d
                                const Handle(Prs3d_Presentation)& thePrs,
                                const Standard_Integer theMode)
 {
-  Handle(Graphic3d_Structure) aStructure = Handle(Graphic3d_Structure)::DownCast (thePrs);
+  Handle(Graphic3d_Structure) aStructure (thePrs);
   Handle(Graphic3d_Group)     aGroup     = aStructure->NewGroup();
   Handle(Prs3d_ShadingAspect) anAspect = myDrawer->ShadingAspect();
   Graphic3d_MaterialAspect aMat = anAspect->Aspect()->FrontMaterial();
index df52bb1..4711261 100644 (file)
@@ -220,7 +220,7 @@ static Standard_Integer QAHandleBool (Draw_Interpretor& theDI,
   Handle(NCollection_IncAllocator) anInc = Handle(NCollection_IncAllocator)::DownCast (aPtr);
   CHECK (theDI, ! anInc.IsNull(), "cast to NCollection_IncAllocator");
 
-  Handle(NCollection_BaseAllocator) anAlloc = Handle(NCollection_BaseAllocator)::DownCast (aPtr);
+  Handle(NCollection_BaseAllocator) anAlloc = aPtr;
   CHECK (theDI, ! anAlloc.IsNull(), "cast to NCollection_BaseAllocator");
   
   Handle(NCollection_HeapAllocator) aHAlloc = Handle(NCollection_HeapAllocator)::DownCast (aPtr);
@@ -423,178 +423,6 @@ static Standard_Integer QAHandleInc (Draw_Interpretor& theDI,
   return 0;
 }
 
-namespace
-{
-  //! Auxiliary class to perform casting to specified type.
-  template<typename TTo> struct QACast
-  {
-    //! Perform casting using OCCT DownCast() operation.
-    template<typename TFrom>
-    static void doDownCast (Draw_Interpretor& theDI,
-                            const Standard_Integer theNbIters,
-                            const TFrom&           theHandle)
-    {
-      std::vector<TTo> aHandles (theNbIters);
-      {
-        QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
-        for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
-        {
-          aHandles[anIter] = TTo::DownCast (theHandle);
-        }
-      }
-    }
-
-    //! Perform casting using standard C++ dynamic_cast<> operation.
-    template<typename TFrom>
-    static void doDynamicCast (Draw_Interpretor& theDI,
-                               const Standard_Integer theNbIters,
-                               const TFrom&           theHandle)
-    {
-      std::vector<typename TTo::element_type*> aPointers (theNbIters);
-      {
-        QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
-        for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
-        {
-          aPointers[anIter] = dynamic_cast<typename TTo::element_type* > (theHandle.operator->());
-        }
-      }
-    }
-
-    //! Perform dynamic casting using shared_ptr::dynamic_pointer_cast operation.
-    template<typename TFrom>
-    static void doShareCast (Draw_Interpretor& theDI,
-                             const Standard_Integer        theNbIters,
-                             const std::shared_ptr<TFrom>& theSharePtr)
-    {
-      std::vector< std::shared_ptr<typename TTo::element_type> > aSharePointers (theNbIters);
-      {
-        QATimer aTimer (theDI, " ", QATimer::ns, theNbIters);
-        for (Standard_Integer anIter = 0; anIter < theNbIters; ++anIter)
-        {
-          aSharePointers[anIter] = std::dynamic_pointer_cast<typename TTo::element_type, TFrom> (theSharePtr);
-        }
-      }
-    }
-
-  };
-
-  template<typename TAs>
-  static void qaCastAs (Draw_Interpretor& theDI,
-                        const qaclass00_50&    theInst,
-                        const Standard_Integer theNbIters)
-  {
-    #define QA_TEST_CAST10(theTens, theDoCast) \
-      QACast<QA_HANDLE_NAME(theTens ## 0)>::theDoCast(theDI, theNbIters, aPtr); \
-      QACast<QA_HANDLE_NAME(theTens ## 5)>::theDoCast(theDI, theNbIters, aPtr);
-    typedef typename TAs::element_type aPtrType;
-    TAs aDummy (new aPtrType());
-    theDI << "Making a pointer:\n";
-    theDI << aDummy->DynamicType()->Name() << "* ptr = new " << theInst.DynamicType()->Name() << "\n";
-    theDI << "then measuring the time of casting it to base classes from qaclass00_50 to qaclass50_50, ns\n";
-    if (!theInst.IsKind (aDummy->DynamicType()))
-    {
-      return;
-    }
-
-    theDI << "\nOCCT Handle: ";
-    {
-      TAs aPtr ((typename TAs::element_type* )theInst.Clone());
-      QA_TEST_CAST10(0, doDownCast);
-      QA_TEST_CAST10(1, doDownCast);
-      QA_TEST_CAST10(2, doDownCast);
-      QA_TEST_CAST10(3, doDownCast);
-      QA_TEST_CAST10(4, doDownCast);
-      QACast<Handle(qaclass50_50)>::doDownCast(theDI, theNbIters, aPtr);
-    }
-    theDI << "\nC++ dynamic_cast: ";
-    {
-      TAs aPtr ((typename TAs::element_type* )theInst.Clone());
-      QA_TEST_CAST10(0, doDynamicCast);
-      QA_TEST_CAST10(1, doDynamicCast);
-      QA_TEST_CAST10(2, doDynamicCast);
-      QA_TEST_CAST10(3, doDynamicCast);
-      QA_TEST_CAST10(4, doDynamicCast);
-      QACast<Handle(qaclass50_50)>::doDynamicCast(theDI, theNbIters, aPtr);
-    }
-    theDI << "\nC++ dynamic_pointer_cast: ";
-    {
-      std::shared_ptr<typename TAs::element_type> aPtr ((typename TAs::element_type* )theInst.Clone());
-      QA_TEST_CAST10(0, doShareCast);
-      QA_TEST_CAST10(1, doShareCast);
-      QA_TEST_CAST10(2, doShareCast);
-      QA_TEST_CAST10(3, doShareCast);
-      QA_TEST_CAST10(4, doShareCast);
-      QACast<Handle(qaclass50_50)>::doShareCast(theDI, theNbIters, aPtr);
-    }
-  }
-
-}
-
-//=======================================================================
-//function : QAHandleCast
-//purpose  : Estimate performance of RTTI mechanisms - dynamic type casting
-//=======================================================================
-static Standard_Integer QAHandleCast (Draw_Interpretor& theDI,
-                                      Standard_Integer  theArgNb,
-                                      const char**      theArgVec)
-{
-  if (theArgNb > 4)
-  {
-    std::cout << "Error: wrong syntax! See usage:\n";
-    theDI.PrintHelp (theArgVec[0]);
-    return 1;
-  }
-  Standard_Integer anArgIter = 0;
-  const Standard_Integer anInst   = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 50;
-  const Standard_Integer aPtrTo   = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 0;
-  const Standard_Integer aNbIters = (++anArgIter < theArgNb) ? Draw::Atoi (theArgVec[anArgIter]) : 1000000;
-
-  if (aNbIters < 1)
-  {
-    std::cout << "Error: number of iterations (" << aNbIters << ") should be positive!\n";
-    return 1;
-  }
-  if (anInst > 50 || anInst < 0)
-  {
-    std::cout << "Error: class instance (" << anInst << ") should be specified within 0..50 range!\n";
-    return 1;
-  }
-  if (aPtrTo > anInst || aPtrTo < 0)
-  {
-    std::cout << "Error: class pointer (" << aPtrTo << ") should be specified within 0.." << anInst << " range!\n";
-    return 1;
-  }
-  else if (aPtrTo % 10 != 0)
-  {
-    std::cout << "Error: class pointer (" << aPtrTo << ") should be multiple of 10!\n";
-    return 1;
-  }
-
-  Handle(qaclass00_50) aHandle  = new qaclass50_50();
-  for (Standard_Integer anInstIter = 50 - anInst; anInstIter > 0; --anInstIter)
-  {
-    Handle(Standard_Transient) aParent (aHandle->CreateParent());
-    aHandle = Handle(qaclass00_50)::DownCast (aParent);
-  }
-
-  std::ios::fmtflags aFlags = std::cout.flags();
-  std::cout.precision (5);
-
-  switch (aPtrTo)
-  {
-    // vc11 requires /bigobj option
-    case 0:  qaCastAs<Handle(qaclass00_50)>(theDI, *aHandle, aNbIters); break;
-    case 10: qaCastAs<Handle(qaclass10_50)>(theDI, *aHandle, aNbIters); break;
-    case 20: qaCastAs<Handle(qaclass20_50)>(theDI, *aHandle, aNbIters); break;
-    case 30: qaCastAs<Handle(qaclass30_50)>(theDI, *aHandle, aNbIters); break;
-    case 40: qaCastAs<Handle(qaclass40_50)>(theDI, *aHandle, aNbIters); break;
-    case 50: qaCastAs<Handle(qaclass50_50)>(theDI, *aHandle, aNbIters); break;
-  }
-  std::cout.setf (aFlags);
-  return 0;
-}
-
 //=======================================================================
 //function : QAHandleKind
 //purpose  :
@@ -692,12 +520,6 @@ void QANCollection::CommandsHandle (Draw_Interpretor& theCommands)
                    "QAHandleInc nbIter=1000000"
                    "\n\t\t: Test handle increment performance",
                    __FILE__, QAHandleInc,  THE_GROUP);
-  theCommands.Add ("QAHandleCast",
-                   "QAHandleCast [instance=50 [pointerTo=0 [nbIter=1000000]]]"
-                   "\n\t\t: Test handle DownCast performance."
-                   "\n\t\t: instance  - specifies the depth of instantiated class"
-                   "\n\t\t: pointerTo - specifies the depth of pointer class, where instance is stored into",
-                   __FILE__, QAHandleCast, THE_GROUP);
   theCommands.Add ("QAHandleKind",
                    "Test handle IsKind",
                    __FILE__, QAHandleKind, THE_GROUP);
index 63d4a18..f38d385 100644 (file)
@@ -335,8 +335,7 @@ void RWStepGeom_RWBSplineCurveWithKnotsAndRationalBSplineCurve::Check
    const Interface_ShareTool& aShto,
    Handle(Interface_Check)& ach) const
 {
-  Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aRationalBSC =
-    Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(ent);
+  Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve) aRationalBSC = ent;
   Handle(StepGeom_BSplineCurveWithKnots) aBSCWK =
     aRationalBSC->BSplineCurveWithKnots();
   RWStepGeom_RWBSplineCurveWithKnots t1;
index 35116e3..b155652 100644 (file)
@@ -428,9 +428,7 @@ void RWStepGeom_RWBSplineSurfaceWithKnotsAndRationalBSplineSurface::Check
    const Interface_ShareTool& aShto,
    Handle(Interface_Check)& ach) const
 {
-  Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aRationalBSS =
-    Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
-      ::DownCast(ent);
+  Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface) aRationalBSS = ent;
   Handle(StepGeom_BSplineSurfaceWithKnots) aBSSWK =
     aRationalBSS->BSplineSurfaceWithKnots();
   RWStepGeom_RWBSplineSurfaceWithKnots t1;
index 1667804..ee7b30b 100644 (file)
@@ -1415,8 +1415,7 @@ static Standard_Boolean findNextSHUOlevel (const Handle(XSControl_WorkSession) &
   if (subSHUO.IsNull())
     return Standard_False;
   
-  Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO =
-    Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(subSHUO->NextUsage());
+  Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO = subSHUO->NextUsage();
   if (NUNAUO.IsNull())
     return Standard_False;
 //   Handle(Interface_InterfaceModel) Model = WS->Model();
@@ -1454,8 +1453,7 @@ static TDF_Label setSHUOintoDoc (const Handle(XSControl_WorkSession) &WS,
   // get upper usage NAUO from SHUO.
   Handle(StepRepr_NextAssemblyUsageOccurrence) UUNAUO =
     Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(SHUO->UpperUsage());
-  Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO =
-    Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(SHUO->NextUsage());
+  Handle(StepRepr_NextAssemblyUsageOccurrence) NUNAUO = SHUO->NextUsage();
   if ( UUNAUO.IsNull() || NUNAUO.IsNull() ) {
 #ifdef OCCT_DEBUG
     cout << "Warning: " << __FILE__ <<": Upper_usage or Next_usage of styled SHUO is null. Skip it" << endl;
@@ -1795,8 +1793,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
         Handle(StepRepr_ShapeAspectRelationship) SAR = 
           Handle(StepRepr_ShapeAspectRelationship)::DownCast(anIterC.Value());
         if(SAR.IsNull()) continue;
-        Handle(StepRepr_ShapeAspect) aS = 
-          Handle(StepRepr_ShapeAspect)::DownCast(SAR->RelatedShapeAspect());
+        Handle(StepRepr_ShapeAspect) aS = SAR->RelatedShapeAspect();
         if(aS.IsNull()) continue;
         Interface_EntityIterator anIterSA = aGraph.Sharings(aS);
         for(anIterSA.Start(); anIterSA.More() && aPGISU.IsNull(); anIterSA.Next()) {
@@ -1835,7 +1832,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
     Handle(StepRepr_RepresentationItem) aRI;
     for(Standard_Integer i = 1 ; i <= aPGISU->NbIdentifiedItem() && aRI.IsNull(); i++)
     {
-      aRI = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(i));
+      aRI = aPGISU->IdentifiedItemValue(i);
     }
     if(aRI.IsNull()) continue;
     Standard_Integer index = aTP->MapIndex(aRI);
@@ -1891,7 +1888,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
                   = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIterDSWP.Value());
                 Handle(StepRepr_RepresentationItem) anItem;
                 if(aPGISU->NbIdentifiedItem() > 0) {
-                  anItem = Handle(StepRepr_RepresentationItem)::DownCast(aPGISU->IdentifiedItemValue(1));
+                  anItem = aPGISU->IdentifiedItemValue(1);
                 }
                 if(anItem.IsNull()) continue;
                 Standard_Integer anItemIndex = aTP->MapIndex(anItem);
@@ -2059,8 +2056,7 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt
         {
           for(Standard_Integer i = aDRCA->Lower(); i <= aDRCA->Upper(); i++)
           {
-            Handle(StepDimTol_DatumReferenceCompartment) aDRC
-              = Handle(StepDimTol_DatumReferenceCompartment)::DownCast(aDRCA->Value(i));
+            Handle(StepDimTol_DatumReferenceCompartment) aDRC = aDRCA->Value(i);
             //gete modifiers
             Handle(StepDimTol_HArray1OfDatumReferenceModifier) aModif = aDRC->Modifiers();
             XCAFDimTolObjects_DatumModifiersSequence aXCAFModifiers;
@@ -2328,8 +2324,7 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
                     Handle(StepRepr_HArray1OfRepresentationItem) HARI = VR->ItemElement();
                     if(HARI.IsNull()) continue;
                     if(HARI->Length()>0) {
-                      Handle(StepRepr_RepresentationItem) RI1 =
-                        Handle(StepRepr_RepresentationItem)::DownCast(HARI->Value(1));
+                      Handle(StepRepr_RepresentationItem) RI1 = HARI->Value(1);
                       if(RI1.IsNull()) continue;
                       if(RI1->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
                         Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMWU =
@@ -2344,8 +2339,7 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
                       }
                     }
                     if(HARI->Length()>1) {
-                      Handle(StepRepr_RepresentationItem) RI2 =
-                        Handle(StepRepr_RepresentationItem)::DownCast(HARI->Value(2));
+                      Handle(StepRepr_RepresentationItem) RI2 = HARI->Value(2);
                       if(RI2.IsNull()) continue;
                       if(RI2->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
                         Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) RILMWU =
@@ -2635,8 +2629,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
         {
           for(Standard_Integer nr = aHARI->Lower(); nr <= aHARI->Upper(); nr++)
           {
-            Handle(StepRepr_RepresentationItem) aDRI =
-              Handle(StepRepr_RepresentationItem)::DownCast(aHARI->Value(nr));
+            Handle(StepRepr_RepresentationItem) aDRI = aHARI->Value(nr);
             if(aDRI.IsNull()) continue;
 
             if(aDRI->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
index b9ab630..d502b2d 100644 (file)
@@ -949,8 +949,7 @@ static Standard_Boolean getStyledItem(const TopoDS_Shape& S,
         
         
         for (Standard_Integer jsi = 1; jsi <= aSelItm->NbStyles() && !found; jsi++) {
-          Handle(StepVisual_PresentationStyleAssignment) aFatherPSA =
-            Handle(StepVisual_PresentationStyleAssignment)::DownCast(aSelItm->StylesValue(jsi));
+          Handle(StepVisual_PresentationStyleAssignment) aFatherPSA = aSelItm->StylesValue(jsi);
           // check for PSA for top-level (not Presentation style by contex for NAUO)
           if (aFatherPSA.IsNull() || aFatherPSA->IsKind(STANDARD_TYPE(StepVisual_PresentationStyleByContext)))
             continue;
@@ -973,8 +972,7 @@ static Standard_Boolean setDefaultInstanceColor (const Handle(StepVisual_StyledI
 {
    Standard_Boolean found = Standard_False;
   for (Standard_Integer jsi = 1; jsi <= aSelItm->NbStyles() && !found; jsi++) {
-    Handle(StepVisual_PresentationStyleAssignment) aFatherPSA =
-    Handle(StepVisual_PresentationStyleAssignment)::DownCast(aSelItm->StylesValue(jsi));
+    Handle(StepVisual_PresentationStyleAssignment) aFatherPSA = aSelItm->StylesValue(jsi);
   // check for PSA for top-level (not Presentation style by contex for NAUO)
   if (aFatherPSA.IsNull() || aFatherPSA->IsKind(STANDARD_TYPE(StepVisual_PresentationStyleByContext))) 
     return Standard_False;
@@ -1279,8 +1277,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work
         for ( si=1; si <= oldLengthlen; si++ )
           newItems->SetValue( el++, oldItems->Value( si ) );
         for ( si=1; si <= Styles.NbStyles(); si++ ) {
-          newItems->SetValue( el++, Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si)));
-//           WP->Model()->AddWithRefs ( Handle(StepRepr_RepresentationItem)::DownCast (Styles.Style(si)));
+          newItems->SetValue( el++, Styles.Style(si));
         }
        
         if (newItems->Length() > 0)
@@ -1294,8 +1291,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work
         new StepVisual_HArray1OfInvisibleItem (1,Styles.NbStyles());
       // put all style item into the harray
       for ( Standard_Integer si=1; si <= Styles.NbStyles(); si++ ) {
-        Handle(StepRepr_RepresentationItem) styledItm =
-          Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si));
+        Handle(StepRepr_RepresentationItem) styledItm = Styles.Style(si);
         StepVisual_InvisibleItem anInvItem;
         anInvItem.SetValue( styledItm );
         HInvsblItm->SetValue( si, anInvItem );
@@ -1909,7 +1905,7 @@ static Standard_Boolean createSHUOStyledItem (const XCAFPrs_Style& style,
     Standard_Integer el = 1;
     for ( si=1; si <= oldLengthlen; si++ )
       newItems->SetValue( el++, oldItems->Value( si ) );
-    newItems->SetValue( el++, Handle(StepRepr_RepresentationItem)::DownCast(STEPstyle) );
+    newItems->SetValue (el++, STEPstyle);
     // init MDGPR be new array of styled items
     if (newItems->Length() > 0)
       aMDGPR->SetItems( newItems );
@@ -2846,7 +2842,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
     StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
     aDefinition.SetValue(aDS);
     Handle(StepRepr_HArray1OfRepresentationItem) anReprItems = new StepRepr_HArray1OfRepresentationItem(1, 1);
-    Handle(StepRepr_RepresentationItem) anIdentifiedItem = Handle(StepRepr_RepresentationItem)::DownCast(anAxis);
+    Handle(StepRepr_RepresentationItem) anIdentifiedItem = anAxis;
     anReprItems->SetValue(1, anIdentifiedItem);
     Interface_EntityIterator subs = aGraph.Sharings(aFirstDatum->OfShape());
     Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
index 8b0c88d..ae2936c 100644 (file)
@@ -177,7 +177,7 @@ void STEPSelections_Counter::Count(const Interface_Graph& graph,
   
   if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
     DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
-    DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
+    Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
     if ( SRR.IsNull() ) return ;
     
     Handle(StepRepr_Representation) rep;
index ff263f2..bc4e8ea 100644 (file)
@@ -102,7 +102,7 @@ static void AddInstances(const Handle(Standard_Transient)& start,
 
   if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
     DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
-    DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
+    Handle(StepRepr_RepresentationRelationship) SRR = CDSR->RepresentationRelation();
     if ( SRR.IsNull() ) return ;
     
     Handle(StepRepr_Representation) rep;
index 0122caa..c24fd61 100644 (file)
@@ -214,8 +214,7 @@ void SelectMgr_SelectionManager::Remove (const Handle(SelectMgr_SelectableObject
     SelectMgr_SequenceOfSelector& aSelectors = myLocal.ChangeFind (theObject);
     for (Standard_Integer aSelectorsIdx = 1; aSelectorsIdx <= aSelectors.Length(); aSelectorsIdx++)
     {
-      Handle(SelectMgr_ViewerSelector) aCurSelector =
-        Handle(SelectMgr_ViewerSelector)::DownCast (aSelectors (aSelectorsIdx));
+      Handle(SelectMgr_ViewerSelector) aCurSelector = aSelectors (aSelectorsIdx);
       if (!aCurSelector->Contains (theObject))
         continue;
 
@@ -334,8 +333,7 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
       SelectMgr_SequenceOfSelector& theSelectors = myLocal.ChangeFind (theObject);
       for (Standard_Integer aSelectorIdx = 1; aSelectorIdx <= theSelectors.Length(); aSelectorIdx++)
       {
-        Handle(SelectMgr_ViewerSelector) aCurSelector =
-          Handle(SelectMgr_ViewerSelector)::DownCast (theSelectors (aSelectorIdx));
+        Handle(SelectMgr_ViewerSelector) aCurSelector = theSelectors (aSelectorIdx);
         Activate (theObject, theMode, aCurSelector);
       }
     }
index 89e859a..64aba8a 100644 (file)
@@ -553,7 +553,7 @@ Handle(Geom2d_Curve) ShapeBuild_Edge::TransformPCurve(const Handle(Geom2d_Curve)
       Geom2dConvert_ApproxCurve approx (tcurve, Precision::Approximation(), 
         GeomAbs_C1, 100, 6 );
       if ( approx.HasResult() )
-        aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+        aBSpline2d = approx.Curve();
       else
         aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
       aFirst = aBSpline2d->FirstParameter();
index e165633..9e4f3a4 100644 (file)
@@ -84,7 +84,7 @@ Handle(Geom_BSplineCurve) ShapeConstruct::ConvertCurveToBSpline(const Handle(Geo
       OCC_CATCH_SIGNALS
       GeomConvert_ApproxCurve approx (tcurve, Tol3d, Continuity, MaxSegments, MaxDeg);
       if ( approx.HasResult() )
-       aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+       aBSpline = approx.Curve();
       else
        aBSpline = GeomConvert::CurveToBSplineCurve(C3D,Convert_QuasiAngular);
     }
@@ -117,7 +117,7 @@ Handle(Geom2d_BSplineCurve) ShapeConstruct::ConvertCurveToBSpline(const Handle(G
     Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(C2D,First,Last); //protection agains parabols ets
     Geom2dConvert_ApproxCurve approx (tcurve, Tol2d, Continuity, MaxSegments, MaxDegree);
     if ( approx.HasResult() )
-      aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+      aBSpline2d = approx.Curve();
     else 
       aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
   } 
@@ -248,7 +248,7 @@ Handle(Geom_BSplineSurface) ShapeConstruct::ConvertSurfaceToBSpline(const Handle
       }
       else {
        if(anApprox.HasResult()) 
-         errSpl = Handle(Geom_BSplineSurface)::DownCast(anApprox.Surface());
+         errSpl = anApprox.Surface();
 #ifdef OCCT_DEBUG
        cout << "\terror = " << anApprox.MaxError() <<endl;
 #endif
index 0943af5..e2cb165 100644 (file)
@@ -895,7 +895,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve(const Handle(Geom_
     Handle(Geom_Curve) tcurve = new Geom_TrimmedCurve(aCurve,First,Last); //protection agains parabols ets
     GeomConvert_ApproxCurve approx (tcurve, myTol3d/*Precision::Approximation()*/, myContinuity2d, myNbMaxSeg, 6 );
     if ( approx.HasResult() )
-      aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+      aBSpline = approx.Curve();
     else 
       aBSpline = GeomConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
 
@@ -1202,7 +1202,7 @@ Standard_Boolean ShapeCustom_BSplineRestriction::ConvertCurve2d(const Handle(Geo
     Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(aCurve,First,Last); //protection agains parabols ets
     Geom2dConvert_ApproxCurve approx (tcurve, myTol2d,myContinuity2d,myNbMaxSeg , 6 );
     if ( approx.HasResult() )
-      aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+      aBSpline2d = approx.Curve();
     else 
       aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
 
index 8536e4c..9887c08 100644 (file)
@@ -365,7 +365,7 @@ Standard_Boolean ShapeFix_Face::Perform()
 {
   myStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
   myFixWire->SetContext ( Context() );
-  Handle(ShapeFix_Wire) theAdvFixWire = Handle(ShapeFix_Wire)::DownCast(myFixWire);
+  Handle(ShapeFix_Wire) theAdvFixWire = myFixWire;
   if (theAdvFixWire.IsNull()) return Standard_False;
 
   BRep_Builder B;
index 80dd614..a064c7a 100644 (file)
@@ -102,7 +102,7 @@ Standard_Boolean ShapeFix_Shape::Perform(const Handle(Message_ProgressIndicator)
 {
   Standard_Integer savFixSmallAreaWireMode = 0;
   Standard_Integer savFixVertexTolMode =  myFixVertexTolMode;
-  Handle(ShapeFix_Face) fft = Handle(ShapeFix_Face)::DownCast( FixFaceTool() );
+  Handle(ShapeFix_Face) fft = FixFaceTool();
   if ( !fft.IsNull() ) {
     savFixSmallAreaWireMode = fft->FixSmallAreaWireMode();
     if ( savFixSmallAreaWireMode == -1 &&
index d475e91..6d58364 100644 (file)
@@ -535,7 +535,7 @@ Standard_Boolean ShapeFix_Wire::FixEdgeCurves()
   Handle(ShapeExtend_WireData) sbwd = WireData();
   Standard_Integer i, nb = sbwd->NbEdges();
   TopoDS_Face face = Face();
-  Handle(ShapeFix_Edge) theAdvFixEdge = Handle(ShapeFix_Edge)::DownCast(myFixEdge);
+  Handle(ShapeFix_Edge) theAdvFixEdge = myFixEdge;
   if (theAdvFixEdge.IsNull()) myFixReversed2dMode = Standard_False;
 
   // fix revesred 2d / 3d curves
@@ -1142,7 +1142,7 @@ Standard_Boolean ShapeFix_Wire::FixSmall (const Standard_Integer num,
   if ( ! IsLoaded() || NbEdges() <=1 ) return Standard_False;
 
   // analysis:
-  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
   if (theAdvAnalyzer.IsNull()) return Standard_False;
   Standard_Integer n = ( num >0 ? num : NbEdges() );
   theAdvAnalyzer->CheckSmall ( n, precsmall );
@@ -2190,7 +2190,7 @@ Standard_Boolean ShapeFix_Wire::FixSelfIntersectingEdge (const Standard_Integer
   // analysis
   IntRes2d_SequenceOfIntersectionPoint points2d;
   TColgp_SequenceOfPnt points3d;
-  Handle(ShapeAnalysis_Wire) theAdvAnalyzer =  Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
   if (theAdvAnalyzer.IsNull()) return Standard_False;
   theAdvAnalyzer->CheckSelfIntersectingEdge ( num, points2d, points3d ); 
   if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
@@ -2385,7 +2385,7 @@ Standard_Boolean ShapeFix_Wire::FixIntersectingEdges (const Standard_Integer num
   IntRes2d_SequenceOfIntersectionPoint points2d;
   TColgp_SequenceOfPnt points3d;
   TColStd_SequenceOfReal errors;
-  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
   if (theAdvAnalyzer.IsNull()) return Standard_False;
   theAdvAnalyzer->CheckIntersectingEdges ( num, points2d, points3d, errors );
   if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
@@ -2647,7 +2647,7 @@ Standard_Boolean ShapeFix_Wire::FixIntersectingEdges (const Standard_Integer num
   IntRes2d_SequenceOfIntersectionPoint points2d;
   TColgp_SequenceOfPnt points3d;
   TColStd_SequenceOfReal errors;
-  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
   if (theAdvAnalyzer.IsNull()) return Standard_False;
   theAdvAnalyzer->CheckIntersectingEdges ( num1, num2, points2d, points3d, errors);
   if ( theAdvAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
@@ -2918,7 +2918,7 @@ Standard_Boolean ShapeFix_Wire::FixLacking (const Standard_Integer num,
   //=============
   // First phase: analysis whether the problem (gap) exists
   gp_Pnt2d p2d1, p2d2;
-  Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer)->CheckLacking ( num, ( force ? Precision() : 0. ), p2d1, p2d2 );
+  myAnalyzer->CheckLacking ( num, ( force ? Precision() : 0. ), p2d1, p2d2 );
   if ( myAnalyzer->LastCheckStatus ( ShapeExtend_FAIL ) ) {
     myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL1 );
   }
@@ -3186,7 +3186,7 @@ Standard_Boolean ShapeFix_Wire::FixNotchedEdges()
   myLastFixStatus = ShapeExtend::EncodeStatus ( ShapeExtend_OK );
   if ( ! IsReady() ) return Standard_False;
   
-  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = Handle(ShapeAnalysis_Wire)::DownCast(myAnalyzer);
+  Handle(ShapeAnalysis_Wire) theAdvAnalyzer = myAnalyzer;
   TopoDS_Face face = Face();
   if ( ! Context().IsNull() ) UpdateWire();
   Handle(ShapeExtend_WireData) sewd = WireData();
index f74d43f..316988e 100644 (file)
@@ -692,8 +692,8 @@ static Standard_Boolean fixshape (const Handle(ShapeProcess_Context)& context)
   if ( ! ctx->Messages().IsNull() ) msg = new ShapeExtend_MsgRegistrator;
   
   Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;
-  Handle(ShapeFix_Face) sff  = Handle(ShapeFix_Face)::DownCast(sfs->FixFaceTool());
-  Handle(ShapeFix_Wire) sfw  = Handle(ShapeFix_Wire)::DownCast(sfs->FixWireTool());
+  Handle(ShapeFix_Face) sff  = sfs->FixFaceTool();
+  Handle(ShapeFix_Wire) sfw  = sfs->FixWireTool();
   sfs->SetMsgRegistrator( msg );
   
   sfs->SetPrecision    ( ctx->RealVal ( "Tolerance3d",    Precision::Confusion() ) );
index 7a766b1..88fb71d 100644 (file)
@@ -138,7 +138,7 @@ void ShapeUpgrade_ConvertCurve2dToBezier::Compute()
       Geom2dConvert_ApproxCurve approx (tcurve, Precision::Approximation(), 
                                        GeomAbs_C1, 100, 6 );
       if ( approx.HasResult() )
-       aBSpline2d = Handle(Geom2d_BSplineCurve)::DownCast(approx.Curve());
+       aBSpline2d = approx.Curve();
       else 
        aBSpline2d = Geom2dConvert::CurveToBSplineCurve(tcurve,Convert_QuasiAngular);
       
index c12a738..d05b7c1 100644 (file)
@@ -121,7 +121,7 @@ void ShapeUpgrade_ConvertCurve3dToBezier::Compute()
       GeomConvert_ApproxCurve approx (tcurve, Precision::Approximation(), 
                                      GeomAbs_C1, 100, 6 );
       if ( approx.HasResult() )
-       aBSpline = Handle(Geom_BSplineCurve)::DownCast(approx.Curve());
+       aBSpline = approx.Curve();
       else {
        Handle(Geom_TrimmedCurve) t3d = new Geom_TrimmedCurve(myCurve,First,Last);
        aBSpline = GeomConvert::CurveToBSplineCurve(t3d,Convert_QuasiAngular);
index 0b8d705..9f1586f 100644 (file)
@@ -449,10 +449,8 @@ void ShapeUpgrade_SplitSurface::Build(const Standard_Boolean Segment)
       }
       else {
        // not a BSpline: trimming instead of segmentation
-       Handle(Geom_Surface) 
-         theNewSurf = Handle(Geom_Surface)::DownCast(theNew);
        Handle(Geom_RectangularTrimmedSurface) SplittedSurf= 
-         new Geom_RectangularTrimmedSurface(theNewSurf,U1,U2,V1,V2);
+         new Geom_RectangularTrimmedSurface(theNew,U1,U2,V1,V2);
        Surfaces->SetValue((irow-1),(icol-1),SplittedSurf);
       }
       
index 257b9a8..0eed97c 100644 (file)
@@ -181,16 +181,34 @@ namespace opencascade {
       return get() < theHandle.get();
     }
 
-    //! Down casting operator
+    //! Down casting operator from handle to base type
     template <class T2>
-    static handle DownCast (const handle<T2>& theObject)
+    static typename std::enable_if<is_base_but_not_same<T2, T>::value, handle>::type
+      DownCast (const handle<T2>& theObject)
     {
       return handle (dynamic_cast<T*>(const_cast<T2*>(theObject.get())));
     }
 
-    //! Down casting operator
+    //! Down casting operator from pointer to base type
     template <class T2>
-    static handle DownCast (const T2* thePtr)
+    static typename std::enable_if<is_base_but_not_same<T2, T>::value, handle>::type 
+      DownCast (const T2* thePtr)
+    {
+      return handle (dynamic_cast<T*>(const_cast<T2*>(thePtr)));
+    }
+
+    //! For compatibility, define down casting operator from non-base type, as deprecated
+    template <class T2>
+    Standard_DEPRECATED("down-casting from object of the same or unrelated type is meaningless")
+    static handle DownCast (const handle<T2>& theObject, typename std::enable_if<!is_base_but_not_same<T2, T>::value, void*>::type = 0)
+    {
+      return handle (dynamic_cast<T*>(const_cast<T2*>(theObject.get())));
+    }
+
+    //! For compatibility, define down casting operator from non-base type, as deprecated
+    template <class T2>
+    Standard_DEPRECATED("down-casting from object of the same or unrelated type is meaningless")
+    static handle DownCast (const T2* thePtr, typename std::enable_if<!is_base_but_not_same<T2, T>::value, void*>::type = 0)
     {
       return handle (dynamic_cast<T*>(const_cast<T2*>(thePtr)));
     }
index 3f63914..09b2ee8 100644 (file)
@@ -51,7 +51,7 @@ public:
   {
     Handle(StdObjMgt_Persistent) aTarget = theTarget;
     ReadReference (aTarget);
-    theTarget = Handle(Type)::DownCast (aTarget);
+    theTarget = dynamic_cast<Type*> (aTarget.get());
     return *this;
   }
 
index b45f8eb..b2f122c 100644 (file)
@@ -402,7 +402,7 @@ void StdSelect_ViewerSelector3d::ComputeSensitivePrs (const Handle(Graphic3d_Str
 
       for (int i = 0; i < anEntities.Length(); i++)
       {
-        Handle(Select3D_SensitiveEntity) SubEnt = Handle(Select3D_SensitiveEntity)::DownCast(anEntities.Value(i));
+        Handle(Select3D_SensitiveEntity) SubEnt = anEntities.Value(i);
 
         //Segment
         if (SubEnt->DynamicType()==STANDARD_TYPE(Select3D_SensitiveSegment))
index 9b893df..f2c20cd 100644 (file)
@@ -691,8 +691,7 @@ Standard_Boolean StepAP209_Construct::CreateAnalysStructure (const Handle(StepBa
   Handle(StepData_StepModel) smodel = Handle(StepData_StepModel)::DownCast(Model());
 
   // replace existing contexts for using AP209
-  Handle(StepBasic_ProductContext) OldProdCtx = 
-    Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1));
+  Handle(StepBasic_ProductContext) OldProdCtx = Prod->FrameOfReferenceValue(1);
   if(!OldProdCtx.IsNull()) {
     Handle(StepBasic_ProductContext) ProdCtx = new StepBasic_ProductContext;
     ProdCtx->Init(OldProdCtx->Name(),
@@ -704,8 +703,7 @@ Standard_Boolean StepAP209_Construct::CreateAnalysStructure (const Handle(StepBa
     HAPC->SetValue(1,ProdCtx);
     Prod->SetFrameOfReference(HAPC);
   }
-  Handle(StepBasic_ProductDefinitionContext) OldPDCtx =
-    Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference());
+  Handle(StepBasic_ProductDefinitionContext) OldPDCtx = PD->FrameOfReference();
   if(!OldPDCtx.IsNull()) {
     Handle(StepBasic_ProductDefinitionContext) PDCtx = new StepBasic_ProductDefinitionContext;
     PDCtx->Init(OldPDCtx->Name(),
@@ -1308,8 +1306,7 @@ Handle(StepData_StepModel) StepAP209_Construct::CreateAP203Structure() const
 
   // replacing contexts:
   Handle(StepBasic_ApplicationContext) ApplCtx;
-  Handle(StepBasic_ProductContext) ProdCtx = 
-    Handle(StepBasic_ProductContext)::DownCast(Prod->FrameOfReferenceValue(1));
+  Handle(StepBasic_ProductContext) ProdCtx = Prod->FrameOfReferenceValue(1);
   if(!ProdCtx.IsNull()) {
     Handle(StepBasic_MechanicalContext) MechCtx = new StepBasic_MechanicalContext;
     MechCtx->Init(ProdCtx->Name(), ProdCtx->FrameOfReference(),
@@ -1320,8 +1317,7 @@ Handle(StepData_StepModel) StepAP209_Construct::CreateAP203Structure() const
     Prod->SetFrameOfReference(HAPC);
     ApplCtx = MechCtx->FrameOfReference();
   }
-  Handle(StepBasic_ProductDefinitionContext) PDCtx = 
-    Handle(StepBasic_ProductDefinitionContext)::DownCast(PD->FrameOfReference());
+  Handle(StepBasic_ProductDefinitionContext) PDCtx = PD->FrameOfReference();
   if(!PDCtx.IsNull()) {
     Handle(StepBasic_DesignContext) DesCtx = new StepBasic_DesignContext;
     DesCtx->Init(PDCtx->Name(), PDCtx->FrameOfReference(),
index e2a98a2..3096b4c 100644 (file)
@@ -689,9 +689,7 @@ Handle(Geom_BSplineSurface) StepToGeom::MakeBSplineSurface (const Handle(StepGeo
     BSR =
       Handle(StepGeom_BSplineSurfaceWithKnotsAndRationalBSplineSurface)
        ::DownCast(SS);
-    BS =
-      Handle(StepGeom_BSplineSurfaceWithKnots)
-       ::DownCast(BSR->BSplineSurfaceWithKnots());
+    BS = BSR->BSplineSurfaceWithKnots();
   }
   else
     BS = Handle(StepGeom_BSplineSurfaceWithKnots)::DownCast(SS);
@@ -1526,8 +1524,7 @@ Handle(Geom_Surface) StepToGeom::MakeSurface (const Handle(StepGeom_Surface)& SS
     else if (SS->IsKind(STANDARD_TYPE(StepGeom_SurfaceReplica))) { //:n7 abv 16 Feb 99
       const Handle(StepGeom_SurfaceReplica) SR = Handle(StepGeom_SurfaceReplica)::DownCast(SS);
       const Handle(StepGeom_Surface) PS = SR->ParentSurface();
-      const Handle(StepGeom_CartesianTransformationOperator3d) T =
-        Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(SR->Transformation());
+      const Handle(StepGeom_CartesianTransformationOperator3d) T = SR->Transformation();
       // protect against cyclic references and wrong type of cartop
       if ( !T.IsNull() && PS != SS ) {
         Handle(Geom_Surface) S1 = MakeSurface (PS);
index 4eda09f..6933a83 100644 (file)
@@ -19,7 +19,7 @@
 
   if (SC->IsKind(STANDARD_TYPE(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve))) {
     BSCWR = Handle(StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve)::DownCast(SC);
-    BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(BSCWR->BSplineCurveWithKnots());
+    BSCW = BSCWR->BSplineCurveWithKnots();
   }
   else
     BSCW = Handle(StepGeom_BSplineCurveWithKnots)::DownCast(SC);
index 1969fda..05e6c42 100644 (file)
@@ -296,9 +296,7 @@ void TCollection_HExtendedString::Print(Standard_OStream& S) const
 Standard_Boolean TCollection_HExtendedString::IsSameState
    (const Handle(TCollection_HExtendedString)& other) const
  {
-   Handle(TCollection_HExtendedString) H;
-   H = Handle(TCollection_HExtendedString)::DownCast(other);
-   return ( myString == H->ChangeString() );
+   return myString == other->String();
  }
 
 
index 2c6ca29..6d69b92 100644 (file)
@@ -1268,8 +1268,7 @@ void TObj_Object::CopyReferences
    new TObj_OcafObjectIterator(GetChildLabel(), NULL, Standard_True);
   for(; aSrcChildren->More(); aSrcChildren->Next())
   {
-    Handle(TObj_Object) aSrcChild =
-      Handle(TObj_Object)::DownCast(aSrcChildren->Value());
+    Handle(TObj_Object) aSrcChild = aSrcChildren->Value();
     TDF_Label aSrcL = aSrcChild->GetLabel();
     TDF_Label aDestLabel;
     if( !theRelocTable->HasRelocation(aSrcL, aDestLabel) )
index 3b71df2..a876692 100644 (file)
@@ -128,7 +128,7 @@ Handle(TObj_Object) TObj_TReference::Get() const
   {
     return anObject;
   }
-  anObject = Handle(TObj_Object)::DownCast(aTObject->Get());
+  anObject = aTObject->Get();
   return anObject;
 }
 
index 68db593..af1dda9 100644 (file)
@@ -214,7 +214,7 @@ static void SetPoint
                                         namedisp.ToCString(),namecolor);
   }
   char *pname = (char *)namedbrep.ToCString();
-  Draw::Set(pname,Handle(Draw_Marker3D)::DownCast(D));
+  Draw::Set(pname,D);
   
 }
 void tsee_entity0::See() 
@@ -259,7 +259,7 @@ static void SetCurve
   Handle(TestTopOpeDraw_DrawableC3D) D;
   D = new TestTopOpeDraw_DrawableC3D(GTC,namecolor,namedisp.ToCString(),namecolor);
   char *pname = (char *)namedbrep.ToCString();
-  Draw::Set(pname,Handle(DrawTrSurf_Curve)::DownCast(D));
+  Draw::Set(pname,D);
 }
 
 static TopoDS_Shape bidbid;
index 7387723..43a8ec1 100644 (file)
@@ -139,7 +139,7 @@ void TestTopOpeDraw_Displayer::DisplayShapePrivate()
   if (myPar != -1.0 ) D->SetPar(myPar);
   
   char* pname = (char *)myNameDBRep.ToCString();
-  Draw::Set(pname,Handle(DBRep_DrawableShape)::DownCast(D));
+  Draw::Set(pname,D);
 }
 
 //=======================================================================
index 75af39a..1fc28ba 100644 (file)
@@ -4333,7 +4333,7 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
 template <typename T>
 static void printLocalSelectionInfo (const T& theContext, Draw_Interpretor& theDI)
 {
-  const Standard_Boolean isGlobalCtx = !(Handle(AIS_InteractiveContext)::DownCast (theContext).IsNull());
+  const Standard_Boolean isGlobalCtx = (theContext->DynamicType() == STANDARD_TYPE(AIS_InteractiveContext));
   TCollection_AsciiString aPrevName;
   for (theContext->InitSelected(); theContext->MoreSelected(); theContext->NextSelected())
   {
index ef92b56..c1862ca 100644 (file)
@@ -621,8 +621,7 @@ void VrmlData_Scene::createShape
     const Handle(VrmlData_ShapeNode) aNodeShape =
       Handle(VrmlData_ShapeNode)::DownCast (anIter.Value());
     if (aNodeShape.IsNull() == Standard_False) {
-      const Handle(VrmlData_Geometry) aNodeGeom =
-        Handle(VrmlData_Geometry)::DownCast(aNodeShape->Geometry());
+      const Handle(VrmlData_Geometry) aNodeGeom = aNodeShape->Geometry();
       if (aNodeGeom.IsNull() == Standard_False) {
         if (aSingleShape.IsNull() == Standard_False)
           isSingleShape = Standard_False;
index b0ac14a..85fede6 100644 (file)
@@ -735,11 +735,11 @@ static Standard_Integer meshcolors( Draw_Interpretor& di,
           Standard_Integer aReflection = Draw::Atoi(argv[3]);
 
           for (Standard_Integer aCount = 0 ; aCount < aMesh->GetBuildersCount(); aCount++ ){
-            aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder"));
+            aTempBuilder = aMesh->FindBuilder("MeshVS_ElementalColorPrsBuilder");
             if( !aTempBuilder.IsNull())
               aMesh->RemoveBuilderById(aTempBuilder->GetId());
 
-            aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder"));
+            aTempBuilder = aMesh->FindBuilder("MeshVS_NodalColorPrsBuilder");
             if( !aTempBuilder.IsNull())
               aMesh->RemoveBuilderById(aTempBuilder->GetId());
           }
@@ -942,7 +942,7 @@ static Standard_Integer meshvectors( Draw_Interpretor& di,
 
   Handle(MeshVS_PrsBuilder) aTempBuilder;
 
-  aTempBuilder = Handle(MeshVS_PrsBuilder)::DownCast(aMesh->FindBuilder("MeshVS_VectorPrsBuilder"));
+  aTempBuilder = aMesh->FindBuilder("MeshVS_VectorPrsBuilder");
   if( !aTempBuilder.IsNull())
     aMesh->RemoveBuilderById(aTempBuilder->GetId());
 
index b2e2957..bafc754 100644 (file)
@@ -88,8 +88,7 @@ Standard_Boolean XmlTObjDrivers_ReferenceDriver::Paste
     TDF_Tool::Label (Target->Label().Data(), RefEntry, aLabel, Standard_True);
   else
   {
-    Handle(TObj_Model) aModel = Handle(TObj_Model)::DownCast
-      ( TObj_Assistant::FindModel( InHolderEntry.ToCString() ));
+    Handle(TObj_Model) aModel = TObj_Assistant::FindModel (InHolderEntry.ToCString());
     TDF_Tool::Label (aModel->GetLabel().Data(), RefEntry, aLabel, Standard_True);
   }
   Handle(TObj_TReference) aTarget =
@@ -135,8 +134,7 @@ void XmlTObjDrivers_ReferenceDriver::Paste
   // is reference to other document 
   if (aLabel.Root() == aMasterLabel.Root()) return;
 
-  Handle(TObj_Model) aModel =
-    Handle(TObj_Model)::DownCast( aLObject->GetModel() );
+  Handle(TObj_Model) aModel = aLObject->GetModel();
   TCollection_AsciiString aModelName( aModel->GetModelName()->String() );
   Target.Element().setAttribute(::ReferredModelEntry(), aModelName.ToCString());
 }