973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
42cf5bc1 |
14 | |
15 | #include <IGESBasic_Group.hxx> |
16 | #include <IGESBasic_SingleParent.hxx> |
7fd59977 |
17 | #include <IGESData_IGESEntity.hxx> |
18 | #include <IGESGeom_Plane.hxx> |
42cf5bc1 |
19 | #include <IGESSelect_SelectFaces.hxx> |
7fd59977 |
20 | #include <IGESSolid_ManifoldSolid.hxx> |
21 | #include <IGESSolid_Shell.hxx> |
42cf5bc1 |
22 | #include <Interface_EntityIterator.hxx> |
23 | #include <Interface_Graph.hxx> |
7fd59977 |
24 | #include <Interface_Macros.hxx> |
42cf5bc1 |
25 | #include <Standard_Transient.hxx> |
26 | #include <Standard_Type.hxx> |
27 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
28 | |
92efcf78 |
29 | IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectFaces,IFSelect_SelectExplore) |
30 | |
b311480e |
31 | IGESSelect_SelectFaces::IGESSelect_SelectFaces () |
7fd59977 |
32 | : IFSelect_SelectExplore (-1) { } |
33 | |
34 | |
35 | Standard_Boolean IGESSelect_SelectFaces::Explore |
35e08fe8 |
36 | (const Standard_Integer /*level*/, const Handle(Standard_Transient)& ent, |
37 | const Interface_Graph& /*G*/, Interface_EntityIterator& explored) const |
7fd59977 |
38 | { |
39 | DeclareAndCast(IGESData_IGESEntity,igesent,ent); |
40 | if (igesent.IsNull()) return Standard_False; |
41 | Standard_Integer igt = igesent->TypeNumber(); |
42 | |
43 | // Cas clairs et nets : Faces typees comme telles |
44 | |
45 | if (igt == 510 || igt == 144 || igt == 143) return Standard_True; |
46 | |
47 | // Surfaces Libres |
48 | if (igt == 114 || igt == 118 || igt == 120 || igt == 122 || igt == 128 || igt == 140) |
49 | return Standard_True; |
50 | |
51 | // Cas du Plane |
52 | if (igt == 108) { |
53 | DeclareAndCast(IGESGeom_Plane,pln,ent); |
54 | return pln->HasBoundingCurve(); |
55 | } |
56 | |
57 | // A present, contenants possibles |
58 | |
59 | // SingleParent |
60 | if (igt == 402 && igesent->FormNumber() == 9) { |
61 | DeclareAndCast(IGESBasic_SingleParent,sp,ent); |
62 | if (sp.IsNull()) return Standard_False; |
63 | explored.AddItem (sp->SingleParent()); |
64 | Standard_Integer i,nb = sp->NbChildren(); |
65 | for (i = 1; i <= nb; i ++) explored.AddItem (sp->Child(i)); |
66 | return Standard_True; |
67 | } |
68 | |
69 | // Groups ... en dernier de la serie 402 |
70 | if (igt == 402) { |
71 | DeclareAndCast(IGESBasic_Group,gr,ent); |
72 | if (gr.IsNull()) return Standard_False; |
73 | Standard_Integer i, nb = gr->NbEntities(); |
74 | for (i = 1; i <= nb; i ++) explored.AddItem (gr->Entity(i)); |
75 | return Standard_True; |
76 | } |
77 | |
78 | // ManifoldSolid 186 -> Shells |
79 | if (igt == 186) { |
80 | DeclareAndCast(IGESSolid_ManifoldSolid,msb,ent); |
81 | explored.AddItem (msb->Shell()); |
82 | Standard_Integer i, nb = msb->NbVoidShells(); |
83 | for (i = 1; i <= nb; i ++) explored.AddItem (msb->VoidShell(i)); |
84 | return Standard_True; |
85 | } |
86 | |
87 | // Shell 514 -> Faces |
88 | if (igt == 514) { |
89 | DeclareAndCast(IGESSolid_Shell,sh,ent); |
90 | Standard_Integer i, nb = sh->NbFaces(); |
91 | for (i = 1; i <= nb; i ++) explored.AddItem (sh->Face(i)); |
92 | return Standard_True; |
93 | } |
94 | |
95 | // Pas trouve |
96 | return Standard_False; |
97 | } |
98 | |
99 | TCollection_AsciiString IGESSelect_SelectFaces::ExploreLabel () const |
100 | { return TCollection_AsciiString ("Faces"); } |