b311480e |
1 | // Created on: 1999-03-22 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 1999-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <Interface_EntityIterator.hxx> |
19 | #include <Interface_Graph.hxx> |
20 | #include <Standard_Transient.hxx> |
21 | #include <Standard_Type.hxx> |
7fd59977 |
22 | #include <StepGeom_CompositeCurve.hxx> |
7fd59977 |
23 | #include <StepGeom_CompositeCurveSegment.hxx> |
42cf5bc1 |
24 | #include <StepGeom_Curve.hxx> |
25 | #include <STEPSelections_SelectGSCurves.hxx> |
26 | #include <StepShape_GeometricSet.hxx> |
27 | #include <TCollection_AsciiString.hxx> |
7fd59977 |
28 | |
92efcf78 |
29 | IMPLEMENT_STANDARD_RTTIEXT(STEPSelections_SelectGSCurves,IFSelect_SelectExplore) |
30 | |
7fd59977 |
31 | static Standard_Integer flag; |
32 | |
33 | STEPSelections_SelectGSCurves::STEPSelections_SelectGSCurves():IFSelect_SelectExplore (-1){ flag = 1;} |
34 | |
35e08fe8 |
35 | Standard_Boolean STEPSelections_SelectGSCurves::Explore(const Standard_Integer /*level*/, |
7fd59977 |
36 | const Handle(Standard_Transient)& start, |
37 | const Interface_Graph& G, |
38 | Interface_EntityIterator& explored) const |
39 | { |
40 | if(start.IsNull()) return Standard_False; |
41 | |
42 | if (start->IsKind(STANDARD_TYPE(StepGeom_Curve))) { |
43 | if(start->IsKind(STANDARD_TYPE(StepGeom_CompositeCurve))) { |
44 | Interface_EntityIterator subs = G.Sharings(start); |
45 | Standard_Boolean isInGeomSet = Standard_False; |
46 | for (subs.Start(); subs.More()&&!isInGeomSet; subs.Next()) |
47 | if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))){ |
48 | if(flag) { |
49 | explored.AddItem (subs.Value()); |
50 | flag =0; |
51 | } |
52 | isInGeomSet = Standard_True; |
53 | } |
54 | if(isInGeomSet) { |
51740958 |
55 | Interface_EntityIterator aSubsShareds = G.Shareds(start); |
56 | aSubsShareds.Start(); |
57 | Standard_Boolean isSome = aSubsShareds.More(); |
58 | for (; aSubsShareds.More(); aSubsShareds.Next()) |
59 | explored.AddItem (aSubsShareds.Value()); |
7fd59977 |
60 | return isSome; |
61 | } else |
62 | return Standard_False; |
63 | } else { |
64 | Interface_EntityIterator subs = G.Sharings(start); |
65 | for (subs.Start(); subs.More(); subs.Next()) { |
66 | if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_GeometricSet))|| |
67 | subs.Value()->IsKind(STANDARD_TYPE(StepGeom_CompositeCurveSegment))) |
68 | return Standard_True; |
69 | } |
70 | } |
71 | } |
72 | |
73 | Interface_EntityIterator subs = G.Shareds(start); |
74 | subs.Start(); |
75 | Standard_Boolean isSome = subs.More(); |
76 | for (; subs.More(); subs.Next()) |
77 | explored.AddItem (subs.Value()); |
78 | |
79 | return isSome; |
80 | } |
81 | |
82 | TCollection_AsciiString STEPSelections_SelectGSCurves::ExploreLabel() const |
83 | { |
84 | return TCollection_AsciiString ("Curves in GS"); |
85 | } |