0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / IGESControl / IGESControl_Writer.hxx
CommitLineData
42cf5bc1 1// Created on: 1996-01-30
2// Created by: Christian CAILLET
3// Copyright (c) 1996-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 _IGESControl_Writer_HeaderFile
18#define _IGESControl_Writer_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <IGESData_BasicEditor.hxx>
25#include <Standard_Integer.hxx>
26#include <Standard_Boolean.hxx>
27#include <Standard_CString.hxx>
28#include <Standard_OStream.hxx>
29class Transfer_FinderProcess;
30class IGESData_IGESModel;
31class TopoDS_Shape;
32class Standard_Transient;
33class IGESData_IGESEntity;
34
35
36//! This class creates and writes
37//! IGES files from CAS.CADE models. An IGES file can be written to
38//! an existing IGES file or to a new one.
39//! The translation can be performed in one or several
40//! operations. Each translation operation
41//! outputs a distinct root entity in the IGES file.
42//! To write an IGES file it is possible to use the following sequence:
43//! To modify the IGES file header or to change translation
44//! parameters it is necessary to use class Interface_Static (see
45//! IGESParameters and GeneralParameters).
46class IGESControl_Writer
47{
48public:
49
50 DEFINE_STANDARD_ALLOC
51
52
53 //! Creates a writer object with the
54 //! default unit (millimeters) and write mode (Face).
55 //! IGESControl_Writer (const Standard_CString unit,
56 //! const Standard_Integer modecr = 0);
57 Standard_EXPORT IGESControl_Writer();
58
59 //! Creates a writer with given
60 //! values for units and for write mode.
61 //! unit may be any unit that is accepted by the IGES standard.
62 //! By default, it is the millimeter.
63 //! modecr defines the write mode and may be:
64 //! - 0: Faces (default)
65 //! - 1: BRep.
66 Standard_EXPORT IGESControl_Writer(const Standard_CString unit, const Standard_Integer modecr = 0);
67
68 //! Creates a writer object with the
69 //! prepared IGES model model in write mode.
70 //! modecr defines the write mode and may be:
71 //! - 0: Faces (default)
72 //! - 1: BRep.
73 Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr = 0);
74
75 //! Returns the IGES model to be written in output.
76 Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
77
78 Standard_EXPORT Handle(Transfer_FinderProcess) TransferProcess() const;
79
80 //! Returns/Sets the TransferProcess : it contains final results
81 //! and if some, check messages
82 Standard_EXPORT void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP);
83
84 //! Translates a Shape to IGES Entities and adds them to the model
85 //! Returns True if done, False if Shape not suitable for IGES or null
86 Standard_EXPORT Standard_Boolean AddShape (const TopoDS_Shape& sh);
87
88 //! Translates a Geometry (Surface or Curve) to IGES Entities and
89 //! adds them to the model
90 //! Returns True if done, False if geom is neither a Surface or
91 //! a Curve suitable for IGES or is null
92 Standard_EXPORT Standard_Boolean AddGeom (const Handle(Standard_Transient)& geom);
93
94 //! Adds an IGES entity (and the ones it references) to the model
95 Standard_EXPORT Standard_Boolean AddEntity (const Handle(IGESData_IGESEntity)& ent);
96
97 //! Computes the entities found in
98 //! the model, which is ready to be written.
99 //! This contrasts with the default computation of headers only.
100 Standard_EXPORT void ComputeModel();
101
102 //! Computes then writes the model to an OStream
103 //! Returns True when done, false in case of error
104 Standard_EXPORT Standard_Boolean Write (Standard_OStream& S, const Standard_Boolean fnes = Standard_False);
105
106 //! Prepares and writes an IGES model
107 //! either to an OStream, S or to a file name,CString.
108 //! Returns True if the operation was performed correctly and
109 //! False if an error occurred (for instance,
110 //! if the processor could not create the file).
111 Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
112
113 //! Prints Statistics about Transfer
114 Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
115
116
117
118
119protected:
120
121
122
123
124
125private:
126
127
128
129 Handle(Transfer_FinderProcess) theTP;
130 Handle(IGESData_IGESModel) themod;
131 IGESData_BasicEditor thedit;
132 Standard_Integer thecr;
133 Standard_Boolean thest;
134
135
136};
137
138
139
140
141
142
143
144#endif // _IGESControl_Writer_HeaderFile