0028066: Samples - mfc ocaf sample could not read/save any document without environme...
authorabv <abv@opencascade.com>
Tue, 8 Nov 2016 04:22:06 +0000 (07:22 +0300)
committerapn <apn@opencascade.com>
Tue, 8 Nov 2016 15:52:26 +0000 (18:52 +0300)
Persistence libs are loaded using DefineFormat() in OCAF sample

samples/mfc/standard/06_Ocaf/CMakeLists.txt
samples/mfc/standard/06_Ocaf/src/OcafApp.cpp
samples/mfc/standard/06_Ocaf/src/TOcaf_Application.cxx
samples/mfc/standard/06_Ocaf/src/TOcaf_Application.hxx
samples/mfc/standard/06_Ocaf/src/TOcaf_Application.ixx

index eb2c500..8186e50 100644 (file)
@@ -67,4 +67,4 @@ include_directories (${CMAKE_BINARY_DIR}/inc
                      ${Ocaf_SRC_DIR}
                      ${MFC_STANDARD_SAMPLES_DIR}/Common)
 
-target_link_libraries (Ocaf mfcsample TKLCAF TKVCAF TKBO)
+target_link_libraries (Ocaf mfcsample TKLCAF TKVCAF TKBO TKBin TKXml)
index 940c21a..ff43d3c 100755 (executable)
@@ -13,6 +13,9 @@
 #include "direct.h"
 #include <OSD_Environment.hxx>
 
+#include <BinDrivers.hxx>
+#include <XmlDrivers.hxx>
+
 /////////////////////////////////////////////////////////////////////////////
 // COcafApp
 
@@ -39,6 +42,10 @@ COcafApp::COcafApp() : OCC_App()
   SampleName = "OCAF"; //for about dialog
   SetSamplePath (L"..\\..\\06_Ocaf");
 
+  // load persistence
+  BinDrivers::DefineFormat (myApp);
+  XmlDrivers::DefineFormat (myApp);
+
   try
   {
     UnitsAPI::SetLocalSystem(UnitsAPI_MDTV);
index 8ad4f83..26da435 100755 (executable)
 
 TOcaf_Application::TOcaf_Application()
 {
-       // Instanciate a TOcafFunction_BoxDriver and add it to the TFunction_DriverTable
-       TFunction_DriverTable::Get()->AddDriver(TOcafFunction_BoxDriver::GetID(), 
-                                                                                       new TOcafFunction_BoxDriver());
-
-       // Instanciate a TOcafFunction_CylDriver and add it to the TFunction_DriverTable
-       TFunction_DriverTable::Get()->AddDriver(TOcafFunction_CylDriver::GetID(),
-                                                                                       new TOcafFunction_CylDriver());
-
-       // Instanciate a TOcafFunction_CutDriver and add it to the TFunction_DriverTable
-       Handle(TOcafFunction_CutDriver) myCutDriver = new TOcafFunction_CutDriver();
-       TFunction_DriverTable::Get()->AddDriver(TOcafFunction_CutDriver::GetID(), 
-                                                                                       new TOcafFunction_CutDriver());
-
-}
-
-
-//=======================================================================
-//function : Formats
-//purpose  : 
-//=======================================================================
-
-void TOcaf_Application::Formats(TColStd_SequenceOfExtendedString& Formats) 
-{
-  Formats.Append(TCollection_ExtendedString("BinOcaf"));
-  Formats.Append(TCollection_ExtendedString("XmlOcaf"));
+  // Instanciate a TOcafFunction_BoxDriver and add it to the TFunction_DriverTable
+  TFunction_DriverTable::Get()->AddDriver (TOcafFunction_BoxDriver::GetID(),
+                                           new TOcafFunction_BoxDriver());
+
+  // Instanciate a TOcafFunction_Cyl  Driver and add it to the TFunction_DriverTable
+  TFunction_DriverTable::Get()->AddDriver (TOcafFunction_CylDriver::GetID(),
+                                           new TOcafFunction_CylDriver());
+
+  // Instanciate a TOcafFunction_CutDriver and add it to the TFunction_DriverTable
+  Handle(TOcafFunction_CutDriver) myCutDriver = new TOcafFunction_CutDriver();
+  TFunction_DriverTable::Get()->AddDriver (TOcafFunction_CutDriver::GetID(),
+                                           new TOcafFunction_CutDriver());
 }
-
-
-//=======================================================================
-//function : ResourcesName
-//purpose  : 
-//=======================================================================
-
-Standard_CString TOcaf_Application::ResourcesName() 
-{
-  return Standard_CString ("Standard");
-}
-
-
index 34eefd4..2efd458 100755 (executable)
@@ -33,12 +33,6 @@ public:
  // Methods PUBLIC
  // 
 Standard_EXPORT TOcaf_Application();
-Standard_EXPORT virtual  void Formats(TColStd_SequenceOfExtendedString& Formats) ;
-Standard_EXPORT   Standard_CString ResourcesName() ;
-Standard_EXPORT ~TOcaf_Application();
-
-
-
 
  // Type management
  //
index 9560979..5fec999 100755 (executable)
@@ -18,8 +18,6 @@
 #include <Standard_TypeMismatch.hxx>
 #endif
 
-TOcaf_Application::~TOcaf_Application() {}
-
 // DownCast method
 //   allow safe downcasting
 //