// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // %ExportedHeaderCode #include %End %ModuleHeaderCode HYDROData_Object* copyObject( HYDROData_Object* theObject ); Handle(HYDROData_Object) createHandle( HYDROData_Object* theObject ); HYDROData_Object* createPointer( const Handle(HYDROData_Object)& theObject ); %End enum Data_DocError { DocError_OK = 0, ///< success DocError_ResourcesProblem, ///< resources files are invalid or not found DocError_CanNotOpen, ///< can not open file for reading or writing DocError_InvalidVersion, ///< version of document is different than expected DocError_InvalidFormat, ///< format of the document is bad DocError_UnknownProblem ///< problem has unknown nature }; class HYDROData_Document { %TypeHeaderCode #include %End %ConvertToSubClassCode if ( !Handle(HYDROData_Document)::DownCast( sipCpp ).IsNull() ) sipClass = sipClass_HYDROData_Document; else sipClass = NULL; %End %TypeCode HYDROData_Object* copyObject( HYDROData_Object* theObject ) { HYDROData_Object* aRes = NULL; if ( theObject == NULL ) return aRes; switch( theObject->GetKind() ) { case KIND_BATHYMETRY: { aRes = new HYDROData_Bathymetry( *dynamic_cast( theObject ) ); break; } case KIND_IMAGE: { aRes = new HYDROData_Image( *dynamic_cast( theObject ) ); break; } } return aRes; } Handle(HYDROData_Object) createHandle( HYDROData_Object* theObject ) { Handle(HYDROData_Object) aRes = copyObject( theObject ); return aRes; } HYDROData_Object* createPointer( const Handle(HYDROData_Object)& theObject ) { HYDROData_Object* aRes = NULL; if ( !theObject.IsNull() ) aRes = copyObject( theObject.operator->() ); return aRes; } %End public: //! Returns the existing document or creates new if it is not exist static HYDROData_Document Document( const int theStudyID ) [Handle_HYDROData_Document (const int)] ; %MethodCode Handle(HYDROData_Document) aDocument; Py_BEGIN_ALLOW_THREADS aDocument = HYDROData_Document::Document( a0 ); Py_END_ALLOW_THREADS if ( !aDocument.IsNull() ) sipRes = aDocument.operator->(); %End //! Returns true if data model contains document for this study static bool HasDocument( const int theStudyID ); //! Loads the OCAF document from the file. //! \param theFileName full name of the file to load //! \param theStudyID identifier of the SALOME study to associate with loaded file //! \returns error status (OK in case of success) static Data_DocError Load( const char* theFileName, const int theStudyID ); //! Saves the OCAF document to the file. //! \param theFileName full name of the file to store //! \returns error status (OK in case of success) Data_DocError Save( const char* theFileName ); //! Removes document data void Close(); //! Starts a new operation (opens a tansaction) void StartOperation(); //! Finishes the previously started operation (closes the transaction) //void CommitOperation( // const TCollection_ExtendedString& theName = TCollection_ExtendedString() ); //! Aborts the operation void AbortOperation(); //! Returns true if operation has been started, but not yet finished or aborted bool IsOperation(); //! Returns true if document was modified (since creation/opening) bool IsModified(); //! Returns True if there are available Undos bool CanUndo(); //! Returns a list of stored undo actions //const TDF_DeltaList& GetUndos(); //! Clears a list of stored undo actions void ClearUndos(); //! Undoes last operation void Undo(); //! Returns True if there are available Redos bool CanRedo(); //! Returns a list of stored undo actions //const TDF_DeltaList& GetRedos(); //! Clears a list of stored undo actions void ClearRedos(); //! Redoes last operation void Redo(); //! Creates and locates in the document a new object //! \param theKind kind of the created object, can not be UNKNOWN //! \returns the created object HYDROData_Object CreateObject( const ObjectKind theKind ) [Handle_HYDROData_Object (const ObjectKind)] ; %MethodCode Handle(HYDROData_Object) anObject; Py_BEGIN_ALLOW_THREADS anObject = sipSelfWasArg ? sipCpp->HYDROData_Document::CreateObject( a0 ) : sipCpp->CreateObject( a0 ); Py_END_ALLOW_THREADS sipRes = createPointer( anObject ); %End protected: //! Creates new document: private because "Document" method must be used instead of direct creation. HYDROData_Document(); //! Deletes all high-level data, managed this document ~HYDROData_Document(); };