0027667: OCAF binary persistence hangs on reading truncated CBF file
[occt.git] / src / AIS / AIS_AttributeFilter.cxx
index e93d571..3419c44 100644 (file)
@@ -5,8 +5,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <AIS_AttributeFilter.ixx>
 
+#include <AIS_AttributeFilter.hxx>
 #include <AIS_InteractiveObject.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <Standard_Type.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(AIS_AttributeFilter,SelectMgr_Filter)
 
 AIS_AttributeFilter::AIS_AttributeFilter():
 hasC(Standard_False),
@@ -38,25 +41,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;
+  if( hasC && aSelectable->HasColor() )
+    okstat = (myCol == aSelectable->Color());
 
-//#ifndef DEB
-  Handle_SelectMgr_SelectableObject aSelectable = anObj->Selectable() ;
-  if( hasC && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasColor() )
-//#else
-//  if(hasC && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasColor())
-//#endif
-    okstat =  (myCol == ((Handle(AIS_InteractiveObject)&) anObj)->Color());
-
-//#ifndef DEB
-  aSelectable = anObj->Selectable() ;
-  if( hasW && ((Handle(AIS_InteractiveObject)&) aSelectable)->HasWidth() )
-//#else
-//  if(hasW && ((Handle(AIS_InteractiveObject)&) anObj->Selectable())->HasWidth())
-//#endif
-    okstat =  (myWid == ((Handle(AIS_InteractiveObject)&) anObj)->Width()) && okstat;
+  if( hasW && aSelectable->HasWidth() )
+    okstat = (myWid == aSelectable->Width()) && okstat;
 
   return okstat;
-  
 }