0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESCAFControl / IGESCAFControl_Writer.hxx
CommitLineData
42cf5bc1 1// Created on: 2000-08-17
2// Created by: Andrey BETENEV
3// Copyright (c) 2000-2014 OPEN CASCADE SAS
4//
5// This file is part of Open CASCADE Technology software library.
6//
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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _IGESCAFControl_Writer_HeaderFile
17#define _IGESCAFControl_Writer_HeaderFile
18
19#include <Standard.hxx>
20#include <Standard_DefineAlloc.hxx>
21#include <Standard_Handle.hxx>
22
23#include <Standard_Boolean.hxx>
24#include <IGESControl_Writer.hxx>
25#include <Standard_CString.hxx>
26#include <TDF_LabelSequence.hxx>
08b183fe 27#include <XCAFPrs_IndexedDataMapOfShapeStyle.hxx>
42cf5bc1 28#include <XCAFPrs_DataMapOfStyleTransient.hxx>
29#include <TopTools_MapOfShape.hxx>
30class XSControl_WorkSession;
31class TDocStd_Document;
32class TCollection_AsciiString;
33class TopoDS_Shape;
34class XCAFPrs_Style;
35
42cf5bc1 36//! Provides a tool to write DECAF document to the
37//! IGES file. Besides transfer of shapes (including
38//! assemblies) provided by IGESControl, supports also
39//! colors and part names
40//! IGESCAFControl_Writer writer();
41//! Methods for writing IGES file:
42//! writer.Transfer (Document);
43//! writer.Write("filename") or writer.Write(OStream) or
44//! writer.Perform(Document,"filename");
45//! Methods for managing the writing of attributes.
46//! Colors
47//! writer.SetColorMode(colormode);
48//! Standard_Boolean colormode = writer.GetColorMode();
49//! Layers
50//! writer.SetLayerMode(layermode);
51//! Standard_Boolean layermode = writer.GetLayerMode();
52//! Names
53//! writer.SetNameMode(namemode);
54//! Standard_Boolean namemode = writer.GetNameMode();
55class IGESCAFControl_Writer : public IGESControl_Writer
56{
57public:
58
59 DEFINE_STANDARD_ALLOC
60
61
62 //! Creates a writer with an empty
63 //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True.
64 Standard_EXPORT IGESCAFControl_Writer();
65
66 //! Creates a reader tool and attaches it to an already existing Session
67 //! Clears the session if it was not yet set for IGES
68 Standard_EXPORT IGESCAFControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
69
70 //! Transfers a document to a IGES model
71 //! Returns True if translation is OK
72 Standard_EXPORT Standard_Boolean Transfer (const Handle(TDocStd_Document)& doc);
1b44ab4b 73
74 //! Transfers labels to a IGES model
75 //! Returns True if translation is OK
76 Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& labels);
77
78 //! Transfers label to a IGES model
79 //! Returns True if translation is OK
80 Standard_EXPORT Standard_Boolean Transfer (const TDF_Label& label);
81
42cf5bc1 82 Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const TCollection_AsciiString& filename);
83
84 //! Transfers a document and writes it to a IGES file
85 //! Returns True if translation is OK
86 Standard_EXPORT Standard_Boolean Perform (const Handle(TDocStd_Document)& doc, const Standard_CString filename);
87
88 //! Set ColorMode for indicate write Colors or not.
89 Standard_EXPORT void SetColorMode (const Standard_Boolean colormode);
90
91 Standard_EXPORT Standard_Boolean GetColorMode() const;
92
93 //! Set NameMode for indicate write Name or not.
94 Standard_EXPORT void SetNameMode (const Standard_Boolean namemode);
95
96 Standard_EXPORT Standard_Boolean GetNameMode() const;
97
98 //! Set LayerMode for indicate write Layers or not.
99 Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode);
100
101 Standard_EXPORT Standard_Boolean GetLayerMode() const;
102
103
104
105
106protected:
1b44ab4b 107
42cf5bc1 108 //! Reads colors from DECAF document and assigns them
109 //! to corresponding IGES entities
110 Standard_EXPORT Standard_Boolean WriteAttributes (const TDF_LabelSequence& labels);
111
112 //! Reads layers from DECAF document and assigns them
113 //! to corresponding IGES entities
114 Standard_EXPORT Standard_Boolean WriteLayers (const TDF_LabelSequence& labels);
115
116 //! Recursivile iterates on subshapes and assign names
117 //! to IGES entity
118 Standard_EXPORT Standard_Boolean WriteNames (const TDF_LabelSequence& labels);
119
120
121
122
123private:
124
125
126 //! Recursively iterates on subshapes and assigns colors
127 //! to faces and edges (if set)
08b183fe 128 Standard_EXPORT void MakeColors (const TopoDS_Shape& S, const XCAFPrs_IndexedDataMapOfShapeStyle& settings, XCAFPrs_DataMapOfStyleTransient& colors, TopTools_MapOfShape& Map, const XCAFPrs_Style& inherit);
42cf5bc1 129
130
131 Standard_Boolean myColorMode;
132 Standard_Boolean myNameMode;
133 Standard_Boolean myLayerMode;
134
135
136};
137
138
139
140
141
142
143
144#endif // _IGESCAFControl_Writer_HeaderFile