]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorsbh <sergey.belash@opencascade.com>
Thu, 24 Apr 2014 12:02:38 +0000 (16:02 +0400)
committersbh <sergey.belash@opencascade.com>
Thu, 24 Apr 2014 12:02:38 +0000 (16:02 +0400)
Conflicts:
src/PartSet/PartSet_Module.cpp

110 files changed:
CMakeCommon/FindSalome.cmake [new file with mode: 0644]
CMakeLists.txt
build_vc9_Salome_deb.bat [new file with mode: 0644]
msvc10_env.bat
msvc9_env_Salome.bat [new file with mode: 0644]
salomeRun.bat [new file with mode: 0644]
src/Config/CMakeLists.txt
src/Config/Config_FeatureMessage.cpp
src/Config/Config_FeatureMessage.h
src/Config/Config_FeatureReader.cpp
src/Config/Config_PointerMessage.cpp
src/Config/Config_PointerMessage.h
src/Config/Config_XMLReader.cpp
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Plugin.h
src/Event/CMakeLists.txt [deleted file]
src/Event/Event.h [deleted file]
src/Event/Event_Listener.cpp [deleted file]
src/Event/Event_Listener.h [deleted file]
src/Event/Event_Loop.cpp [deleted file]
src/Event/Event_Loop.h [deleted file]
src/Event/Event_Message.cpp [deleted file]
src/Event/Event_Message.h [deleted file]
src/Events/CMakeLists.txt [new file with mode: 0644]
src/Events/Events.h [new file with mode: 0644]
src/Events/Events_Listener.cpp [new file with mode: 0644]
src/Events/Events_Listener.h [new file with mode: 0644]
src/Events/Events_Loop.cpp [new file with mode: 0644]
src/Events/Events_Loop.h [new file with mode: 0644]
src/Events/Events_Message.cpp [new file with mode: 0644]
src/Events/Events_Message.h [new file with mode: 0644]
src/GeomAPI/CMakeLists.txt
src/GeomAPI/GeomAPI.i
src/GeomAPI/GeomAPI_Interface.cpp
src/GeomAPI/GeomAPI_Interface.h
src/GeomAPI/GeomAPI_Pln.cpp [new file with mode: 0644]
src/GeomAPI/GeomAPI_Pln.h [new file with mode: 0644]
src/GeomAlgoAPI/CMakeLists.txt
src/GeomAlgoAPI/GeomAlgoAPI.i
src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp [new file with mode: 0644]
src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h [new file with mode: 0644]
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_FaceBuilder.h
src/Model/CMakeLists.txt
src/Model/Model_Application.cpp
src/Model/Model_Application.h
src/Model/Model_AttributeDocRef.cpp
src/Model/Model_AttributeDocRef.h
src/Model/Model_Data.cpp
src/Model/Model_Data.h
src/Model/Model_Document.cpp
src/Model/Model_Document.h
src/Model/Model_Events.cpp
src/Model/Model_Events.h
src/Model/Model_Iterator.cpp
src/Model/Model_Iterator.h
src/Model/Model_PluginManager.cpp
src/Model/Model_PluginManager.h
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_AttributeDocRef.h
src/ModelAPI/ModelAPI_Data.h
src/ModelAPI/ModelAPI_Document.h
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Iterator.h
src/ModelAPI/ModelAPI_Plugin.h
src/ModelAPI/ModelAPI_PluginManager.cpp
src/ModelAPI/ModelAPI_PluginManager.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_PropPanelOperation.h
src/NewGeom/CMakeLists.txt [new file with mode: 0644]
src/NewGeom/NewGeom.h [new file with mode: 0644]
src/NewGeom/NewGeom_Module.cpp [new file with mode: 0644]
src/NewGeom/NewGeom_Module.h [new file with mode: 0644]
src/NewGeom/resources/LightApp.xml [new file with mode: 0644]
src/NewGeom/resources/newgeom.png [new file with mode: 0644]
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSetPlugin/PartSetPlugin_Part.cpp
src/PartSetPlugin/PartSetPlugin_Part.h
src/PartSetPlugin/PartSetPlugin_Plugin.cpp
src/PartSetPlugin/PartSetPlugin_Plugin.h
src/SketchPlugin/SketchPlugin_Feature.cpp
src/SketchPlugin/SketchPlugin_Feature.h
src/SketchPlugin/SketchPlugin_Plugin.cpp
src/SketchPlugin/SketchPlugin_Plugin.h
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_Constants.h
src/XGUI/XGUI_DataTreeModel.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_DocumentDataModel.cpp
src/XGUI/XGUI_DocumentDataModel.h
src/XGUI/XGUI_Module.h
src/XGUI/XGUI_OperationMgr.cpp [new file with mode: 0644]
src/XGUI/XGUI_OperationMgr.h [new file with mode: 0644]
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_PartDataModel.h
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_Viewer.cpp
src/XGUI/XGUI_Viewer.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

