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 | |
7fd59977 |
15 | #include <IGESData_IGESEntity.hxx> |
c04c30b3 |
16 | #include <IGESData_ViewKindEntity.hxx> |
42cf5bc1 |
17 | #include <IGESSelect_SelectFromDrawing.hxx> |
18 | #include <Interface_EntityIterator.hxx> |
19 | #include <Interface_Graph.hxx> |
20 | #include <Interface_InterfaceError.hxx> |
7fd59977 |
21 | #include <Interface_Macros.hxx> |
42cf5bc1 |
22 | #include <Standard_Type.hxx> |
23 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
24 | |
92efcf78 |
25 | IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SelectFromDrawing,IFSelect_SelectDeduct) |
26 | |
7fd59977 |
27 | #define PourDrawing 404 |
28 | |
29 | |
b311480e |
30 | IGESSelect_SelectFromDrawing::IGESSelect_SelectFromDrawing () { } |
7fd59977 |
31 | |
32 | |
33 | Interface_EntityIterator IGESSelect_SelectFromDrawing::RootResult |
34 | (const Interface_Graph& G) const |
35 | { |
36 | Interface_EntityIterator list, views; |
37 | Interface_EntityIterator draws = InputResult(G); |
38 | if (draws.NbEntities() == 0) return list; |
39 | Standard_Integer nb = G.Size(); |
7fd59977 |
40 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
7fd59977 |
41 | |
42 | // Pour chaque Drawing : prendre d une part l integralite de son contenu, |
43 | // (c-a-d avec le "Frame"), d autre part les entites attachees a ses vues |
44 | for (draws.Start(); draws.More(); draws.Next()) { |
45 | DeclareAndCast(IGESData_IGESEntity,igesent,draws.Value()); |
46 | if (igesent.IsNull()) continue; |
47 | if (igesent->TypeNumber() != PourDrawing) continue; |
48 | list.GetOneItem (igesent); |
49 | Interface_EntityIterator someviews = G.Shareds (draws.Value()); |
50 | list.AddList (someviews.Content()); |
7fd59977 |
51 | } |
52 | for (i = 1; i <= nb; i ++) { |
53 | // if (!G.IsPresent(i)) continue; |
54 | DeclareAndCast(IGESData_IGESEntity,igesent,G.Entity(i)); |
55 | if (igesent.IsNull()) continue; |
56 | Standard_Integer nv = G.EntityNumber (igesent->View()); |
57 | if (nv > 0 && nv <= nb) list.GetOneItem(igesent); |
58 | } |
7fd59977 |
59 | return list; |
60 | } |
61 | |
62 | |
63 | TCollection_AsciiString IGESSelect_SelectFromDrawing::Label () const |
64 | { return TCollection_AsciiString ("Entities attached to a Drawing"); } |