Salome HOME
Some corrections of import/export operations
authormpa <mpa@opencascade.com>
Tue, 13 Jan 2015 12:32:33 +0000 (15:32 +0300)
committermpa <mpa@opencascade.com>
Tue, 13 Jan 2015 12:32:33 +0000 (15:32 +0300)
35 files changed:
idl/CMakeLists.txt
idl/DXFPlugin.idl [new file with mode: 0644]
idl/DXFPlugin_Gen.idl [deleted file]
src/CMakeLists.txt
src/DXFPluginBuilder.py
src/DXFPluginEngine.cxx [deleted file]
src/DXFPluginGUI.cxx [deleted file]
src/DXFPluginGUI.h [deleted file]
src/DXFPlugin_Engine.cxx [new file with mode: 0644]
src/DXFPlugin_Engine.hxx
src/DXFPlugin_ExportDlg.cxx [deleted file]
src/DXFPlugin_ExportDlg.h [deleted file]
src/DXFPlugin_ExportDriver.cxx
src/DXFPlugin_ExportDriver.hxx
src/DXFPlugin_GUI.cxx [new file with mode: 0644]
src/DXFPlugin_GUI.h [new file with mode: 0644]
src/DXFPlugin_IECallBack.cxx
src/DXFPlugin_IECallBack.hxx
src/DXFPlugin_IOperations.cxx
src/DXFPlugin_IOperations.hxx
src/DXFPlugin_IOperations_i.cc [new file with mode: 0644]
src/DXFPlugin_IOperations_i.hh [new file with mode: 0644]
src/DXFPlugin_ImportDlg.cxx [deleted file]
src/DXFPlugin_ImportDlg.h [deleted file]
src/DXFPlugin_ImportDriver.cxx
src/DXFPlugin_ImportDriver.hxx
src/DXFPlugin_OperationsCreator.cc [deleted file]
src/DXFPlugin_OperationsCreator.cxx [new file with mode: 0644]
src/DXFPlugin_OperationsCreator.hh [deleted file]
src/DXFPlugin_OperationsCreator.hxx [new file with mode: 0755]
src/DXFPlugin_Operations_i.cc [deleted file]
src/DXFPlugin_Operations_i.hh [deleted file]
src/resources/DXFPlugin_msg_en.ts
src/resources/DXFPlugin_msg_fr.ts
src/resources/DXFPlugin_msg_ja.ts