diff --git a/CMakeCommon/FindSalome.cmake b/CMakeCommon/FindSalome.cmake
new file mode 100644 (file)
index 0000000..c2403c2
--- /dev/null
@@ -0,0 +1,53 @@
+
+
+SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL directory")
+SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI directory")
+IF(EXISTS ${GUI_ROOT_DIR})
+       SET(HAVE_SALOME YES)
+  
+       FIND_LIBRARY(caf caf ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(CAM CAM ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(CASCatch CASCatch ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(DDS DDS ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(Event Event ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(GLViewer GLViewer ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(LightApp LightApp ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(LogWindow LogWindow ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(ObjBrowser ObjBrowser ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(OCCViewer OCCViewer ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(OpenGLUtils OpenGLUtils ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(Plot2d Plot2d ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(PyConsole PyConsole ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(PyInterp PyInterp ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(QDS QDS ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(qtx qtx ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(QxScene QxScene ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeApp SalomeApp ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeIDLGUI SalomeIDLGUI ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeObject SalomeObject ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomePrs SalomePrs ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomePyQtGUILight SalomePyQtGUILight ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomePyQtGUI SalomePyQtGUI ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomePyQt SalomePyQt ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomePy SalomePy ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeSession SalomeSession ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeStyle SalomeStyle ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SOCC SOCC ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SPlot2d SPlot2d ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(std std ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SUITApp SUITApp ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(suit suit ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SVTK SVTK ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(ToolsGUI ToolsGUI ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(ViewerTools ViewerTools ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(ViewerData ViewerData ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(VTKViewer VTKViewer ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(vtkEDFOverloads vtkEDFOverloads ${GUI_ROOT_DIR}/lib/paraview)
+       FIND_LIBRARY(vtkTools vtkTools ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeGuiHelpers SalomeGuiHelpers ${GUI_ROOT_DIR}/lib/salome)
+       FIND_LIBRARY(SalomeTreeData SalomeTreeData ${GUI_ROOT_DIR}/lib/salome)
+
+       SET(SALOME_GUI_INCLUDE ${GUI_ROOT_DIR}/include/salome)
+       SET(SALOME_KERNEL_INCLUDE ${KERNEL_ROOT_DIR}/include/salome)
+       ADD_DEFINITIONS( -DHAVE_SALOME )
+ENDIF(EXISTS ${GUI_ROOT_DIR})
index b61b627094ba80b70ff55a7be3a27b81ec3a8ae6..f29f9a8ba61c9747cc9c805a61fd0535e4d4169e 100644 (file)
@@ -6,7 +6,9 @@ SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeCommon" ${CMAKE_MODULE_PATH})
 
 INCLUDE(Common)
 INCLUDE(FindQt)
+INCLUDE(FindBoost)
 INCLUDE(FindPython)
+INCLUDE(FindSalome)
 
 IF(UNIX)
     IF(CMAKE_COMPILER_IS_GNUCC)
@@ -19,7 +21,7 @@ ENDIF(UNIX)
 
 
 ADD_SUBDIRECTORY (src/Config)
-ADD_SUBDIRECTORY (src/Event)
+ADD_SUBDIRECTORY (src/Events)
 ADD_SUBDIRECTORY (src/Model)
 ADD_SUBDIRECTORY (src/ModelAPI)
 ADD_SUBDIRECTORY (src/GeomAPI)
@@ -34,3 +36,7 @@ ADD_SUBDIRECTORY (src/PyEvent)
 ADD_SUBDIRECTORY (src/PyInterp)
 ADD_SUBDIRECTORY (src/XGUI)
 ADD_SUBDIRECTORY (src/GeomApp)
+
+IF(${HAVE_SALOME})
+       ADD_SUBDIRECTORY (src/NewGeom)
+ENDIF(${HAVE_SALOME})
diff --git a/build_vc9_Salome_deb.bat b/build_vc9_Salome_deb.bat
new file mode 100644 (file)
index 0000000..cbf4e49
--- /dev/null
@@ -0,0 +1,19 @@
+@ECHO OFF
+
+REM Find absolute path to ROOT_DIR 
+@SET PARENT_DIR=%~dp0..
+@SET ROOT_DIR=
+pushd %PARENT_DIR%
+@SET ROOT_DIR=%CD%
+popd
+
+@SET SRC_DIR=%ROOT_DIR%\sources
+@SET OCC_LIB_PREFIX=d
+
+call %SRC_DIR%\msvc9_env_Salome.bat
+mkdir %ROOT_DIR%\build
+cd %ROOT_DIR%\build
+
+cmake %SRC_DIR% -G "Visual Studio 9 2008" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
+
+start "" %MSVC_EXE% NewGEOM.sln
index ac0173ad4150e08ad1089b103ba366cbe1a7195f..7717e8047d9d515e66827a98b2cb650e8085dc98 100644 (file)
@@ -121,7 +121,6 @@ set PATH=%CMAKEDIR%\bin;%PATH%
 @SET PATH=%PDIR%\swig-2.0.9\bin;%PATH%
 @REM -------------------------
 
-@REM -------------------------
 @REM BOOST
 @SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0
 @SET PATH=%BOOST_ROOT_DIR%\lib;%PATH%
@@ -130,6 +129,13 @@ set PATH=%CMAKEDIR%\bin;%PATH%
 @SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
 @SET PATH=%ROOT_DIR%\install\plugins;%PATH%
 
+@REM -------------------------
+if "%GUI_ROOT_DIR%" == "" (
+  @SET GUI_ROOT_DIR=%ROOT_DIR%\SALOME\GUI\DEBUG\GUI_INSTALL
+)
+@REM -------------------------
+
+
 rem -------- Visual Studio --------------------
 rem Detect Visual Studio (either commercial or Express edition)
 if "%VS100COMNTOOLS%" == "" (
diff --git a/msvc9_env_Salome.bat b/msvc9_env_Salome.bat
new file mode 100644 (file)
index 0000000..15317ad
--- /dev/null
@@ -0,0 +1,77 @@
+@echo off
+
+IF NOT EXIST "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" GOTO ERROR1
+
+@REM Load local settings from file localenv.bat that should be located in the root directory
+if "%ROOT_DIR%" == "" (
+  set ROOT_DIR=%~dp0..
+)
+
+if exist "%ROOT_DIR%\localenv.bat" (
+  echo Setting local environment from %ROOT_DIR%\localenv.bat
+  call "%ROOT_DIR%\localenv.bat"
+) else (
+  echo Warning: file %ROOT_DIR%\localenv.bat does not exist; using default environment
+)
+
+if "%SALOME_ROOT_DIR%" == "" (
+  set SALOME_ROOT_DIR=%ROOT_DIR%\SALOME
+)
+
+call "%SALOME_ROOT_DIR%\WORK\set_env.bat"
+call "%PDIR%\env_compile.bat"
+
+@REM -------------------------
+@REM Python
+@SET PYTHON_LIB_DIR=%PYTHON_ROOT_DIR%\libs
+@SET PYTHON_INC_DIR=%PYTHON_ROOT_DIR%\include
+@REM -------------------------
+
+@REM -------------------------
+@REM CASCADE
+@SET PATH=%CASROOT%;%CASROOT%\win32\bin%OCC_LIB_PREFIX%;%PATH%
+@SET LIB=%CASROOT%\win32\lib%OCC_LIB_PREFIX%;%LIB%
+@set CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT
+@set CSF_LANGUAGE=us
+@set MMGT_CLEAR=1
+@set CSF_EXCEPTION_PROMPT=1
+@set CSF_SHMessage=%CASROOT%\src\SHMessage
+@set CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures
+@set CSF_XSMessage=%CASROOT%\src\XSMessage
+@set CSF_StandardDefaults=%CASROOT%\src\StdResource
+@set CSF_PluginDefaults=%CASROOT%\src\StdResource
+@set CSF_XCAFDefaults=%CASROOT%\src\StdResource
+@set CSF_StandardLiteDefaults=%CASROOT%\src\StdResource
+@set CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat
+@set CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat
+@set CSF_IGESDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_STEPDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource
+@REM -------------------------
+
+@REM -------------------------
+@REM Create launch path
+@SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH%
+@SET PATH=%PDIR%\tbb\bin;%PATH%
+@SET PATH=%PDIR%\freeimage-3.15.4\bin;%PATH%
+@SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH%
+@SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH%
+@SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH%
+@SET PATH=%PDIR%\qwt-5.2.1\lib;%PATH%
+@REM -------------------------
+
+IF "%ARCH%" == "Win64" (
+  call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x64
+) ELSE (
+  IF "%ARCH%" == "Win32" (
+    call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x86
+  ) ELSE (
+    echo Wrong architecture is used. Win32 or Win64 architecture is allowed only.
+    echo Refer to the set_env.bat script.
+  )
+)
+
+@SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
+@SET PATH=%ROOT_DIR%\install\bin;%ROOT_DIR%\install\plugins;%PATH%
+
+@SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%GUI_ROOT_DIR%\share\salome\resources\gui
diff --git a/salomeRun.bat b/salomeRun.bat
new file mode 100644 (file)
index 0000000..3738b2f
--- /dev/null
@@ -0,0 +1,16 @@
+@ECHO OFF
+
+REM Find absolute path to ROOT_DIR 
+@SET PARENT_DIR=%~dp0..
+@SET ROOT_DIR=
+pushd %PARENT_DIR%
+@SET ROOT_DIR=%CD%
+popd
+
+@SET SRC_DIR=%ROOT_DIR%\sources
+@SET OCC_LIB_PREFIX=d
+
+call %SRC_DIR%\msvc9_env_Salome.bat
+
+
+SuitApp.exe LightApp -style salome --modules=NewGeom --uselicense --noexcepthandling
index 92aee7ca611efc77eface8cad5f13fa00012be14..a501bcfa7030116808ce7f2941952bb41e5d1802 100644 (file)
@@ -1,7 +1,7 @@
 INCLUDE(Common)
 INCLUDE(XMLProcessing)
 
-INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event) 
+INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events
 
 SET(PROJECT_HEADERS
   Config.h
@@ -30,7 +30,7 @@ SET(XML_RESOURCES
 )
 
 SET(PROJECT_LIBRARIES
-    Event
+    Events
     ${LIBXML2_LIBRARIES}
 )
 
index 209bb7aa2fef6119f383c7b4d26ca4b8ceea64ad..2da65741751e84095ff74d22cce605efb2b33baf 100644 (file)
@@ -3,8 +3,8 @@
  */
 #include "Config_FeatureMessage.h"
 
-Config_FeatureMessage::Config_FeatureMessage(const Event_ID theId, const void* theParent)
-    : Event_Message(theId, theParent)
+Config_FeatureMessage::Config_FeatureMessage(const Events_ID theId, const void* theParent)
+    : Events_Message(theId, theParent)
 {
   myId = "";
   myText = "";
index 900d547d3474239b9a8827a823c79aa6cc0b4867..a7928800a5e5dc36fe20c07f58943bb6030dc937 100644 (file)
@@ -2,7 +2,7 @@
 #define CONFIG_MESSAGE_H\r
 \r
 #include <Config.h>\r
-#include <Event_Message.h>\r
+#include <Events_Message.h>\r
 \r
 #include <string>\r
 \r
@@ -11,7 +11,7 @@
  * Example of the feature entry:\r
  * <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>\r
  */\r
-class Config_FeatureMessage: public Event_Message\r
+class Config_FeatureMessage: public Events_Message\r
 {\r
   std::string myId;  //Feature unique id\r
   std::string myText; //Represents action's text\r
@@ -26,8 +26,8 @@ class Config_FeatureMessage: public Event_Message
   bool myUseInput; //Action is being checked until user commit the operation\r
 \r
 public:\r
-  //const Event_ID theID, const void* theSender = 0\r
-  CONFIG_EXPORT Config_FeatureMessage(const Event_ID theId, const void* theParent = 0);\r
+  //const Events_ID theID, const void* theSender = 0\r
+  CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);\r
 \r
   //TODO(sbh): Implement static method to extract event id [SEID]\r
   //static const char* eventId() { return ""; }\r
@@ -56,4 +56,4 @@ public:
   CONFIG_EXPORT void setUseInput(bool isUseInput);\r
 };\r
 \r
-#endif // CONFIG_MESSAGE_H
+#endif // CONFIG_MESSAGE_H\r
index 1b574cfbac4fd3b4e8e125a91e83fcee577d2c2f..2fd10770ef396d5a8db5fe66eedcfba3955cc821 100644 (file)
@@ -9,8 +9,8 @@
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
 #include <Config_FeatureReader.h>
-#include <Event_Message.h>
-#include <Event_Loop.h>
+#include <Events_Message.h>
+#include <Events_Loop.h>
 
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -43,9 +43,9 @@ std::list<std::string> Config_FeatureReader::features() const
 
 void Config_FeatureReader::processNode(xmlNodePtr theNode)
 {
-  Event_ID aMenuItemEvent = Event_Loop::eventByName(myEventGenerated);
+  Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated);
   if (isNode(theNode, NODE_FEATURE, NULL)) {
-    Event_Loop* aEvLoop = Event_Loop::loop();
+    Events_Loop* aEvLoop = Events_Loop::loop();
     Config_FeatureMessage aMessage(aMenuItemEvent, this);
     fillFeature(theNode, aMessage);
     myFeatures.push_back(getProperty(theNode, _ID));
index cc4b353d5dbbf2f496767a1d4d10c101cc8c74cf..91e9d10f335d14df142ce0e6743aa8bbacaf7bac 100644 (file)
@@ -7,8 +7,8 @@
 
 #include <Config_PointerMessage.h>
 
-Config_PointerMessage::Config_PointerMessage(const Event_ID theId, const void* theParent)
-    : Event_Message(theId, theParent), myPointer(0)
+Config_PointerMessage::Config_PointerMessage(const Events_ID theId, const void* theParent)
+    : Events_Message(theId, theParent), myPointer(0)
 {
 
 }
index e0ac3e44094c5329969604194d2b4e869164f9c2..f108d3edeaa50bc7ad81f1071026fd6f5825484f 100644 (file)
@@ -9,15 +9,15 @@
 #define PARTSET_MESSAGE_H_
 
 #include <Config.h>
-#include <Event_Message.h>
+#include <Events_Message.h>
 
 /*
  * A general class to pass pointers over the event loop.
  */
-class CONFIG_EXPORT Config_PointerMessage: public Event_Message
+class CONFIG_EXPORT Config_PointerMessage: public Events_Message
 {
 public:
-  Config_PointerMessage(const Event_ID theId, const void* theParent = 0);
+  Config_PointerMessage(const Events_ID theId, const void* theParent = 0);
   virtual ~Config_PointerMessage();
 
   void* pointer() const;
index 0ac45babf63b02f277520d2e0e6e5802a6cc8542..e86579ede4618d8373d487497c83a4cdc106edab 100644 (file)
@@ -9,7 +9,7 @@
 #include <Config_Keywords.h>
 #include <Config_Common.h>
 
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
@@ -60,7 +60,7 @@ void Config_XMLReader::readAll()
 
 /*
  * Allows to customize reader's behavior for a node. Virtual.
- * The default implementation does nothing. (In debug mode prints
+ * The default impl does nothing. (In debug mode prints
  * some info)
  */
 void Config_XMLReader::processNode(xmlNodePtr theNode)
@@ -77,7 +77,7 @@ void Config_XMLReader::processNode(xmlNodePtr theNode)
 
 /*
  * Defines which nodes should be processed recursively. Virtual.
- * The default implementation is to read all nodes.
+ * The default impl is to read all nodes.
  */
 bool Config_XMLReader::processChildren(xmlNodePtr aNode)
 {
index c433491f9f5a0e9fffd7b4dd10e94f9636a2f745..5c1f39f2f8de2dfc5bc87f1df52371d2fbb9dff3 100644 (file)
@@ -14,11 +14,11 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
   ModelAPI_PluginManager::get()->registerPlugin(this);
 }
 
-shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
 {
   if (theFeatureID == "Point") {
-    return shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+    return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
   }
   // feature of such kind is not found
-  return shared_ptr<ModelAPI_Feature>();
+  return boost::shared_ptr<ModelAPI_Feature>();
 }
index 91875f362d130012bd6087e22971f10546f01b42..0201b40a36715f6cc468e03bc2eaed4e7706c1d4 100644 (file)
@@ -13,7 +13,7 @@ class CONSTRUCTIONPLUGIN_EXPORT ConstructionPlugin_Plugin: public ModelAPI_Plugi
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 
 public:
   /// Is needed for python wrapping by swig
diff --git a/src/Event/CMakeLists.txt b/src/Event/CMakeLists.txt
deleted file mode 100644 (file)
index 6319166..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-INCLUDE(Common)
-
-SET(PROJECT_HEADERS
-    Event.h
-    Event_Message.h
-    Event_Listener.h
-    Event_Loop.h
-)
-
-SET(PROJECT_SOURCES
-    Event_Message.cpp
-    Event_Listener.cpp
-    Event_Loop.cpp
-)
-
-ADD_DEFINITIONS(-DEVENT_EXPORTS)
-ADD_LIBRARY(Event SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
-
-TARGET_LINK_LIBRARIES(Event ${PROJECT_LIBRARIES})
-
-INSTALL(TARGETS Event DESTINATION bin)
diff --git a/src/Event/Event.h b/src/Event/Event.h
deleted file mode 100644 (file)
index d99cd00..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef EVENT_H
-#define EVENT_H
-
-#if defined EVENT_EXPORTS
-#if defined WIN32
-#define EVENT_EXPORT              __declspec( dllexport )
-#else
-#define EVENT_EXPORT
-#endif
-#else
-#if defined WIN32
-#define EVENT_EXPORT              __declspec( dllimport )
-#else
-#define EVENT_EXPORT
-#endif
-#endif
-
-#endif
diff --git a/src/Event/Event_Listener.cpp b/src/Event/Event_Listener.cpp
deleted file mode 100644 (file)
index ffb56c7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// File:       Event_Listener.cxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#include <Event_Listener.h>
diff --git a/src/Event/Event_Listener.h b/src/Event/Event_Listener.h
deleted file mode 100644 (file)
index c47d28d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// File:       Event_Listener.hxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#ifndef Event_Listener_HeaderFile
-#define Event_Listener_HeaderFile
-
-#include <Event.h>
-class Event_Message;
-
-/**\class Event_Listener
- * \ingroup EventLoop
- * \brief Base interface for any event listener.
- *
- * If some object wants to listen some events it must inherit
- * this class and register in the Loop.
- */
-class EVENT_EXPORT Event_Listener {
-
-public:
-  //! This method is called by loop when the event is started to process.
-  virtual void processEvent(const Event_Message* theMessage) = 0;
-};
-
-#endif
diff --git a/src/Event/Event_Loop.cpp b/src/Event/Event_Loop.cpp
deleted file mode 100644 (file)
index c938dbe..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// File:       Event_Loop.hxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#include <Event_Loop.h>
-
-#include <string>
-#include <cstring>
-
-using namespace std;
-
-Event_Loop* Event_Loop::loop()
-{
-  // initialized on initialization of the application
-  static Event_Loop MAIN_LOOP;
-  return &MAIN_LOOP;
-}
-
-Event_ID Event_Loop::eventByName(const char* theName)
-{
-  ///! All events created in this session, uniquely identified by the text and char pointer
-  static map<string, char*> CREATED_EVENTS;
-  char* aResult;
-  string aName(theName);
-  map<string, char*>::iterator aFound = CREATED_EVENTS.find(aName);
-  if (aFound == CREATED_EVENTS.end()) { //not created yet
-    aResult = strdup(theName); // copy to make unique internal pointer
-    CREATED_EVENTS[aName] = aResult;
-  } else
-    aResult = aFound->second;
-
-  return Event_ID(aResult);
-}
-
-void Event_Loop::send(Event_Message& theMessage)
-{
-  // TO DO: make it in thread and wit husage of semaphores
-
-  map<char*, map<void*, list<Event_Listener*> > >::iterator aFindID = myListeners.find(
-      theMessage.eventID().eventText());
-  if (aFindID != myListeners.end()) {
-    map<void*, list<Event_Listener*> >::iterator aFindSender = aFindID->second.find(
-        theMessage.sender());
-    if (aFindSender != aFindID->second.end()) {
-      list<Event_Listener*>& aListeners = aFindSender->second;
-      for(list<Event_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
-        (*aL)->processEvent(&theMessage);
-    }
-    if (theMessage.sender()) { // also call for NULL senders registered
-      aFindSender = aFindID->second.find(NULL);
-      if (aFindSender != aFindID->second.end()) {
-        list<Event_Listener*>& aListeners = aFindSender->second;
-        for(list<Event_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
-          (*aL)->processEvent(&theMessage);
-      }
-    }
-  }
-}
-
-void Event_Loop::registerListener(Event_Listener* theListener, const Event_ID theID,
-                                  void* theSender)
-{
-  map<char*, map<void*, list<Event_Listener*> > >::iterator aFindID = myListeners.find(
-      theID.eventText());
-  if (aFindID == myListeners.end()) { // create container associated with ID
-    myListeners[theID.eventText()] = map<void*, list<Event_Listener*> >();
-    aFindID = myListeners.find(theID.eventText());
-  }
-
-  map<void*, list<Event_Listener*> >::iterator aFindSender = aFindID->second.find(theSender);
-  if (aFindSender == aFindID->second.end()) { // create container associated with sender
-    aFindID->second[theSender] = list<Event_Listener*>();
-    aFindSender = aFindID->second.find(theSender);
-  }
-  // check that listener was not registered wit hsuch parameters before
-  list<Event_Listener*>& aListeners = aFindSender->second;
-  for(list<Event_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
-    if (*aL == theListener)
-      return; // avoid duplicates
-
-  aListeners.push_back(theListener);
-}
diff --git a/src/Event/Event_Loop.h b/src/Event/Event_Loop.h
deleted file mode 100644 (file)
index 60ddacd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// File:       Event_Loop.hxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#ifndef Event_Loop_HeaderFile
-#define Event_Loop_HeaderFile
-
-#include <Event_Message.h>
-#include <Event_Listener.h>
-
-#include <map>
-#include <list>
-
-/**\class Event_Lopp
- * \ingroup EventLoop
- * \brief Base class that manages the receiving and sending of all
- * not Qt-events in the application.
- *
- * One per application, initialized on start. Listeners must register in this loop
- * to get events, called by senders. Sending of events is very fast (just adding to container).
- * Performing of events is processed in separated thread, so, sender takes 
- * control back immideately.
- */
-class Event_Loop {
-  std::map<char*, std::map<void*, std::list<Event_Listener*> > >
-    myListeners; ///< map from event ID to sender pointer to listeners that must be called for this
-
-  //! The empty constructor, will be called at startup of the application, only once
-  Event_Loop() {};
-public:
-  ///! Returns the main object of the loop, one per application.
-  EVENT_EXPORT static Event_Loop* loop();
-  //! Returns the unique event by the given name. Call this method only on initialization of object
-  //! to speedup the events processing without parsing of the string.
-  EVENT_EXPORT static Event_ID eventByName(const char* theName);
-
-  //! Allows to send an event
-  EVENT_EXPORT void send(Event_Message& theMessage);
-
-  //! Registers (or adds if such listener is already registered) a listener 
-  //! that will be called on the event and from the defined sender
-  EVENT_EXPORT void registerListener(Event_Listener* theListener, const Event_ID theID, 
-    void* theSender = 0);
-};
-
-#endif
diff --git a/src/Event/Event_Message.cpp b/src/Event/Event_Message.cpp
deleted file mode 100644 (file)
index 764ed82..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-// File:       Event_Message.cxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#include <Event_Message.h>
diff --git a/src/Event/Event_Message.h b/src/Event/Event_Message.h
deleted file mode 100644 (file)
index 0c27020..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// File:       Event_Message.hxx
-// Created:    Thu Mar 13 2014
-// Author:     Mikhail PONIKAROV
-
-#ifndef Event_Message_HeaderFile
-#define Event_Message_HeaderFile
-
-#include <Event.h>
-
-/**\class Event_ID
- * \ingroup EventLoop
- * \brief Identifier of the event kind.
- *
- * Each event ID is created in main Envent_Loop class
- * that stores correspondance between the string-name of the
- * identifier and the pointer to the static string that is really
- * used as an identifier (this is usefull for debugging of the events
- * with log files and in debugger).
- */
-class EVENT_EXPORT Event_ID {
-  char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type
-
-  Event_ID(char* theID) {myID = theID;}
-
-  friend class Event_Loop;
-public:
-  /// Returns the text-identifier of the event (for debugging reasons)
-  char* eventText() const {return myID;}
-  /// Allows to compare identifiers
-  bool operator==(const Event_ID& theID) const {return myID == theID.myID;}
-};
-
-/**\class Event_Message
- * \ingroup EventLoop
- * \brief Message for communication between sender and listener of event.
- * Normally it is inherited by the higher-level 
- */
-class EVENT_EXPORT Event_Message {
-  Event_ID myEventId; ///< identifier of the event
-  void* mySender; ///< the sender object
-
-public:
-
-  //! Creates the message
-  Event_Message(const Event_ID theID, const void* theSender = 0)
-    : myEventId(theID), mySender((void*) theSender) {}
-  //! do nothing in the destructor yet
-  virtual ~Event_Message() {}
-
-  //! Returns identifier of the message
-  const Event_ID& eventID() const {return myEventId;}
-
-  //! Returns sender of the message or NULL if it is anonymous message
-  void* sender() const {return mySender;}
-};
-
-#endif
diff --git a/src/Events/CMakeLists.txt b/src/Events/CMakeLists.txt
new file mode 100644 (file)
index 0000000..08c3903
--- /dev/null
@@ -0,0 +1,21 @@
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+    Events.h
+    Events_Message.h
+    Events_Listener.h
+    Events_Loop.h
+)
+
+SET(PROJECT_SOURCES
+    Events_Message.cpp
+    Events_Listener.cpp
+    Events_Loop.cpp
+)
+
+ADD_DEFINITIONS(-DEVENTS_EXPORTS)
+ADD_LIBRARY(Events SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+
+TARGET_LINK_LIBRARIES(Events ${PROJECT_LIBRARIES})
+
+INSTALL(TARGETS Events DESTINATION bin)
diff --git a/src/Events/Events.h b/src/Events/Events.h
new file mode 100644 (file)
index 0000000..928056c
--- /dev/null
@@ -0,0 +1,18 @@
+#ifndef EVENTS_H
+#define EVENTS_H
+
+#if defined EVENTS_EXPORTS
+#if defined WIN32
+#define EVENTS_EXPORT              __declspec( dllexport )
+#else
+#define EVENTS_EXPORT
+#endif
+#else
+#if defined WIN32
+#define EVENTS_EXPORT              __declspec( dllimport )
+#else
+#define EVENTS_EXPORT
+#endif
+#endif
+
+#endif
diff --git a/src/Events/Events_Listener.cpp b/src/Events/Events_Listener.cpp
new file mode 100644 (file)
index 0000000..8a7720c
--- /dev/null
@@ -0,0 +1,5 @@
+// File:       Events_Listener.cxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#include <Events_Listener.h>
diff --git a/src/Events/Events_Listener.h b/src/Events/Events_Listener.h
new file mode 100644 (file)
index 0000000..2fdcb09
--- /dev/null
@@ -0,0 +1,25 @@
+// File:       Events_Listener.hxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#ifndef Events_Listener_HeaderFile
+#define Events_Listener_HeaderFile
+
+#include <Events.h>
+class Events_Message;
+
+/**\class Events_Listener
+ * \ingroup EventsLoop
+ * \brief Base interface for any event listener.
+ *
+ * If some object wants to listen some events it must inherit
+ * this class and register in the Loop.
+ */
+class EVENTS_EXPORT Events_Listener {
+
+public:
+  //! This method is called by loop when the event is started to process.
+  virtual void processEvent(const Events_Message* theMessage) = 0;
+};
+
+#endif
diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp
new file mode 100644 (file)
index 0000000..6c8bb47
--- /dev/null
@@ -0,0 +1,82 @@
+// File:       Events_Loop.hxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#include <Events_Loop.h>
+
+#include <string>
+#include <cstring>
+
+using namespace std;
+
+Events_Loop* Events_Loop::loop()
+{
+  // initialized on initialization of the application
+  static Events_Loop MAIN_LOOP;
+  return &MAIN_LOOP;
+}
+
+Events_ID Events_Loop::eventByName(const char* theName)
+{
+  ///! All events created in this session, uniquely identified by the text and char pointer
+  static map<string, char*> CREATED_EVENTS;
+  char* aResult;
+  string aName(theName);
+  map<string, char*>::iterator aFound = CREATED_EVENTS.find(aName);
+  if (aFound == CREATED_EVENTS.end()) { //not created yet
+    aResult = strdup(theName); // copy to make unique internal pointer
+    CREATED_EVENTS[aName] = aResult;
+  } else
+    aResult = aFound->second;
+
+  return Events_ID(aResult);
+}
+
+void Events_Loop::send(Events_Message& theMessage)
+{
+  // TO DO: make it in thread and wit husage of semaphores
+
+  map<char*, map<void*, list<Events_Listener*> > >::iterator aFindID = myListeners.find(
+      theMessage.eventID().eventText());
+  if (aFindID != myListeners.end()) {
+    map<void*, list<Events_Listener*> >::iterator aFindSender = aFindID->second.find(
+        theMessage.sender());
+    if (aFindSender != aFindID->second.end()) {
+      list<Events_Listener*>& aListeners = aFindSender->second;
+      for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+        (*aL)->processEvent(&theMessage);
+    }
+    if (theMessage.sender()) { // also call for NULL senders registered
+      aFindSender = aFindID->second.find(NULL);
+      if (aFindSender != aFindID->second.end()) {
+        list<Events_Listener*>& aListeners = aFindSender->second;
+        for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+          (*aL)->processEvent(&theMessage);
+      }
+    }
+  }
+}
+
+void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID theID,
+                                  void* theSender)
+{
+  map<char*, map<void*, list<Events_Listener*> > >::iterator aFindID = myListeners.find(
+      theID.eventText());
+  if (aFindID == myListeners.end()) { // create container associated with ID
+    myListeners[theID.eventText()] = map<void*, list<Events_Listener*> >();
+    aFindID = myListeners.find(theID.eventText());
+  }
+
+  map<void*, list<Events_Listener*> >::iterator aFindSender = aFindID->second.find(theSender);
+  if (aFindSender == aFindID->second.end()) { // create container associated with sender
+    aFindID->second[theSender] = list<Events_Listener*>();
+    aFindSender = aFindID->second.find(theSender);
+  }
+  // check that listener was not registered wit hsuch parameters before
+  list<Events_Listener*>& aListeners = aFindSender->second;
+  for(list<Events_Listener*>::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++)
+    if (*aL == theListener)
+      return; // avoid duplicates
+
+  aListeners.push_back(theListener);
+}
diff --git a/src/Events/Events_Loop.h b/src/Events/Events_Loop.h
new file mode 100644 (file)
index 0000000..893ecb1
--- /dev/null
@@ -0,0 +1,46 @@
+// File:       Events_Loop.hxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#ifndef Events_Loop_HeaderFile
+#define Events_Loop_HeaderFile
+
+#include <Events_Message.h>
+#include <Events_Listener.h>
+
+#include <map>
+#include <list>
+
+/**\class Events_Lopp
+ * \ingroup EventsLoop
+ * \brief Base class that manages the receiving and sending of all
+ * not Qt-events in the application.
+ *
+ * One per application, initialized on start. Listeners must register in this loop
+ * to get events, called by senders. Sending of events is very fast (just adding to container).
+ * Performing of events is processed in separated thread, so, sender takes 
+ * control back immideately.
+ */
+class Events_Loop {
+  std::map<char*, std::map<void*, std::list<Events_Listener*> > >
+    myListeners; ///< map from event ID to sender pointer to listeners that must be called for this
+
+  //! The empty constructor, will be called at startup of the application, only once
+  Events_Loop() {};
+public:
+  ///! Returns the main object of the loop, one per application.
+  EVENTS_EXPORT static Events_Loop* loop();
+  //! Returns the unique event by the given name. Call this method only on initialization of object
+  //! to speedup the events processing without parsing of the string.
+  EVENTS_EXPORT static Events_ID eventByName(const char* theName);
+
+  //! Allows to send an event
+  EVENTS_EXPORT void send(Events_Message& theMessage);
+
+  //! Registers (or adds if such listener is already registered) a listener 
+  //! that will be called on the event and from the defined sender
+  EVENTS_EXPORT void registerListener(Events_Listener* theListener, const Events_ID theID, 
+    void* theSender = 0);
+};
+
+#endif
diff --git a/src/Events/Events_Message.cpp b/src/Events/Events_Message.cpp
new file mode 100644 (file)
index 0000000..6de3839
--- /dev/null
@@ -0,0 +1,5 @@
+// File:       Events_Message.cxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#include <Events_Message.h>
diff --git a/src/Events/Events_Message.h b/src/Events/Events_Message.h
new file mode 100644 (file)
index 0000000..1d5a57d
--- /dev/null
@@ -0,0 +1,57 @@
+// File:       Events_Message.hxx
+// Created:    Thu Mar 13 2014
+// Author:     Mikhail PONIKAROV
+
+#ifndef Events_Message_HeaderFile
+#define Events_Message_HeaderFile
+
+#include <Events.h>
+
+/**\class Events_ID
+ * \ingroup EventsLoop
+ * \brief Identifier of the event kind.
+ *
+ * Each event ID is created in main Envent_Loop class
+ * that stores correspondance between the string-name of the
+ * identifier and the pointer to the static string that is really
+ * used as an identifier (this is usefull for debugging of the events
+ * with log files and in debugger).
+ */
+class EVENTS_EXPORT Events_ID {
+  char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type
+
+  Events_ID(char* theID) {myID = theID;}
+
+  friend class Events_Loop;
+public:
+  /// Returns the text-identifier of the event (for debugging reasons)
+  char* eventText() const {return myID;}
+  /// Allows to compare identifiers
+  bool operator==(const Events_ID& theID) const {return myID == theID.myID;}
+};
+
+/**\class Events_Message
+ * \ingroup EventsLoop
+ * \brief Message for communication between sender and listener of event.
+ * Normally it is inherited by the higher-level 
+ */
+class EVENTS_EXPORT Events_Message {
+  Events_ID myEventsId; ///< identifier of the event
+  void* mySender; ///< the sender object
+
+public:
+
+  //! Creates the message
+  Events_Message(const Events_ID theID, const void* theSender = 0)
+    : myEventsId(theID), mySender((void*) theSender) {}
+  //! do nothing in the destructor yet
+  virtual ~Events_Message() {}
+
+  //! Returns identifier of the message
+  const Events_ID& eventID() const {return myEventsId;}
+
+  //! Returns sender of the message or NULL if it is anonymous message
+  void* sender() const {return mySender;}
+};
+
+#endif
index 15162678616da2275f604cd114e5b2c174ecfe3d..c0c67230e5acef38e77d47571e39a9bc30fc9527 100644 (file)
@@ -9,6 +9,7 @@ SET(PROJECT_HEADERS
     GeomAPI_Interface.h
     GeomAPI_Pnt.h
     GeomAPI_Dir.h
+    GeomAPI_Pln.h
     GeomAPI_Shape.h
 )
 
@@ -16,6 +17,7 @@ SET(PROJECT_SOURCES
     GeomAPI_Interface.cpp
     GeomAPI_Pnt.cpp
     GeomAPI_Dir.cpp
+    GeomAPI_Pln.cpp
     GeomAPI_Shape.cpp
 )
 
index 717c7d264ad4ded423606aaa3888e3f0f0add158..67d8297f7baa307eb1c14caacba98ca43a264dd8 100644 (file)
@@ -1,10 +1,12 @@
 /* GeomAPI.i */
 %module GeomAPI
 %{
-  #include "memory"
+  #include "boost/shared_ptr.hpp"
   #include "GeomAPI.h"
   #include "GeomAPI_Interface.h"
   #include "GeomAPI_Pnt.h"
+  #include "GeomAPI_Dir.h"
+  #include "GeomAPI_Pln.h"
   #include "GeomAPI_Shape.h"
 %}
 
 // standard definitions
 %include "typemaps.i"
 %include "std_string.i"
-%include <std_shared_ptr.i>
+//%include <std_shared_ptr.i>
+%include <boost_shared_ptr.i>
 
 // boost pointers
 // %include <boost_shared_ptr.i>
 %shared_ptr(GeomAPI_Interface)
 %shared_ptr(GeomAPI_Pnt)
+%shared_ptr(GeomAPI_Dir)
+%shared_ptr(GeomAPI_Pln)
 %shared_ptr(GeomAPI_Shape)
 
 // all supported interfaces
 %include "GeomAPI_Interface.h"
 %include "GeomAPI_Pnt.h"
+%include "GeomAPI_Dir.h"
+%include "GeomAPI_Pln.h"
 %include "GeomAPI_Shape.h"
index 5e9b257fbb17a6436d864d3ce921126caf2b59e5..a583aa564cb499f9022c84ad94de9169f3d5da48 100644 (file)
@@ -20,12 +20,7 @@ GeomAPI_Interface::~GeomAPI_Interface()
     delete myImpl;
 }
 
-void* GeomAPI_Interface::implementation()
-{
-  return myImpl;
-}
-
-void GeomAPI_Interface::setImplementation(void* theImpl)
+void GeomAPI_Interface::setImpl(void* theImpl)
 {
   if (myImpl)
     delete myImpl;
index 1a605595bf5445069eb36a7c5a25e089337ea1b3..bd9a77ab13078880e6a961b4a9ab86df08e55900 100644 (file)
 class GEOMAPI_EXPORT GeomAPI_Interface
 {
 protected:
-  void* myImpl; ///< pointer to the internal implementation object
+  void* myImpl; ///< pointer to the internal impl object
 
 public:
   /// None - constructor
   GeomAPI_Interface();
 
-  /// Constructor by the implementation pointer (used for internal needs)
+  /// Constructor by the impl pointer (used for internal needs)
   GeomAPI_Interface(void* theImpl);
   
   /// Destructor
   virtual ~GeomAPI_Interface();
 
-  /// Returns the pointer to the implementation
-  void* implementation();
-  /// Updates the implementation (deletes the old one)
-  void setImplementation(void* theImpl);
+  /// Returns the pointer to the impl
+  template<class T> inline T* implPtr() {return dynamic_cast<T*>(myImpl);}
+  /// Returns the reference object of the impl
+  template<class T> inline const T& impl() {return *(static_cast<T*>(myImpl));}
+  /// Updates the impl (deletes the old one)
+  void setImpl(void* theImpl);
 };
 
 #endif
-
diff --git a/src/GeomAPI/GeomAPI_Pln.cpp b/src/GeomAPI/GeomAPI_Pln.cpp
new file mode 100644 (file)
index 0000000..d018031
--- /dev/null
@@ -0,0 +1,36 @@
+// File:        GeomAPI_Pln.cpp
+// Created:     23 Apr 2014
+// Author:      Mikhail PONIKAROV
+
+#include<GeomAPI_Pln.h>
+#include <GeomAPI_Pnt.h>
+#include <GeomAPI_Dir.h>
+
+#include<gp_Pln.hxx>
+
+using namespace std;
+
+GeomAPI_Pln::GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
+            const boost::shared_ptr<GeomAPI_Dir>& theNormal)
+: GeomAPI_Interface(new gp_Pln(thePoint->impl<gp_Pnt>(),
+                               theNormal->impl<gp_Dir>()))
+{
+}
+
+GeomAPI_Pln::GeomAPI_Pln(
+  const double theA, const double theB, const double theC, const double theD)
+: GeomAPI_Interface(new gp_Pln(theA, theB, theC, theD))
+{
+}
+
+boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pln::location()
+{
+  gp_Pnt aLoc = impl<gp_Pln>().Location();
+  return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+}
+
+boost::shared_ptr<GeomAPI_Dir> GeomAPI_Pln::direction()
+{
+  const gp_Dir& aDir = impl<gp_Pln>().Axis().Direction();
+  return boost::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+}
diff --git a/src/GeomAPI/GeomAPI_Pln.h b/src/GeomAPI/GeomAPI_Pln.h
new file mode 100644 (file)
index 0000000..0d02084
--- /dev/null
@@ -0,0 +1,37 @@
+// File:        GeomAPI_Pln.hxx
+// Created:     23 Apr 2014
+// Author:      Mikhail PONIKAROV
+
+#ifndef GeomAPI_Pln_HeaderFile
+#define GeomAPI_Pln_HeaderFile
+
+#include <boost/shared_ptr.hpp>
+#include <GeomAPI_Interface.h>
+
+class GeomAPI_Pnt;
+class GeomAPI_Dir;
+
+/**\class GeomAPI_Pln
+ * \ingroup DataModel
+ * \brief 3D point defined by three coordinates
+ */
+
+class GEOMAPI_EXPORT GeomAPI_Pln: public GeomAPI_Interface
+{
+public:
+  /// Creation of plane by the point and normal
+  GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
+              const boost::shared_ptr<GeomAPI_Dir>& theNormal);
+
+  /// Creation of plane by coefficients A * X + B * Y + C * Z + D = 0.0 
+  GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
+
+  /// Returns a point of this plane
+  boost::shared_ptr<GeomAPI_Pnt> location();
+
+  /// Returns a plane normal
+  boost::shared_ptr<GeomAPI_Dir> direction();
+};
+
+#endif
+
index 509d8ac2d1f190f1b71e85a7df9c1eb0926ad1b1..40fcc4633133283606b43216bde6fe9a7154b63e 100644 (file)
@@ -6,10 +6,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
 SET(PROJECT_HEADERS
     GeomAlgoAPI.h
+    GeomAlgoAPI_CompoundBuilder.h
     GeomAlgoAPI_FaceBuilder.h
 )
 
 SET(PROJECT_SOURCES
+    GeomAlgoAPI_CompoundBuilder.cpp
     GeomAlgoAPI_FaceBuilder.cpp
 )
 
index 4e71ea109728f3dea7bee048c14e60a7e8c88931..99a815f744a870d1b0d90f71dd916ad3b3d7f167 100644 (file)
@@ -12,7 +12,8 @@
 // standard definitions
 %include "typemaps.i"
 %include "std_string.i"
-%include <std_shared_ptr.i>
+//%include <std_shared_ptr.i>
+%include <boost_shared_ptr.i>
 
 // all supported interfaces
 %include "GeomAlgoAPI_FaceBuilder.h"
diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.cpp
new file mode 100644 (file)
index 0000000..2882ee2
--- /dev/null
@@ -0,0 +1,28 @@
+// File:        GeomAlgoAPI_CompoundBuilder.cpp
+// Created:     24 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#include <GeomAlgoAPI_CompoundBuilder.h>
+//#include <gp_Pln.hxx>
+//#include <BRepBuilderAPI_MakeFace.hxx>
+//#include <TopoDS_Face.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_CompoundBuilder::compound
+                            (std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes)
+{
+  BRep_Builder aBuilder;
+  TopoDS_Compound aComp;
+  aBuilder.MakeCompound(aComp);
+
+  std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = theShapes.begin(),
+                                                               aLast = theShapes.end();
+  for (; anIt != aLast; anIt++) {
+    aBuilder.Add(aComp, (*anIt)->impl<TopoDS_Shape>());
+  }
+
+  boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  aRes->setImpl(new TopoDS_Shape(aComp));
+  return aRes;
+}
diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h b/src/GeomAlgoAPI/GeomAlgoAPI_CompoundBuilder.h
new file mode 100644 (file)
index 0000000..5cca6ad
--- /dev/null
@@ -0,0 +1,30 @@
+// File:        GeomAlgoAPI_CompoundBuilder.h
+// Created:     24 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#ifndef GeomAlgoAPI_CompoundBuilder_HeaderFile
+#define GeomAlgoAPI_CompoundBuilder_HeaderFile
+
+#include <GeomAlgoAPI.h>
+#include <GeomAPI_Shape.h>
+#include <GeomAPI_Pnt.h>
+#include <GeomAPI_Dir.h>
+#include <boost/shared_ptr.hpp>
+
+#include <list>
+
+/**\class GeomAlgoAPI_CompoundBuilder
+ * \ingroup DataAlgo
+ * \brief Allows to create face-shapes by different parameters
+ */
+
+class GEOMALGOAPI_EXPORT GeomAlgoAPI_CompoundBuilder
+{
+public:
+  /// Creates compund of the given shapes
+  /// \param theShapes a list of shapes
+  static boost::shared_ptr<GeomAPI_Shape> compound
+                            (std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes);
+};
+
+#endif
index bec2c7f1bcfd72238d95337eced517ce9ff5903d..4b2ebc4d26b6adfd3ca7c27a2e31b08961348584 100644 (file)
@@ -7,17 +7,17 @@
 #include <BRepBuilderAPI_MakeFace.hxx>
 #include <TopoDS_Face.hxx>
 
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
-  std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
+boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
+  boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
   const double theSize)
 {
-  gp_Pnt* aCenter = static_cast<gp_Pnt*>(theCenter->implementation());
-  gp_Dir* aDir = static_cast<gp_Dir*>(theNormal->implementation());
-  gp_Pln aPlane(*aCenter, *aDir);
+  const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
+  const gp_Dir& aDir = theNormal->impl<gp_Dir>();
+  gp_Pln aPlane(aCenter, aDir);
   // half of the size in each direction from the center
   BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, 
     -theSize / 2., theSize / 2., -theSize / 2., theSize / 2.);
-  std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
-  aRes->setImplementation(new TopoDS_Shape(aFaceBuilder.Face()));
+  boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
   return aRes;
 }
index 15243f233099d9f5e41ee61dc5f608d39e15b386..61ebfaeb6139ae0a172f1ab2a6c2213b7a82953d 100644 (file)
@@ -9,7 +9,7 @@
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Dir.h>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 /**\class GeomAlgoAPI_FaceBuilder
  * \ingroup DataAlgo
@@ -21,8 +21,8 @@ class GEOMALGOAPI_EXPORT GeomAlgoAPI_FaceBuilder
 public:
   /// Creates square planar face by given point of the center,
   /// normal to the plane and size of square
-  static std::shared_ptr<GeomAPI_Shape> square(std::shared_ptr<GeomAPI_Pnt> theCenter,
-    std::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
+  static boost::shared_ptr<GeomAPI_Shape> square(boost::shared_ptr<GeomAPI_Pnt> theCenter,
+    boost::shared_ptr<GeomAPI_Dir> theNormal, const double theSize);
 };
 
 #endif
index abad9811b1fcf26e6572523c8576ffaf6e8efe7f..24bee85be889d3455ad8ed342b4e6271a187f057 100644 (file)
@@ -24,13 +24,13 @@ SET(PROJECT_SOURCES
     Model_Events.cpp
 )
 
-ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
+ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
 ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
-TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config)
+TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Events Config)
 
 INCLUDE_DIRECTORIES(
   ../ModelAPI
-  ../Event
+  ../Events
   ../Config
   ${CAS_INCLUDE_DIRS}
 )
index 40704967e8de9cef5e8a568dac24330bd0fc5f37..166b4e1a173f3812013eabdce23d4aec14c8f8f2 100644 (file)
@@ -19,12 +19,12 @@ Handle(Model_Application) Model_Application::getApplication()
 }
 
 //=======================================================================
-const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
 {
   if (myDocs.find(theDocID) != myDocs.end())
     return myDocs[theDocID];
 
-  std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
+  boost::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
   myDocs[theDocID] = aNew;
   return myDocs[theDocID];
 }
index 3865434796cad755f7869adb96677e18fb41d2f4..ddd3155bd0ed9e599b34ebca545df95da6eca10c 100644 (file)
@@ -30,7 +30,7 @@ public:
   //! Retuns the application: one per process    
   MODEL_EXPORT static Handle_Model_Application getApplication();
   //! Returns the main document (on first call creates it) by the string identifier
-  MODEL_EXPORT const std::shared_ptr<Model_Document>& getDocument(std::string theDocID);
+  MODEL_EXPORT const boost::shared_ptr<Model_Document>& getDocument(std::string theDocID);
   //! Returns true if document has been created
   MODEL_EXPORT bool hasDocument(std::string theDocID);
   //! Deletes the document from the application
@@ -50,7 +50,7 @@ public:
 
 private:
   /// Map from string identifiers to created documents of an application
-  std::map<std::string, std::shared_ptr<Model_Document> > myDocs;
+  std::map<std::string, boost::shared_ptr<Model_Document> > myDocs;
 };
 
 #endif
index 07712d0b6a568a12559ac8bd058abfd3680f3c4a..9df9c22190611371b1cd80357fc9de7b3de3fa14 100644 (file)
@@ -7,18 +7,18 @@
 
 using namespace std;
 
-void Model_AttributeDocRef::setValue(std::shared_ptr<ModelAPI_Document> theDoc)
+void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc)
 {
   myComment->Set(TCollection_ExtendedString(theDoc->id().c_str()));
 }
 
-std::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
+boost::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
 {
   if (myComment->Get().Length())
     return Model_Application::getApplication()->getDocument(
       TCollection_AsciiString(myComment->Get()).ToCString());
   // not initialized
-  return std::shared_ptr<ModelAPI_Document>();
+  return boost::shared_ptr<ModelAPI_Document>();
 }
 
 Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
index 778ed316bd0eceda4ef02932193287ca0b35bfb6..f3a3fcf899110239e308ce23c33abdb2098d7bc9 100644 (file)
@@ -20,10 +20,10 @@ class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
   Handle_TDataStd_Comment myComment; ///< reference to document is identified as string-id
 public:
   /// Defines the document referenced from this attribute
-  MODEL_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc);
+  MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc);
 
   /// Returns document referenced from this attribute
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> value();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value();
 
 protected:
   /// Initializes attibutes
index a9ac29bf05dc6d9303df6c33972a99b63a89fb58..87c7be8672fda2dfa7b0a6b7c95ad461598d2bbc 100644 (file)
@@ -41,35 +41,35 @@ void Model_Data::addAttribute(string theID, string theAttrType)
     anAttr = new Model_AttributeDouble(anAttrLab);
 
   if (anAttr)
-    myAttrs[theID] = std::shared_ptr<ModelAPI_Attribute>(anAttr);
+    myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
   else
     ; // TODO: generate error on unknown attribute request and/or add mechanism for customization
 }
 
-shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
+boost::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
 {
-  map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+  map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
   if (aFound == myAttrs.end()) {
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
-    return std::shared_ptr<ModelAPI_AttributeDocRef>();
+    return boost::shared_ptr<ModelAPI_AttributeDocRef>();
   }
-  shared_ptr<ModelAPI_AttributeDocRef> aRes = 
-    dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeDocRef> aRes = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
   return aRes;
 }
 
-shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
+boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
 {
-  map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+  map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
   if (aFound == myAttrs.end()) {
     // TODO: generate error on unknown attribute request and/or add mechanism for customization
-    return std::shared_ptr<ModelAPI_AttributeDouble>();
+    return boost::shared_ptr<ModelAPI_AttributeDouble>();
   }
-  shared_ptr<ModelAPI_AttributeDouble> aRes = 
-    dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
+  boost::shared_ptr<ModelAPI_AttributeDouble> aRes = 
+    boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
   if (!aRes) {
     // TODO: generate error on invalid attribute type request
   }
index d33819a8fb50ba6d8038e4ba6667b07e140440c1..5c3ffdf2ff66eb6105c92c829070792870712c36 100644 (file)
@@ -23,9 +23,9 @@ class Model_Data: public ModelAPI_Data
 {
   TDF_Label myLab; ///< label of the feature in the document
   /// All attributes of the object identified by the attribute ID
-  std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
+  std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> > myAttrs;
 
-  std::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
+  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
 
   Model_Data();
 
@@ -40,9 +40,9 @@ public:
   /// Defines the name of the feature visible by the user in the object browser
   MODEL_EXPORT virtual void setName(std::string theName);
   /// Returns the attribute that references to another document
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
   /// Returns the attribute that contains real value with double precision
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
 
   /// Initializes object by the attributes: must be called just after the object is created
   /// for each attribute of the object
@@ -51,13 +51,13 @@ public:
   MODEL_EXPORT virtual void addAttribute(std::string theID, std::string theAttrType);
 
   /// Returns the document of this data
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() {return myDoc;}
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> document() {return myDoc;}
 
   /// Puts feature to the document data sub-structure
   MODEL_EXPORT void setLabel(TDF_Label& theLab);
 
   /// Sets the document of this data
-  MODEL_EXPORT virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}
+  MODEL_EXPORT virtual void setDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}
 };
 
 #endif
index 22641f4b3d7665376060fb4f3221448119503efd..d33caaae8109707c31480b20d5ef28a1aa43813f 100644 (file)
@@ -9,7 +9,7 @@
 #include <Model_PluginManager.h>
 #include <Model_Iterator.h>
 #include <Model_Events.h>
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
@@ -206,25 +206,25 @@ void Model_Document::redo()
     subDocument(*aSubIter)->redo();
 }
 
-shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
 {
-  shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
+  boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
   if (aFeature) {
-    dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
+    boost::dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
   } else {
     // TODO: generate error that feature is not created
   }
   return aFeature;
 }
 
-void Model_Document::addFeature(const std::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   const std::string& aGroup = theFeature->getGroup();
   TDF_Label aGroupLab = groupLabel(aGroup);
   TDF_Label anObjLab = aGroupLab.NewChild();
-  std::shared_ptr<Model_Data> aData(new Model_Data);
+  boost::shared_ptr<Model_Data> aData(new Model_Data);
   aData->setLabel(anObjLab);
-  shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
   aData->setDocument(aThis);
   theFeature->setData(aData);
   setUniqueName(theFeature);
@@ -236,12 +236,12 @@ void Model_Document::addFeature(const std::shared_ptr<ModelAPI_Feature> theFeatu
   myFeatures[aGroup].push_back(theFeature);
 
   // event: feature is added
-  static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED);
+  static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED);
   ModelAPI_FeatureUpdatedMessage aMsg(aThis, theFeature, anEvent);
-  Event_Loop::loop()->send(aMsg);
+  Events_Loop::loop()->send(aMsg);
 }
 
-shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
 {
   Handle(TDataStd_Integer) aFeatureIndex;
   if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
@@ -251,15 +251,15 @@ shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
       return myFeatures[aGroup][aFeatureIndex->Get()];
     }
   }
-  return std::shared_ptr<ModelAPI_Feature>(); // not found
+  return boost::shared_ptr<ModelAPI_Feature>(); // not found
 }
 
-int Model_Document::featureIndex(shared_ptr<ModelAPI_Feature> theFeature)
+int Model_Document::featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   if (theFeature->data()->document().get() != this) {
     return theFeature->data()->document()->featureIndex(theFeature);
   }
-  shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>(theFeature->data());
+  boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
   Handle(TDataStd_Integer) aFeatureIndex;
   if (aData->label().FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
     return aFeatureIndex->Get();
@@ -267,7 +267,7 @@ int Model_Document::featureIndex(shared_ptr<ModelAPI_Feature> theFeature)
   return -1; // not found
 }
 
-shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
+boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
 {
   // just store sub-document identifier here to manage it later
   if (mySubs.find(theDocID) == mySubs.end())
@@ -275,22 +275,22 @@ shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
   return Model_Application::getApplication()->getDocument(theDocID);
 }
 
-shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
+boost::shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
 {
-  shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
+  boost::shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
   // create an empty iterator for not existing group 
   // (to avoidance of attributes management outside the transaction)
   if (myGroups.find(theGroup) == myGroups.end())
-    return shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
-  return shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
+    return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
+  return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
 }
 
-shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
 {
   // TODO: optimize this method
-  shared_ptr<ModelAPI_Iterator>  anIter = featuresIterator(theGroupID);
+  boost::shared_ptr<ModelAPI_Iterator>  anIter = featuresIterator(theGroupID);
   for(int a = 0; a != theIndex && anIter->more(); anIter->next()) a++;
-  return anIter->more() ? anIter->current() : shared_ptr<ModelAPI_Feature>();
+  return anIter->more() ? anIter->current() : boost::shared_ptr<ModelAPI_Feature>();
 }
 
 const vector<string>& Model_Document::getGroups() const
@@ -317,17 +317,16 @@ TDF_Label Model_Document::groupLabel(const string theGroup)
     myGroupsNames.push_back(theGroup);
     // set to the group label the group idntifier to restore on "open"
     TDataStd_Comment::Set(myGroups[theGroup], theGroup.c_str());
-    myFeatures[theGroup] = vector<shared_ptr<ModelAPI_Feature> >();
+    myFeatures[theGroup] = vector<boost::shared_ptr<ModelAPI_Feature> >();
   }
   return myGroups[theGroup];
 }
 
-void Model_Document::setUniqueName(
-  shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   // first count all objects of such kind to start with index = count + 1
   int aNumObjects = 0;
-  shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
+  boost::shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
   for(; anIter->more(); anIter->next()) {
     if (anIter->currentKind() == theFeature->getKind())
       aNumObjects++;
@@ -352,7 +351,7 @@ void Model_Document::setUniqueName(
 
 void Model_Document::synchronizeFeatures()
 {
-  shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+  boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
   // iterate groups labels
   TDF_ChildIDIterator aGroupsIter(myDoc->Main().FindChild(TAG_OBJECTS),
     TDataStd_Comment::GetID(), Standard_False);
@@ -372,7 +371,7 @@ void Model_Document::synchronizeFeatures()
     aGroupNamesIter = myGroupsNames.erase(aGroupNamesIter);
     // say that features were deleted from group
     ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName);
-    Event_Loop::loop()->send(aMsg);
+    Events_Loop::loop()->send(aMsg);
   }
   // create new groups basing on the following data model update
   for(; aGroupsIter.More(); aGroupsIter.Next()) {
@@ -380,7 +379,7 @@ void Model_Document::synchronizeFeatures()
       aGroupsIter.Value())->Get()).ToCString();
     myGroupsNames.push_back(aGroupName);
     myGroups[aGroupName] = aGroupsIter.Value()->Label();
-    myFeatures[aGroupName] = vector<shared_ptr<ModelAPI_Feature> >();
+    myFeatures[aGroupName] = vector<boost::shared_ptr<ModelAPI_Feature> >();
   }
   // update features group by group
   aGroupsIter.Initialize(myDoc->Main().FindChild(TAG_OBJECTS),
@@ -389,8 +388,8 @@ void Model_Document::synchronizeFeatures()
     string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
       aGroupsIter.Value())->Get()).ToCString();
     // iterate features in internal container
-    vector<shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
-    vector<shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
+    vector<boost::shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
+    vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
     // and in parallel iterate labels of features
     TDF_ChildIDIterator aFLabIter(
       aGroupsIter.Value()->Label(), TDataStd_Comment::GetID(), Standard_False);
@@ -398,7 +397,7 @@ void Model_Document::synchronizeFeatures()
       static const int INFINITE_TAG = INT_MAX; // no label means that it exists somwhere in infinite
       int aFeatureTag = INFINITE_TAG; 
       if (aFIter != aFeatures.end()) { // existing tag for feature
-        shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>((*aFIter)->data());
+        boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>((*aFIter)->data());
         aFeatureTag = aData->label().Tag();
       }
       int aDSTag = INFINITE_TAG; 
@@ -409,23 +408,23 @@ void Model_Document::synchronizeFeatures()
         aFIter = aFeatures.erase(aFIter);
         // event: model is updated
         ModelAPI_FeatureDeletedMessage aMsg(aThis, aGroupName);
-        Event_Loop::loop()->send(aMsg);
+        Events_Loop::loop()->send(aMsg);
       } else if (aDSTag < aFeatureTag) { // a new feature is inserted
         // create a feature
-        shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
+        boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
           TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
           aFLabIter.Value())->Get()).ToCString());
 
-        std::shared_ptr<Model_Data> aData(new Model_Data);
+        boost::shared_ptr<Model_Data> aData(new Model_Data);
         TDF_Label aLab = aFLabIter.Value()->Label();
         aData->setLabel(aLab);
         aData->setDocument(Model_Application::getApplication()->getDocument(myID));
         aFeature->setData(aData);
         aFeature->initAttributes();
         // event: model is updated
-        static Event_ID anEvent = Event_Loop::eventByName(EVENT_FEATURE_CREATED);
+        static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_CREATED);
         ModelAPI_FeatureUpdatedMessage aMsg(aThis, aFeature, anEvent);
-        Event_Loop::loop()->send(aMsg);
+        Events_Loop::loop()->send(aMsg);
 
         if (aFIter == aFeatures.end()) {
           aFeatures.push_back(aFeature);
index 3b2477c32a4f0d5ec5237f89cf0a73f84ed6de61..f98788c5ec8c3f802a5bde4228a8350ad7712c68 100644 (file)
@@ -61,23 +61,23 @@ public:
 
   //! Adds to the document the new feature of the given feature id
   //! \param creates feature and puts it in the document
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
 
   //! Returns the existing feature by the label
   //! \param theLabel base label of the feature
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> feature(TDF_Label& theLabel);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature(TDF_Label& theLabel);
 
   //! Adds a new sub-document by the identifier, or returns existing one if it is already exist
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
 
   //! Creates an iterator of the features by the specific groups
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Iterator> featuresIterator(
     const std::string theGroup);
 
   MODEL_EXPORT virtual const std::string& id() const {return myID;}
 
   //! Returns the feature in the group by the index (started from zero)
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> 
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> 
     feature(const std::string& theGroupID, const int theIndex);
 
   ///! Returns the vector of groups already added to the document
@@ -85,7 +85,7 @@ public:
 
   //! Returns the index of feature in the group (zero based)
   //! \retruns -1 if not found
-  MODEL_EXPORT virtual int featureIndex(std::shared_ptr<ModelAPI_Feature> theFeature);
+  MODEL_EXPORT virtual int featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature);
 
 protected:
 
@@ -94,10 +94,10 @@ protected:
 
   //! Initializes feature with a unique name in this group (unique name is generated as 
   //! feature type + "_" + index
-  void setUniqueName(std::shared_ptr<ModelAPI_Feature> theFeature);
+  void setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature);
 
   //! Adds to the document the new feature
-  void addFeature(const std::shared_ptr<ModelAPI_Feature> theFeature);
+  void addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature);
 
   //! Synchronizes myGroups, myGroupsNames, myFeatures and mySubs list with the updated document
   void synchronizeFeatures();
@@ -116,7 +116,7 @@ private:
   std::map<std::string, TDF_Label> myGroups;
   std::vector<std::string> myGroupsNames; ///< names of added groups to the document
   /// Features managed by this document: by group name
-  std::map<std::string, std::vector<std::shared_ptr<ModelAPI_Feature> > > myFeatures;
+  std::map<std::string, std::vector<boost::shared_ptr<ModelAPI_Feature> > > myFeatures;
   std::set<std::string> mySubs; ///< set of identifiers of sub-documents of this document
   /// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc
   std::map<int, bool> myIsEmptyTr;
index dc35573ebae8a405ab2eab7f77800ebcdb2d41f0..b71ecff50e068a2ab7d75775888446271c43ea6c 100644 (file)
@@ -3,23 +3,23 @@
 // Author:      Mikhail PONIKAROV
 
 #include <Model_Events.h>
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 
 ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage(
-  const std::shared_ptr<ModelAPI_Document>& theDoc,
-  const std::shared_ptr<ModelAPI_Feature>& theFeature, const Event_ID& theEvent)
-  : Event_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc)
+  const boost::shared_ptr<ModelAPI_Document>& theDoc,
+  const boost::shared_ptr<ModelAPI_Feature>& theFeature, const Events_ID& theEvent)
+  : Events_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc)
 {}
 
 ModelAPI_FeatureDeletedMessage::ModelAPI_FeatureDeletedMessage(
-  const std::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
-  : Event_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup)
+  const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+  : Events_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup)
 
 {
 }
 
-const Event_ID ModelAPI_FeatureDeletedMessage::messageId()
+const Events_ID ModelAPI_FeatureDeletedMessage::messageId()
 {
-  static Event_ID MY_ID = Event_Loop::eventByName(EVENT_FEATURE_DELETED);
+  static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED);
   return MY_ID;
 }
index c4af9f5279248d6423bec10de83b7d63eb638cfc..feda6ab0263a8ce85e458916ab77227e9c8956d0 100644 (file)
@@ -6,8 +6,8 @@
 #define Model_Events_HeaderFile
 
 #include <Model.h>
-#include <Event_Message.h>
-#include <memory>
+#include <Events_Message.h>
+#include <boost/shared_ptr.hpp>
 #include <string>
 
 class ModelAPI_Feature;
@@ -21,36 +21,36 @@ static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
 static const char * EVENT_FEATURE_DELETED = "FeatureDeleted";
 
 /// Message that feature was changed (used for Object Browser update)
-class ModelAPI_FeatureUpdatedMessage : public Event_Message {
-  std::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
-  std::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
+class ModelAPI_FeatureUpdatedMessage : public Events_Message {
+  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
+  boost::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
 public:
   /// sender is not important, all information is located in the feature
   ModelAPI_FeatureUpdatedMessage(
-    const std::shared_ptr<ModelAPI_Document>& theDoc,
-    const std::shared_ptr<ModelAPI_Feature>& theFeature,
-    const Event_ID& theEvent);
+    const boost::shared_ptr<ModelAPI_Document>& theDoc,
+    const boost::shared_ptr<ModelAPI_Feature>& theFeature,
+    const Events_ID& theEvent);
 
   /// Returns the feature that has been updated
-  std::shared_ptr<ModelAPI_Feature> feature() const {return myFeature;}
+  boost::shared_ptr<ModelAPI_Feature> feature() const {return myFeature;}
   /// Returns the document that has been updated
-  std::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+  boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
 };
 
 /// Message that feature was deleted (used for Object Browser update)
-class ModelAPI_FeatureDeletedMessage : public Event_Message {
-  std::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
+class ModelAPI_FeatureDeletedMessage : public Events_Message {
+  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
   std::string myGroup; ///< group identifier that contained the deleted feature
 public:
   /// creates a message by initialization of fields
-  ModelAPI_FeatureDeletedMessage(const std::shared_ptr<ModelAPI_Document>& theDoc,
+  ModelAPI_FeatureDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
     const std::string& theGroup);
 
   /// Returns the ID of this message (EVENT_FEATURE_DELETED)
-  static const Event_ID messageId();
+  static const Events_ID messageId();
 
   /// Returns the feature that has been updated
-  std::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+  boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
 
   /// Returns the group where the feature was deleted
   const std::string& group() const {return myGroup;}
index 001ebdff8146c3d2bab6e71cc80cbca487696fa2..ba59cdf75aadf63089514734eff3f0b5b9744928 100644 (file)
@@ -21,7 +21,7 @@ bool Model_Iterator::more()
   return myIter.More() == Standard_True;
 }
 
-shared_ptr<ModelAPI_Feature> Model_Iterator::current()
+boost::shared_ptr<ModelAPI_Feature> Model_Iterator::current()
 {
   TDF_Label aLab = myIter.Value()->Label();
   return myDoc->feature(aLab);
@@ -51,10 +51,10 @@ int Model_Iterator::numIterationsLeft()
   return aResult;
 }
 
-bool Model_Iterator::isEqual(std::shared_ptr<ModelAPI_Feature> theFeature)
+bool Model_Iterator::isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature)
 {
   return (myIter.Value()->Label() == 
-    dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
+    boost::dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
 
 }
 
@@ -62,6 +62,6 @@ Model_Iterator::Model_Iterator()
 {
 }
 
-Model_Iterator::Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
+Model_Iterator::Model_Iterator(boost::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
   : myDoc(theDoc), myIter(theLab, TDataStd_Comment::GetID(), Standard_False)
 {}
index 5d8c61baec0c7a8fbb413d1e6a414c04da3d0ecb..ff116605dee753c35d7c888e62b87cad63ab066b 100644 (file)
@@ -20,7 +20,7 @@ class Model_Document;
 
 class Model_Iterator : public ModelAPI_Iterator
 {
-  std::shared_ptr<Model_Document> myDoc; ///< the document of iterated objects
+  boost::shared_ptr<Model_Document> myDoc; ///< the document of iterated objects
   TDF_ChildIDIterator myIter; ///< iterator of the features-labels
 public:
   /// Iterates to the next feature
@@ -28,7 +28,7 @@ public:
   /// Returns true if the current iteration is valid and next iteration is possible
   MODEL_EXPORT virtual bool more();
   /// Returns the currently iterated feature
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> current();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> current();
   /// Returns the kind of the current feature (faster than Current()->getKind())
   MODEL_EXPORT virtual std::string currentKind();
   /// Returns the name of the current feature (faster than Current()->getName())
@@ -39,7 +39,7 @@ public:
 
   /// Compares the current feature with the given one
   /// \returns true if given feature equals to the current one
-  MODEL_EXPORT virtual bool isEqual(std::shared_ptr<ModelAPI_Feature> theFeature);
+  MODEL_EXPORT virtual bool isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature);
 
 protected:
   /// Creates an empty iterator that alway returns More false
@@ -47,7 +47,7 @@ protected:
   /// Initializes iterator
   /// \param theDoc document where the iteration is performed
   /// \param theLab label of the features group to iterate
-  Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab);
+  Model_Iterator(boost::shared_ptr<Model_Document> theDoc, TDF_Label theLab);
 
   friend class Model_Document;
 };
index cf18adc564e4b4e210b5c09075389f7e252507bc..e02847db4b22f3dc21727d07c1a093d679459516 100644 (file)
@@ -8,7 +8,7 @@
 #include <Model_Data.h>
 #include <Model_Document.h>
 #include <Model_Application.h>
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 #include <Config_FeatureMessage.h>
 #include <Config_ModuleReader.h>
 
@@ -16,30 +16,30 @@ using namespace std;
 
 static Model_PluginManager* myImpl = new Model_PluginManager();
 
-shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
 {
   if (this != myImpl) return myImpl->createFeature(theFeatureID);
 
   LoadPluginsInfo();
   if (myPlugins.find(theFeatureID) != myPlugins.end()) {
-    if (myPluginObjs.find(myPlugins[theFeatureID]) == myPluginObjs.end()) {
+    myCurrentPluginName = myPlugins[theFeatureID];
+    if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) {
       // load plugin library if not yet done
-      myCurrentPluginName = myPlugins[theFeatureID];
       loadLibrary(myCurrentPluginName);
     }
     if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
-      std::shared_ptr<ModelAPI_Feature> aCreated = 
+      boost::shared_ptr<ModelAPI_Feature> aCreated = 
         myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
       return aCreated;
     }
   }
 
-  return std::shared_ptr<ModelAPI_Feature>(); // return nothing
+  return boost::shared_ptr<ModelAPI_Feature>(); // return nothing
 }
 
-std::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
+boost::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
 {
-  return std::shared_ptr<ModelAPI_Document>(
+  return boost::shared_ptr<ModelAPI_Document>(
     Model_Application::getApplication()->getDocument("root"));
 }
 
@@ -48,14 +48,14 @@ bool Model_PluginManager::hasRootDocument()
   return Model_Application::getApplication()->hasDocument("root");
 }
 
-shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
+boost::shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
 {
   if (!myCurrentDoc)
     myCurrentDoc = rootDocument();
   return myCurrentDoc;
 }
 
-void Model_PluginManager::setCurrentDocument(shared_ptr<ModelAPI_Document> theDoc)
+void Model_PluginManager::setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc)
 {
   myCurrentDoc = theDoc;
 }
@@ -64,15 +64,15 @@ Model_PluginManager::Model_PluginManager()
 {
   myPluginsInfoLoaded = false;
   //TODO(sbh): Implement static method to extract event id [SEID]
-  static Event_ID aFeatureEvent = Event_Loop::eventByName("FeatureRegisterEvent");
+  static Events_ID aFeatureEvent = Events_Loop::eventByName("FeatureRegisterEvent");
 
-  ModelAPI_PluginManager::SetPluginManager(std::shared_ptr<ModelAPI_PluginManager>(this));
+  ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager>(this));
   // register the configuration reading listener
-  Event_Loop* aLoop = Event_Loop::loop();
+  Events_Loop* aLoop = Events_Loop::loop();
   aLoop->registerListener(this, aFeatureEvent);
 }
 
-void Model_PluginManager::processEvent(const Event_Message* theMessage)
+void Model_PluginManager::processEvent(const Events_Message* theMessage)
 {
   const Config_FeatureMessage* aMsg =
     dynamic_cast<const Config_FeatureMessage*>(theMessage);
index 8fc49bdf2c6e9ccb84c136360b34c33a91bd933b..7f405573fea644010a96dc6c53757e2be75b83af 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "Model.h"
 #include <ModelAPI_PluginManager.h>
-#include <Event_Listener.h>
+#include <Events_Listener.h>
 #include <map>
 
 class Model_Document;
@@ -18,26 +18,26 @@ class Model_Document;
  * plugin contains which feature, loads and stores reference to loaded plugins by
  * the feature functionality request.
  */
-class Model_PluginManager : public ModelAPI_PluginManager, public Event_Listener
+class Model_PluginManager : public ModelAPI_PluginManager, public Events_Listener
 {
   bool myPluginsInfoLoaded; ///< it true if plugins information is loaded
   /// map of feature IDs to plugin name
   std::map<std::string, std::string> myPlugins;
   std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
   std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
-  std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
+  boost::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
 public:
   /// Returns the root document of the application (that may contains sub-documents)
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> rootDocument();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> rootDocument();
 
   /// Return true if root document has been already created
   MODEL_EXPORT virtual bool hasRootDocument();
 
   /// Returns the current document that used for current work in the application
-  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> currentDocument();
+  MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> currentDocument();
 
   /// Defines the current document that used for current work in the application
-  MODEL_EXPORT virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc);
+  MODEL_EXPORT virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc);
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by 
@@ -45,7 +45,7 @@ public:
   MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin);
 
   /// Processes the configuration file reading
-  MODEL_EXPORT virtual void processEvent(const Event_Message* theMessage);
+  MODEL_EXPORT virtual void processEvent(const Events_Message* theMessage);
 
   /// Is called only once, on startup of the application
   Model_PluginManager();
@@ -55,7 +55,7 @@ protected:
   void LoadPluginsInfo();
 
   /// Creates the feature object using plugins functionality
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 };
 
 #endif
index c0bcc3221d3c186a51164f82070c41ebce399ece..19be24d4d21dd4e5ba1798ebf2b8178892fabdbc 100644 (file)
 // standard definitions
 %include "typemaps.i"
 %include "std_string.i"
-%include <std_shared_ptr.i>
+//%include <std_shared_ptr.i>
 
 // boost pointers
-// %include <boost_shared_ptr.i>
+%include <boost_shared_ptr.i>
 %shared_ptr(ModelAPI_Document)
 %shared_ptr(ModelAPI_PluginManager)
 %shared_ptr(ModelAPI_Feature)
index 9b0a6c2956a592f7d0c321d0a9ee5ae87dd6aa0f..473db7a44782e1784f28eb575a964bd61a2837e5 100644 (file)
@@ -17,10 +17,10 @@ class MODELAPI_EXPORT ModelAPI_AttributeDocRef : public ModelAPI_Attribute
 {
 public:
   /// Defines the document referenced from this attribute
-  virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
+  virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
 
   /// Returns document referenced from this attribute
-  virtual std::shared_ptr<ModelAPI_Document> value() = 0;
+  virtual boost::shared_ptr<ModelAPI_Document> value() = 0;
 
   /// Returns the type of this class of attributes
   static std::string type() {return "DocRef";}
index c8f006ea5a8a7258049dbe032119832a24bbe238..73fe3d7ded337819b4e5ca8dbfbb7aa69755ac32 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_AttributeDocRef;
 class ModelAPI_AttributeDouble;
@@ -30,9 +30,9 @@ public:
   virtual void setName(std::string theName) = 0;
 
   /// Returns the attribute that references to another document
-  virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
+  virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
   /// Returns the attribute that contains real value with double precision
-  virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+  virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
 
   /// Initializes object by the attributes: must be called just after the object is created
   /// for each attribute of the object
@@ -41,7 +41,7 @@ public:
   virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
 
   /// Returns the document of this data
-  virtual std::shared_ptr<ModelAPI_Document> document() = 0;
+  virtual boost::shared_ptr<ModelAPI_Document> document() = 0;
 
   /// To virtually destroy the fields of successors
   virtual ~ModelAPI_Data() {}
index 378915c639ee65d153e5b4ea76235348def95b70..efc85b2756a317c37849e096aa522b286b0749a2 100644 (file)
@@ -7,7 +7,7 @@
 
 #include <ModelAPI.h>
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 #include <vector>
 
 class ModelAPI_Feature;
@@ -68,24 +68,24 @@ public:
 
   //! Adds to the document the new feature of the given feature id
   //! \param creates feature and puts it in the document
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
 
   ///! Adds a new sub-document by the identifier, or returns existing one if it is already exist
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
 
   ///! Creates an iterator of the features by the specific groups
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Iterator> featuresIterator(
     const std::string theGroup) = 0;
 
   ///! Returns the id of hte document
   MODELAPI_EXPORT virtual const std::string& id() const = 0;
 
   //! Returns the feature in the group by the index (started from zero)
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature> 
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> 
     feature(const std::string& theGroupID, const int theIndex) = 0;
 
   //! Returns the index of feature in the group (zero based)
-  MODELAPI_EXPORT virtual int featureIndex(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+  MODELAPI_EXPORT virtual int featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
 
   ///! Returns the vector of groups already added to the document
   MODELAPI_EXPORT virtual const std::vector<std::string>& getGroups() const = 0;
index 7cb9256a08874c3c8e609625020ba2c5bcec78b3..8c1a82e75e2a3a22380065e42dab13463cba0662 100644 (file)
@@ -9,7 +9,7 @@
 #include "ModelAPI_PluginManager.h"
 
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_Data;
 class ModelAPI_Document;
@@ -21,7 +21,7 @@ class ModelAPI_Document;
  */
 class ModelAPI_Feature
 {
-  std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
+  boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
 
 public:
   /// Returns the kind of a feature (like "Point")
@@ -37,11 +37,11 @@ public:
   MODELAPI_EXPORT virtual void execute() = 0;
 
   /// Returns the data manager of this feature
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() {return myData;}
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Data> data() {return myData;}
 
   /// Must return document where the new feature must be added to
   /// By default it is current document
-  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd()
+  MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd()
   {return ModelAPI_PluginManager::get()->currentDocument();}
 
   /// To virtually destroy the fields of successors
@@ -54,7 +54,7 @@ protected:
   {}
 
   /// Sets the data manager of an object (document does)
-  MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
+  MODELAPI_EXPORT void setData(boost::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
   friend class Model_Document;
 };
 
index 8a128a59db5bc1e19536f06873aef01cd5ffada1..db4a5d1195cf037501cf87cb9381ae3a7e091e51 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_Feature;
 class ModelAPI_Document;
@@ -26,7 +26,7 @@ public:
   /// Returns true if the current iteration is valid and next iteration is possible
   virtual bool more() = 0;
   /// Returns the currently iterated feature
-  virtual std::shared_ptr<ModelAPI_Feature> current() = 0;
+  virtual boost::shared_ptr<ModelAPI_Feature> current() = 0;
   /// Returns the kind of the current feature (faster than Current()->getKind())
   virtual std::string currentKind() = 0;
   /// Returns the name of the current feature (faster than Current()->getName())
@@ -36,7 +36,7 @@ public:
   virtual int numIterationsLeft() = 0;
   /// Compares the current feature with the given one
   /// \returns true if given feature equals to the current one
-  virtual bool isEqual(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+  virtual bool isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
 
   /// To virtually destroy the fields of successors
   virtual ~ModelAPI_Iterator() {}
index fb084002ccf9aba58f93ab3326c6b6fba10e470e..fb65e0b142ecf3426cfd3094a94ac7b8b8b0f87e 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_Feature;
 
@@ -20,7 +20,7 @@ class MODELAPI_EXPORT ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
   /// To virtually destroy the fields of successors
   virtual ~ModelAPI_Plugin() {}
index f3e7e9b9d5f13b377247169f802d41162eed67bb..772ac8d9888b4ea4ac3893c5ca1e1c4cebf20d7c 100644 (file)
@@ -31,19 +31,19 @@ using namespace std;
 string library(const string& theLibName);
 
 /// Manager that will be initialized from Model package, one per application
-std::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
+boost::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
 
 ModelAPI_PluginManager::ModelAPI_PluginManager()
 {
 }
 
 void ModelAPI_PluginManager::SetPluginManager(
-  std::shared_ptr<ModelAPI_PluginManager> theManager)
+  boost::shared_ptr<ModelAPI_PluginManager> theManager)
 {
   MY_MANAGER = theManager;
 }
 
-std::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
+boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
 {
   if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
     loadLibrary("Model");
index 2b2f2fc277f002c79bc46b0d669a8ea86aeb3f41..ce89be8cb6eceff0cbe5c3086831b9917359fb86 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "ModelAPI.h"
 #include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class ModelAPI_Feature;
 class ModelAPI_Plugin;
@@ -24,7 +24,7 @@ class MODELAPI_EXPORT ModelAPI_PluginManager
 {
 public:
   /// Returns the real implementation (the alone instance per application) of the plugin manager
-  static std::shared_ptr<ModelAPI_PluginManager> get();
+  static boost::shared_ptr<ModelAPI_PluginManager> get();
 
   /// Registers the plugin that creates features.
   /// It is obligatory for each plugin to call this function on loading to be found by 
@@ -32,16 +32,16 @@ public:
   virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
 
   /// Returns the root document of the application (that may contains sub-documents)
-  virtual std::shared_ptr<ModelAPI_Document> rootDocument() = 0;
+  virtual boost::shared_ptr<ModelAPI_Document> rootDocument() = 0;
 
   /// Return true if root document has been already created
   virtual bool hasRootDocument() = 0;
 
   /// Returns the current document that used for current work in the application
-  virtual std::shared_ptr<ModelAPI_Document> currentDocument() = 0;
+  virtual boost::shared_ptr<ModelAPI_Document> currentDocument() = 0;
 
   /// Defines the current document that used for current work in the application
-  virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
+  virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
 
   /// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
   static void loadLibrary(const std::string theLibName);
@@ -54,9 +54,9 @@ public:
 
 protected:
   /// Creates the feature object using plugins functionality
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
 
-  static void SetPluginManager(std::shared_ptr<ModelAPI_PluginManager> theManager);
+  static void SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager);
 
   friend class Model_Document;
 };
index 3c052e4753a131cc4167540f49b7daa3c1e8a3af..76459c132203a50b7d311cc2f89c6a73d67885c3 100644 (file)
@@ -54,7 +54,7 @@ QString ModuleBase_Operation::operationId() const
   return myOperationId;
 }
 
-std::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::feature() const
+boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::feature() const
 {
   return myFeature;
 }
@@ -100,7 +100,7 @@ bool ModuleBase_Operation::isValid(ModuleBase_Operation*) const
  * \return Returns TRUE if current operation must not be checked for ActiveOperation->IsValid( this )
  *
  * This method must be redefined in derived operation if operation of derived class
- * must be always can start above any launched one. Default implementation returns FALSE,
+ * must be always can start above any launched one. Default impl returns FALSE,
  * so it is being checked for IsValid, but some operations may overload IsGranted()
  * In this case they will always start, no matter what operation is running.
  */
@@ -112,7 +112,7 @@ bool ModuleBase_Operation::isGranted() const
 /*
  * Returns pointer to the root document.
  */
-std::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
+boost::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
 {
   return ModelAPI_PluginManager::get()->rootDocument();
 }
@@ -259,8 +259,8 @@ void ModuleBase_Operation::storeReal(double theValue)
     return;
   }
   QString anId = sender()->objectName();
-  std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
-  std::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
+  boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+  boost::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
   aReal->setValue(theValue);
 }
 
@@ -268,7 +268,7 @@ void ModuleBase_Operation::storeReal(double theValue)
  * \brief Verifies whether operator is ready to start.
  * \return TRUE if operation is ready to start
  *
- * Default implementation returns TRUE. Redefine this method to add own verifications
+ * Default impl returns TRUE. Redefine this method to add own verifications
  */
 bool ModuleBase_Operation::isReadyToStart() const
 {
@@ -279,11 +279,11 @@ bool ModuleBase_Operation::isReadyToStart() const
  * \brief Virtual method called when operation is started
  *
  * Virtual method called when operation started (see start() method for more description)
- * Default implementation calls corresponding slot and commits immediately.
+ * Default impl calls corresponding slot and commits immediately.
  */
 void ModuleBase_Operation::startOperation()
 {
-  std::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
+  boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
   myFeature = aDoc->addFeature(myOperationId.toStdString());
   if (myFeature) // TODO: generate an error if feature was not created
     myFeature->execute();
index 6e109860b8ca56052459d678b1f66a92f08225d8..75724ea34e6e418524ebf2230986c3594fee9ac2 100644 (file)
@@ -14,7 +14,7 @@
 #include <QObject>
 #include <QString>
 
-#include <memory>
+#include <boost/shared_ptr.hpp>
 
 class SUIT_Study;
 class XGUI_Workshop;
@@ -76,7 +76,7 @@ public:
   // Operation processing.
   virtual QString operationId() const;
 
-  std::shared_ptr<ModelAPI_Feature> feature() const;
+  boost::shared_ptr<ModelAPI_Feature> feature() const;
 
   OperationState state() const;
   bool isRunning() const;
@@ -122,7 +122,7 @@ protected:
   void setExecStatus(const int);
   void setState(const OperationState);
 
-  std::shared_ptr<ModelAPI_Document> document() const;
+  boost::shared_ptr<ModelAPI_Document> document() const;
 
 private:
   int myFlags;               //!< Operation flags
@@ -131,7 +131,7 @@ private:
 
   //!< Next fields could be extracted into a subclass;
   QString myOperationId;
-  std::shared_ptr<ModelAPI_Feature> myFeature;
+  boost::shared_ptr<ModelAPI_Feature> myFeature;
 };
 
 #endif
index c6dc06814d25a8b2d10e6c040973a10179101016..29ced2bd3ae5d3ec045762ae5eccaf591e6f3eb4 100644 (file)
@@ -29,6 +29,15 @@ public:
   ModuleBase_PropPanelOperation(const QString& theId = "", QObject* parent = 0);
   virtual ~ModuleBase_PropPanelOperation();
 
+  /*!
+   * \brief Replied whether the operation should be commited after the start, or the operation itself
+   *  do that. The default realization provides the check by the operation having the xml prepresentation 
+   *  @return the boolean value
+   */
+  virtual bool isPerformedImmediately() const
+  {
+    return xmlRepresentation().isEmpty();
+  }
   /*!
    *  \brief Returns XML representation of the operation's widget.
    *  \return XML QString
diff --git a/src/NewGeom/CMakeLists.txt b/src/NewGeom/CMakeLists.txt
new file mode 100644 (file)
index 0000000..4d908a2
--- /dev/null
@@ -0,0 +1,54 @@
+
+INCLUDE(FindCAS)
+
+SET(CMAKE_AUTOMOC ON)
+
+SET(PROJECT_HEADERS
+       NewGeom.h
+       NewGeom_Module.h
+)
+
+SET(PROJECT_AUTOMOC 
+    ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp
+)
+
+SET(PROJECT_SOURCES
+       NewGeom_Module.cpp
+)
+
+SET(PROJECT_RESOURCES
+       resources/LightApp.xml
+       resources/newgeom.png
+)
+
+SET(PROJECT_LIBRARIES
+    Events
+    Config
+       XGUI
+       ${QT_LIBRARIES}
+       ${LightApp}
+       ${CAM}
+       ${OCCViewer}
+)
+
+ADD_DEFINITIONS( -DNewGeom_EXPORTS ${CAS_DEFINITIONS} )
+
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI
+                                       ${PROJECT_SOURCE_DIR}/src/Events
+                                       ${SALOME_GUI_INCLUDE}
+                                       ${SALOME_KERNEL_INCLUDE}
+                    ${CAS_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(NewGeom SHARED 
+       ${PROJECT_SOURCES} 
+       ${PROJECT_HEADERS} 
+)
+
+ADD_DEPENDENCIES(NewGeom XGUI)
+
+# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
+TARGET_LINK_LIBRARIES(NewGeom ${PROJECT_LIBRARIES})
+
+INSTALL(TARGETS NewGeom DESTINATION bin)
+INSTALL(FILES ${PROJECT_RESOURCES} DESTINATION share/salome/resources/newgeom )
\ No newline at end of file
diff --git a/src/NewGeom/NewGeom.h b/src/NewGeom/NewGeom.h
new file mode 100644 (file)
index 0000000..78f0f99
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef NewGeom_H
+#define NewGeom_H
+
+#if defined NewGeom_EXPORTS
+#if defined WIN32
+#define NewGeom_EXPORT     __declspec( dllexport )
+#else
+#define NewGeom_EXPORT
+#endif
+#else
+#if defined WIN32
+#define NewGeom_EXPORT     __declspec( dllimport )
+#else
+#define NewGeom_EXPORT
+#endif
+#endif
+
+#endif
+
+
+
diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp
new file mode 100644 (file)
index 0000000..4fe5e15
--- /dev/null
@@ -0,0 +1,44 @@
+
+
+#include "NewGeom_Module.h"
+
+#include <LightApp_Application.h>
+#include <OCCViewer_ViewModel.h>
+
+
+
+NewGeom_Module::NewGeom_Module()
+: LightApp_Module( "NewGeom" )
+{
+}
+
+
+NewGeom_Module::~NewGeom_Module()
+{
+}
+
+void NewGeom_Module::initialize(CAM_Application* theApp)
+{
+}
+
+void NewGeom_Module::windows(QMap<int, int>& theWndMap) const
+{
+  theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+}
+
+void NewGeom_Module::viewManagers(QStringList& theList) const
+{
+  theList.append( OCCViewer_Viewer::Type() );
+}
+
+bool NewGeom_Module::activateModule(SUIT_Study* theStudy)
+{
+  return LightApp_Module::activateModule(theStudy);
+}
+
+bool NewGeom_Module::deactivateModule(SUIT_Study* theStudy)
+{
+  return LightApp_Module::deactivateModule(theStudy);
+}
+
+
diff --git a/src/NewGeom/NewGeom_Module.h b/src/NewGeom/NewGeom_Module.h
new file mode 100644 (file)
index 0000000..bd6886e
--- /dev/null
@@ -0,0 +1,28 @@
+
+
+#ifndef NewGeom_Module_H
+#define NewGeom_Module_H
+
+#include "NewGeom.h"
+#include <LightApp_Module.h>
+
+class NewGeom_EXPORT NewGeom_Module: public LightApp_Module
+{
+  Q_OBJECT
+public:
+  NewGeom_Module();
+  virtual ~NewGeom_Module();
+
+  virtual void initialize( CAM_Application* theApp);
+  virtual void windows( QMap<int, int>& theWndMap) const;
+  virtual void viewManagers( QStringList& theList) const;
+
+public slots:
+  bool activateModule( SUIT_Study* theStudy);
+  bool deactivateModule( SUIT_Study* theStudy);
+
+private:
+
+};
+
+#endif
diff --git a/src/NewGeom/resources/LightApp.xml b/src/NewGeom/resources/LightApp.xml
new file mode 100644 (file)
index 0000000..db530bd
--- /dev/null
@@ -0,0 +1,31 @@
+<!--
+  Copyright (C) 2005-2013  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.
+
+  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
+
+-->
+<document>
+  <section name="NewGeom">
+    <!-- Major module parameters -->
+    <parameter name="name" value="NewGeom"/>
+    <parameter name="icon" value="newgeom.png"/>
+  </section>
+  <section name="resources">
+    <!-- Module resources -->
+    <parameter name="NewGeom" value="${NEWGEOM_ROOT_DIR}/share/salome/resources/newgeom"/>
+  </section>
+</document>
diff --git a/src/NewGeom/resources/newgeom.png b/src/NewGeom/resources/newgeom.png
new file mode 100644 (file)
index 0000000..d4827e2
Binary files /dev/null and b/src/NewGeom/resources/newgeom.png differ
index 1554472a2eef3d4f0a14f7d6a9154cc5504576ef..260da21aa23d88a18d2849ad6bcacbab6b84d112 100644 (file)
@@ -44,7 +44,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI 
                     ${CMAKE_SOURCE_DIR}/src/Config
-                    ${CMAKE_SOURCE_DIR}/src/Event
+                    ${CMAKE_SOURCE_DIR}/src/Events
                     ${CMAKE_SOURCE_DIR}/src/ModuleBase
                     ${CMAKE_SOURCE_DIR}/src/ModelAPI
                     ${CMAKE_SOURCE_DIR}/src/SketchPlugin
index bbdde0c198ea928a24a19b0d40d01551e41c28d3..46e0c44521b87a6b3c9d74441ea3fab211a2d80e 100644 (file)
@@ -5,12 +5,15 @@
 
 #include <XGUI_MainWindow.h>
 #include <XGUI_Displayer.h>
+#include <XGUI_Viewer.h>
+#include <XGUI_Workshop.h>
+#include <XGUI_OperationMgr.h>
 
 #include <Config_PointerMessage.h>
 #include <Config_ModuleReader.h>
 #include <Config_WidgetReader.h>
-#include <Event_Loop.h>
-#include <Event_Message.h>
+#include <Events_Loop.h>
+#include <Events_Message.h>
 
 #include <QObject>
 #include <QString>
@@ -29,6 +32,11 @@ extern "C" PARTSET_EXPORT XGUI_Module* createModule(XGUI_Workshop* theWshop)
 PartSet_Module::PartSet_Module(XGUI_Workshop* theWshop)
 {
   myWorkshop = theWshop;
+  XGUI_OperationMgr* anOperationMgr = myWorkshop->operationMgr();
+
+  connect(anOperationMgr, SIGNAL(operationStarted()), this, SLOT(onOperationStarted()));
+  connect(anOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
+          this, SLOT(onOperationStopped(ModuleBase_Operation*)));
 }
 
 PartSet_Module::~PartSet_Module()
@@ -71,23 +79,45 @@ void PartSet_Module::onFeatureTriggered()
   } else {
     aPartSetOp = new ModuleBase_PropPanelOperation(aCmdId, this);
   }
-  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(aPartSetOp);
-  if (aPreviewOp) {
-    connect(aPreviewOp, SIGNAL(visualizePreview()), this, SLOT(onVisualizePreview()));
-  }
   aPartSetOp->setXmlRepresentation(QString::fromStdString(aXmlCfg));
   aPartSetOp->setDescription(QString::fromStdString(aDescription));
 
   //TODO(sbh): Implement static method to extract event id [SEID]
-  static Event_ID aModuleEvent = Event_Loop::eventByName("PartSetModuleEvent");
+  static Events_ID aModuleEvent = Events_Loop::eventByName("PartSetModuleEvent");
   Config_PointerMessage aMessage(aModuleEvent, this);
   aMessage.setPointer(aPartSetOp);
-  Event_Loop::loop()->send(aMessage);
+  Events_Loop::loop()->send(aMessage);
 }
 
-void PartSet_Module::onVisualizePreview()
+void PartSet_Module::onOperationStarted()
 {
-  ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
+  ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
+
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+  if (aPreviewOp) {
+    connect(myWorkshop->mainWindow()->viewer(), SIGNAL(selectionChanged()),
+            aPreviewOp, SLOT(onViewSelectionChanged()));
+    visualizePreview(true);
+  }
+}
+
+void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
+{
+  ModuleBase_PropPanelOperation* anOperation = dynamic_cast<ModuleBase_PropPanelOperation*>(theOperation);
+  if (!anOperation)
+    return;
+
+  PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+  if (aPreviewOp) {
+    disconnect(myWorkshop->mainWindow()->viewer(), SIGNAL(selectionChanged()),
+               aPreviewOp, SLOT(onViewSelectionChanged()));
+    visualizePreview(false);
+  }
+}
+
+void PartSet_Module::visualizePreview(bool isDisplay)
+{
+  ModuleBase_Operation* anOperation = myWorkshop->operationMgr()->currentOperation();
   if (!anOperation)
     return;
 
@@ -95,5 +125,12 @@ void PartSet_Module::onVisualizePreview()
   if (!aPreviewOp)
     return;
 
-  myWorkshop->displayer()->Display(anOperation->feature(), aPreviewOp->preview());
+  if (isDisplay) {
+    myWorkshop->displayer()->LocalSelection(anOperation->feature(), aPreviewOp->preview(),
+                                            aPreviewOp->getSelectionMode());
+  }
+  else {
+    myWorkshop->displayer()->GlobalSelection(false);
+    myWorkshop->displayer()->Erase(anOperation->feature(), aPreviewOp->preview());
+  }
 }
index 7f8f9cea5df4360c39345a078137c29f322351f9..2a4a6c076b650b502616245694a9e4b46f0e17a2 100644 (file)
@@ -25,7 +25,17 @@ public:
 
 public slots:
   void onFeatureTriggered();
-  void onVisualizePreview();
+  /// SLOT, that is called after the operation is started. Perform some specific for module
+  /// actions, e.g. connect the sketch feature to the viewer selection and show the sketch preview.
+  void onOperationStarted();
+  /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature
+  /// from the viewer selection and show the sketch preview.
+  void onOperationStopped(ModuleBase_Operation* theOperation);
+
+private:
+  /// Displays or erase the current operation preview, if it has it.
+  /// \param isDisplay the state whether the presentation should be displayed or erased
+  void visualizePreview(bool isDisplay);
 
 private:
   XGUI_Workshop* myWorkshop;
index b5aa1874753ff6b137242c411307295eff1910a8..01010ee554d2580b9025f6a2f9ef3e03f553cc8d 100644 (file)
@@ -1,3 +1,7 @@
+// File:        PartSet_OperationSketch.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #include <PartSet_OperationSketch.h>
 
 #include <SketchPlugin_Feature.h>
@@ -14,9 +18,16 @@ PartSet_OperationSketch::PartSet_OperationSketch(const QString& theId,
 {
 }
 
-/*!
- * \brief Destructor
- */
 PartSet_OperationSketch::~PartSet_OperationSketch()
 {
 }
+
+bool PartSet_OperationSketch::isPerformedImmediately() const
+{
+  return false;
+}
+
+int PartSet_OperationSketch::getSelectionMode() const
+{
+  return TopAbs_FACE;
+}
index 99cacfbb68c7f2ff90ba8c661d40bcdd11fb5b25..ee8df257aa0485a14d60c756cd3bd779035cfe47 100644 (file)
@@ -1,3 +1,7 @@
+// File:        PartSet_OperationSketch.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #ifndef PartSet_OperationSketch_H
 #define PartSet_OperationSketch_H
 
 
 /*!
  \class PartSet_OperationSketch
- * \brief The operation for the sketch creation
- *
- *  Base class for all operations. If you perform an action it is reasonable to create
+ * \brief The operation for the sketch feature creation
 */
 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
 {
-Q_OBJECT
+  Q_OBJECT
 public:
+  /// Constructor
+  /// \param theId the feature identifier
+  /// \param theParent the operation parent
   PartSet_OperationSketch(const QString& theId, QObject* theParent);
+  /// Destructor
   virtual ~PartSet_OperationSketch();
+
+  /// The sketch can not be created immediately, firstly a plane should be set
+  virtual bool isPerformedImmediately() const;
+
+  /// Returns the operation local selection mode
+  /// \return the selection mode
+  virtual int getSelectionMode() const;
 };
 
 #endif
index 0201255b81cc0b51778e9a61f56c66e31f9c281d..ba3a626f277cbaf09184d6a579a879a52f826772 100644 (file)
@@ -1,3 +1,7 @@
+// File:        PartSet_OperationSketchBase.cpp
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #include <PartSet_OperationSketchBase.h>
 
 #include <SketchPlugin_Feature.h>
 
 using namespace std;
 
-/*!
- \brief Constructor
-  \param theId an feature index
-  \param theParent the object parent
- */
 PartSet_OperationSketchBase::PartSet_OperationSketchBase(const QString& theId,
                                                             QObject* theParent)
 : ModuleBase_PropPanelOperation(theId, theParent)
 {
 }
 
-/*!
- * \brief Destructor
- */
 PartSet_OperationSketchBase::~PartSet_OperationSketchBase()
 {
 }
 
-/**
- * Returns the feature preview shape
- */
 const TopoDS_Shape& PartSet_OperationSketchBase::preview() const
 {
-  shared_ptr<SketchPlugin_Feature> aFeature = dynamic_pointer_cast<SketchPlugin_Feature>(feature());
-  return *(static_cast<TopoDS_Shape*>(aFeature->preview()->implementation()));
+  boost::shared_ptr<SketchPlugin_Feature> aFeature = 
+    boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+  return aFeature->preview()->impl<TopoDS_Shape>();
 }
 
-/*!
- * Perform the operation start and emit signal about visualization of the operation preview
- */
-void PartSet_OperationSketchBase::startOperation()
+int PartSet_OperationSketchBase::getSelectionMode() const
 {
-  ModuleBase_PropPanelOperation::startOperation();
-
-  emit visualizePreview();
+  return 0;
 }
index ceb88026415606c8113319a9fc575c441f44e732..92500d786fb306f3b06f6c0a494565d6964f8384 100644 (file)
@@ -1,3 +1,7 @@
+// File:        PartSet_OperationSketchBase.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #ifndef PartSet_OperationSketchBase_H
 #define PartSet_OperationSketchBase_H
 
 #include <QObject>
 
 /*!
- \class PartSet_OperationSketchBase
- * \brief The base operation for the sketch features.
- *
- *  Base class for all sketch operations. It provides an access to the feature preview
+  \class PartSet_OperationSketchBase
+  * \brief The base operation for the sketch features.
+  *  Base class for all sketch operations. It provides an access to the feature preview
 */
 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_PropPanelOperation
 {
-Q_OBJECT
+  Q_OBJECT
 public:
+  /// Constructor
+  /// \param theId an feature index
+  /// \param theParent the object parent
   PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
+  /// Destructor
   virtual ~PartSet_OperationSketchBase();
 
+  /// Returns the feature preview shape
   const TopoDS_Shape& preview() const;
 
-signals:
-  void visualizePreview();
-
-protected:
-  virtual void startOperation();
+  /// Returns the operation local selection mode
+  /// \return the selection mode
+  virtual int getSelectionMode() const;
 };
 
 #endif
index 440eb6f2596322c2ed2f98a6e840a6115904db14..144411717f28f3fc8de381777c41e5a3bc97407d 100644 (file)
@@ -22,13 +22,13 @@ void PartSetPlugin_Part::initAttributes()
 
 void PartSetPlugin_Part::execute() 
 {
-  shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
+  boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
   if (!aDocRef->value()) { // create a document if not yet created
-    shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
+    boost::shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
     aDocRef->setValue(aPartSetDoc->subDocument(data()->getName()));
   }
 }
 
-shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
+boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
   return ModelAPI_PluginManager::get()->rootDocument();
 }
index f1ee4306421704bdbd9ddf2af2a055113f15e9b9..25af3bea7bb586245b7c1def4c684911e9630114 100644 (file)
@@ -32,7 +32,7 @@ public:
   /// Request for initialization of data model of the feature: adding all attributes
   PARTSETPLUGIN_EXPORT virtual void initAttributes();
 
-  PARTSETPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd();
+  PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
 
   /// Use plugin manager for features creation
   PartSetPlugin_Part();
index 7ef8f66e1e4d657f2a11e35d0108b5057535b8a6..85ea1c37eacf527337a523ae115b3684134ef227 100644 (file)
@@ -14,11 +14,11 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin()
   ModelAPI_PluginManager::get()->registerPlugin(this);
 }
 
-shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
 {
   if (theFeatureID == "Part") {
-    return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
+    return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
   }
   // feature of such kind is not found
-  return shared_ptr<ModelAPI_Feature>();
+  return boost::shared_ptr<ModelAPI_Feature>();
 }
index 74f6e73c02d90caa136d918152b0ce52d2f5c650..ff577f79a3adec8e2003a43ece502a805e536255 100644 (file)
@@ -13,7 +13,7 @@ class PARTSETPLUGIN_EXPORT PartSetPlugin_Plugin: public ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 
 public:
   /// Is needed for python wrapping by swig
index 27040b92d88233ed76e4bd3597fec416f546ca31..e7d9d292ac90e44937429ac44a5ea2fb23052938 100644 (file)
@@ -1,18 +1,11 @@
 #include "SketchPlugin_Feature.h"
 
-/**
- * Returns the sketch preview
- */
-const std::shared_ptr<GeomAPI_Shape>& SketchPlugin_Feature::preview()
+void SketchPlugin_Feature::setPreview(const boost::shared_ptr<GeomAPI_Shape>& theShape)
 {
-  return myPreview;
+  myPreview = theShape;
 }
 
-/**
- * Set the shape to the internal preview field
- * \param theShape a preview shape
- */
-void SketchPlugin_Feature::setPreview(const std::shared_ptr<GeomAPI_Shape>& theShape)
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Feature::getPreview() const
 {
-  myPreview = theShape;
+  return myPreview;
 }
index a440dbdfdd2a353e6f6c74530c5a990a277344da..2bb33c268c36be267526e0b38cfa6aca00640d30 100644 (file)
 
 /**\class SketchPlugin_Feature
  * \ingroup DataModel
- * \brief Feature for creation of the new part in PartSet.
+ * \brief Feature for creation of the new feature in PartSet. This is an abstract class to give
+ * an interface to create the sketch feature preview.
  */
 class SketchPlugin_Feature: public ModelAPI_Feature
 {
 public:
- SKETCHPLUGIN_EXPORT virtual const std::shared_ptr<GeomAPI_Shape>& preview() = 0;
+  /// Returns the sketch preview
+  /// \return the built preview
+  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview() = 0;
 
 protected:
-  void setPreview(const std::shared_ptr<GeomAPI_Shape>& theShape); ///< the preview shape
+  /// Set the shape to the internal preview field
+  /// \param theShape a preview shape
+  void setPreview(const boost::shared_ptr<GeomAPI_Shape>& theShape); ///< the preview shape
+  /// Return the shape from the internal preview field
+  /// \return theShape a preview shape
+  const boost::shared_ptr<GeomAPI_Shape>& getPreview() const;
 
 private:
-  std::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
+  boost::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
 };
 
 #endif
index 56f3b20e7f890f043aafb27e077d5bc4f8286744..1149409813a5645b6b24018d974e55aa79b3f29b 100644 (file)
@@ -14,14 +14,14 @@ SketchPlugin_Plugin::SketchPlugin_Plugin()
   ModelAPI_PluginManager::get()->registerPlugin(this);
 }
 
-shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
 {
   if (theFeatureID == "Sketch") {
-    return shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
+    return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
   }
   /*else if (theFeatureID == "Point") {
     return shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
   }*/
   // feature of such kind is not found
-  return shared_ptr<ModelAPI_Feature>();
+  return boost::shared_ptr<ModelAPI_Feature>();
 }
index 2b26663504d1a8668fbcef2cecde7f639205e3ac..f232b68fac26fdfdd6d38e824cae6f624aa520fb 100644 (file)
@@ -13,7 +13,7 @@ class SKETCHPLUGIN_EXPORT SketchPlugin_Plugin: public ModelAPI_Plugin
 {
 public:
   /// Creates the feature object of this plugin by the feature string ID
-  virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+  virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
 
 public:
   /// Is needed for python wrapping by swig
index 9a3624daf39295bae1573005d6092ae084019731..2eaa512c80813ea8adb60d0e405f91b6d29e419e 100644 (file)
@@ -5,6 +5,7 @@
 #include "SketchPlugin_Sketch.h"
 #include <ModelAPI_Data.h>
 #include <GeomAlgoAPI_FaceBuilder.h>
+#include <GeomAlgoAPI_CompoundBuilder.h>
 
 using namespace std;
 
@@ -24,16 +25,25 @@ void SketchPlugin_Sketch::execute()
 {
 }
 
-const shared_ptr<GeomAPI_Shape>& SketchPlugin_Sketch::preview()
+const boost::shared_ptr<GeomAPI_Shape>& SketchPlugin_Sketch::preview()
 {
-  if (!SketchPlugin_Feature::preview())
-  {
-
-    shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
-    shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(1, 0, 0));
-    shared_ptr<GeomAPI_Shape> aFace = 
-      GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
-    setPreview(aFace);
-  }
-  return SketchPlugin_Feature::preview();
+  std::list<boost::shared_ptr<GeomAPI_Shape> > aFaces;
+
+  addPlane(1, 0, 0, aFaces); // YZ plane
+  addPlane(0, 1, 0, aFaces); // XZ plane
+  addPlane(0, 0, 1, aFaces); // XY plane
+  boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
+  setPreview(aCompound);
+
+  return getPreview();
+}
+
+void SketchPlugin_Sketch::addPlane(double theX, double theY, double theZ,
+                                   std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const
+{
+  boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
+  boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
+  boost::shared_ptr<GeomAPI_Shape> aFace = 
+    GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal, PLANE_SIZE);
+  theShapes.push_back(aFace);
 }
index e261df1a8625dc9c275c17af60b3aac5fb3e1a00..ed936bde999554a599a9a99dfd9994c3d98ec7f0 100644 (file)
@@ -8,6 +8,8 @@
 #include "SketchPlugin.h"
 #include <SketchPlugin_Feature.h>
 
+#include <list>
+
 /// part reference attribute
 const std::string PART_ATTR_DOC_REF = "SketchDocument";
 
@@ -33,10 +35,19 @@ public:
  SKETCHPLUGIN_EXPORT virtual void initAttributes();
 
   /// Returns the sketch preview
-  SKETCHPLUGIN_EXPORT virtual const std::shared_ptr<GeomAPI_Shape>& preview();
+  SKETCHPLUGIN_EXPORT virtual const boost::shared_ptr<GeomAPI_Shape>& preview();
 
   /// Use plugin manager for features creation
   SketchPlugin_Sketch();
+protected:
+  /// Creates a plane and append it to the list
+  /// \param theX the X normal value
+  /// \param theY the Y normal value
+  /// \param theZ the Z normal value
+  /// \param theShapes the list of result shapes
+  void addPlane(double theX, double theY, double theZ,
+                std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const;
+
 };
 
 #endif
index 30949838013fffa5d394850023ac14e976158a47..a246e4060ebcd25ac868fb9babc49dabc0fc7bcd 100644 (file)
@@ -9,6 +9,7 @@ SET(PROJECT_HEADERS
        XGUI_MainMenu.h
        XGUI_MainWindow.h
        XGUI_MenuGroupPanel.h
+       XGUI_Module.h
        XGUI_Tools.h
        XGUI_Workbench.h
        XGUI_Workshop.h
@@ -22,6 +23,7 @@ SET(PROJECT_HEADERS
        XGUI_DocumentDataModel.h
        XGUI_PartDataModel.h
        XGUI_ObjectsBrowser.h
+       XGUI_OperationMgr.h
     XGUI_DataTreeModel.h
     XGUI_SelectionMgr.h
     XGUI_SwitchWidget.h
@@ -49,6 +51,7 @@ SET(PROJECT_SOURCES
        XGUI_DocumentDataModel.cpp
        XGUI_PartDataModel.cpp
        XGUI_ObjectsBrowser.cpp
+       XGUI_OperationMgr.cpp
     XGUI_SelectionMgr.cpp
     XGUI_SwitchWidget.cpp
 )
@@ -62,7 +65,7 @@ SET(PROJECT_RESOURCES
 #)
 
 SET(PROJECT_LIBRARIES
-    Event
+    Events
     Config
        ${QT_LIBRARIES}
        ${CAS_VIEWER}
@@ -89,7 +92,7 @@ SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
 
 ADD_DEFINITIONS( -DXGUI_EXPORTS ${CAS_DEFINITIONS} )
 
-INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event
+INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events
                                         ${PROJECT_SOURCE_DIR}/src/Config
                                         ${PROJECT_SOURCE_DIR}/src/PyInterp
                                         ${PROJECT_SOURCE_DIR}/src/PyConsole
index f523c3ed8c2bca38370c1a8cbd8afeafdd73c3df..f228e092e9daf37a54bd9bcd4d213d970a74b155 100644 (file)
@@ -12,7 +12,7 @@ typedef QList<short> QShortList;     //!< list of short int values
 typedef QList<double> QDoubleList;    //!< list of double values
 
 //! Pointer on feature object
-typedef std::shared_ptr<ModelAPI_Feature> FeaturePtr;
+typedef boost::shared_ptr<ModelAPI_Feature> FeaturePtr;
 typedef QList<FeaturePtr> QFeatureList; //!< List of features
 
 namespace XGUI
index c602d02c10a26db4bce4dec559d4f4f49f480a95..676c9d8fdf98e249441ae195287e952f57e4d033 100644 (file)
@@ -15,7 +15,7 @@
 class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
 {
 public:
-  XGUI_FeaturesModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
+  XGUI_FeaturesModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
       QAbstractItemModel(theParent), myDocument(theDocument) {}
 
   //! Returns Feature object by the given Model index.
@@ -23,13 +23,13 @@ public:
   virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
+  virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
 
 protected:
-  std::shared_ptr<ModelAPI_Document> myDocument;
+  boost::shared_ptr<ModelAPI_Document> myDocument;
 };
 
 
@@ -40,13 +40,13 @@ protected:
 class XGUI_PartModel : public XGUI_FeaturesModel
 {
 public:
-  XGUI_PartModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
+  XGUI_PartModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
       XGUI_FeaturesModel(theDocument, theParent) {}
 
   void setPartId(int theId) { myId = theId; }
 
   //! Returns true if the given document is a sub-document of this tree
-  virtual bool hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
+  virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
 
 protected:
   //! Id of the current part object in the document
index 1df32917011497fda656630e3987b3b61bd6ef6f..a036e8f7503f43064338e915fdbdcf9720503a93 100644 (file)
@@ -1,47 +1,67 @@
+// File:        XGUI_Displayer.cpp
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #include "XGUI_Displayer.h"
-#include "XGUI_Tools.h"
 #include "XGUI_Viewer.h"
 
 #include <ModelAPI_Document.h>
 
 #include <AIS_InteractiveContext.hxx>
+#include <AIS_ListOfInteractive.hxx>
+
 #include <AIS_Shape.hxx>
 
-/*!
- \brief Constructor
- */
 XGUI_Displayer::XGUI_Displayer(XGUI_Viewer* theViewer)
 : myViewer(theViewer)
 {
 }
 
-/*!
- \brief Destructor
- */
 XGUI_Displayer::~XGUI_Displayer()
 {
 }
 
-/*!
- * Display the feature
- * \param theFeature a feature instance
- */
-void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature)
+void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                             const bool isUpdateViewer)
 {
 }
 
-/*!
- * Display the feature and a shape. This shape would be associated to the given feature
- * \param theFeature a feature instance
- * \param theFeature a shape
- */
-void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature,
-                             const TopoDS_Shape& theShape)
+void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                             const TopoDS_Shape& theShape, const bool isUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
 
   Handle(AIS_Shape) anAIS = new AIS_Shape(theShape);
   aContext->Display(anAIS, Standard_False);
 
-  aContext->UpdateCurrentViewer();
+  if (isUpdateViewer)
+    aContext->UpdateCurrentViewer();
 }
+
+void XGUI_Displayer::Erase(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                           const TopoDS_Shape& theShape, const bool isUpdateViewer)
+{
+  Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
+  aContext->EraseAll();
+  if (isUpdateViewer)
+    aContext->UpdateCurrentViewer();
+}
+
+void XGUI_Displayer::LocalSelection(boost::shared_ptr<ModelAPI_Feature> theFeature,
+                                    const TopoDS_Shape& theShape,
+                                    const int theMode, const bool isUpdateViewer)
+{
+  Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
+
+  Handle(AIS_Shape) anAIS = new AIS_Shape(theShape);
+  aContext->Display(anAIS, Standard_False);
+  AIS_ListOfInteractive anAISList;
+  anAISList.Append(anAIS);
+  myViewer->setLocalSelection(anAISList, theMode, true);
+}
+
+void XGUI_Displayer::GlobalSelection(const bool isUpdateViewer)
+{
+  myViewer->setGlobalSelection(true);
+}
+
index cf5dbbbd9c177150d15029a1e9f5639ddee97648..1dc238b906be7046c02f67a4ae8552df01562110 100644 (file)
@@ -1,9 +1,14 @@
+// File:        XGUI_Displayer.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
 #ifndef XGUI_Displayer_H
 #define XGUI_Displayer_H
 
 #include "XGUI.h"
 
 #include <QString>
+#include <boost/shared_ptr.hpp>
 
 #include <TopoDS_Shape.hxx>
 
@@ -12,20 +17,50 @@ class ModelAPI_Feature;
 
 /**\class XGUI_Displayer
  * \ingroup GUI
- * \brief Displayer. Provides mechanizm of displa/erase of objects in viewer
+ * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
  */
 class XGUI_EXPORT XGUI_Displayer
 {
 public:
+  /// Constructor
+  /// \param theViewer the viewer
   XGUI_Displayer(XGUI_Viewer* theViewer);
+  /// Destructor
   virtual ~XGUI_Displayer();
 
-  void Display(std::shared_ptr<ModelAPI_Feature> theFeature);
+  /// Display the feature. Obtain the visualized object from the feature.
+  /// \param theFeature a feature instance
+  /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const bool isUpdateViewer = true);
+
+  /// Display the feature and a shape. This shape would be associated to the given feature
+  /// \param theFeature a feature instance
+  /// \param theShape a shape
+  /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
+               const bool isUpdateViewer = true);
+  
+  /// Display the shape and activate selection of sub-shapes
+  /// \param theFeature a feature instance
+  /// \param theShape a shape
+  /// \param theMode a local selection mode
+  /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  void LocalSelection(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
+                      const int theMode, const bool isUpdateViewer = true);
+
+  /// Erase the feature and a shape.
+  /// \param theFeature a feature instance
+  /// \param theFeature a shape
+  /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  void Erase(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape,
+             const bool isUpdateViewer = true);
 
-  void Display(std::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
+  /// Deactivates selection of sub-shapes
+  /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+  void GlobalSelection(const bool isUpdateViewer = true);
 
 protected:
-  XGUI_Viewer* myViewer; ///< the viewer
+  XGUI_Viewer* myViewer; ///< the viewer where the objects should be visualized
 };
 
 #endif
index 9ccc7f643901885c2ec076a5274d3bd6f5e52deb..50ea7c707b4e5dde0904308e794153c3e7bcb75d 100644 (file)
@@ -8,7 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <Model_Events.h>
 
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 
 
 #include <QIcon>
@@ -19,13 +19,13 @@ XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
   : QAbstractItemModel(theParent)
 {
   // Find Document object
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
   myDocument = aMgr->currentDocument();
 
   // Register in event loop
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_CREATED));
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_UPDATED));
-  Event_Loop::loop()->registerListener(this, Event_Loop::eventByName(EVENT_FEATURE_DELETED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_CREATED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+  Events_Loop::loop()->registerListener(this, Events_Loop::eventByName(EVENT_FEATURE_DELETED));
 
   // Create a top part of data tree model
   myModel = new XGUI_TopDataModel(myDocument, this);
@@ -38,13 +38,13 @@ XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
 }
 
 
-void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage)
+void XGUI_DocumentDataModel::processEvent(const Events_Message* theMessage)
 {
   // Created object event *******************
   if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_CREATED) {
     const ModelAPI_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
-    std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
-    std::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
+    boost::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
+    boost::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
 
     if (aDoc == myDocument) {  // If root objects
       if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
@@ -80,7 +80,7 @@ void XGUI_DocumentDataModel::processEvent(const Event_Message* theMessage)
   // Deteted object event ***********************
   } else if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_DELETED) {
     const ModelAPI_FeatureDeletedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureDeletedMessage*>(theMessage);
-    std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
+    boost::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
 
     if (aDoc == myDocument) {  // If root objects
       if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
index ba7558e0ede450c7800faec333cfb91897d9e17c..80d69f3b69b2bb4225589dde9c64487d15dc52da 100644 (file)
@@ -6,7 +6,7 @@
 #include "XGUI_Constants.h"
 
 #include <QAbstractItemModel>
-#include <Event_Listener.h>
+#include <Events_Listener.h>
 
 #include <QList>
 
@@ -19,7 +19,7 @@ class XGUI_TopDataModel;
  * \brief This is a proxy data model for Object Browser (QTreeView).
  * It contains several sub-models for generation of each sub-part of data tree.
  */
-class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Event_Listener
+class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Events_Listener
 {
   Q_OBJECT
 public:
@@ -29,7 +29,7 @@ public:
   virtual ~XGUI_DocumentDataModel();
 
   // Event Listener method
-  virtual void processEvent(const Event_Message* theMessage);
+  virtual void processEvent(const Events_Message* theMessage);
 
 
   virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
@@ -74,7 +74,7 @@ private:
   bool hasSubModel(const QAbstractItemModel* theModel) const;
 
   //! Document
-  std::shared_ptr<ModelAPI_Document> myDocument;
+  boost::shared_ptr<ModelAPI_Document> myDocument;
 
   //! Data model of top part of data tree (not parts object)
   XGUI_TopDataModel* myModel;
index 374e057eac601e58a43c6fed73001c402d79aa68..347cc061a6c485ac53ff1117fae152679d5bbd46 100644 (file)
@@ -22,4 +22,4 @@ typedef XGUI_Module* (*CREATE_FUNC)(XGUI_Workshop*);
 \r
 #define CREATE_MODULE "createModule"\r
 \r
-#endif //XGUI_Module\r
\ No newline at end of file
+#endif //XGUI_Module\r
diff --git a/src/XGUI/XGUI_OperationMgr.cpp b/src/XGUI/XGUI_OperationMgr.cpp
new file mode 100644 (file)
index 0000000..aeb0ed3
--- /dev/null
@@ -0,0 +1,82 @@
+// File:        XGUI_OperationMgr.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#include "XGUI_OperationMgr.h"
+
+#include "ModuleBase_Operation.h"
+
+#include <QMessageBox>
+
+XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent)
+: QObject(theParent)
+{
+}
+
+XGUI_OperationMgr::~XGUI_OperationMgr()
+{
+}
+
+ModuleBase_Operation* XGUI_OperationMgr::currentOperation() const
+{
+  return myOperations.count() > 0 ? myOperations.last() : 0;
+}
+
+bool XGUI_OperationMgr::startOperation(ModuleBase_Operation* theOperation)
+{
+  if (!canStartOperation(theOperation))
+    return false;
+
+  myOperations.append(theOperation);
+
+  connect(theOperation, SIGNAL(stopped()), this, SLOT(onOperationStopped()));
+  connect(theOperation, SIGNAL(started()), this, SIGNAL(operationStarted()));
+
+  theOperation->start();
+  return true;
+}
+
+bool XGUI_OperationMgr::canStartOperation(ModuleBase_Operation* theOperation)
+{
+  bool aCanStart = true;
+  ModuleBase_Operation* aCurrentOp = currentOperation();
+  if (aCurrentOp && !theOperation->isGranted())
+  {
+    int anAnswer = QMessageBox::question(0, tr("Operation launch"),
+                                tr("Previous operation is not finished and will be aborted"),
+                                QMessageBox::Ok, QMessageBox::Cancel);
+    if (anAnswer == QMessageBox::Ok)
+      aCurrentOp->abort();
+    else
+      aCanStart = false;
+  }
+  return aCanStart;
+}
+
+void XGUI_OperationMgr::onOperationStopped()
+{
+  ModuleBase_Operation* aSenderOperation = dynamic_cast<ModuleBase_Operation*>(sender());
+  ModuleBase_Operation* anOperation = currentOperation();
+  if (!aSenderOperation || !anOperation || aSenderOperation != anOperation )
+    return;
+
+  emit operationStopped(anOperation);
+
+  myOperations.removeAll(anOperation);
+  anOperation->deleteLater();
+
+  // get last operation which can be resumed
+  ModuleBase_Operation* aResultOp = 0;
+  QListIterator<ModuleBase_Operation*> anIt(myOperations);
+  anIt.toBack();
+  while(anIt.hasPrevious())
+  {
+    ModuleBase_Operation* anOp = anIt.previous();
+    if (anOp) {
+      aResultOp = anOp;
+      break;
+    }
+  }
+  if (aResultOp)
+    startOperation(aResultOp);
+}
diff --git a/src/XGUI/XGUI_OperationMgr.h b/src/XGUI/XGUI_OperationMgr.h
new file mode 100644 (file)
index 0000000..ef06d7d
--- /dev/null
@@ -0,0 +1,65 @@
+// File:        XGUI_OperationMgr.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#ifndef XGUI_OperationMgr_H
+#define XGUI_OperationMgr_H
+
+#include "XGUI.h"
+
+#include <ModuleBase_Operation.h>
+
+#include <QList>
+#include <QObject>
+
+/**\class XGUI_OperationMgr
+ * \ingroup GUI
+ * \brief Operation manager. Servers to manupulate to the workshop operations. Contains a stack
+ * of started operations. In simple case, if only one operration is started, the stack contains
+ * one operation. It is possible for some kind of operations to start them above already
+ * started one. In that case, the previous active operation becames suspended, a new one - active.
+ * The new operation is added to the top of the stack. Then it is finished, it is removed from
+ * the stack and the previous operation is activated.
+ */
+class XGUI_EXPORT XGUI_OperationMgr : public QObject
+{
+  Q_OBJECT
+public:
+  /// Constructor
+  /// \param theParent the parent
+  XGUI_OperationMgr(QObject* theParent);
+  /// Destructor
+  virtual ~XGUI_OperationMgr();
+
+  /// Returns the current operation or NULL
+  /// \return the current operation
+  ModuleBase_Operation* currentOperation() const;
+  /// Sets the current operation or NULL
+  /// \return the current operation
+  bool startOperation(ModuleBase_Operation* theOperation);
+
+signals:
+  /// Signal about an operation is started. It is emitted after the start() of operation is done.
+  void operationStarted();
+  /// Signal about an operation is stopped. It is emitted after the stop() of operation is done.
+  /// \param theOperation a stopped operation
+  void operationStopped(ModuleBase_Operation* theOperation);
+
+protected:
+  /// Returns whether the operation can be started. Check if there is already started operation and
+  /// the granted parameter of the launched operation
+  /// \param theOperation an operation to check
+  bool canStartOperation(ModuleBase_Operation* theOperation);
+
+protected slots:
+  /// Slot that is called by an operation stop. Removes the stopped operation form the stack.
+  /// If there is a suspended operation, restart it.
+  void onOperationStopped();
+
+private:
+  typedef QList<ModuleBase_Operation*> Operations; ///< definition for a list of operations
+  Operations myOperations; ///< a stack of started operations. The active operation is on top,
+                           // others are suspended and started by the active is finished
+};
+
+#endif
index 127c3478f83b339946447f9506afa2adf9f28b6d..ba5bbbea33ddeb56b71e88afd3bc741fe9ec67ff 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <QIcon>
 
-XGUI_TopDataModel::XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_TopDataModel::XGUI_TopDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
   : XGUI_FeaturesModel(theDocument, theParent)
 {
 }
@@ -29,7 +29,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
       return tr("Parameters");
     case ParamObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       } 
@@ -37,7 +37,7 @@ QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
         return tr("Constructions");
     case ConstructObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
@@ -141,7 +141,7 @@ FeaturePtr XGUI_TopDataModel::feature(const QModelIndex& theIndex) const
 }
 
 
-QModelIndex XGUI_TopDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_TopDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
 {
   QString aGroup(theFeature->getGroup().c_str());
 
@@ -165,7 +165,7 @@ QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
 //******************************************************************
 //******************************************************************
 //******************************************************************
-XGUI_PartDataModel::XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_PartDataModel::XGUI_PartDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
   : XGUI_PartModel(theDocument, theParent)
 {
 }
@@ -183,7 +183,7 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
     switch (theIndex.internalId()) {
     case MyRoot:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+        boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
@@ -193,14 +193,14 @@ QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) cons
       return tr("Constructions");
     case ParamObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = 
+        boost::shared_ptr<ModelAPI_Feature> aFeature = 
           featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
       }
     case ConstructObject:
       {
-        std::shared_ptr<ModelAPI_Feature> aFeature = 
+        boost::shared_ptr<ModelAPI_Feature> aFeature = 
           featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
         if (aFeature)
           return aFeature->data()->getName().c_str();
@@ -299,9 +299,9 @@ bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const
 }
 
 
-std::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
+boost::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
 {
-  std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+  boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
   return aFeature->data()->docRef("PartDocument")->value();
 }
 
@@ -321,13 +321,13 @@ FeaturePtr XGUI_PartDataModel::feature(const QModelIndex& theIndex) const
   return FeaturePtr();
 }
 
-bool XGUI_PartDataModel::hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const
+bool XGUI_PartDataModel::hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const
 {
   return (featureDocument() == theDoc);
 }
 
 
-QModelIndex XGUI_PartDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_PartDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
 {
   QString aGroup(theFeature->getGroup().c_str());
 
index 15c863519bb69f76eed5b8bf05ad4c7277ca3df0..e1f0246ef732636aa0f825c1c16ab6539a685c40 100644 (file)
@@ -14,10 +14,10 @@ class XGUI_EXPORT XGUI_TopDataModel : public XGUI_FeaturesModel
 {
   Q_OBJECT
 public:
-  XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
+  XGUI_TopDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
   virtual ~XGUI_TopDataModel();
 
-  // Reimplementation from QAbstractItemModel
+  // Reimpl from QAbstractItemModel
   virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
   virtual QVariant headerData(int section, Qt::Orientation orientation,
                               int role = Qt::DisplayRole) const;
@@ -37,7 +37,7 @@ public:
   virtual FeaturePtr feature(const QModelIndex& theIndex) const;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
+  virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const;
@@ -63,10 +63,10 @@ class XGUI_PartDataModel : public XGUI_PartModel
 {
   Q_OBJECT
 public:
-  XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
+  XGUI_PartDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
   virtual ~XGUI_PartDataModel();
 
-  // Reimplementation from QAbstractItemModel
+  // Reimpl from QAbstractItemModel
   virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
   virtual QVariant headerData(int section, Qt::Orientation orientation,
                               int role = Qt::DisplayRole) const;
@@ -86,16 +86,16 @@ public:
   virtual FeaturePtr feature(const QModelIndex& theIndex) const;
 
   //! Returns true if the given document is a sub-document of this tree
-  virtual bool hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const;
+  virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const;
 
   //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
+  virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
 
   //! Returns index corresponded to the group
   virtual QModelIndex findGroup(const std::string& theGroup) const;
 
 private: 
-  std::shared_ptr<ModelAPI_Document> featureDocument() const;
+  boost::shared_ptr<ModelAPI_Document> featureDocument() const;
 
   //! Types of QModelIndexes
   enum DataIds {
index 510fb1b4062b2776e50862ecd83e4f812ef8044f..6421d278b62bcd816a9999d6ae99cc485ea1196c 100644 (file)
@@ -34,8 +34,8 @@ void XGUI_SelectionMgr::onSelectionChanged()
   if (mySelectedData.size() > 0) {
     FeaturePtr aFeature = mySelectedData.first();
 
-    std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-    std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+    boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+    boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
     if (aDocRef)
       aMgr->setCurrentDocument(aDocRef->value());
   }
index 6d4c100681cd3677f60761ca556c521ef5172601..c78bd72d1bfa7fa6d065fb90bfe2d148682c6880 100644 (file)
@@ -19,6 +19,8 @@
 #include <V3d_View.hxx>
 #include <Visual3d_View.hxx>
 #include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <AIS_Shape.hxx>
 
 #include <QMouseEvent>
 
@@ -188,6 +190,47 @@ QMdiSubWindow* XGUI_Viewer::createView(V3d_TypeOfView theType)
   return aWnd;
 }
 
+void XGUI_Viewer::setLocalSelection(const AIS_ListOfInteractive& theAISObjects, const int theMode,
+                                    const bool isUpdateViewer)
+{
+  Handle(AIS_InteractiveContext) ic = AISContext();
+
+  // Open local context if there is no one
+  bool allObjects = false; // calculate by AIS shape
+  if (!ic->HasOpenedContext()) {
+    ic->ClearCurrents(false);
+    ic->OpenLocalContext(allObjects, true, true);
+  }
+
+  // Activate selection of objects from prs
+  AIS_ListIteratorOfListOfInteractive aIter(theAISObjects);
+  for (; aIter.More(); aIter.Next()) {
+    Handle(AIS_InteractiveObject) anAIS = aIter.Value();
+    if (!anAIS.IsNull()) {
+      if (anAIS->IsKind(STANDARD_TYPE(AIS_Shape))) {
+        ic->Load(anAIS, -1, false);
+        ic->Activate(anAIS, AIS_Shape::SelectionMode((TopAbs_ShapeEnum)theMode));
+      }
+      else if (anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron)) {
+        ic->Load(anAIS, -1, false);
+        ic->Activate(anAIS, theMode);
+      }
+    }
+  }
+  if (isUpdateViewer)
+    ic->UpdateCurrentViewer();
+}
+
+void XGUI_Viewer::setGlobalSelection(const bool isUpdateViewer)
+{
+  Handle(AIS_InteractiveContext) ic = AISContext();
+  if (!ic.IsNull()) {
+    ic->CloseAllContexts(false);
+    if (isUpdateViewer)
+      ic->UpdateCurrentViewer();
+  }
+}
+
 /*! Sets hot button
  *\param theOper - hot operation
  *\param theState - adding state to state map operations.
index 5b68ebdf0b9a47e516d0ea7d28973311a6f9742d..3e33be3ae6a802a191814013328b5bf2e41b7771 100644 (file)
@@ -18,6 +18,8 @@ class XGUI_ViewWindow;
 class QMouseEvent;
 class QKeyEvent;
 
+class AIS_ListOfInteractive;
+
 /**\class XGUI_Viewer
  * \ingroup GUI
  * \brief Represents a 3d viewer. The viewer manages 3d scene and a set of view windows
@@ -53,6 +55,16 @@ public:
     return myAISContext;
   }
 
+  //! Activate local selection
+  //! \param theAIS the list of objects
+  //! \param theMode the selection mode
+  //! \param isUpdateViewer the state wether the viewer should be updated immediatelly
+  void setLocalSelection(const AIS_ListOfInteractive& theAISObjects, const int theMode,
+                         const bool isUpdateViewer);
+  //! Deactivate local selection
+  //! \param isUpdateViewer the state wether the viewer should be updated immediatelly
+  void setGlobalSelection(const bool isUpdateViewer);
+
   //! Trihedron 3d object shown in the viewer
   Handle(AIS_Trihedron) trihedron() const
   {
index 5cdf21db84baf4f3758989d8520925a596b6f0d4..f653683a1d478f76a4cdf8f3e438da33ab6dfd71 100644 (file)
 #include "XGUI_SelectionMgr.h"
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_Displayer.h"
+#include "XGUI_OperationMgr.h"
 
 #include <ModelAPI_PluginManager.h>
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 
-#include <Event_Loop.h>
+#include <Events_Loop.h>
 #include <ModuleBase_PropPanelOperation.h>
 #include <ModuleBase_Operation.h>
 #include <Config_FeatureMessage.h>
 
 XGUI_Workshop::XGUI_Workshop()
   : QObject(), 
-  myCurrentOperation(NULL),
   myPartSetModule(NULL)
 {
   myMainWindow = new XGUI_MainWindow();
   mySelector = new XGUI_SelectionMgr(this);
   myDisplayer = new XGUI_Displayer(myMainWindow->viewer());
+  myOperationMgr = new XGUI_OperationMgr(this);
+  connect(myOperationMgr, SIGNAL(operationStarted()),  this, SLOT(onOperationStarted()));
+  connect(myOperationMgr, SIGNAL(operationStopped(ModuleBase_Operation*)),
+          this, SLOT(onOperationStopped(ModuleBase_Operation*)));
 }
 
 //******************************************************
@@ -61,11 +65,11 @@ void XGUI_Workshop::startApplication()
 {
   initMenu();
   //Initialize event listening
-  Event_Loop* aLoop = Event_Loop::loop();
+  Events_Loop* aLoop = Events_Loop::loop();
   //TODO(sbh): Implement static method to extract event id [SEID]
-  Event_ID aFeatureId = aLoop->eventByName("FeatureEvent");
+  Events_ID aFeatureId = aLoop->eventByName("FeatureEvent");
   aLoop->registerListener(this, aFeatureId);
-  Event_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent");
+  Events_ID aPartSetId = aLoop->eventByName("PartSetModuleEvent");
   aLoop->registerListener(this, aPartSetId);
   activateModule();
   myMainWindow->show();
@@ -73,12 +77,12 @@ void XGUI_Workshop::startApplication()
   updateCommandStatus();
   onNew();
   // Testing of document creation
-  //std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-  //std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
-  //std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
+  //boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  //boost::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
+  //boost::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
   //aPart->execute();
   //aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
-  //std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
+  //boost::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
   //aPoint2 = aMgr->rootDocument()->addFeature("Point");
 
   //aPart = aMgr->rootDocument()->addFeature("Part");
@@ -138,9 +142,9 @@ XGUI_Workbench* XGUI_Workshop::addWorkbench(const QString& theName)
 }
 
 //******************************************************
-void XGUI_Workshop::processEvent(const Event_Message* theMessage)
+void XGUI_Workshop::processEvent(const Events_Message* theMessage)
 {
-  static Event_ID aFeatureId = Event_Loop::loop()->eventByName("FeatureEvent");
+  static Events_ID aFeatureId = Events_Loop::loop()->eventByName("FeatureEvent");
   if (theMessage->eventID() == aFeatureId) {
     const Config_FeatureMessage* aFeatureMsg =
         dynamic_cast<const Config_FeatureMessage*>(theMessage);
@@ -150,15 +154,14 @@ void XGUI_Workshop::processEvent(const Event_Message* theMessage)
   const Config_PointerMessage* aPartSetMsg =
       dynamic_cast<const Config_PointerMessage*>(theMessage);
   if (aPartSetMsg) {
-    ModuleBase_PropPanelOperation* aOperation =
+    ModuleBase_PropPanelOperation* anOperation =
         (ModuleBase_PropPanelOperation*)(aPartSetMsg->pointer());
-    setCurrentOperation(aOperation);
-    if(aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
-      myCurrentOperation->start();
-      myCurrentOperation->commit();
-      updateCommandStatus();
-    } else {
-      fillPropertyPanel(aOperation);
+
+    if (myOperationMgr->startOperation(anOperation)) {
+      if (anOperation->isPerformedImmediately()) {
+        anOperation->commit();
+        updateCommandStatus();
+      }
     }
     return;
   }
@@ -170,6 +173,36 @@ void XGUI_Workshop::processEvent(const Event_Message* theMessage)
 
 }
 
+//******************************************************
+void XGUI_Workshop::onOperationStarted()
+{
+  ModuleBase_PropPanelOperation* aOperation =
+        (ModuleBase_PropPanelOperation*)(myOperationMgr->currentOperation());
+
+  if(aOperation->xmlRepresentation().isEmpty()) { //!< No need for property panel
+  } else {
+    connectWithOperation(aOperation);
+    QWidget* aPropWidget = myMainWindow->findChild<QWidget*>(XGUI::PROP_PANEL_WDG);
+    qDeleteAll(aPropWidget->children());
+
+    myMainWindow->showPropertyPanel();
+
+    XGUI_WidgetFactory aFactory = XGUI_WidgetFactory(aOperation);
+    aFactory.createWidget(aPropWidget);
+    myMainWindow->setPropertyPannelTitle(aOperation->description());
+  }
+}
+
+//******************************************************
+void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation)
+{
+  myMainWindow->hidePropertyPanel();
+  updateCommandStatus();
+
+  XGUI_MainMenu* aMenu = myMainWindow->menuObject();
+  aMenu->restoreCommandState();
+}
+
 /*
  *
  */
@@ -207,33 +240,6 @@ void XGUI_Workshop::addFeature(const Config_FeatureMessage* theMessage)
   myPartSetModule->featureCreated(aCommand);
 }
 
-/*
- *
- */
-void XGUI_Workshop::fillPropertyPanel(ModuleBase_PropPanelOperation* theOperation)
-{
-  connectWithOperation(theOperation);
-  QWidget* aPropWidget = myMainWindow->findChild<QWidget*>(XGUI::PROP_PANEL_WDG);
-  qDeleteAll(aPropWidget->children());
-  theOperation->start();
-  XGUI_WidgetFactory aFactory = XGUI_WidgetFactory(theOperation);
-  aFactory.createWidget(aPropWidget);
-  myMainWindow->setPropertyPannelTitle(theOperation->description());
-}
-
-void XGUI_Workshop::setCurrentOperation(ModuleBase_Operation* theOperation)
-{
-  //FIXME: Ask user about aborting of current operation?
-  if (myCurrentOperation) {
-    //TODO get isOperation from document
-    if (myCurrentOperation->isRunning())
-      myCurrentOperation->abort();
-
-    myCurrentOperation->deleteLater();
-  }
-  myCurrentOperation = theOperation;
-}
-
 /*
  * Makes a signal/slot connections between Property Panel
  * and given operation. The given operation becomes a
@@ -247,13 +253,7 @@ void XGUI_Workshop::connectWithOperation(ModuleBase_Operation* theOperation)
   QPushButton* aCancelBtn = aPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
   connect(aCancelBtn, SIGNAL(clicked()), theOperation, SLOT(abort()));
 
-  connect(theOperation, SIGNAL(started()), myMainWindow, SLOT(showPropertyPanel()));
-  connect(theOperation, SIGNAL(stopped()), myMainWindow, SLOT(hidePropertyPanel()));
-  connect(theOperation, SIGNAL(stopped()), this, SLOT(updateCommandStatus()));
-
   XGUI_MainMenu* aMenu = myMainWindow->menuObject();
-  connect(theOperation, SIGNAL(stopped()), aMenu, SLOT(restoreCommandState()));
-
   XGUI_Command* aCommand = aMenu->feature(theOperation->operationId());
   //Abort operation on uncheck the command
   connect(aCommand, SIGNAL(toggled(bool)), theOperation, SLOT(setRunning(bool)));
@@ -306,8 +306,8 @@ void XGUI_Workshop::onSaveAs()
 void XGUI_Workshop::onUndo()
 {
   myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-  std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+  boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
   aDoc->undo();
   updateCommandStatus();
 }
@@ -316,8 +316,8 @@ void XGUI_Workshop::onUndo()
 void XGUI_Workshop::onRedo()
 {
   myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
-  std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+  boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
   aDoc->redo();
   updateCommandStatus();
 }
@@ -400,7 +400,7 @@ void XGUI_Workshop::updateCommandStatus()
   QList<XGUI_Command*> aCommands = aMenuBar->features();
   QList<XGUI_Command*>::const_iterator aIt;
 
-  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
   if (aMgr->hasRootDocument()) {
     XGUI_Command* aUndoCmd;
     XGUI_Command* aRedoCmd;
@@ -412,7 +412,7 @@ void XGUI_Workshop::updateCommandStatus()
       else // Enable all commands
         (*aIt)->enable();
     }
-    std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+    boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
     aUndoCmd->setEnabled(aDoc->canUndo());
     aRedoCmd->setEnabled(aDoc->canRedo());
   } else {
index eea91e4763edbcf5347889184a8408d7a7e9f8dc..6c9034d49e30d95b990a8cade7b9627bea1f6db5 100644 (file)
@@ -2,7 +2,7 @@
 #define XGUI_WORKSHOP_H
 
 #include "XGUI.h"
-#include <Event_Listener.h>
+#include <Events_Listener.h>
 
 #include <QObject>
 #include <QMap>
@@ -15,6 +15,7 @@ class XGUI_Module;
 class XGUI_Workbench;
 class XGUI_SelectionMgr;
 class XGUI_Displayer;
+class XGUI_OperationMgr;
 class ModuleBase_Operation;
 class ModuleBase_PropPanelOperation;
 
@@ -25,7 +26,7 @@ class Config_PointerMessage;
  * \ingroup GUI
  * \brief Class which defines a configuration of the application (Workshop) and launches it.
  */
-class XGUI_EXPORT XGUI_Workshop: public QObject, public Event_Listener
+class XGUI_EXPORT XGUI_Workshop: public QObject, public Events_Listener
 {
 Q_OBJECT
 public:
@@ -48,14 +49,14 @@ public:
   //! Returns displayer
   XGUI_Displayer* displayer() const { return myDisplayer; }
 
+  //! ! Returns operation manager.
+  XGUI_OperationMgr* operationMgr() const { return myOperationMgr; }
+
   //! Creates and adds a new workbench (menu group) with the given name and returns it
   XGUI_Workbench* addWorkbench(const QString& theName);
 
-  //! Returns the current operation or NULL
-  ModuleBase_Operation* currentOperation() { return myCurrentOperation; }
-
-  //! Redefinition of Event_Listener method
-  virtual void processEvent(const Event_Message* theMessage);
+  //! Redefinition of Events_Listener method
+  virtual void processEvent(const Events_Message* theMessage);
 
 public slots:
   void updateCommandStatus();
@@ -71,9 +72,16 @@ public slots:
 protected:
   //Event-loop processing methods:
   void addFeature(const Config_FeatureMessage*);
-  void fillPropertyPanel(ModuleBase_PropPanelOperation* theOperation);
   void connectWithOperation(ModuleBase_Operation* theOperation);
-  void setCurrentOperation(ModuleBase_Operation* theOperation);
+
+protected slots:
+  /// SLOT, that is called after the operation is started. Update workshop state according to
+  /// the started operation, e.g. visualizes the property panel and connect to it.
+  void onOperationStarted();
+  /// SLOT, that is called after the operation is stopped. Update workshop state, e.g.
+  /// hides the property panel and udpate the command status.
+  /// \param theOpertion a stopped operation
+  void onOperationStopped(ModuleBase_Operation* theOperation);
 
 private:
   void initMenu();
@@ -87,7 +95,7 @@ private:
   XGUI_SelectionMgr* mySelector;
   XGUI_Displayer* myDisplayer;
 
-  ModuleBase_Operation* myCurrentOperation;
+  XGUI_OperationMgr* myOperationMgr; ///< manager to manipulate through the operations
 };
 
 #endif