ff205346 |
1 | // Copyright (c) 2015 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | |
15 | #ifndef _StdPersistent_PPrsStd_PatternStd_HeaderFile |
16 | #define _StdPersistent_PPrsStd_PatternStd_HeaderFile |
17 | |
18 | #include <StdObjMgt_Attribute.hxx> |
19 | #include <StdLPersistent_HString.hxx> |
20 | |
21 | #include <TDataXtd_Presentation.hxx> |
22 | |
23 | class StdPersistent_PPrsStd |
24 | { |
25 | public: |
26 | class AISPresentation : public StdObjMgt_Attribute<TDataXtd_Presentation> |
27 | { |
28 | public: |
29 | //! Read persistent data from a file. |
30 | inline void Read (StdObjMgt_ReadData& theReadData) |
31 | { |
32 | theReadData >> myIsDisplayed >> myDriverGUID |
33 | >> myTransparency >> myColor >> myMaterial >> myWidth; |
34 | } |
ec964372 |
35 | //! Write persistent data to a file. |
36 | inline void Write (StdObjMgt_WriteData& theWriteData) const |
37 | { |
38 | theWriteData << myIsDisplayed << myDriverGUID |
39 | << myTransparency << myColor << myMaterial << myWidth; |
40 | } |
41 | //! Gets persistent child objects |
42 | inline void PChildren(StdObjMgt_Persistent::SequenceOfPersistent& theChildren) const |
43 | { |
44 | theChildren.Append(myDriverGUID); |
45 | } |
46 | //! Returns persistent type name |
47 | inline Standard_CString PName() const { return "PPrsStd_AISPresentation"; } |
ff205346 |
48 | |
49 | //! Import transient attribuite from the persistent data. |
50 | void Import (const Handle(TDataXtd_Presentation)& theAttribute) const; |
51 | |
52 | private: |
45d8465e |
53 | Standard_Boolean myIsDisplayed; |
54 | Handle(StdObjMgt_Persistent) myDriverGUID; |
55 | Standard_Real myTransparency; |
56 | Standard_Integer myColor; |
57 | Standard_Integer myMaterial; |
58 | Standard_Real myWidth; |
ff205346 |
59 | }; |
60 | |
61 | class AISPresentation_1 : public AISPresentation |
62 | { |
63 | public: |
64 | //! Read persistent data from a file. |
65 | inline void Read (StdObjMgt_ReadData& theReadData) |
66 | { |
67 | AISPresentation::Read (theReadData); |
68 | theReadData >> myMode; |
69 | } |
ec964372 |
70 | //! Write persistent data to a file. |
71 | inline void Write (StdObjMgt_WriteData& theWriteData) |
72 | { |
73 | AISPresentation::Write (theWriteData); |
74 | theWriteData << myMode; |
75 | } |
76 | //! Returns persistent type name |
77 | inline Standard_CString PName() const { return "PPrsStd_AISPresentation_1"; } |
ff205346 |
78 | |
79 | //! Import transient attribuite from the persistent data. |
80 | void Import (const Handle(TDataXtd_Presentation)& theAttribute) const; |
81 | |
82 | private: |
45d8465e |
83 | Standard_Integer myMode; |
ff205346 |
84 | }; |
85 | }; |
86 | |
87 | #endif |