1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024023: Revamp the OCCT Handle -- downcast (automatic)

Automatic update by command "occt_upgrade . -downcast"

C-style cast of Handle to that of derived type (now illegal) is replaced by call to DownCast()
Const reference local variables of Handle type initialized by result of DownCast are replaced by normal variables.
This commit is contained in:
abv
2015-07-02 16:41:05 +03:00
parent ce8b059af3
commit c5f3a42524
158 changed files with 863 additions and 888 deletions

View File

@@ -81,7 +81,7 @@ void StdSelect_BRepSelectionTool::preBuildBVH (const Handle(SelectMgr_Selection)
if (aSensitive->IsInstance ("Select3D_SensitiveGroup"))
{
const Handle(Select3D_SensitiveGroup)& aGroup = Handle(Select3D_SensitiveGroup)::DownCast (aSensitive);
Handle(Select3D_SensitiveGroup) aGroup (Handle(Select3D_SensitiveGroup)::DownCast (aSensitive));
const Select3D_EntitySequence& aSubEntities = aGroup->GetEntities();
for (Select3D_EntitySequenceIter aSubEntitiesIter (aSubEntities); aSubEntitiesIter.More(); aSubEntitiesIter.Next())
{

View File

@@ -64,7 +64,7 @@ Standard_Boolean StdSelect_EdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)&
{
if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False;
const TopoDS_Shape& sh = ((Handle(StdSelect_BRepOwner)&)EO)->Shape();
const TopoDS_Shape& sh = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape();
if(sh.ShapeType()!= TopAbs_EDGE) return Standard_False;
switch(mytype){

View File

@@ -51,7 +51,7 @@ Standard_Boolean StdSelect_FaceFilter::
IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
{
if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull()) return Standard_False;
const TopoDS_Shape& anobj= ((Handle(StdSelect_BRepOwner)&)EO)->Shape();
const TopoDS_Shape& anobj= Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape();
if(anobj.ShapeType()!= TopAbs_FACE)return Standard_False;
switch(mytype) {
case StdSelect_AnyFace:

View File

@@ -517,16 +517,15 @@ void StdSelect_ViewerSelector3d::ComputeSensitivePrs (const Handle(SelectMgr_Sel
//==========================================================
else if (Ent->DynamicType()==STANDARD_TYPE(Select3D_SensitiveTriangulation))
{
const Handle(Poly_Triangulation)& PT =
(*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->Triangulation();
Handle(Poly_Triangulation) PT (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->Triangulation());
const Poly_Array1OfTriangle& triangles = PT->Triangles();
const TColgp_Array1OfPnt& Nodes = PT->Nodes();
Standard_Integer n[3];
TopLoc_Location iloc, bidloc;
if ((*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->HasInitLocation())
bidloc = (*((Handle(Select3D_SensitiveTriangulation)*) &Ent))->GetInitLocation();
if (Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->HasInitLocation())
bidloc = Handle(Select3D_SensitiveTriangulation)::DownCast (Ent)->GetInitLocation();
if (bidloc.IsIdentity())
iloc = theLoc;