index 8b3333851585588849a37e947834455a87db5351..6fd41e0027158f34217791bd7fbd27207c9a1111 100755 (executable)
@@ -31,7 +31,7 @@ IF(WIN32)
 ENDIF(WIN32)
 
 SET(SalomeIDLDXFPlugin_IDLSOURCES
-  DXFPlugin_Gen.idl
+  DXFPlugin.idl
 )
 
 SET(IDL_INCLUDE_DIRS
diff --git a/idl/DXFPlugin.idl b/idl/DXFPlugin.idl
new file mode 100644 (file)
index 0000000..935dbf2
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+#ifndef __DXFPlugin_IDL__
+#define __DXFPlugin_IDL__
+
+#include "GEOM_Gen.idl"
+
+module DXFPlugin
+{
+  /*!
+   *  \brief Interface for DXFPlugin modeling functions.
+   */
+  interface IDXFOperations : GEOM::GEOM_IOperations
+  {
+    /*!
+     *  \brief Export the given shape into a file with given name in DXF format.
+     *
+     *  \param theObject Shape to be stored in the file.
+     *  \param theFileName Name of the file to store the given shape in.
+     */
+    void ExportDXF( in GEOM::GEOM_Object theObject, 
+                     in string           theFileName );
+      
+    /*!
+     *  \brief Import a shape from the DXF file.
+     *
+     *  \param theFileName The file, containing the shape.
+     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+     */              
+    GEOM::ListOfGO ImportDXF( in string theFileName );
+  };
+};
+
+#endif // __DXFPlugin_IDL__
+
diff --git a/idl/DXFPlugin_Gen.idl b/idl/DXFPlugin_Gen.idl
deleted file mode 100644 (file)
index bec926e..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef __DXFPlugin_GEN__
-#define __DXFPlugin_GEN__
-
-#include "GEOM_Gen.idl"
-
-module DXFPlugin {
-
-  /*!
-   *  \brief Interface for DXFPlugin modeling functions.
-   */
-  interface GEOM_IDXFPluginOperations : GEOM::GEOM_IOperations
-  {
-    /*!
-     *  \brief Export the given shape into a file with given name in DXF format.
-     *
-     *  \param theObject Shape to be stored in the file.
-     *  \param theFileName Name of the file to store the given shape in.
-     */
-    void ExportDXF( in GEOM::GEOM_Object theObject, 
-                     in string            theFileName );
-      
-    /*!
-     *  \brief Import a shape from the DXF file.
-     *
-     *  \param theFileName The file, containing the shape.
-     *  \return List of GEOM_Objects, containing the created shape and propagation groups.
-     */              
-    GEOM::ListOfGO ImportDXF( in string theFileName );
-  };
-};
-
-#endif
index c6a6cabd96560ad1661e8314b2fd8b2a9f8d3d97..14ef9653edc8a1aeff8039b72a1cebd94697a860 100644 (file)
@@ -29,7 +29,6 @@ INCLUDE_DIRECTORIES(
   ${CAS_INCLUDE_DIRS}
   ${DXF_INCLUDE_DIRS}
   ${KERNEL_INCLUDE_DIRS}
-  ${GUI_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}
   ${PROJECT_BINARY_DIR}/idl
   )
@@ -37,6 +36,8 @@ INCLUDE_DIRECTORIES(
 IF(SALOME_BUILD_GUI)
   INCLUDE_DIRECTORIES(
     ${QT_INCLUDE_DIRS}
+    ${GUI_INCLUDE_DIRS}
+    ${GEOM_INCLUDE_DIRS}
     )
 ENDIF()
 
@@ -52,7 +53,7 @@ ADD_DEFINITIONS(
 ENDIF()
 
 # libraries to link to
-SET(_link_LIBRARIES
+SET(_link_engine_LIBRARIES
   ${CAS_TKXSBase}
   ${DXF_LIBRARIES}
   ${KERNEL_SALOMEBasics}
@@ -66,8 +67,10 @@ SET(_link_LIBRARIES
   )
   
 IF(SALOME_BUILD_GUI)
-  SET(_link_LIBRARIES
-    ${_link_LIBRARIES}
+  SET(_link_gui_LIBRARIES
+    SalomeIDLDXFPlugin
+    ${GEOM_GEOMObject}
+    ${GEOM_GEOMBase}
     ${GEOM_GEOMBase}
     )
 ENDIF()
@@ -76,9 +79,9 @@ ENDIF()
 # --- headers ---
 
 SET(DXFPluginEngine_HEADERS
-  DXFPlugin_Operations_i.hh
+  DXFPlugin_IOperations_i.hh
   DXFPlugin_Engine.hxx
-  DXFPlugin_OperationsCreator.hh
+  DXFPlugin_OperationsCreator.hxx
   DXFPlugin_IOperations.hxx
   DXFPlugin_IExport.hxx 
   DXFPlugin_IImport.hxx
@@ -90,8 +93,7 @@ SET(DXFPluginEngine_HEADERS
 IF(SALOME_BUILD_GUI)  
   # header files / to be processed by moc
   SET(_moc_HEADERS
-    DXFPlugin_ExportDlg.h
-    DXFPlugin_ImportDlg.h
+    DXFPlugin_GUI.h
     )
 ENDIF()
 
@@ -102,17 +104,15 @@ IF(SALOME_BUILD_GUI)
   QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
 
   SET(DXFPluginGUI_SOURCES
-    DXFPluginGUI.cxx
-    DXFPlugin_ExportDlg.cxx
-    DXFPlugin_ImportDlg.cxx
+    DXFPlugin_GUI.cxx
     ${_moc_SOURCES}
     )
 ENDIF()
   
 SET(DXFPluginEngine_SOURCES
-  DXFPluginEngine.cxx
-  DXFPlugin_OperationsCreator.cc
-  DXFPlugin_Operations_i.cc
+  DXFPlugin_Engine.cxx
+  DXFPlugin_OperationsCreator.cxx
+  DXFPlugin_IOperations_i.cc
   DXFPlugin_IOperations.cxx
   DXFPlugin_ExportDriver.cxx
   DXFPlugin_ImportDriver.cxx
@@ -136,13 +136,13 @@ SET(_python_DXF_SCRIPTS
 
 # install Engine library
 ADD_LIBRARY(DXFPluginEngine ${DXFPluginEngine_SOURCES})
-TARGET_LINK_LIBRARIES(DXFPluginEngine ${_link_LIBRARIES})
+TARGET_LINK_LIBRARIES(DXFPluginEngine ${_link_engine_LIBRARIES})
 INSTALL(TARGETS DXFPluginEngine EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
 
 # install GUI library
 IF(SALOME_BUILD_GUI)
   ADD_LIBRARY(DXFPluginGUI ${DXFPluginGUI_SOURCES})
-  TARGET_LINK_LIBRARIES(DXFPluginGUI ${_link_LIBRARIES})
+  TARGET_LINK_LIBRARIES(DXFPluginGUI ${_link_gui_LIBRARIES})
   INSTALL(TARGETS DXFPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
   # install resources
   QT4_INSTALL_TS_RESOURCES("${DXFPlugin_RESOURCES}" "${SALOME_DXFPLUGIN_INSTALL_RES_DATA}")
index 72b5c730af5cc3165cf31c5fd81ff5f52375c828..63404d6b7c1019b0c7d4ef61169d94703610cb04 100644 (file)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-from DXFPlugin import GEOM_IDXFPluginOperations
+from DXFPlugin import IDXFOperations
 
 # Engine Library Name
 __libraryName__ = "DXFPluginEngine"
 
 def GetDXFPluginOperations(self):
     anOp = self.GetPluginOperations(self.myStudyId, __libraryName__)
-    return anOp._narrow(GEOM_IDXFPluginOperations)
+    return anOp._narrow(IDXFOperations)
 
 ## Export the given shape into a file with given name in DXF format.
 #  @param theObject Shape to be stored in the file.
diff --git a/src/DXFPluginEngine.cxx b/src/DXFPluginEngine.cxx
deleted file mode 100644 (file)
index 1c380c2..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPlugin_Engine.hxx"
-#include "DXFPlugin_OperationsCreator.hh"
-
-extern "C"
-{
-DXFPLUGINENGINE_EXPORT
-  GEOM_GenericOperationsCreator* GetOperationsCreator()
-  {
-       DXFPlugin_OperationsCreator* aCreator = new DXFPlugin_OperationsCreator();
-    return aCreator;
-  }
-}
diff --git a/src/DXFPluginGUI.cxx b/src/DXFPluginGUI.cxx
deleted file mode 100644 (file)
index 21e41f8..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPluginGUI.h"
-#include "DXFPlugin_ExportDlg.h"
-#include "DXFPlugin_ImportDlg.h"
-
-// GUI includes
-#include <SUIT_Desktop.h>
-#include <SUIT_MessageBox.h>
-#include <SalomeApp_Application.h>
-#include <SALOME_ListIteratorOfListIO.hxx>
-#include <LightApp_SelectionMgr.h>
-
-// GEOM includes
-#include <GeometryGUI.h>
-
-//=======================================================================
-// function : DXFPluginGUI()
-// purpose  : Constructor
-//=======================================================================
-DXFPluginGUI::DXFPluginGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
-{
-}
-
-//=======================================================================
-// function : ~DXFPluginGUI
-// purpose  : Destructor
-//=======================================================================
-DXFPluginGUI::~DXFPluginGUI()
-{
-}
-
-//=======================================================================
-// function : OnGUIEvent()
-// purpose  : 
-//=======================================================================
-bool DXFPluginGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
-{
-  switch ( theCommandID ) {
-  case 1:
-    return OnGUIEvent("Export_DXF", parent);
-  case 2:
-    return OnGUIEvent("Import_DXF", parent);
-  default:
-    return OnGUIEvent("", parent);
-  }
-  return false;
-}
-
-//=======================================================================
-// function : OnGUIEvent()
-// purpose  :
-//=======================================================================
-bool DXFPluginGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
-{
-  SalomeApp_Application* app = getGeometryGUI()->getApp();
-  if (!app) return false;
-
-  getGeometryGUI()->EmitSignalDeactivateDialog();
-
-  SUIT_FileDlg* dialog = NULL;
-  if( theCommandID == "Export_DXF" ) {
-    // Get selected objects
-    LightApp_SelectionMgr* sm = app->selectionMgr();
-    if( !sm ) return false;
-    SALOME_ListIO selectedObjects;
-    sm->selectedObjects( selectedObjects );
-    if( selectedObjects.Extent() == 0 ) {
-      SUIT_MessageBox::warning( app->desktop(),
-                                QObject::tr("WRN_WARNING"),
-                                QObject::tr("GEOM_WRN_NO_APPROPRIATE_SELECTION") );
-    }
-    else {
-      SALOME_ListIteratorOfListIO It( selectedObjects );
-      for( ; It.More(); It.Next() ) {
-        Handle(SALOME_InteractiveObject) IObject = It.Value();
-        dialog = new DXFPlugin_ExportDlg( IObject, parent );
-        if( dialog->exec() == QDialog::Accepted )
-          delete dialog;
-      }
-    }
-  }
-  else if (theCommandID == "Import_DXF") {
-    dialog = new DXFPlugin_ImportDlg( parent );
-    if (dialog != NULL)
-      dialog->show();
-    if( dialog->exec() == QDialog::Accepted )
-      delete dialog;
-  }
-  else {
-    app->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
-  }
-
-  return true;
-}
-
-//=====================================================================================
-// EXPORTED METHODS
-//=====================================================================================
-extern "C"
-{
-#ifdef WIN32
-    __declspec( dllexport )
-#endif
-  GEOMGUI* GetLibGUI( GeometryGUI* parent )
-  {
-    return new DXFPluginGUI( parent );
-  }
-}
diff --git a/src/DXFPluginGUI.h b/src/DXFPluginGUI.h
deleted file mode 100644 (file)
index 1e4419b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef DXFPluginGUI_H
-#define DXFPluginGUI_H
-
-#include <GEOMPluginGUI.h>
-
-class DXFPluginGUI: public GEOMPluginGUI
-{
-public:
-  DXFPluginGUI( GeometryGUI* parent );
-  ~DXFPluginGUI();
-
-  bool OnGUIEvent( int commandId, SUIT_Desktop* );
-  bool OnGUIEvent( const QString&, SUIT_Desktop* );
-};
-
-#endif // DXFPluginGUI_H
diff --git a/src/DXFPlugin_Engine.cxx b/src/DXFPlugin_Engine.cxx
new file mode 100644 (file)
index 0000000..e3a40d2
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+#include "DXFPlugin_OperationsCreator.hxx"
+
+extern "C"
+{
+  DXFPLUGINENGINE_EXPORT
+  GEOM_GenericOperationsCreator* GetOperationsCreator()
+  {
+    return new DXFPlugin_OperationsCreator();
+  }
+}
index 0274c578a188602229dd53dde5525c374659e022..073d0df7addaa44cc44490d5739bfa5f911f38eb 100755 (executable)
@@ -21,7 +21,7 @@
 #define _DXFPLUGIN_ENGINE_HXX_
 
 #ifdef WIN32
- #if defined DXFPLUGINENGINE_EXPORTS || defined DXFPLUGINENGINE_EXPORTS
+ #if defined DXFPLUGINENGINE_EXPORTS || defined DXFPluginEngine_EXPORTS
    #define DXFPLUGINENGINE_EXPORT __declspec( dllexport )
  #else
    #define DXFPLUGINENGINE_EXPORT __declspec( dllimport )
diff --git a/src/DXFPlugin_ExportDlg.cxx b/src/DXFPlugin_ExportDlg.cxx
deleted file mode 100644 (file)
index e999d79..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPlugin_ExportDlg.h"
-#include "DXFPlugin_Operations_i.hh"
-
-// GUI includes
-#include <SUIT_Session.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_Tools.h>
-#include <SUIT_MessageBox.h>
-#include <SUIT_OverrideCursor.h>
-
-#include <SalomeApp_Application.h>
-
-// GEOM includes
-#include <GEOMBase.h>
-#include <GEOM_Operation.h>
-#include <GEOM_Constants.h>
-
-//=================================================================================
-// Constructor
-//=================================================================================
-DXFPlugin_ExportDlg::DXFPlugin_ExportDlg( Handle(SALOME_InteractiveObject)& object, QWidget* parent )
-: SUIT_FileDlg( parent, false, true, true ),
-  GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) )
-{
-  setWindowTitle( tr( "DXFPLUGIN_EXPORT_TITLE" ) );
-  setNameFilter( tr( "DXFPLUGIN_DXF_FILES" ) );
-
-  myObject = object;
-  const char* objectName = myObject->getName();
-  selectFile( QString( objectName ) );
-}
-
-//=================================================================================
-// Destructor
-//=================================================================================
-DXFPlugin_ExportDlg::~DXFPlugin_ExportDlg()
-{
-  // no need to delete child widgets, Qt does it all for us
-}
-
-//=================================================================================
-// function : createOperation
-// purpose  :
-//=================================================================================
-GEOM::GEOM_IOperations_ptr DXFPlugin_ExportDlg::createOperation()
-{
-  return getGeomEngine()->GetPluginOperations( getStudyId(), "DXFPluginEngine" );
-}
-
-//=================================================================================
-// function : isValid
-// purpose  :
-//=================================================================================
-bool DXFPlugin_ExportDlg::isValid( QString& msg )
-{
-  bool ok = true;
-  //@@ add custom validation actions here @@//
-  return ok;
-}
-
-//=================================================================================
-// function : execute
-// purpose  :
-//=================================================================================
-bool DXFPlugin_ExportDlg::execute( ObjectList& objects )
-{
-  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-  if (!app) return false;
-
-  DXFPlugin::GEOM_IDXFPluginOperations_var aDXFOp = DXFPlugin::GEOM_IDXFPluginOperations::_narrow( getOperation() );
-  if ( aDXFOp->_is_nil() ) return false;
-
-  GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject( myObject );
-  if ( anObj->_is_nil() ) return false;
-
-  QString aFile = selectedFile();
-
-  // User has pressed "Cancel" --> stop the operation
-  if ( aFile.isEmpty() )
-    return false;
-
-  GEOM_Operation* anOp = new GEOM_Operation( app, aDXFOp.in() );
-  try {
-    SUIT_OverrideCursor wc;
-    app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( aFile, /*withExten=*/true )) );
-    anOp->start();
-    aDXFOp->ExportDXF( anObj, aFile.toUtf8().constData() );
-    if( aDXFOp->IsDone() )
-      anOp->commit();
-    else {
-      anOp->abort();
-      wc.suspend();
-      SUIT_MessageBox::critical( app->desktop(),
-                                 QObject::tr("GEOM_ERROR"),
-                                 QObject::tr("GEOM_PRP_ABORT") + "\n" + QObject::tr( aDXFOp->GetErrorCode() ) );
-      return false;
-    }
-  }
-  catch( const SALOME::SALOME_Exception& S_ex ) {
-    anOp->abort();
-    return false;
-  }
-
-  objects.push_back( anObj._retn() );
-  return true;
-}
-
-void DXFPlugin_ExportDlg::accept()
-{
-  SUIT_FileDlg::accept();
-  onAccept(false);
-}
diff --git a/src/DXFPlugin_ExportDlg.h b/src/DXFPlugin_ExportDlg.h
deleted file mode 100644 (file)
index 426d9a8..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef DXFPlugin_ExportDlg_H
-#define DXFPlugin_ExportDlg_H
-
-// GUI includes
-#include <SUIT_FileDlg.h>
-
-// GEOM includes
-#include <GEOM_GenericObjPtr.h>
-#include <GEOMBase_Helper.h>
-
-
-class DXFPlugin_ExportDlg: public SUIT_FileDlg, public GEOMBase_Helper
-{
-  Q_OBJECT
-
-public:
-  DXFPlugin_ExportDlg( Handle(SALOME_InteractiveObject)&, QWidget* = 0 );
-  ~DXFPlugin_ExportDlg();
-
-protected:
-  // redefined from GEOMBase_Helper
-  virtual GEOM::GEOM_IOperations_ptr createOperation();
-  virtual bool                       isValid( QString& );
-  virtual bool                       execute( ObjectList& );
-
-protected slots:
-  void                               accept();
-
-private:
-  Handle(SALOME_InteractiveObject)   myObject;
-};
-
-#endif // DXFPlugin_ExportDlg_H
index e0275e70deedde707da5f16fafdb778939b8ad27..97dc38155e6dfa81fa79743ab7b975ce8f9340b1 100644 (file)
@@ -20,7 +20,6 @@
 // internal includes
 #include "DXFPlugin_ExportDriver.hxx"
 #include "DXFPlugin_IExport.hxx"
-#include "DXFPlugin_Engine.hxx"
 
 // KERNEL includes
 #include <Basics_Utils.hxx>
index 05c6eafb9f2c46c91d1487f899224dc8fc5b506a..ad88707384c304e01409d8c57c7a814f7b286065 100644 (file)
@@ -33,17 +33,16 @@ DEFINE_STANDARD_HANDLE( DXFPlugin_ExportDriver, GEOM_BaseDriver );
 class DXFPlugin_ExportDriver : public GEOM_BaseDriver
 {
 public:
-  Standard_EXPORT DXFPlugin_ExportDriver();
-  Standard_EXPORT ~DXFPlugin_ExportDriver() {};
+  DXFPlugin_ExportDriver();
+  ~DXFPlugin_ExportDriver() {};
 
-  Standard_EXPORT static const Standard_GUID& GetID();
-  Standard_EXPORT virtual Standard_Integer    Execute( TFunction_Logbook& log ) const;
-  Standard_EXPORT Standard_Boolean            MustExecute( const TFunction_Logbook& ) const;
-  Standard_EXPORT virtual void                Validate( TFunction_Logbook& ) const {}
+  static const Standard_GUID& GetID();
+  virtual Standard_Integer    Execute( TFunction_Logbook& log ) const;
+  Standard_Boolean            MustExecute( const TFunction_Logbook& ) const;
+  virtual void                Validate( TFunction_Logbook& ) const {}
 
-  Standard_EXPORT virtual
-  bool GetCreationInformation( std::string&             theOperationName,
-                               std::vector<GEOM_Param>& params );
+  virtual bool                GetCreationInformation( std::string& theOperationName,
+                                                      std::vector<GEOM_Param>& params );
 
 DEFINE_STANDARD_RTTI( DXFPlugin_ExportDriver )
 };
diff --git a/src/DXFPlugin_GUI.cxx b/src/DXFPlugin_GUI.cxx
new file mode 100644 (file)
index 0000000..6f74748
--- /dev/null
@@ -0,0 +1,265 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+// internal includes
+#include "DXFPlugin_GUI.h"
+
+// GUI includes
+#include <SUIT_Desktop.h>
+#include <SUIT_FileDlg.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
+#include <SUIT_Tools.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <SALOME_ListIO.hxx>
+
+// GEOM includes
+#include "GeometryGUI.h"
+#include "GEOM_Operation.h"
+#include "GEOMBase.h"
+#include "GEOM_Displayer.h"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(DXFPlugin)
+
+//=======================================================================
+// function : DXFPlugin_GUI()
+// purpose  : Constructor
+//=======================================================================
+DXFPlugin_GUI::DXFPlugin_GUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
+{
+}
+
+//=======================================================================
+// function : ~DXFPlugin_GUI
+// purpose  : Destructor
+//=======================================================================
+DXFPlugin_GUI::~DXFPlugin_GUI()
+{
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose  : 
+//=======================================================================
+bool DXFPlugin_GUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
+{
+  QString cmd;
+  switch ( theCommandID ) {
+  case 1:
+    cmd = "Export_DXF";
+  case 2:
+    cmd = "Import_DXF";
+  default:
+    break;
+  }
+  return OnGUIEvent( cmd, parent );
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose  :
+//=======================================================================
+bool DXFPlugin_GUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
+{
+  bool result = false;
+
+  if ( theCommandID == "Export_DXF" )
+  {
+    result = exportDXF( parent );
+  }
+  else if ( theCommandID == "Import_DXF" )
+  {
+    result = importDXF( parent );
+  }
+  else
+  {
+    getGeometryGUI()->getApp()->putInfo( tr("GEOM_PRP_COMMAND").arg( theCommandID ) );
+  }
+  return result;
+}
+
+//=======================================================================
+// function : importDXF
+// purpose  :
+//=======================================================================
+bool DXFPlugin_GUI::importDXF( SUIT_Desktop* parent )
+{
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return false;
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
+  if ( !study ) return false;
+
+  SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "DXFPluginEngine" );
+  DXFPlugin::IDXFOperations_var dxfOp = DXFPlugin::IDXFOperations::_narrow( op );
+  if ( CORBA::is_nil( dxfOp ) ) return false;
+
+  QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""),
+                                                 tr( "DXF_FILES" ),
+                                                 tr( "IMPORT_TITLE" ),
+                                                 parent );
+  if ( fileNames.count() > 0 )
+  {
+    QStringList entryList;
+    QStringList errors;
+
+    foreach( QString fileName, fileNames )
+    {
+      SUIT_OverrideCursor wc;
+      GEOM_Operation transaction( app, dxfOp.in() );
+
+      try
+      {
+        app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( fileName ) );
+        transaction.start();
+        GEOM::ListOfGO_var result = dxfOp->ImportDXF( fileName.toUtf8().constData() );
+        if ( result->length() > 0 && dxfOp->IsDone() )
+        {
+          GEOM::GEOM_Object_var main = result[0];
+          QString publishName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileName, true ) );
+          SALOMEDS::SObject_var so = GeometryGUI::GetGeomGen()->PublishInStudy( dsStudy,
+                                                  SALOMEDS::SObject::_nil(),
+                                                  main.in(),
+                                                  publishName.toUtf8().constData() );
+
+          entryList.append( so->GetID() );
+          transaction.commit();
+          GEOM_Displayer( study ).Display( main.in() );
+        }
+        else
+        {
+          transaction.abort();
+          errors.append( QString( "%1 : %2" ).arg( fileName ).arg( dxfOp->GetErrorCode() ) );
+        }
+      }
+      catch( const SALOME::SALOME_Exception& e )
+      {
+        transaction.abort();
+      }
+    }
+    getGeometryGUI()->updateObjBrowser( true );
+    app->browseObjects( entryList );
+
+    if ( errors.count() > 0 )
+    {
+      SUIT_MessageBox::critical( parent,
+                                tr( "GEOM_ERROR" ),
+                                tr( "GEOM_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
+    }
+  }
+  return fileNames.count() > 0;
+}
+
+//=======================================================================
+// function : exportDXF
+// purpose  :
+//=======================================================================
+bool DXFPlugin_GUI::exportDXF( SUIT_Desktop* parent )
+{
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return false;
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
+  if ( !study ) return false;
+
+  SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() );
+  GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "DXFPluginEngine" );
+  DXFPlugin::IDXFOperations_var dxfOp = DXFPlugin::IDXFOperations::_narrow( op );
+  if ( CORBA::is_nil( dxfOp ) ) return false;
+
+  LightApp_SelectionMgr* sm = app->selectionMgr();
+  if ( !sm ) return false;
+
+  SALOME_ListIO selectedObjects;
+  sm->selectedObjects( selectedObjects );
+  bool ok = false;
+
+  SALOME_ListIteratorOfListIO it( selectedObjects );
+  for ( ; it.More(); it.Next() )
+  {
+    Handle(SALOME_InteractiveObject) io = it.Value();
+    GEOM::GEOM_Object_var obj = GEOMBase::ConvertIOinGEOMObject( io );
+
+    if ( CORBA::is_nil( obj ) ) continue;
+
+    QString fileName = app->getFileName( false,
+                                         QString( io->getName() ),
+                                         tr( "DXF_FILES" ),
+                                         tr( "EXPORT_TITLE" ),
+                                         parent );
+
+    if ( fileName.isEmpty() )
+      return false;
+
+    SUIT_OverrideCursor wc;
+
+    GEOM_Operation transaction( app, dxfOp.in() );
+
+    try
+    {
+      app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
+      transaction.start();
+
+      dxfOp->ExportDXF( obj, fileName.toUtf8().constData() );
+
+      if ( dxfOp->IsDone() )
+      {
+        transaction.commit();
+      }
+      else
+      {
+        transaction.abort();
+        SUIT_MessageBox::critical( parent,
+                                   tr( "GEOM_ERROR" ),
+                                   tr( "GEOM_PRP_ABORT" ) + "\n" + tr( dxfOp->GetErrorCode() ) );
+        return false;
+      }
+    }
+    catch ( const SALOME::SALOME_Exception& e )
+    {
+      transaction.abort();
+      return false;
+    }
+    ok = true;
+  }
+
+  if ( !ok )
+  {
+    SUIT_MessageBox::warning( parent,
+                              tr( "WRN_WARNING" ),
+                              tr( "GEOM_WRN_NO_APPROPRIATE_SELECTION" ) );
+  }
+  return ok;
+}
+
+//=====================================================================================
+// EXPORTED METHODS
+//=====================================================================================
+extern "C"
+{
+#ifdef WIN32
+    __declspec( dllexport )
+#endif
+  GEOMGUI* GetLibGUI( GeometryGUI* parent )
+  {
+    return new DXFPlugin_GUI( parent );
+  }
+}
diff --git a/src/DXFPlugin_GUI.h b/src/DXFPlugin_GUI.h
new file mode 100644 (file)
index 0000000..99045fd
--- /dev/null
@@ -0,0 +1,40 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+#ifndef DXFPlugin_GUI_H
+#define DXFPlugin_GUI_H
+
+#include <GEOMPluginGUI.h>
+
+class DXFPlugin_GUI: public GEOMPluginGUI
+{
+  Q_OBJECT
+public:
+  DXFPlugin_GUI( GeometryGUI* parent );
+  ~DXFPlugin_GUI();
+
+  bool OnGUIEvent( int commandId, SUIT_Desktop* );
+  bool OnGUIEvent( const QString&, SUIT_Desktop* );
+
+private:
+  bool importDXF( SUIT_Desktop* );
+  bool exportDXF( SUIT_Desktop* );
+};
+
+#endif // DXFPlugin_GUI_H
index e66c3f72ab6d78c8b11ab1505493953b88dbc83d..8aa1685ee7b6333eb4a8a9540a4cc4669a076ad7 100755 (executable)
 
 // internal includes
 #include "DXFPlugin_IECallBack.hxx"
+#include "DXFPlugin_IOperations.hxx"
+#include "DXFPlugin_OperationsCreator.hxx"
 
 //=============================================================================
 /*!
  *  constructor
  */
 //=============================================================================
-DXFPlugin_IECallBack::DXFPlugin_IECallBack( DXFPlugin_IOperations* theOperations )
-: GEOMImpl_IECallBack()
+DXFPlugin_IECallBack::DXFPlugin_IECallBack()
 {
-  myPluginOperations = theOperations;
 }
 
 //=============================================================================
@@ -45,11 +45,13 @@ DXFPlugin_IECallBack::~DXFPlugin_IECallBack()
  *  Export
  */
 //=============================================================================
-bool DXFPlugin_IECallBack::Export( const Handle(GEOM_Object)      theOriginal,
-                              const TCollection_AsciiString& theFileName,
-                              const TCollection_AsciiString& theFormatName )
+bool DXFPlugin_IECallBack::Export( int theDocId,
+                                   const Handle(GEOM_Object) theOriginal,
+                                   const TCollection_AsciiString& theFileName,
+                                   const TCollection_AsciiString& theFormatName )
 {
-  myPluginOperations->ExportDXF( theOriginal, theFileName );
+  DXFPlugin_IOperations* aPluginOperations = DXFPlugin_OperationsCreator::get( GetEngine(), theDocId );
+  aPluginOperations->ExportDXF( theOriginal, theFileName );
   return true;
 }
 
@@ -59,9 +61,11 @@ bool DXFPlugin_IECallBack::Export( const Handle(GEOM_Object)      theOriginal,
  */
 //=============================================================================
 Handle(TColStd_HSequenceOfTransient)
-DXFPlugin_IECallBack::Import( const TCollection_AsciiString& theFormatName,
-                         const TCollection_AsciiString& theFileName )
+DXFPlugin_IECallBack::Import( int theDocId,
+                              const TCollection_AsciiString& theFormatName,
+                              const TCollection_AsciiString& theFileName )
 {
-  return myPluginOperations->ImportDXF( theFileName );
+  DXFPlugin_IOperations* aPluginOperations = DXFPlugin_OperationsCreator::get( GetEngine(), theDocId );
+  return aPluginOperations->ImportDXF( theFileName );
 }
 
index 92e0265707ecbff8c74708a5082c6396b6e6de68..0e0b5c152a39e8b497dc3a717e7083ffee1883d3 100644 (file)
 // OCC includes
 #include <TCollection_AsciiString.hxx>
 
-class DXFPlugin_IECallBack : public GEOMImpl_IECallBack
+class DXFPLUGINENGINE_EXPORT DXFPlugin_IECallBack : public GEOMImpl_IECallBack
 {
 public:
-  Standard_EXPORT DXFPlugin_IECallBack( DXFPlugin_IOperations* theOperations );
-  Standard_EXPORT ~DXFPlugin_IECallBack();
+  DXFPlugin_IECallBack();
+  ~DXFPlugin_IECallBack();
   
-  Standard_EXPORT virtual bool         Export( const Handle(GEOM_Object)      theOriginal,
-                                               const TCollection_AsciiString& theFileName,
-                                               const TCollection_AsciiString& theFormatName );
-
-  Standard_EXPORT virtual
-  Handle(TColStd_HSequenceOfTransient) Import( const TCollection_AsciiString& theFormatName,
-                                                                          const TCollection_AsciiString& theFileName );
-
-private:
-  DXFPlugin_IOperations* myPluginOperations;
+  bool Export( int theDocId,
+               const Handle(GEOM_Object) theOriginal,
+               const TCollection_AsciiString& theFileName,
+               const TCollection_AsciiString& theFormatName );
+
+  Handle(TColStd_HSequenceOfTransient) Import( int theDocId,
+                                               const TCollection_AsciiString& theFormatName,
+                                               const TCollection_AsciiString& theFileName );
 };
 
 #endif
index 752c164fbe3d98fcaac6bf63c15ad7207d05b50e..65b3732a58be65dead63a0c903823852aa3a80cd 100644 (file)
@@ -60,12 +60,10 @@ DXFPlugin_IOperations::~DXFPlugin_IOperations()
  *  Export a shape to DXF format
  *  \param theOriginal The shape to export
  *  \param theFileName The name of the file to exported
- *  \param theIsASCII The format of the exported file (ASCII or Binary)
- *  \param theDeflection The deflection of the shape to exported
  */
 //=============================================================================
 void DXFPlugin_IOperations::ExportDXF( const Handle(GEOM_Object)      theOriginal,
-                                                 const TCollection_AsciiString& theFileName )
+                                       const TCollection_AsciiString& theFileName )
 {
   SetErrorCode(KO);
   if( theOriginal.IsNull() ) return;
@@ -90,9 +88,7 @@ void DXFPlugin_IOperations::ExportDXF( const Handle(GEOM_Object)      theOrigina
 
   //Perform the Export
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if( !GetSolver()->ComputeFunction( aFunction ) ) {
       SetErrorCode( "Not enough space on disk, or you haven't permissions to write this directory" );
       return;
@@ -144,9 +140,7 @@ DXFPlugin_IOperations::ImportDXF( const TCollection_AsciiString& theFileName )
   Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
 
   try {
-#if OCC_VERSION_LARGE > 0x06010000
     OCC_CATCH_SIGNALS;
-#endif
     if( !GetSolver()->ComputeFunction( aFunction ) ) {
       SetErrorCode( "Import driver failed" );
       return NULL;
index 40cea1ee199ffd8926fddefc3ce3345d29906d43..c3d9d2624486fca51fe06ae50f333768f7fdfed3 100644 (file)
 #ifndef _DXFPlugin_IOperations_HXX_
 #define _DXFPlugin_IOperations_HXX_
 
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+
 // GEOM includes
 #include <GEOMImpl_IBaseIEOperations.hxx>
 
-class DXFPlugin_IOperations: public GEOMImpl_IBaseIEOperations
+class DXFPLUGINENGINE_EXPORT DXFPlugin_IOperations: public GEOMImpl_IBaseIEOperations
 {
 public:
-  Standard_EXPORT DXFPlugin_IOperations( GEOM_Engine*, int );
-  Standard_EXPORT ~DXFPlugin_IOperations();
+  DXFPlugin_IOperations( GEOM_Engine*, int );
+  ~DXFPlugin_IOperations();
 
-  Standard_EXPORT void ExportDXF( const Handle(GEOM_Object),
-                                   const TCollection_AsciiString& );
+  void ExportDXF( const Handle(GEOM_Object),
+                  const TCollection_AsciiString& );
 
-  Standard_EXPORT Handle(TColStd_HSequenceOfTransient) ImportDXF( const TCollection_AsciiString& );
+  Handle(TColStd_HSequenceOfTransient) ImportDXF( const TCollection_AsciiString& );
 };
 
 #endif
diff --git a/src/DXFPlugin_IOperations_i.cc b/src/DXFPlugin_IOperations_i.cc
new file mode 100644 (file)
index 0000000..bca345b
--- /dev/null
@@ -0,0 +1,109 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+// internal includes
+#include "DXFPlugin_IOperations_i.hh"
+#include "DXFPlugin_IOperations.hxx"
+#include <DXFPLUGIN_version.h>
+
+// KERNEL includes
+#include <utilities.h>
+
+//=============================================================================
+/*!
+ *   constructor:
+ */
+//=============================================================================
+DXFPlugin_IOperations_i::DXFPlugin_IOperations_i( PortableServer::POA_ptr  thePOA,
+                                                  GEOM::GEOM_Gen_ptr       theEngine,
+                                                  ::DXFPlugin_IOperations* theImpl )
+:GEOM_IOperations_i( thePOA, theEngine, theImpl )
+{
+  MESSAGE( "DXFPlugin_Operations_i::DXFPlugin_Operations_i" );
+}
+
+//=============================================================================
+/*!
+ *  destructor
+ */
+//=============================================================================
+DXFPlugin_IOperations_i::~DXFPlugin_IOperations_i()
+{
+  MESSAGE( "DXFPlugin_Operations_i::~DXFPlugin_Operations_i" );
+}
+
+//=============================================================================
+/*!
+ *  ExportDXF
+ *  Export a shape to DXF format
+ *  \param theOriginal The shape to export
+ *  \param theFileName The name of the exported file
+ */
+//=============================================================================
+void DXFPlugin_IOperations_i::ExportDXF( GEOM::GEOM_Object_ptr theOriginal,
+                                         const char*           theFileName )
+{
+  // duplicate the original shape
+  GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Get the reference shape
+  Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
+  if (anOriginal.IsNull()) return;
+
+  //Export the shape to the file
+  GetOperations()->ExportDXF( anOriginal, theFileName );
+}
+
+//=============================================================================
+/*!
+ *  ImportDXF
+ *  Import a shape from DXF format
+ *  \param theFileName The name of the file to import
+ *  \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* DXFPlugin_IOperations_i::ImportDXF( const char* theFileName )
+{
+  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+  //Set a not done flag
+  GetOperations()->SetNotDone();
+
+  //Import the shape from the file
+  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->ImportDXF( theFileName );
+
+  if( !GetOperations()->IsDone() || aHSeq.IsNull() )
+    return aSeq._retn();
+
+  // Copy created objects.
+  Standard_Integer aLength = aHSeq->Length();
+  aSeq->length( aLength );
+  for( Standard_Integer i = 1; i <= aLength; i++ )
+    aSeq[i-1] = GetObject( Handle(GEOM_Object)::DownCast( aHSeq->Value(i) ) );
+
+  return aSeq._retn();
+}
+
+DXFPlugin_IOperations* DXFPlugin_IOperations_i::GetOperations()
+{
+  return (DXFPlugin_IOperations*)GetImpl();
+}
diff --git a/src/DXFPlugin_IOperations_i.hh b/src/DXFPlugin_IOperations_i.hh
new file mode 100644 (file)
index 0000000..689e900
--- /dev/null
@@ -0,0 +1,52 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+#ifndef _DXFPlugin_IOperations_i_HeaderFile
+#define _DXFPlugin_IOperations_i_HeaderFile
+
+// idl includes
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER( GEOM_Gen )
+#include CORBA_SERVER_HEADER( DXFPlugin )
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+
+// GEOM includes
+#include <GEOM_IOperations_i.hh>
+
+class DXFPlugin_IOperations;
+
+class DXFPLUGINENGINE_EXPORT DXFPlugin_IOperations_i :
+      public virtual POA_DXFPlugin::IDXFOperations,
+      public virtual GEOM_IOperations_i
+{
+public:
+  DXFPlugin_IOperations_i( PortableServer::POA_ptr thePOA,
+                           GEOM::GEOM_Gen_ptr theEngine,
+                           DXFPlugin_IOperations* theImpl );
+  ~DXFPlugin_IOperations_i();
+
+  void            ExportDXF( GEOM::GEOM_Object_ptr, const char* );
+  GEOM::ListOfGO* ImportDXF( const char* );
+
+  DXFPlugin_IOperations* GetOperations();
+};
+
+#endif // _DXFPlugin_IOperations_i_HeaderFile
diff --git a/src/DXFPlugin_ImportDlg.cxx b/src/DXFPlugin_ImportDlg.cxx
deleted file mode 100644 (file)
index ba69e45..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPlugin_ImportDlg.h"
-#include "DXFPlugin_Operations_i.hh"
-
-// GUI includes
-#include <SUIT_Session.h>
-#include <SUIT_MessageBox.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_Tools.h>
-#include <SalomeApp_Application.h>
-
-// GEOM includes
-#include <GEOMBase.h>
-#include <GEOM_Operation.h>
-
-//=================================================================================
-// Constructor
-//=================================================================================
-DXFPlugin_ImportDlg::DXFPlugin_ImportDlg( QWidget* parent )
-: SUIT_FileDlg( parent, true, true, true ),
-  GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( parent ) )
-{
-  setWindowTitle( tr( "DXFPLUGIN_IMPORT_TITLE" ) );
-  setAcceptMode( AcceptOpen );
-  setNameFilter( tr( "DXFPLUGIN_DXF_FILES" ) );
-  setFileMode( QFileDialog::ExistingFiles );
-}
-
-//=================================================================================
-// Destructor
-//=================================================================================
-DXFPlugin_ImportDlg::~DXFPlugin_ImportDlg()
-{
-  // no need to delete child widgets, Qt does it all for us
-}
-
-//=================================================================================
-// function : createOperation
-// purpose  :
-//=================================================================================
-GEOM::GEOM_IOperations_ptr DXFPlugin_ImportDlg::createOperation()
-{
-  return getGeomEngine()->GetPluginOperations(getStudyId(), "DXFPluginEngine");
-}
-
-//=================================================================================
-// function : isValid
-// purpose  :
-//=================================================================================
-bool DXFPlugin_ImportDlg::isValid (QString& msg)
-{
-  bool ok = true;
-  //@@ add custom validation actions here @@//
-  return ok;
-}
-
-//=================================================================================
-// function : execute
-// purpose  :
-//=================================================================================
-bool DXFPlugin_ImportDlg::execute( ObjectList& objects )
-{
-  bool res = false;
-  GEOM::GEOM_Object_var anObj;
-  DXFPlugin::GEOM_IDXFPluginOperations_var anOper = DXFPlugin::GEOM_IDXFPluginOperations::_narrow( getOperation() );
-
-  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-
-  QStringList fileNames = selectedFiles();
-  if ( fileNames.count() == 0 )
-    return false; // nothing selected, return
-
-  for( int i = 0; i < fileNames.size(); i++ ) {
-    QString aFileName = fileNames.at( i );
-    if ( aFileName.isEmpty() )
-      continue;
-    GEOM_Operation* anOp = new GEOM_Operation( app, anOper.in() );
-    try {
-      app->putInfo( tr( "GEOM_PRP_LOADING" ).arg( SUIT_Tools::file( aFileName.toUtf8().constData(), /*withExten=*/true ) ) );
-      anOp->start();
-      GEOM::ListOfGO_var anObj = anOper->ImportDXF( aFileName.toUtf8().constData() );
-      if( anObj->length() > 0 && anOper->IsDone() ) {
-        GEOM::GEOM_Object_ptr anObjPtr = anObj[0]._retn();
-        objects.push_back( anObjPtr );
-        QString aPublishObjName = GEOMBase::GetDefaultName( SUIT_Tools::file( fileNames.at( i ),
-                                                            /*withExten=*/true ) );
-        anObjPtr->SetName( aPublishObjName.toStdString().c_str() );
-        anOp->commit();
-      }
-      else {
-        anOp->abort();
-        SUIT_MessageBox::critical( app->desktop(),
-                                   QObject::tr("GEOM_ERROR"),
-                                   QObject::tr("GEOM_PRP_ABORT") + "\n" + QObject::tr( anOper->GetErrorCode() ) );
-      }
-    }
-    catch( const SALOME::SALOME_Exception& S_ex ) {
-      anOp->abort();
-    }
-  }
-  return true;
-}
-
-//=================================================================================
-// function : accept
-// purpose  :
-//=================================================================================
-void DXFPlugin_ImportDlg::accept()
-{
-  SUIT_FileDlg::accept();
-  onAccept();
-}
-
-//=================================================================================
-// function : getObjectName
-// purpose  :
-//=================================================================================
-QString DXFPlugin_ImportDlg::getObjectName( GEOM::GEOM_Object_ptr object ) const
-{
-  if( object->_is_nil() )
-    return QString::null;
-  return object->GetName();
-}
diff --git a/src/DXFPlugin_ImportDlg.h b/src/DXFPlugin_ImportDlg.h
deleted file mode 100644 (file)
index 48bdbf4..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef DXFPlugin_IMPORTDLG_H
-#define DXFPlugin_IMPORTDLG_H
-
-// GUI includes
-#include <SUIT_FileDlg.h>
-
-// GEOM includes
-#include <GEOMBase_Helper.h>
-#include <GEOM_GenericObjPtr.h>
-
-class DXFPlugin_ImportDlg: public SUIT_FileDlg, public GEOMBase_Helper
-{
-  Q_OBJECT
-
-public:
-  DXFPlugin_ImportDlg( QWidget* = 0 );
-  ~DXFPlugin_ImportDlg();
-
-protected:
-  // redefined from GEOMBase_Helper
-  virtual GEOM::GEOM_IOperations_ptr createOperation();
-  virtual bool                       isValid( QString& );
-  virtual bool                       execute( ObjectList& );
-  virtual QString                    getObjectName( GEOM::GEOM_Object_ptr object ) const;
-
-protected slots:
-  void                               accept();
-};
-
-#endif // DXFPlugin_IMPORTDLG_H
index ae700d08a9bbe17d80987aff50b1d5867edd1dd4..c9615c293c94738ee671be3530ccd1f66bf2ab95 100644 (file)
@@ -20,7 +20,6 @@
 // internal includes
 #include "DXFPlugin_ImportDriver.hxx"
 #include "DXFPlugin_IImport.hxx"
-#include "DXFPlugin_Engine.hxx"
 
 // KERNEL includes
 #include <Basics_Utils.hxx>
index 2128c2b7b08091b7be129ef76a21d984d0895caf..dfc6ac446bf47a4f1dd3d488064f86763648d7d8 100644 (file)
@@ -33,17 +33,16 @@ DEFINE_STANDARD_HANDLE( DXFPlugin_ImportDriver, GEOM_BaseDriver );
 class DXFPlugin_ImportDriver : public GEOM_BaseDriver
 {
 public:
-  Standard_EXPORT DXFPlugin_ImportDriver();
-  Standard_EXPORT ~DXFPlugin_ImportDriver() {};
+  DXFPlugin_ImportDriver();
+  ~DXFPlugin_ImportDriver() {};
 
-  Standard_EXPORT static const Standard_GUID& GetID();
-  Standard_EXPORT virtual Standard_Integer    Execute( TFunction_Logbook& log ) const;
-  Standard_EXPORT Standard_Boolean            MustExecute( const TFunction_Logbook& ) const;
-  Standard_EXPORT virtual void                Validate( TFunction_Logbook& ) const {}
+  static const Standard_GUID& GetID();
+  virtual Standard_Integer    Execute( TFunction_Logbook& log ) const;
+  Standard_Boolean            MustExecute( const TFunction_Logbook& ) const;
+  virtual void                Validate( TFunction_Logbook& ) const {}
  
-  Standard_EXPORT virtual
-  bool GetCreationInformation( std::string&             theOperationName,
-                               std::vector<GEOM_Param>& params );
+  virtual bool                GetCreationInformation( std::string& theOperationName,
+                                                      std::vector<GEOM_Param>& params );
 
 DEFINE_STANDARD_RTTI( DXFPlugin_ImportDriver )
 };
diff --git a/src/DXFPlugin_OperationsCreator.cc b/src/DXFPlugin_OperationsCreator.cc
deleted file mode 100644 (file)
index 41705b0..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPlugin_OperationsCreator.hh"
-#include "DXFPlugin_Operations_i.hh"
-#include "DXFPlugin_ExportDriver.hxx"
-#include "DXFPlugin_ImportDriver.hxx"
-#include "DXFPlugin_IECallBack.hxx"
-
-// KERNEL includes
-#include <Utils_ExceptHandlers.hxx>
-#include <utilities.h>
-
-// GEOM includes
-#include <GEOMImpl_IECallBack.hxx>
-
-// OCCT includes
-#include <TFunction_DriverTable.hxx>
-
-//============================================================================
-// function : Create
-// purpose  :
-//============================================================================
-GEOM_IOperations_i* DXFPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
-                                                          int                     theStudyId,
-                                                          GEOM::GEOM_Gen_ptr      theEngine,
-                                                          ::GEOMImpl_Gen*         theGenImpl )
-{
-  Unexpect aCatch( SALOME_SalomeException );
-  MESSAGE( "DXFPlugin_OperationsCreator::Create" );
-
-  if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() ) {
-    DXFPlugin_IOperations* anOper = new DXFPlugin_IOperations( theGenImpl, theStudyId );
-    _mapOfOperations[theStudyId] = anOper;
-
-    // Import/Export DXF
-    TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ExportDriver::GetID(),
-                                             new DXFPlugin_ExportDriver() );
-    TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ImportDriver::GetID(),
-                                             new DXFPlugin_ImportDriver() );
-
-    DXFPlugin_IECallBack* DXFCallBack = new DXFPlugin_IECallBack( anOper );
-    GEOMImpl_IECallBack::Register( "DXF", DXFCallBack );
-  }
-
-  DXFPlugin_Operations_i* aServant =
-    new DXFPlugin_Operations_i( thePOA, theEngine, _mapOfOperations[theStudyId] );
-
-  return aServant;
-}
diff --git a/src/DXFPlugin_OperationsCreator.cxx b/src/DXFPlugin_OperationsCreator.cxx
new file mode 100644 (file)
index 0000000..a20b6c8
--- /dev/null
@@ -0,0 +1,71 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+// internal includes
+#include "DXFPlugin_OperationsCreator.hxx"
+#include "DXFPlugin_IOperations_i.hh"
+#include "DXFPlugin_ExportDriver.hxx"
+#include "DXFPlugin_ImportDriver.hxx"
+#include "DXFPlugin_IECallBack.hxx"
+
+// KERNEL includes
+#include <Utils_ExceptHandlers.hxx>
+#include <utilities.h>
+
+// GEOM includes
+#include <GEOMImpl_IECallBack.hxx>
+
+// OCCT includes
+#include <TFunction_DriverTable.hxx>
+
+std::map <int, DXFPlugin_IOperations*> DXFPlugin_OperationsCreator::_mapOfOperations;
+
+DXFPlugin_OperationsCreator::DXFPlugin_OperationsCreator()
+{
+  // Register drivers
+  TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ExportDriver::GetID(),
+                                           new DXFPlugin_ExportDriver() );
+  TFunction_DriverTable::Get()->AddDriver( DXFPlugin_ImportDriver::GetID(),
+                                           new DXFPlugin_ImportDriver() );
+  // Register callback
+  DXFPlugin_IECallBack* callback = new DXFPlugin_IECallBack();
+  GEOMImpl_IECallBack::Register( "DXF", callback );
+}
+
+DXFPlugin_OperationsCreator::~DXFPlugin_OperationsCreator()
+{
+}
+
+GEOM_IOperations_i* DXFPlugin_OperationsCreator::Create( PortableServer::POA_ptr thePOA,
+                                                         int                     theStudyId,
+                                                         GEOM::GEOM_Gen_ptr      theEngine,
+                                                         ::GEOMImpl_Gen*         theGenImpl )
+{
+  Unexpect aCatch( SALOME_SalomeException );
+  MESSAGE( "DXFPlugin_OperationsCreator::Create" );
+  return new DXFPlugin_IOperations_i( thePOA, theEngine, get( theGenImpl, theStudyId ) );
+}
+
+DXFPlugin_IOperations* DXFPlugin_OperationsCreator::get( ::GEOMImpl_Gen* theGenImpl,
+                                                         int             theStudyId )
+{
+  if (_mapOfOperations.find( theStudyId ) == _mapOfOperations.end() )
+    _mapOfOperations[theStudyId] = new DXFPlugin_IOperations( theGenImpl, theStudyId );
+  return _mapOfOperations[theStudyId];
+}
diff --git a/src/DXFPlugin_OperationsCreator.hh b/src/DXFPlugin_OperationsCreator.hh
deleted file mode 100755 (executable)
index c3ca1ab..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef _GEOM_DXFPlugin_OperationsCreator_HXX_
-#define _GEOM_DXFPlugin_OperationsCreator_HXX_
-
-// internal includes
-#include "DXFPlugin_Engine.hxx"
-#include "DXFPlugin_IOperations.hxx"
-
-// GEOM includes
-#include "GEOM_Gen_i.hh"
-
-// C++ includes
-#include <map>
-
-//=====================================================================
-// Operations creator
-//=====================================================================
-class DXFPLUGINENGINE_EXPORT DXFPlugin_OperationsCreator : public GEOM_GenericOperationsCreator
-{
-public:
-  virtual GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
-                                      int                     theStudyId,
-                                      GEOM::GEOM_Gen_ptr      theEngine,
-                                      ::GEOMImpl_Gen*         theGenImpl );
- private:
-  std::map <int, DXFPlugin_IOperations*>  _mapOfOperations;
-};
-
-#endif
diff --git a/src/DXFPlugin_OperationsCreator.hxx b/src/DXFPlugin_OperationsCreator.hxx
new file mode 100755 (executable)
index 0000000..3d8df73
--- /dev/null
@@ -0,0 +1,57 @@
+// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// 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, or (at your option) any later version.
+//
+// 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
+//
+
+#ifndef _GEOM_DXFPlugin_OperationsCreator_HXX_
+#define _GEOM_DXFPlugin_OperationsCreator_HXX_
+
+// internal includes
+#include "DXFPlugin_Engine.hxx"
+
+// GEOM includes
+#include "GEOM_Gen_i.hh"
+
+// C++ includes
+#include <map>
+
+class DXFPlugin_IOperations;
+
+//=====================================================================
+// Operations creator
+//=====================================================================
+class DXFPLUGINENGINE_EXPORT DXFPlugin_OperationsCreator : public GEOM_GenericOperationsCreator
+{
+public:
+  DXFPlugin_OperationsCreator();
+  ~DXFPlugin_OperationsCreator();
+
+  GEOM_IOperations_i* Create( PortableServer::POA_ptr thePOA,
+                              int                     theStudyId,
+                              GEOM::GEOM_Gen_ptr      theEngine,
+                              ::GEOMImpl_Gen*         theGenImpl );
+
+private:
+  static DXFPlugin_IOperations* get( ::GEOMImpl_Gen* theGenImpl,
+                                     int             theStudyId );
+
+  static std::map <int, DXFPlugin_IOperations*>  _mapOfOperations;
+
+  friend class DXFPlugin_IECallBack;
+};
+
+#endif
diff --git a/src/DXFPlugin_Operations_i.cc b/src/DXFPlugin_Operations_i.cc
deleted file mode 100644 (file)
index 115daf0..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-// internal includes
-#include "DXFPlugin_Operations_i.hh"
-#include <DXFPLUGIN_version.h>
-
-// KERNEL includes
-#include <utilities.h>
-
-//=============================================================================
-/*!
- *   constructor:
- */
-//=============================================================================
-DXFPlugin_Operations_i::DXFPlugin_Operations_i( PortableServer::POA_ptr thePOA,
-                                                            GEOM::GEOM_Gen_ptr theEngine,
-                                                            ::DXFPlugin_IOperations* theImpl )
-:GEOM_IOperations_i( thePOA, theEngine, theImpl )
-{
-  MESSAGE( "DXFPlugin_Operations_i::DXFPlugin_Operations_i" );
-}
-
-//=============================================================================
-/*!
- *  destructor
- */
-//=============================================================================
-DXFPlugin_Operations_i::~DXFPlugin_Operations_i()
-{
-  MESSAGE( "DXFPlugin_Operations_i::~DXFPlugin_Operations_i" );
-}
-
-//=============================================================================
-/*!
- *  ExportDXF
- *  Export a shape to DXF format
- *  \param theOriginal The shape to export
- *  \param theFileName The name of the exported file
- */
-//=============================================================================
-void DXFPlugin_Operations_i::ExportDXF( GEOM::GEOM_Object_ptr theOriginal,
-                                               const char*           theFileName )
-{
-  // duplicate the original shape
-  GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
-
-  //Set a not done flag
-  GetOperations()->SetNotDone();
-
-  //Get the reference shape
-  Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
-  if (anOriginal.IsNull()) return;
-
-  //Export the shape to the file
-  char* aFileName = strdup( theFileName );
-
-  GetOperations()->ExportDXF( anOriginal, aFileName );
-  free( aFileName );
-}
-
-//=============================================================================
-/*!
- *  ImportDXF
- *  Import a shape from DXF format
- *  \param theFileName The name of the file to import
- *  \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* DXFPlugin_Operations_i::ImportDXF( const char* theFileName )
-{
-  GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
-  //Set a not done flag
-  GetOperations()->SetNotDone();
-
-  //Import the shape from the file
-  char* aFileName = strdup( theFileName );
-  TCollection_AsciiString fileName( aFileName );
-
-  //Import the shape from the file
-  Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->ImportDXF( fileName );
-
-  free( aFileName );
-  if( !GetOperations()->IsDone() || aHSeq.IsNull() )
-    return aSeq._retn();
-
-  // Copy created objects.
-  Standard_Integer aLength = aHSeq->Length();
-  aSeq->length( aLength );
-  for( Standard_Integer i = 1; i <= aLength; i++ )
-    aSeq[i-1] = GetObject( Handle(GEOM_Object)::DownCast( aHSeq->Value(i) ) );
-
-  return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- *  \brief Get version of the plugin.
- *  \return the version of the plugin
-*/
-//=============================================================================
-
-int DXFPlugin_Operations_i::GetVersion()
-{
-  return DXFPLUGIN_VERSION;
-}
-//=============================================================================
-/*!
- *  \brief Get version of the plugin.
- *  \return the string representation of the plugin's version
-*/
-//=============================================================================
-
-char* DXFPlugin_Operations_i::GetVersionStr()
-{
-  return (char*)DXFPLUGIN_VERSION_STR;
-}
diff --git a/src/DXFPlugin_Operations_i.hh b/src/DXFPlugin_Operations_i.hh
deleted file mode 100644 (file)
index 21488b2..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2014  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// 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, or (at your option) any later version.
-//
-// 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
-//
-
-#ifndef _DXFPlugin_Operations_i_HeaderFile
-#define _DXFPlugin_Operations_i_HeaderFile
-
-// idl includes
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER( GEOM_Gen )
-#include CORBA_SERVER_HEADER( DXFPlugin_Gen )
-
-// internal includes
-#include "DXFPlugin_Engine.hxx"
-#include "DXFPlugin_IOperations.hxx"
-
-// GEOM includes
-#include <GEOM_IOperations_i.hh>
-
-class DXFPLUGINENGINE_EXPORT DXFPlugin_Operations_i :
-      public virtual POA_DXFPlugin::GEOM_IDXFPluginOperations,
-      public virtual GEOM_IOperations_i
-{
-public:
-  DXFPlugin_Operations_i( PortableServer::POA_ptr thePOA,
-                                GEOM::GEOM_Gen_ptr theEngine,
-                                ::DXFPlugin_IOperations* theImpl );
-  ~DXFPlugin_Operations_i();
-
-  void            ExportDXF( GEOM::GEOM_Object_ptr, const char* );
-  GEOM::ListOfGO* ImportDXF( const char* );
-
-  // Version information
-  virtual int     GetVersion();
-  virtual char*   GetVersionStr();
-
-  ::DXFPlugin_IOperations* GetOperations()
-  { return (::DXFPlugin_IOperations*)GetImpl(); }
-};
-
-#endif
index 24fc2b31bbb789d7f8ec1fa1345adca162a149a1..6021633840c460d05b243cfe6d939b9c303ab29e 100644 (file)
         <source>STB_IMPORTDXF</source>
         <translation>Import DXF</translation>
     </message>
