1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 #include <HYDROData_Document.h>
28 DocError_OK = 0, ///< success
29 DocError_ResourcesProblem, ///< resources files are invalid or not found
30 DocError_CanNotOpen, ///< can not open file for reading or writing
31 DocError_InvalidVersion, ///< version of document is different than expected
32 DocError_InvalidFormat, ///< format of the document is bad
33 DocError_UnknownProblem ///< problem has unknown nature
36 class HYDROData_Document
39 #include <HYDROData_Document.h>
42 %ConvertToSubClassCode
43 if ( !Handle(HYDROData_Document)::DownCast( sipCpp ).IsNull() )
44 sipClass = sipClass_HYDROData_Document;
51 //! Returns the existing document or creates new if it is not exist
52 static HYDROData_Document Document( const int theStudyID ) [Handle_HYDROData_Document (const int)] ;
55 Py_BEGIN_ALLOW_THREADS
56 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( a0 );
57 if ( !aDocument.IsNull() )
59 sipRes = aDocument.operator->();
66 //! Returns true if data model contains document for this study
67 static bool HasDocument( const int theStudyID );
69 //! Loads the OCAF document from the file.
70 //! \param theFileName full name of the file to load
71 //! \param theStudyID identifier of the SALOME study to associate with loaded file
72 //! \returns error status (OK in case of success)
73 static Data_DocError Load( const char* theFileName, const int theStudyID );
75 //! Saves the OCAF document to the file.
76 //! \param theFileName full name of the file to store
77 //! \returns error status (OK in case of success)
78 Data_DocError Save( const char* theFileName );
80 //! Removes document data
83 //! Starts a new operation (opens a tansaction)
84 void StartOperation();
86 //! Finishes the previously started operation (closes the transaction)
87 //void CommitOperation(
88 // const TCollection_ExtendedString& theName = TCollection_ExtendedString() );
90 //! Aborts the operation
91 void AbortOperation();
93 //! Returns true if operation has been started, but not yet finished or aborted
96 //! Returns true if document was modified (since creation/opening)
99 //! Returns True if there are available Undos
102 //! Returns a list of stored undo actions
103 //const TDF_DeltaList& GetUndos();
105 //! Clears a list of stored undo actions
108 //! Undoes last operation
111 //! Returns True if there are available Redos
114 //! Returns a list of stored undo actions
115 //const TDF_DeltaList& GetRedos();
117 //! Clears a list of stored undo actions
120 //! Redoes last operation
123 //! Creates and locates in the document a new object
124 //! \param theKind kind of the created object, can not be UNKNOWN
125 //! \returns the created object
126 HYDROData_Object CreateObject( const ObjectKind theKind ) [Handle_HYDROData_Object (const ObjectKind)] ;
129 Py_BEGIN_ALLOW_THREADS
131 Handle(HYDROData_Object) anObject =
132 sipSelfWasArg ? sipCpp->HYDROData_Document::CreateObject( a0 ) : sipCpp->CreateObject( a0 );
133 if ( !anObject.IsNull() )
135 switch( anObject->GetKind() )
137 case KIND_BATHYMETRY:
139 Handle(HYDROData_Bathymetry) aBathymetry =
140 Handle(HYDROData_Bathymetry)::DownCast( anObject );
141 sipRes = new HYDROData_Bathymetry( *aBathymetry.operator->() );
153 //friend class HYDROData_Iterator;
154 //friend class test_HYDROData_Document;
156 //! Creates new document: private because "Document" method must be used instead of direct creation.
157 HYDROData_Document();
159 //! Deletes all high-level data, managed this document
160 ~HYDROData_Document();