1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0024023: Revamp the OCCT Handle - gcc and clang

Adaptations for compiling with GCC 4.7 and 4.8:
- Construction semantics is used for Handle objects being initialized by const Handle objects of derived type, to avoid overload resolution error in GCC 4.7.
- Missing includes added.
- Fixed bugs related to misuse of direct casts of handle.
- Eliminate CLang warnings on uninitialized and unused variables, functions, and expressions
This commit is contained in:
abv
2015-07-03 11:31:43 +03:00
parent caaeed1b91
commit 5b111128de
72 changed files with 250 additions and 431 deletions

View File

@@ -39,25 +39,16 @@ hasW(Standard_True){}
Standard_Boolean AIS_AttributeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
{
if (Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull()) return Standard_False;
Handle(AIS_InteractiveObject) aSelectable (Handle(AIS_InteractiveObject)::DownCast (anObj->Selectable()));
if (aSelectable.IsNull())
return Standard_False;
Standard_Boolean okstat = Standard_True;
//#ifndef OCCT_DEBUG
Handle(SelectMgr_SelectableObject) aSelectable = anObj->Selectable() ;
if( hasC && Handle(AIS_InteractiveObject)::DownCast (aSelectable)->HasColor() )
//#else
// if(hasC && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasColor())
//#endif
if( hasC && aSelectable->HasColor() )
okstat = (myCol == Handle(AIS_InteractiveObject)::DownCast (anObj)->Color());
//#ifndef OCCT_DEBUG
aSelectable = anObj->Selectable() ;
if( hasW && Handle(AIS_InteractiveObject)::DownCast (aSelectable)->HasWidth() )
//#else
// if(hasW && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasWidth())
//#endif
if( hasW && aSelectable->HasWidth() )
okstat = (myWid == Handle(AIS_InteractiveObject)::DownCast (anObj)->Width()) && okstat;
return okstat;
}

View File

@@ -51,13 +51,14 @@ Standard_Boolean AIS_BadEdgeFilter::ActsOn(const TopAbs_ShapeEnum aType) const
Standard_Boolean AIS_BadEdgeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
{
if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull())
return Standard_True;
if (myContour==0)
return Standard_True;
const TopoDS_Shape& aShape = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape();
Handle(StdSelect_BRepOwner) aBO (Handle(StdSelect_BRepOwner)::DownCast(EO));
if (aBO.IsNull())
return Standard_True;
const TopoDS_Shape& aShape = aBO->Shape();
if (myBadEdges.IsBound(myContour)) {
TopTools_ListIteratorOfListOfShape it(myBadEdges.Find(myContour));

View File

@@ -78,10 +78,11 @@ Standard_Boolean AIS_C0RegularityFilter::ActsOn(const TopAbs_ShapeEnum aType) co
Standard_Boolean AIS_C0RegularityFilter::IsOk(const Handle(SelectMgr_EntityOwner)& EO) const
{
if (Handle(StdSelect_BRepOwner)::DownCast(EO).IsNull())
Handle(StdSelect_BRepOwner) aBO (Handle(StdSelect_BRepOwner)::DownCast(EO));
if (aBO.IsNull())
return Standard_False;
const TopoDS_Shape& aShape = Handle(StdSelect_BRepOwner)::DownCast (EO)->Shape();
const TopoDS_Shape& aShape = aBO->Shape();
if(aShape.ShapeType()!= TopAbs_EDGE)
return Standard_False;

View File

@@ -49,10 +49,10 @@ static Handle(Prs3d_LineAspect) GetLineAspect(const Handle(Prs3d_Drawer)& Dr,
return Dr->VectorAspect();
break;
case AIS_TOA_UIso:
return Dr->UIsoAspect();
return Handle(Prs3d_LineAspect) (Dr->UIsoAspect());
break;
case AIS_TOA_VIso:
return Dr->VIsoAspect();
return Handle(Prs3d_LineAspect) (Dr->VIsoAspect());
break;
case AIS_TOA_Free:
return Dr->FreeBoundaryAspect();

View File

@@ -1307,8 +1307,8 @@ void AIS_LocalContext::ClearSensitive(const Handle(V3d_View)& aviou)
//=======================================================================
Standard_Boolean AIS_LocalContext::IsShape(const Standard_Integer Index) const
{
if(Handle(StdSelect_BRepOwner)::DownCast(myMapOfOwner->FindKey(Index)).IsNull())
Handle(SelectMgr_EntityOwner) aEO (myMapOfOwner->FindKey(Index));
if (aEO.IsNull() || ! aEO->IsKind(STANDARD_TYPE(StdSelect_BRepOwner)))
return Standard_False;
return
ComesFromDecomposition(Index);

View File

@@ -130,7 +130,7 @@ void AIS_Trihedron::SetSize(const Standard_Real aValue)
myDrawer->DatumAspect()->SetAxisLength(aValue,aValue,aValue);
for(Standard_Integer i=4;i<=6;i++)
(*((Handle(AIS_Plane)*)&myShapes[i]))->SetSize(aValue);
Handle(AIS_Plane)::DownCast (myShapes[i])->SetSize(aValue);
Update();
UpdateSelection();

View File

@@ -25,9 +25,6 @@ myKind(TheKind){}
Standard_Boolean AIS_TypeFilter::IsOk(const Handle(SelectMgr_EntityOwner)& anObj) const
{
if(Handle(AIS_InteractiveObject)::DownCast(anObj->Selectable()).IsNull())
return Standard_False;
Handle(AIS_InteractiveObject) anObject =
Handle(AIS_InteractiveObject)::DownCast (anObj->Selectable());
return ! anObject.IsNull() && anObject->Type()== myKind;