0028840: Data Exchange - rewrite the STL Reader/Writer
[occt.git] / src / StlAPI / StlAPI.hxx
1 // Created on: 1997-05-13
2 // Created by: Fabien REUTER
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _StlAPI_HeaderFile
18 #define _StlAPI_HeaderFile
19
20 #include <Poly_Triangulation.hxx>
21 #include <Standard.hxx>
22 #include <Standard_DefineAlloc.hxx>
23 #include <Standard_Handle.hxx>
24 #include <Standard_CString.hxx>
25 #include <Standard_Boolean.hxx>
26 class TopoDS_Shape;
27 class StlAPI_Writer;
28 class StlAPI_Reader;
29
30 //! Offers the API for STL data manipulation.
31 class StlAPI
32 {
33 public:
34
35   DEFINE_STANDARD_ALLOC
36
37   //! Convert and write shape to STL format.
38   //! File is written in binary if aAsciiMode is False otherwise it is written in Ascii (by default).
39   Standard_EXPORT static Standard_Boolean Write (const TopoDS_Shape&    theShape,
40                                                  const Standard_CString theFile,
41                                                  const Standard_Boolean theAsciiMode = Standard_True);
42
43   //! Legacy interface.
44   //! Read STL file and create a shape composed of triangular faces, one per facet.
45   //! This approach is very inefficient, especially for large files.
46   //! Consider reading STL file to Poly_Triangulation object instead (see class RWStl).
47   Standard_DEPRECATED("This method is very inefficient; see RWStl class for better alternative")
48   Standard_EXPORT static Standard_Boolean Read (TopoDS_Shape& theShape,
49                                                 const Standard_CString aFile);
50
51 };
52
53 #endif // _StlAPI_HeaderFile