7a2d3124a1070be18b4b8fb8c59e15cc5db0e308
[occt.git] / src / BinMNaming / BinMNaming_NamedShapeDriver.hxx
1 // Created on: 2004-04-08
2 // Created by: Sergey ZARITCHNY <szy@opencascade.com>
3 // Copyright (c) 2004-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 _BinMNaming_NamedShapeDriver_HeaderFile
17 #define _BinMNaming_NamedShapeDriver_HeaderFile
18
19 #include <Standard.hxx>
20 #include <Standard_Type.hxx>
21
22 #include <BinTools_ShapeSet.hxx>
23 #include <Standard_Integer.hxx>
24 #include <BinMDF_ADriver.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <BinObjMgt_RRelocationTable.hxx>
27 #include <BinObjMgt_SRelocationTable.hxx>
28 #include <Standard_IStream.hxx>
29 #include <Standard_OStream.hxx>
30 class Message_Messenger;
31 class TDF_Attribute;
32 class BinObjMgt_Persistent;
33 class BinTools_LocationSet;
34
35
36 class BinMNaming_NamedShapeDriver;
37 DEFINE_STANDARD_HANDLE(BinMNaming_NamedShapeDriver, BinMDF_ADriver)
38
39 //! NamedShape  Attribute Driver.
40 class BinMNaming_NamedShapeDriver : public BinMDF_ADriver
41 {
42
43 public:
44
45   
46   Standard_EXPORT BinMNaming_NamedShapeDriver(const Handle(Message_Messenger)& theMessageDriver);
47   
48   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
49   
50   Standard_EXPORT Standard_Boolean Paste (const BinObjMgt_Persistent& Source, const Handle(TDF_Attribute)& Target, BinObjMgt_RRelocationTable& RelocTable) const Standard_OVERRIDE;
51   
52   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Source, BinObjMgt_Persistent& Target, BinObjMgt_SRelocationTable& RelocTable) const Standard_OVERRIDE;
53   
54   //! Input the shapes from Bin Document file
55   Standard_EXPORT void ReadShapeSection (Standard_IStream& theIS,
56                                          const Message_ProgressRange& therange = Message_ProgressRange());
57   
58   //! Output the shapes into Bin Document file
59   Standard_EXPORT void WriteShapeSection(Standard_OStream& theOS,
60                                          const Standard_Integer theDocVer,
61                                          const Message_ProgressRange& therange = Message_ProgressRange());
62   
63   //! Clear myShapeSet
64   Standard_EXPORT void Clear();
65
66   //! Return true if shape should be stored with triangles.
67   Standard_Boolean IsWithTriangles() const { return myWithTriangles; }
68   //! Return true if shape should be stored with triangulation normals.
69   Standard_Boolean IsWithNormals() const { return myWithNormals; }
70   //! set whether to store triangulation
71   void SetWithTriangles (const Standard_Boolean isWithTriangles);
72   //! set whether to store triangulation with normals
73   void SetWithNormals (const Standard_Boolean isWithNormals);
74   //! get the shapes locations
75   Standard_EXPORT BinTools_LocationSet& GetShapesLocations() const;
76
77   //! Sets the flag for quick part of the document access: shapes are stored in the attribute.
78   Standard_EXPORT void EnableQuickPart(const Standard_Boolean theValue) { myIsQuickPart = theValue; }
79   //! Returns true if quick part of the document access is enabled: shapes are stored in the attribute.
80   Standard_EXPORT Standard_Boolean IsQuickPart() { return myIsQuickPart; }
81
82   //! Returns shape-set of the needed type
83   Standard_EXPORT BinTools_ShapeSetBase* ShapeSet (const Standard_Boolean theReading);
84
85   DEFINE_STANDARD_RTTIEXT(BinMNaming_NamedShapeDriver,BinMDF_ADriver)
86
87
88 private:
89
90
91   BinTools_ShapeSetBase *myShapeSet;
92   Standard_Boolean myWithTriangles;
93   Standard_Boolean myWithNormals;
94   //! Enables storing of whole shape data just in the attribute, not in a separated shapes section
95   Standard_Boolean myIsQuickPart;
96
97 };
98
99
100 #include <BinMNaming_NamedShapeDriver.lxx>
101
102
103
104
105
106 #endif // _BinMNaming_NamedShapeDriver_HeaderFile