1 #include <HYDROData_Application.h>
3 #include <TColStd_SequenceOfExtendedString.hxx>
5 IMPLEMENT_STANDARD_HANDLE(HYDROData_Application,TDocStd_Application)
6 IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Application,TDocStd_Application)
8 static HYDROData_Application* TheApplication = new HYDROData_Application;
10 //=======================================================================
11 //function : getApplication
13 //=======================================================================
14 HYDROData_Application* HYDROData_Application::GetApplication()
16 return TheApplication;
19 //=======================================================================
20 //function : GetDocument
22 //=======================================================================
23 bool HYDROData_Application::GetDocumentId(const Handle(HYDROData_Document)& theDocument,
26 DataMapOfStudyIDDocument::Iterator aMapit( myDocuments );
27 for ( ; aMapit.More(); aMapit.Next() )
29 if ( aMapit.Value() != theDocument )
32 theDocId = aMapit.Key();
39 //=======================================================================
40 //function : GetDocument
42 //=======================================================================
43 Handle(HYDROData_Document) HYDROData_Application::GetDocument(int theStudyID) const
45 if (myDocuments.IsBound(theStudyID)) {
46 return myDocuments.Find(theStudyID);
48 // document not found => create the new one
49 return Handle(HYDROData_Document)();
52 //=======================================================================
53 //function : OCAFApp_Application
55 //=======================================================================
56 HYDROData_Application::HYDROData_Application ()
58 // store handle to the application to avoid nullification
59 static Handle(HYDROData_Application) TheKeepHandle;
63 //=======================================================================
64 //function : addDocument
66 //=======================================================================
67 void HYDROData_Application::AddDocument(int theStudyID, const Handle(HYDROData_Document)& theDocument)
69 myDocuments.Bind(theStudyID, theDocument);
72 //=======================================================================
73 //function : removeDocument
75 //=======================================================================
76 void HYDROData_Application::RemoveDocument(const Handle(HYDROData_Document)& theDocument)
78 DataMapOfStudyIDDocument::Iterator anIter(myDocuments);
79 for(; anIter.More(); anIter.Next())
80 if (anIter.Value() == theDocument) {
81 myDocuments.UnBind(anIter.Key());
86 //=======================================================================
89 //=======================================================================
90 void HYDROData_Application::Formats(TColStd_SequenceOfExtendedString& theFormats)
92 theFormats.Append(TCollection_ExtendedString ("BinOcaf")); // standard binary schema
95 //=======================================================================
96 //function : ResourcesName
98 //=======================================================================
99 Standard_CString HYDROData_Application::ResourcesName()
101 return Standard_CString("Standard");