File indexing completed on 2026-11-21 10:22:11
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef TObj_Model_HeaderFile
0019 #define TObj_Model_HeaderFile
0020
0021 #include <Message_Messenger.hxx>
0022 #include <TObj_Partition.hxx>
0023 #include <TCollection_ExtendedString.hxx>
0024
0025 class TObj_TNameContainer;
0026 class TCollection_HExtendedString;
0027 class TDocStd_Document;
0028 class TObj_CheckModel;
0029 class TObj_Application;
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 class TObj_Model : public Standard_Transient
0040 {
0041 protected:
0042
0043
0044 enum DataTag
0045 {
0046 DataTag_FormatVersion = TObj_Partition::DataTag_Last,
0047 DataTag_Last
0048 };
0049
0050 protected:
0051
0052
0053
0054
0055
0056 Standard_EXPORT TObj_Model();
0057
0058
0059 Standard_EXPORT ~TObj_Model() override;
0060
0061
0062 Standard_EXPORT virtual bool checkDocumentEmpty(const TCollection_ExtendedString& theFile);
0063
0064 public:
0065
0066
0067
0068
0069
0070 void SetMessenger(const occ::handle<Message_Messenger>& theMsgr) { myMessenger = theMsgr; }
0071
0072
0073
0074 occ::handle<Message_Messenger> Messenger() const { return myMessenger; }
0075
0076 public:
0077
0078
0079
0080
0081
0082
0083 Standard_EXPORT virtual bool Load(const TCollection_ExtendedString& theFile);
0084
0085
0086
0087 Standard_EXPORT virtual bool Load(Standard_IStream& theIStream);
0088
0089
0090 Standard_EXPORT virtual bool SaveAs(const TCollection_ExtendedString& theFile);
0091
0092
0093 Standard_EXPORT virtual bool SaveAs(Standard_OStream& theOStream);
0094
0095
0096 Standard_EXPORT bool Save();
0097
0098 public:
0099
0100
0101
0102
0103
0104 virtual Standard_EXPORT bool Close();
0105
0106
0107 Standard_EXPORT void CloseDocument(const occ::handle<TDocStd_Document>& theDoc);
0108
0109
0110
0111 static Standard_EXPORT occ::handle<TObj_Model> GetDocumentModel(const TDF_Label& theLabel);
0112
0113
0114
0115 virtual Standard_EXPORT occ::handle<TCollection_HExtendedString> GetFile() const;
0116
0117 public:
0118
0119
0120
0121
0122
0123 virtual Standard_EXPORT occ::handle<TObj_ObjectIterator> GetObjects() const;
0124
0125
0126 virtual Standard_EXPORT occ::handle<TObj_ObjectIterator> GetChildren() const;
0127
0128
0129 virtual Standard_EXPORT occ::handle<TObj_Object> FindObject(
0130 const occ::handle<TCollection_HExtendedString>& theName,
0131 const occ::handle<TObj_TNameContainer>& theDictionary) const;
0132
0133
0134
0135 virtual Standard_EXPORT occ::handle<TObj_CheckModel> GetChecker() const;
0136
0137 public:
0138
0139
0140
0141
0142
0143 virtual Standard_EXPORT occ::handle<TObj_Object> GetRoot() const;
0144
0145
0146 Standard_EXPORT occ::handle<TObj_Partition> GetMainPartition() const;
0147
0148 public:
0149
0150
0151
0152
0153
0154 TDF_Label GetLabel() const { return myLabel; }
0155
0156 public:
0157
0158
0159
0160
0161
0162 virtual Standard_EXPORT occ::handle<TCollection_HExtendedString> GetModelName() const;
0163
0164
0165 static Standard_EXPORT void SetNewName(const occ::handle<TObj_Object>& theObject);
0166
0167
0168
0169 Standard_EXPORT bool IsRegisteredName(
0170 const occ::handle<TCollection_HExtendedString>& theName,
0171 const occ::handle<TObj_TNameContainer>& theDictionary) const;
0172
0173
0174
0175 Standard_EXPORT void RegisterName(const occ::handle<TCollection_HExtendedString>& theName,
0176 const TDF_Label& theLabel,
0177 const occ::handle<TObj_TNameContainer>& theDictionary) const;
0178
0179
0180
0181 Standard_EXPORT void UnRegisterName(const occ::handle<TCollection_HExtendedString>& theName,
0182 const occ::handle<TObj_TNameContainer>& theDictionary) const;
0183
0184 public:
0185
0186
0187
0188
0189
0190
0191 Standard_EXPORT bool HasOpenCommand() const;
0192
0193
0194 Standard_EXPORT void OpenCommand() const;
0195
0196
0197
0198 Standard_EXPORT void CommitCommand() const;
0199
0200
0201
0202 Standard_EXPORT void AbortCommand() const;
0203
0204
0205 virtual Standard_EXPORT bool IsModified() const;
0206
0207
0208 Standard_EXPORT void SetModified(const bool theModified);
0209
0210 public:
0211
0212
0213
0214
0215
0216 virtual Standard_EXPORT const occ::handle<TObj_Application> GetApplication();
0217
0218 public:
0219
0220
0221
0222
0223
0224
0225
0226 virtual Standard_EXPORT TCollection_ExtendedString GetFormat() const;
0227
0228
0229 Standard_EXPORT int GetFormatVersion() const;
0230
0231 protected:
0232
0233
0234
0235
0236
0237 Standard_EXPORT void SetFormatVersion(const int theVersion);
0238
0239 public:
0240
0241
0242
0243
0244
0245 virtual Standard_EXPORT bool Update();
0246
0247 public:
0248
0249
0250
0251
0252
0253 virtual Standard_EXPORT Standard_GUID GetGUID() const;
0254
0255 public:
0256
0257
0258
0259
0260
0261 Standard_EXPORT occ::handle<TObj_TNameContainer> GetDictionary() const;
0262
0263 protected:
0264
0265
0266
0267
0268
0269 Standard_EXPORT occ::handle<TObj_Partition> getPartition(const TDF_Label& theLabel,
0270 const bool theHidden = false) const;
0271
0272
0273
0274 Standard_EXPORT occ::handle<TObj_Partition> getPartition(
0275 const TDF_Label& theLabel,
0276 const int theIndex,
0277 const TCollection_ExtendedString& theName,
0278 const bool theHidden = false) const;
0279
0280
0281
0282 Standard_EXPORT occ::handle<TObj_Partition> getPartition(
0283 const int theIndex,
0284 const TCollection_ExtendedString& theName,
0285 const bool theHidden = false) const;
0286
0287 public:
0288
0289 Standard_EXPORT occ::handle<TDocStd_Document> GetDocument() const;
0290
0291 protected:
0292
0293
0294
0295
0296 Standard_EXPORT TDF_Label GetDataLabel() const;
0297
0298 public:
0299
0300
0301 void SetLabel(const TDF_Label& theLabel) { myLabel = theLabel; }
0302
0303 protected:
0304
0305
0306
0307
0308
0309 virtual Standard_EXPORT bool initNewModel(const bool IsNew);
0310
0311
0312
0313 virtual Standard_EXPORT void updateBackReferences(const occ::handle<TObj_Object>& theObject);
0314
0315
0316
0317
0318 virtual bool isToCheck() const { return true; }
0319
0320 public:
0321
0322
0323
0324
0325
0326
0327
0328 virtual Standard_EXPORT bool Paste(occ::handle<TObj_Model> theModel,
0329 occ::handle<TDF_RelocationTable> theRelocTable = nullptr);
0330
0331
0332 virtual Standard_EXPORT occ::handle<TObj_Model> NewEmpty() = 0;
0333
0334
0335 Standard_EXPORT void CopyReferences(const occ::handle<TObj_Model>& theTarget,
0336 const occ::handle<TDF_RelocationTable>& theRelocTable);
0337
0338 private:
0339
0340
0341
0342
0343 TDF_Label myLabel;
0344 occ::handle<Message_Messenger> myMessenger;
0345
0346 public:
0347
0348 DEFINE_STANDARD_RTTIEXT(TObj_Model, Standard_Transient)
0349 };
0350
0351
0352
0353 #endif