b311480e |
1 | // Created on: 1999-03-25 |
2 | // Created by: data exchange team |
3 | // Copyright (c) 1999-1999 Matra Datavision |
4 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | // |
6 | // The content of this file is subject to the Open CASCADE Technology Public |
7 | // License Version 6.5 (the "License"). You may not use the content of this file |
8 | // except in compliance with the License. Please obtain a copy of the License |
9 | // at http://www.opencascade.org and read it completely before using this file. |
10 | // |
11 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | // |
14 | // The Original Code and all software distributed under the License is |
15 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | // Initial Developer hereby disclaims all such warranties, including without |
17 | // limitation, any warranties of merchantability, fitness for a particular |
18 | // purpose or non-infringement. Please see the License for the specific terms |
19 | // and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | |
22 | |
23 | #include <STEPSelections_SelectAssembly.ixx> |
24 | #include <Interface_Macros.hxx> |
25 | #include <StepShape_ContextDependentShapeRepresentation.hxx> |
26 | #include <StepRepr_ProductDefinitionShape.hxx> |
27 | #include <StepRepr_NextAssemblyUsageOccurrence.hxx> |
28 | #include <StepRepr_MappedItem.hxx> |
29 | #include <StepShape_ShapeRepresentation.hxx> |
30 | #include <StepShape_ShapeDefinitionRepresentation.hxx> |
31 | |
32 | STEPSelections_SelectAssembly::STEPSelections_SelectAssembly():IFSelect_SelectExplore (-1){ } |
33 | |
34 | Standard_Boolean STEPSelections_SelectAssembly::Explore(const Standard_Integer level, |
35 | const Handle(Standard_Transient)& start, |
36 | const Interface_Graph& G, |
37 | Interface_EntityIterator& explored) const |
38 | { |
39 | if(start.IsNull()) return Standard_False; |
40 | |
41 | if(start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) { |
42 | DeclareAndCast(StepShape_ContextDependentShapeRepresentation,sdsr,start); |
43 | Handle(StepRepr_ProductDefinitionShape) pds = sdsr->RepresentedProductRelation(); |
44 | if(pds.IsNull()) return Standard_False; |
45 | Handle(Standard_Transient) ent = pds->Definition().ProductDefinitionRelationship(); |
46 | if(ent.IsNull()) return Standard_False; |
47 | return (ent->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))); |
48 | } |
49 | |
50 | if(start->IsKind(STANDARD_TYPE(StepRepr_MappedItem))) { |
51 | DeclareAndCast(StepRepr_MappedItem,mapped,start); |
52 | Interface_EntityIterator subs = G.Sharings(mapped); |
53 | Handle(StepShape_ShapeRepresentation) shrep; |
54 | for(subs.Start(); subs.More()&&shrep.IsNull(); subs.Next()) |
55 | if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) |
56 | shrep = Handle(StepShape_ShapeRepresentation)::DownCast(subs.Value()); |
57 | if(shrep.IsNull()) return Standard_False; |
58 | |
59 | subs = G.Sharings(shrep); |
60 | Handle(StepShape_ShapeDefinitionRepresentation) shdefrep; |
61 | for(subs.Start(); subs.More()&&shdefrep.IsNull(); subs.Next()) |
62 | if(subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) |
63 | shdefrep = Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(subs.Value()); |
64 | if(shdefrep.IsNull()) return Standard_False; |
65 | |
66 | Handle(StepRepr_ProductDefinitionShape) pds = |
67 | Handle(StepRepr_ProductDefinitionShape)::DownCast ( shdefrep->Definition().PropertyDefinition() ); |
68 | if(pds.IsNull()) return Standard_False; |
69 | Handle(Standard_Transient) ent = pds->Definition().ProductDefinitionRelationship(); |
70 | if(ent.IsNull()) return Standard_False; |
71 | return (ent->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))); |
72 | } |
73 | |
74 | Interface_EntityIterator subs = G.Shareds(start); |
75 | subs.Start(); |
76 | Standard_Boolean isSome = subs.More(); |
77 | for (; subs.More(); subs.Next()) |
78 | explored.AddItem (subs.Value()); |
79 | |
80 | return isSome; |
81 | } |
82 | |
83 | TCollection_AsciiString STEPSelections_SelectAssembly::ExploreLabel() const |
84 | { |
85 | return TCollection_AsciiString ("Assembly components"); |
86 | } |
87 | |
88 | |
89 | |
90 | |
91 | |
92 | |
93 | |