b311480e |
1 | // Created on: 1995-03-17 |
2 | // Created by: Dieter THIEMANN |
3 | // Copyright (c) 1995-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 | |
7fd59977 |
17 | |
42cf5bc1 |
18 | #include <MoniTool_DataMapOfShapeTransient.hxx> |
19 | #include <StdFail_NotDone.hxx> |
20 | #include <StepShape_GeometricCurveSet.hxx> |
7fd59977 |
21 | #include <StepShape_GeometricSetSelect.hxx> |
22 | #include <StepShape_HArray1OfGeometricSetSelect.hxx> |
42cf5bc1 |
23 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
24 | #include <TColStd_HSequenceOfTransient.hxx> |
42cf5bc1 |
25 | #include <TopoDS.hxx> |
42cf5bc1 |
26 | #include <TopoDS_Shape.hxx> |
27 | #include <TopoDSToStep.hxx> |
28 | #include <TopoDSToStep_Builder.hxx> |
29 | #include <TopoDSToStep_MakeGeometricCurveSet.hxx> |
30 | #include <TopoDSToStep_Tool.hxx> |
31 | #include <TopoDSToStep_WireframeBuilder.hxx> |
7fd59977 |
32 | #include <Transfer_FinderProcess.hxx> |
33 | #include <TransferBRep_ShapeMapper.hxx> |
34 | |
7fd59977 |
35 | //============================================================================= |
36 | // Create a GeometricCurveSet of StepShape from a Shape of TopoDS |
37 | //============================================================================= |
7fd59977 |
38 | TopoDSToStep_MakeGeometricCurveSet::TopoDSToStep_MakeGeometricCurveSet( |
39 | const TopoDS_Shape& aShape, |
40 | const Handle(Transfer_FinderProcess)& FP) |
41 | { |
42 | done = Standard_False; |
43 | Handle(TColStd_HSequenceOfTransient) itemList; |
44 | MoniTool_DataMapOfShapeTransient aMap; |
45 | TopoDSToStep_Tool aTool (aMap, Standard_False); |
46 | TopoDSToStep_WireframeBuilder wirefB (aShape, aTool, FP); |
47 | TopoDSToStep::AddResult ( FP, aTool ); |
48 | |
49 | Handle(StepShape_GeometricCurveSet) aGCSet = |
50 | new StepShape_GeometricCurveSet; |
51 | Handle(TCollection_HAsciiString) empty = new TCollection_HAsciiString(""); |
52 | if (wirefB.IsDone()) { |
53 | itemList = wirefB.Value(); |
54 | Standard_Integer nbItem = itemList->Length(); |
55 | if (nbItem > 0) { |
56 | Handle(StepShape_HArray1OfGeometricSetSelect) aGSS = |
57 | new StepShape_HArray1OfGeometricSetSelect(1,nbItem); |
58 | |
59 | for (Standard_Integer i=1; i<=nbItem; i++) { |
60 | StepShape_GeometricSetSelect select; |
61 | select.SetValue(itemList->Value(i)); |
62 | aGSS->SetValue(i,select); |
63 | } |
64 | aGCSet->SetName(empty); |
65 | aGCSet->SetElements(aGSS); |
66 | theGeometricCurveSet = aGCSet; |
67 | done = Standard_True; |
68 | } |
69 | } |
70 | } |
71 | |
72 | const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Value() const |
73 | { |
2d2b3d53 |
74 | StdFail_NotDone_Raise_if (!done, "TopoDSToStep_MakeGeometricCurveSet::Value() - no result"); |
7fd59977 |
75 | return theGeometricCurveSet; |
76 | } |
77 | |
78 | //const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Operator() const |
79 | //{ |
80 | // return Value(); |
81 | //} |
82 | |
83 | //TopoDSToStep_MakeGeometricCurveSet::operator Handle(StepShape_GeometricCurveSet) () const |
84 | //{ |
85 | // return Value(); |
86 | //} |
87 | |
88 | |