1 // Created on: 2007-08-04
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef VrmlData_ShapeConvert_HeaderFile
17 #define VrmlData_ShapeConvert_HeaderFile
19 #include <VrmlData_Geometry.hxx>
20 #include <VrmlData_Appearance.hxx>
21 #include <NCollection_List.hxx>
22 #include <TopoDS_Shape.hxx>
25 class VrmlData_Coordinate;
28 class Poly_Triangulation;
31 * Algorithm converting one shape or a set of shapes to VrmlData_Scene.
34 class VrmlData_ShapeConvert
39 TCollection_AsciiString Name;
41 Handle(VrmlData_Node) Node;
44 // ---------- PUBLIC METHODS ----------
50 * Scene receiving all Vrml data.
52 * Scale factor, considering that VRML standard specifies coordinates in
53 * meters. So if your data are in mm, you should provide theScale=0.001
55 inline VrmlData_ShapeConvert (VrmlData_Scene& theScene,
56 const Standard_Real theScale = 1.)
62 * Add one shape to the internal list, may be called several times with
65 Standard_EXPORT void AddShape (const TopoDS_Shape& theShape,
66 const char * theName = 0L);
69 * Convert all accumulated shapes and store them in myScene.
70 * The internal data structures are cleared in the end of convertion.
71 * @param theExtractFaces
72 * If True, converter extracst faces from the shapes.
73 * @param theExtractEdges
74 * If True, converter extracts edges from the shapes.
75 * @param theDeflection
76 * Deflection for tessellation of geometrical lines/surfaces. Existing mesh
77 * is used if its deflection is smaller than the one given by this
80 * Angular deflection for tessellation of geometrical lines.
82 Standard_EXPORT void Convert (const Standard_Boolean theExtractFaces,
83 const Standard_Boolean theExtractEdges,
84 const Standard_Real theDeflection = 0.01,
85 const Standard_Real theDeflAngle = 20.*M_PI/180.);
86 //this value of theDeflAngle is used by default
87 //for tesselation while shading (Drawer->HLRAngle())
89 // ---------- PROTECTED METHODS ----------
91 Handle(VrmlData_Geometry) triToIndexedFaceSet
92 (const Handle(Poly_Triangulation)&,
94 const Handle(VrmlData_Coordinate)&);
96 Handle(VrmlData_Geometry) polToIndexedLineSet
97 (const Handle(Poly_Polygon3D)&);
99 Handle(VrmlData_Appearance) defaultMaterialFace () const;
101 Handle(VrmlData_Appearance) defaultMaterialEdge () const;
104 // ---------- PRIVATE FIELDS ----------
106 VrmlData_Scene& myScene;
107 Standard_Real myScale;
108 NCollection_List <ShapeData> myShapes;
109 // ---------- PRIVATE METHODS ----------
110 void operator= (const VrmlData_ShapeConvert&);