File indexing completed on 2025-01-18 10:05:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef VrmlData_ShapeConvert_HeaderFile
0017 #define VrmlData_ShapeConvert_HeaderFile
0018
0019 #include <VrmlData_Geometry.hxx>
0020 #include <VrmlData_Group.hxx>
0021 #include <NCollection_List.hxx>
0022 #include <NCollection_DataMap.hxx>
0023 #include <TopoDS_Shape.hxx>
0024
0025 class VrmlData_Scene;
0026 class VrmlData_Coordinate;
0027 class TopoDS_Face;
0028 class Poly_Polygon3D;
0029 class Poly_Triangulation;
0030 class XCAFPrs_Style;
0031 class TDocStd_Document;
0032 class TDF_Label;
0033
0034
0035
0036
0037
0038
0039 class VrmlData_ShapeConvert
0040 {
0041 public:
0042
0043 typedef struct {
0044 TCollection_AsciiString Name;
0045 TopoDS_Shape Shape;
0046 Handle(VrmlData_Node) Node;
0047 } ShapeData;
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 inline VrmlData_ShapeConvert (VrmlData_Scene& theScene,
0061 const Standard_Real theScale = 1.)
0062 : myScene (theScene),
0063 myScale (theScale),
0064 myDeflection(0.0),
0065 myDeflAngle(0.0)
0066 {}
0067
0068
0069
0070
0071
0072 Standard_EXPORT void AddShape (const TopoDS_Shape& theShape,
0073 const char * theName = 0L);
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089 Standard_EXPORT void Convert (const Standard_Boolean theExtractFaces,
0090 const Standard_Boolean theExtractEdges,
0091 const Standard_Real theDeflection = 0.01,
0092 const Standard_Real theDeflAngle = 20.*M_PI/180.);
0093
0094
0095
0096
0097
0098
0099 Standard_EXPORT void ConvertDocument(const Handle(TDocStd_Document)& theDoc);
0100
0101 protected:
0102
0103
0104 Handle(VrmlData_Geometry) triToIndexedFaceSet
0105 (const Handle(Poly_Triangulation)&,
0106 const TopoDS_Face&,
0107 const Handle(VrmlData_Coordinate)&);
0108
0109 Handle(VrmlData_Geometry) polToIndexedLineSet
0110 (const Handle(Poly_Polygon3D)&);
0111
0112 Handle(VrmlData_Appearance) defaultMaterialFace () const;
0113
0114 Handle(VrmlData_Appearance) defaultMaterialEdge () const;
0115
0116 Handle(VrmlData_Geometry) makeTShapeNode(const TopoDS_Shape& theShape,
0117 const TopAbs_ShapeEnum theShapeType,
0118 TopLoc_Location& theLoc);
0119
0120 void addAssembly (const Handle(VrmlData_Group)& theParent,
0121 const TDF_Label& theLabel,
0122 const Handle(TDocStd_Document)& theDoc,
0123 const Standard_Boolean theNeedCreateGroup);
0124
0125 void addInstance (const Handle(VrmlData_Group)& theParent,
0126 const TDF_Label& theLabel,
0127 const Handle(TDocStd_Document)& theDoc);
0128
0129 void addShape (const Handle(VrmlData_Group)& theParent,
0130 const TDF_Label& theLabel,
0131 const Handle(TDocStd_Document)& theDoc);
0132
0133 Handle(VrmlData_Appearance) makeMaterialFromStyle (const XCAFPrs_Style& theStyle,
0134 const TDF_Label& theAttribLab) const;
0135
0136 private:
0137
0138
0139 VrmlData_Scene& myScene;
0140 Standard_Real myScale;
0141 NCollection_List <ShapeData> myShapes;
0142
0143 Standard_Real myDeflection;
0144 Standard_Real myDeflAngle;
0145 NCollection_DataMap <TopoDS_Shape, Handle(VrmlData_Geometry)> myRelMap;
0146
0147
0148 void operator= (const VrmlData_ShapeConvert&);
0149 };
0150
0151 #endif