summaryrefslogtreecommitdiff
path: root/src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cxx
blob: b5217870fd60c7860d4e2bffebb46063f3eee55e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//File:	        TopoDSToStep_MakeGeometricCurveSet.cxx
//Created:	Fri Mar 17 10:54:55 1995
//Author:	Dieter THIEMANN
//		<dth@cinox>
//Copyright:    Matra Datavision 1995

#include <TopoDSToStep_MakeGeometricCurveSet.ixx>
#include <TopoDSToStep.hxx>
#include <TopoDSToStep_Builder.hxx>
#include <TopoDSToStep_WireframeBuilder.hxx>
#include <TopoDSToStep_Tool.hxx>
#include <MoniTool_DataMapOfShapeTransient.hxx>

#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>

#include <StepShape_GeometricSetSelect.hxx>
#include <StepShape_HArray1OfGeometricSetSelect.hxx>

#include <TColStd_HSequenceOfTransient.hxx>
#include <StdFail_NotDone.hxx>
#include <Transfer_FinderProcess.hxx>
#include <TransferBRep_ShapeMapper.hxx>

#include <TCollection_HAsciiString.hxx>

//=============================================================================
// Create a GeometricCurveSet of StepShape from a Shape of TopoDS
//=============================================================================

TopoDSToStep_MakeGeometricCurveSet::TopoDSToStep_MakeGeometricCurveSet(
                                    const TopoDS_Shape& aShape,
				    const Handle(Transfer_FinderProcess)& FP)
{
  done = Standard_False;
  Handle(TColStd_HSequenceOfTransient)  itemList;
  MoniTool_DataMapOfShapeTransient      aMap;
  TopoDSToStep_Tool                aTool (aMap, Standard_False);
  TopoDSToStep_WireframeBuilder    wirefB (aShape, aTool, FP);
  TopoDSToStep::AddResult ( FP, aTool );

  Handle(StepShape_GeometricCurveSet) aGCSet =
    new StepShape_GeometricCurveSet;
  Handle(TCollection_HAsciiString) empty = new TCollection_HAsciiString("");
  if (wirefB.IsDone()) {
    itemList = wirefB.Value();
    Standard_Integer nbItem = itemList->Length();
    if (nbItem > 0) {
      Handle(StepShape_HArray1OfGeometricSetSelect) aGSS =
	new StepShape_HArray1OfGeometricSetSelect(1,nbItem);

      for (Standard_Integer i=1; i<=nbItem; i++) {
	StepShape_GeometricSetSelect select;
	select.SetValue(itemList->Value(i));
	aGSS->SetValue(i,select);
      }
      aGCSet->SetName(empty);
      aGCSet->SetElements(aGSS);
      theGeometricCurveSet = aGCSet;
      done = Standard_True;
    }
  }
}

const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Value() const 
{
  StdFail_NotDone_Raise_if(!done,"");
  return theGeometricCurveSet;
}

//const Handle(StepShape_GeometricCurveSet)& TopoDSToStep_MakeGeometricCurveSet::Operator() const 
//{
//  return Value();
//}

//TopoDSToStep_MakeGeometricCurveSet::operator Handle(StepShape_GeometricCurveSet) () const 
//{
//  return Value();
//}