0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / IGESSelect / IGESSelect_SelectBypassSubfigure.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESBasic_SingularSubfigure.hxx>
16 #include <IGESBasic_SubfigureDef.hxx>
17 #include <IGESData_IGESEntity.hxx>
18 #include <IGESDraw_CircArraySubfigure.hxx>
19 #include <IGESDraw_NetworkSubfigure.hxx>
20 #include <IGESDraw_NetworkSubfigureDef.hxx>
21 #include <IGESDraw_RectArraySubfigure.hxx>
22 #include <IGESSelect_SelectBypassSubfigure.hxx>
23 #include <Interface_EntityIterator.hxx>
24 #include <Interface_Graph.hxx>
25 #include <Interface_InterfaceError.hxx>
26 #include <Interface_Macros.hxx>
27 #include <Standard_Transient.hxx>
28 #include <Standard_Type.hxx>
29 #include <TCollection_AsciiString.hxx>
30
31 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectBypassSubfigure,IFSelect_SelectExplore)
32
33 IGESSelect_SelectBypassSubfigure::IGESSelect_SelectBypassSubfigure
34   (const Standard_Integer level)
35   : IFSelect_SelectExplore (level)    {  }
36
37
38     Standard_Boolean  IGESSelect_SelectBypassSubfigure::Explore
39   (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent,
40    const Interface_Graph& /*G*/,  Interface_EntityIterator& explored) const
41 {
42   DeclareAndCast(IGESData_IGESEntity,igesent,ent);
43   if (igesent.IsNull()) return Standard_False;
44   Standard_Integer igt = igesent->TypeNumber();
45
46 //  SingularSubfigure
47   if (igt == 308) {
48     DeclareAndCast(IGESBasic_SubfigureDef,subf,ent);
49     if (subf.IsNull()) return Standard_True;
50     Standard_Integer i,nb = subf->NbEntities();
51     for (i = 1; i <= nb; i ++) explored.AddItem (subf->AssociatedEntity(i));
52     return Standard_True;
53   }
54   if (igt == 408) {
55     DeclareAndCast(IGESBasic_SingularSubfigure,subf,ent);
56     explored.AddItem (subf->Subfigure());
57   }
58
59 //  NetworkSubfigure
60   if (igt == 320) {
61     DeclareAndCast(IGESDraw_NetworkSubfigureDef,subf,ent);
62     if (subf.IsNull()) return Standard_True;
63     Standard_Integer i,nb = subf->NbEntities();
64     for (i = 1; i <= nb; i ++) explored.AddItem (subf->Entity(i));
65     return Standard_True;
66   }
67   if (igt == 420) {
68     DeclareAndCast(IGESDraw_NetworkSubfigure,subf,ent);
69     explored.AddItem (subf->SubfigureDefinition());
70   }
71
72 //  (Pattern)Subfigure
73   if (igt == 412) {
74     DeclareAndCast(IGESDraw_RectArraySubfigure,subf,ent);
75     explored.AddItem (subf->BaseEntity());
76   }
77   if (igt == 414) {
78     DeclareAndCast(IGESDraw_CircArraySubfigure,subf,ent);
79     explored.AddItem (subf->BaseEntity());
80   }
81
82 //  Si c est pas tout ca, c est un objet de base et on le prend tel quel
83   return Standard_True;
84 }
85
86
87     TCollection_AsciiString IGESSelect_SelectBypassSubfigure::ExploreLabel () const
88       {  return TCollection_AsciiString ("Content of Subfigures");  }