opennurbs_3dm_properties.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_3DM_PROPERTIES_INC_)
18 #define OPENNURBS_3DM_PROPERTIES_INC_
19 
20 //////////////////////////////////////////////////////////////////////////////////////////
21 
22 class ON_CLASS ON_3dmRevisionHistory
23 {
24 public:
25  /*
26  Default construction sets this = ON_3dmRevisionHistory::Empty
27  */
29 
30  ~ON_3dmRevisionHistory() = default;
31 
33  ON_3dmRevisionHistory& operator=(const ON_3dmRevisionHistory&) = default;
34 
35  /*
36  Description:
37  The Empty revision has a revision number zero,
38  all time values set to zero and all string
39  values empty.
40  */
41  static const ON_3dmRevisionHistory Empty;
42 
43  /*
44  Returns:
45  A revision history with
46  m_revision_count = 1
47  m_create_time = now
48  m_last_edit_time = now
49  m_sCreatedBy = current user
50  m_sLastEditedBy = current user
51  */
52  static ON_3dmRevisionHistory FirstRevision();
53 
54  int NewRevision(); // returns updated revision count
55 
56  bool IsValid() const;
57  bool IsEmpty() const;
58  bool Read( ON_BinaryArchive& );
59  bool Write( ON_BinaryArchive& ) const;
60  void Dump( ON_TextLog& ) const;
61 
62  /*
63  Returns:
64  true
65  if m_create_time is >= January 1, 1970
66  */
67  bool CreateTimeIsSet() const;
68 
69  /*
70  Returns:
71  true
72  if m_last_edit_time is >= January 1, 1970
73  */
74  bool LastEditedTimeIsSet() const;
75 
76  ON_wString m_sCreatedBy;
77  ON_wString m_sLastEditedBy;
78  struct tm m_create_time; // UCT create time
79  struct tm m_last_edit_time; // UCT las edited time
80  int m_revision_count = 0;
81 };
82 
83 //////////////////////////////////////////////////////////////////////////////////////////
84 
85 class ON_CLASS ON_3dmNotes
86 {
87 public:
88  ON_3dmNotes();
89  ~ON_3dmNotes();
90 
91  static const ON_3dmNotes Empty;
92 
93  bool IsValid() const;
94  bool IsEmpty() const;
95 
96  bool Read( ON_BinaryArchive& );
97  bool Write( ON_BinaryArchive& ) const;
98 
99  void Dump(ON_TextLog&) const;
101  ////////////////////////////////////////////////////////////////
102  //
103  // Interface - this information is serialized. Applications
104  // may want to derive a runtime class that has additional
105  // window and font information.
106  ON_wString m_notes;
108  bool m_bVisible; // true if notes window is showing
109  bool m_bHTML; // true if notes are in HTML
110 
111  // last window position
112  int m_window_left;
113  int m_window_top;
114  int m_window_right;
115  int m_window_bottom;
116 };
117 
118 //////////////////////////////////////////////////////////////////////////////////////////
119 
120 class ON_CLASS ON_3dmApplication
121 {
122  // application that created the 3dm file
123 public:
126 
127  static const ON_3dmApplication Empty;
128 
129  bool IsValid() const;
130 
131  bool IsEmpty() const;
133  bool Read( ON_BinaryArchive& );
134  bool Write( ON_BinaryArchive& ) const;
135 
136  void Dump( ON_TextLog& ) const;
137 
138  ON_wString m_application_name; // short name like "Rhino 2.0"
139  ON_wString m_application_URL; // URL
140  ON_wString m_application_details; // whatever you want
141 };
142 
143 //////////////////////////////////////////////////////////////////////////////////////////
144 
145 class ON_CLASS ON_3dmProperties
146 {
147 public:
148  ON_3dmProperties() = default;
149  ~ON_3dmProperties() = default;;
150  ON_3dmProperties(const ON_3dmProperties&) = default;
151  ON_3dmProperties& operator=(const ON_3dmProperties&) = default;
152 
153  static const ON_3dmProperties Empty;
154 
155  bool IsEmpty() const;
156 
157  bool Read(
158  ON_BinaryArchive& archive
159  );
160 
161  /*
162  Remarks:
163  If archive.ArchiveFileName() is not empty, that value is
164  written in place of m_3dmArchiveFullPathName in the 3dm archive.
165  If archive.ArchiveFileName() is empty, then m_3dmArchiveFullPathName
166  is written in the 3dm archive.
167  */
168  bool Write(
170  ) const;
171 
172  void Dump( ON_TextLog& ) const;
173 
174  ON_3dmRevisionHistory m_RevisionHistory;
175  ON_3dmNotes m_Notes;
176  ON_WindowsBitmap m_PreviewImage; // preview image of model
177  ON_3dmApplication m_Application; // application that created 3DM file
178 
179  // name of .3dm archive when it was written. Used to find referenced files
180  // when the archive is moved or copied and then read.
181  ON_wString m_3dmArchiveFullPathName;
182 };
183 
184 //////////////////////////////////////////////////////////////////////////////////////////
185 
186 #endif
Definition: opennurbs_3dm_properties.h:22
Definition: opennurbs_3dm_properties.h:139
Definition: opennurbs_3dm_properties.h:79
Definition: opennurbs_string.h:2020
Definition: opennurbs_3dm_properties.h:114
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
Definition: opennurbs_bitmap.h:226