+</context>
+<context>
+    <name>DXFPlugin_GUI</name>
     <message>
-        <source>DXFPLUGIN_DXF_FILES</source>
+        <source>DXF_FILES</source>
         <translation>DXF files( *.dxf )</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ExportDlg</name>
     <message>
-        <source>DXFPLUGIN_EXPORT_TITLE</source>
+        <source>EXPORT_TITLE</source>
         <translation>Export DXF</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ImportDlg</name>
     <message>
-        <source>DXFPLUGIN_IMPORT_TITLE</source>
+        <source>IMPORT_TITLE</source>
         <translation>Import DXF</translation>
     </message>
 </context>
index 9f66bda329d9232a9c7055264566690022e976f6..54f35a20755919d654a1265126c449fa72e955e4 100644 (file)
         <source>STB_IMPORTDXF</source>
         <translation>Importer DXF</translation>
     </message>
+</context>
+<context>
+    <name>DXFPlugin_GUI</name>
     <message>
-        <source>DXFPLUGIN_DXF_FILES</source>
+        <source>DXF_FILES</source>
         <translation>DXF Fichiers( *.dxf )</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ExportDlg</name>
     <message>
-        <source>DXFPLUGIN_EXPORT_TITLE</source>
+        <source>EXPORT_TITLE</source>
         <translation>Exporter DXF</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ImportDlg</name>
     <message>
-        <source>DXFPLUGIN_IMPORT_TITLE</source>
+        <source>IMPORT_TITLE</source>
         <translation>Importer DXF</translation>
     </message>
 </context>
index 859d770d7cf3ad2b7ac4d534f22d356adfc23e76..6c6461e8cc2296e210d8b383975b97ad84066cbe 100644 (file)
         <source>STB_IMPORTDXF</source>
         <translation type="unfinished">Import DXF</translation>
     </message>
+</context>
+<context>
+    <name>DXFPlugin_GUI</name>
     <message>
-        <source>DXFPLUGIN_DXF_FILES</source>
+        <source>DXF_FILES</source>
         <translation type="unfinished">DXF files( *.dxf )</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ExportDlg</name>
     <message>
-        <source>DXFPLUGIN_EXPORT_TITLE</source>
+        <source>EXPORT_TITLE</source>
         <translation type="unfinished">Export DXF</translation>
     </message>
-</context>
-<context>
-    <name>DXFPlugin_ImportDlg</name>
     <message>
-        <source>DXFPLUGIN_IMPORT_TITLE</source>
+        <source>IMPORT_TITLE</source>
         <translation type="unfinished">Import DXF</translation>
     </message>
 </context>