Logo ROOT   6.14/05
Reference Guide
TOCCToStep.h
Go to the documentation of this file.
1 // @(#)geom/geocad:$Id$
2 // Author: Cinzia Luzzi 5/5/2012
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TOCCToStep
13 #define ROOT_TOCCToStep
14 
15 #include "TGeoNode.h"
16 #include "TGeoMatrix.h"
17 #include "TGeoToOCC.h"
18 
19 #include <TDF_Label.hxx>
20 #include <XCAFDoc_ShapeTool.hxx>
21 #include <TDocStd_Document.hxx>
22 #include <STEPCAFControl_Writer.hxx>
23 #include <TDF_Label.hxx>
24 #include <TopoDS_Shape.hxx>
25 
26 
27 class TOCCToStep {
28 
29 private:
30  typedef std::map <TGeoVolume *, TDF_Label> LabelMap_t;
31 
32  STEPCAFControl_Writer fWriter; //the step file pointer
33  Handle(TDocStd_Document) fDoc; //the step document element
34 
35  // The following probably shouldn't be data members.
36  LabelMap_t fTree; //tree of Label's volumes
37  TDF_Label fLabel; //label of the OCC shape element
39  TopoDS_Shape fShape; //OCC shape (translated root shape)
40 
41  void OCCDocCreation();
42  TopoDS_Shape AssemblyShape(TGeoVolume *vol, TGeoHMatrix m);
43  TGeoVolume *GetVolumeOfLabel(TDF_Label fLabel);
44  TDF_Label GetLabelOfVolume(TGeoVolume * v);
45  void AddChildLabel(TDF_Label mother, TDF_Label child, TopLoc_Location loc);
46  TopLoc_Location CalcLocation(TGeoHMatrix matrix);
47 
48  void FillOCCWithNode(TGeoManager* m, TGeoNode* currentNode, TGeoIterator& nextNode, int level, int max_level, int level1_skipped);
49 
50 public:
51  TOCCToStep();
52  void PrintAssembly();
53  TDF_Label OCCShapeCreation(TGeoManager *m);
54  void OCCTreeCreation(TGeoManager *m, int max_level = -1);
55  bool OCCPartialTreeCreation(TGeoManager *m, const char* node_name, int max_level = -1);
56  bool OCCPartialTreeCreation(TGeoManager *m, std::map<std::string,int> part_name_levels);
57 
58 
59  void OCCWriteStep(const char *fname);
60 };
61 
62 #endif
The manager class for any TGeo geometry.
Definition: TGeoManager.h:38
auto * m
Definition: textangle.C:8
void FillOCCWithNode(TGeoManager *m, TGeoNode *currentNode, TGeoIterator &nextNode, int level, int max_level, int level1_skipped)
Definition: TOCCToStep.cxx:351
void OCCWriteStep(const char *fname)
Definition: TOCCToStep.cxx:144
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
void AddChildLabel(TDF_Label mother, TDF_Label child, TopLoc_Location loc)
Definition: TOCCToStep.cxx:181
TGeoVolume * GetVolumeOfLabel(TDF_Label fLabel)
Definition: TOCCToStep.cxx:170
Matrix class used for computing global transformations Should NOT be used for node definition...
Definition: TGeoMatrix.h:420
This class contains implementation of converting ROOT&#39;s geometry shapes to OpenCascade shapes...
Definition: TGeoToOCC.h:30
void PrintAssembly()
Definition: TOCCToStep.cxx:396
STEPCAFControl_Writer fWriter
Definition: TOCCToStep.h:32
A geometry iterator.
Definition: TGeoNode.h:243
std::map< TGeoVolume *, TDF_Label > LabelMap_t
Definition: TOCCToStep.h:30
This class contains implementation of writing OpenCascade&#39;s geometry shapes to the STEP file reproduc...
Definition: TOCCToStep.h:27
SVector< double, 2 > v
Definition: Dict.h:5
LabelMap_t fTree
Definition: TOCCToStep.h:36
TopoDS_Shape fShape
Definition: TOCCToStep.h:39
void OCCDocCreation()
Definition: TOCCToStep.cxx:58
TopLoc_Location CalcLocation(TGeoHMatrix matrix)
Definition: TOCCToStep.cxx:189
TGeoToOCC fRootShape
Definition: TOCCToStep.h:38
TDF_Label fLabel
Definition: TOCCToStep.h:37
void OCCTreeCreation(TGeoManager *m, int max_level=-1)
Definition: TOCCToStep.cxx:210
TDF_Label OCCShapeCreation(TGeoManager *m)
Logical fTree creation.
Definition: TOCCToStep.cxx:71
A node represent a volume positioned inside another.They store links to both volumes and to the TGeoM...
Definition: TGeoNode.h:39
TDF_Label GetLabelOfVolume(TGeoVolume *v)
Definition: TOCCToStep.cxx:159
Handle(TDocStd_Document) fDoc
bool OCCPartialTreeCreation(TGeoManager *m, const char *node_name, int max_level=-1)
Definition: TOCCToStep.cxx:257
TopoDS_Shape AssemblyShape(TGeoVolume *vol, TGeoHMatrix m)