]> OCCT Git - occt-copy.git/commitdiff
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 518f59179c1286715a8a0a1956bac301c3f89415..0a3cb467a50bb79fc9a7f11a4b579cd57d6bd091 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 e19e8a7c512554c33fdb9224be3b740fdc4c81dc..3419c44f4d79e66e11a5d0dad1f2ef2fda54c2b9 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 894dfe250e71dc8347c03e45ef550ae3e2655343..9b80e596f6b4aadde3edb412299c465a41d5ddab 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 367df8fe2d08c08f2efe635ea158c63d1ce69c3b..2f1ccd9583e17aa1ed6ba3e1a201f75d54c36d4a 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 3ffb47aa339d2f3164b2cf167c0593b6ed374d60..6e676f419430323b6c16fc0ccf553ac9522965dc 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 c89defa29dafbbcf442b5ba1506ccf82fab5eddd..bc72f95f00f1913c66d69416ac2cdfa7e2c0cbb8 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 584440763547ac87d87b12cc74b0a921008feb05..c22947ee915c843955c722df2d9aff67fb4cf6fb 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 38f14f91d4894a989d5709cda0b6fb1b7ad2f1d7..006329e0d20749852381bcac577856e85ca2358d 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 8c8368a53c5267093ea6c9c650e480251a949da3..2b91200be45e5bfe84b2e06583427f4a1364c182 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 7f9007e1a45dba67a26d3d6b0f486076637fb326..4986b5e4d6041297072e92f34c65a8a030c4c44b 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 b23020529d6f80db1a8fe46d21d464be39482e8b..cbc1ce3e9e615c9c65febb767d5f72e440e84ccd 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 e0e4e3125d156f9ef642b23119caf086e2759583..868eccee03fb3b0f7437c02368bd362386896332 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 a3d0c6e9aad7f366e6437fdc50f74c18b906d7ba..657ba0c6dfe88e1822aad564fc1de35512e94eab 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 db28c4f908a1fec0aebcc85b9633e6652a03c396..31114a1b45faa685744326d3c92d6873aad1c256 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 c0f1442cfe9804126c93714b774c73dcd679e136..51794e248ccb378cdb4209bfb572377c033dfb17 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 4e09571940ca528be0f65af97f67020bc67a7921..301331682dd67a60169d277f81066ccc170d7aa3 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 9eda42ef14fcd525015a39374e47128be36fc397..ac6c3cd32b21167329fffba1ac3e7954e61300a0 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 a024e31f712f3613c7fe31997a8d475b8b067ebe..fc2ba15b123d305eb062b875b51a4a9bf9e471bb 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 9a7208c7bd5289993bbcaa239168b89867c52850..8b952ac081dee97d67b272411847aff57ccac4a7 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 11723d6bce6e3d9740c84520945a9d427d794c8f..dc479ccb5df65484774d67e2948887039feec449 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 e1316415e2eb507823027ba762b9a8f4eb631257..10d59c8437e628502961458cc0b6298d5369166a 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 9bdd064423b80ecf776766243330613a8c63c29a..80e41859c6037d14fc8ad06d3485e2c573339bf2 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 9325f31f708e9ce1319e7178115242540124704c..180bae2373602a75dd7078a8dd87df5b831d46cc 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 4cae056c65fd664732526d7599bc307c270bbb4c..4ba0822c03d776a7cb1ac20502ac32c66b1a6f2f 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 9ba8c9c85638d4716a2dd30bb5392739b54e376b..557900147d567e2c8b320f8f222d493b9c8705b6 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 759ad05d8a62c17c32070160ea6d3d1f10980837..6ce03026bf5a41431656b7f1aa8c31118950593e 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 3dc90d40f5290e4f8af3fe7289a9f02259e0b61d..b6f023acf40bbacf2ab55aa2e3d86907763cbf7e 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 f2275f308ee77bf6c329848d744973c4f195165f..e6a05975c74d234bbb282305e2f3383b8905d75a 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 c557f70930c4e74b4a6d325048e4bff19f9ebd4f..d5e6296a7286c0456caf6637bf8eb64527018d0e 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 f3d8c168019e419b0d13ba22f2ae5076822758d0..96e6e848565507179bc65cd1c492922492782c8c 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 3f7e4d658e68ba2605ed02d9ae6b64528e1922eb..ec95858d801dab97d87a75b3e9b823cc28ee6e35 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 a77c79da8a595d325bb1a3f65a2cb34fdac5c05e..6dff125d490ad0d0ca7786bfc5e033717e380772 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 df52bb17c2e5fa422976223b590dcfcae2c340ca..4711261562413e7d1dd49691153594151bdfed55 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 63d4a18391e5f9836ac0d2cfcd1b1f838bd30fd8..f38d385d676b43012e1ec64c7608ed162054ee94 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 35116e3e5f7a7e74e933136c426c1d2ef6c7220a..b1556526facda2f0986e23d27523e2ef89ae1b16 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 16678048eeaf6e08d4ddac4264354262df9de8f2..ee7b30bd3fe06543e88ebbf388bc6a5f4ac3a4a2 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 b9ab6305c731fe22358623a305f56d079e7203b9..d502b2dfd8611cd9b5941563448b5b8410471965 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 8b0c88d762e6d4c3f302d527c8efe273f1fa1c2b..ae2936c20408ac1839f0ce77f03868e756ec5fec 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 ff263f27b795abbacdb9d0ddd60e112992a7642b..bc4e8ea15acfed13548aca5ca59e90e7f4080ec8 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 0122caa87e778cff762f7d0728eaf4047092abea..c24fd61ecc493d03fa6fa398cf95b595bcbe52fa 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 89e859a2ce9ca26e2dd5f03926f4030f190195e7..64aba8ad8dc70bb15639cc649565aedce8be03ef 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 e165633b07a1a7babb05fd1191ac236412612bda..9e4f3a4c8d592affa48d56cedc5adba6e4364ba0 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 0943af57a65147b197ed8f228379d3a6342539c0..e2cb1653d99bb419229a2bf242de462f5aebcc44 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 8536e4c201e03169c81ee24765557ad4b4540313..9887c08bd6b175bf56d958c037444198d5e6b250 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 80dd61422b89b9cb03d59b4d31b8194e2363dbfa..a064c7a0370972b7d669e43befc02504868c8df5 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 d475e9129baa4ba1869b7985b397dcc69f95a73a..6d583648d603e5d635c31c08b51536c98530d1e5 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 f74d43fa2a15669fe7146abb0f0e06fb45a1f27e..316988e7322e071278bd667a1b4eea425b5a5dd4 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 7a766b107463d3dcbfe652c8c9c8bb26566e61e2..88fb71debeed9565104560804818fcde6bac343c 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 c12a7388bc9bd0c9a360326b6931ac5b3bbfa92c..d05b7c1905e0ad6b25dc72c1694b5ea9d55a2f15 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 0b8d7056be9cda4bb0953f327108e3bf4c44fd76..9f1586fdf272a930c9579f8c3196795b1ab9521a 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 257b9a82849160022cdee755253d9c7fc90ddfbb..0eed97c9da3ac9e4c5c42a7df1aa479e4c973a6e 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 3f6391413e1be0c705bb668c5ad514881c2b1040..09b2ee8b3382470fa05256cd1d001ad562ecf299 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 b45f8eba912f5a3bc8ae5f44895caa0cb9adb62e..b2f122c11c11a09ec9593f74af38494f98d00cbb 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 9b893df4e516012c77d447a6fb70bd1c9805693b..f2c20cdc203a62e9cc33d928e159624e252a6081 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 e2a98a2fdc74d42919b89b20a3379f0ba37107ce..3096b4cc7ac689a5a67bd6a3328e38c61086c57a 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 4eda09fdeca1623171dd486052ca0d32e450fb94..6933a838a2c1f74c44ac1e0179d04a2d1eb16d3d 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 1969fda0a535fe190081fd6bcde84c51e3b66e5c..05e6c42c4d94b2296af354ac7ab70ed35119ab22 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 2c6ca29bcc9dc09a788ebed90f250ca2a2d55ac7..6d69b927d543be3eb7afd484c16e6ec097850b7f 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 3b71df27b1ee22eed489af8fd2fcedf599753dae..a876692e92301dc7f065112fe37cb9254fbba6ab 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 68db59338db9d742fbbaa5cf280fd036778f0006..af1dda9010cd6fab352e89c884b2a6ed4cec69a8 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 7387723121fd775d73ee30ec80322ef795c958f6..43a8ec16e835fdb676a9725f44f4708a9c7bc15b 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 75af39a4c7e8122edb5d56312dc0543d68e72843..1fc28ba9d279c88b98cb7cd15abb562c1db67589 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 ef92b569c7002babcbf828a6c92021576ab53353..c1862caf4554147f9812c1c7991b662829b7420c 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 b0ac14a3b4e061c39a0b90b75faaf9aa5b9585c8..85fede675647f70a0bcf441b80564e23dd48e45b 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 b2e2957364efb671363f9cd8fb6adf9b0060c15b..bafc7547cc465f260ab582742913b375923f8202 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());
 }