]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorSergey BELASH <belash.sergey@opencascade.com>
Tue, 9 Sep 2014 07:36:21 +0000 (11:36 +0400)
committerSergey BELASH <belash.sergey@opencascade.com>
Tue, 9 Sep 2014 07:36:21 +0000 (11:36 +0400)
29 files changed:
build_vc9_Salome_deb.bat [deleted file]
build_vc9_Salome_rel.bat [deleted file]
msvc9_env_Salome.bat [deleted file]
src/Events/Events_Loop.cpp
src/Events/Events_Loop.h
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/Model/Model_AttributeDocRef.cpp
src/Model/Model_AttributeDocRef.h
src/Model/Model_Document.cpp
src/Model/Model_ResultPart.cpp
src/Model/Model_ResultPart.h
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/ModelAPI_ResultPart.h
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/PartSetPlugin/PartSetPlugin_Part.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/plugin-Sketch.xml
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_OperationMgr.h
src/XGUI/XGUI_PartDataModel.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h

diff --git a/build_vc9_Salome_deb.bat b/build_vc9_Salome_deb.bat
deleted file mode 100644 (file)
index 50fc961..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-@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 d
-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
diff --git a/build_vc9_Salome_rel.bat b/build_vc9_Salome_rel.bat
deleted file mode 100644 (file)
index 90345fb..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-@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
-
-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=Release -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
-
-start "" %MSVC_EXE% NewGEOM.sln
diff --git a/msvc9_env_Salome.bat b/msvc9_env_Salome.bat
deleted file mode 100644 (file)
index d09176f..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-@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
-)
-
-if "%SOLVESPACE_ROOT_DIR%" == "" (
-  @SET SOLVESPACE_ROOT_DIR=%ROOT_DIR%\products\solvespace-2.0
-)
-
-call %SALOME_ROOT_DIR%\WORK\set_env.bat %1
-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%
-@SET PATH=%SOLVESPACE_ROOT_DIR%\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=%PATH%;%ROOT_DIR%\install\bin;%ROOT_DIR%\install\plugins
-
-@SET LightAppConfig=%ROOT_DIR%\install\share\salome\resources\newgeom;%GUI_ROOT_DIR%\share\salome\resources\gui
index 80f48ef48a0004cfdf509664fb779e36b22439d4..1fb0ed1780636c244923a3b50469ce0e68ab22f4 100644 (file)
@@ -103,6 +103,8 @@ void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID
 
 void Events_Loop::flush(const Events_ID& theID)
 {
+  if (!myFlushActive)
+    return;
   std::map<char*, Events_MessageGroup*>::iterator aMyGroup = myGroups.find(theID.eventText());
   if (aMyGroup != myGroups.end()) {  // really sends
     Events_MessageGroup* aGroup = aMyGroup->second;
@@ -111,3 +113,8 @@ void Events_Loop::flush(const Events_ID& theID)
     delete aGroup;
   }
 }
+
+void Events_Loop::activateFlushes(const bool theActivate)
+{
+  myFlushActive = theActivate;
+}
index d62cea6add1f17f6b4fffe17f021c89df90b42bd..cd78497ed1c67b0c7b3482d5964df9b49674572b 100644 (file)
@@ -31,11 +31,12 @@ class Events_Loop
   /// map from event ID to groupped messages (accumulated on flush)
   std::map<char*, Events_MessageGroup*> myGroups;
 
+  /// to process flushes or not
+  bool myFlushActive;
+
   //! The empty constructor, will be called at startup of the application, only once
-  Events_Loop()
-  {
-  }
-  ;
+  Events_Loop() : myFlushActive(true) {}
+
  public:
   ///! Returns the main object of the loop, one per application.
   EVENTS_EXPORT static Events_Loop* loop();
@@ -54,6 +55,10 @@ class Events_Loop
 
   //! Initializes sending of a group-message by the given ID
   EVENTS_EXPORT void flush(const Events_ID& theID);
+
+  //! Allows to disable flushes: needed in synchronization of document mechanism 
+  //! (to synchronize all and only then flush create, update, etc in correct order)
+  EVENTS_EXPORT void activateFlushes(const bool theActivate);
 };
 
 #endif
index 7c6a0eaebb82f4763ebcd333163a2e127c346648..1fb6e46d58089ea69e474bbf0f0daa8fff9bcecc 100644 (file)
@@ -33,12 +33,20 @@ void FeaturesPlugin_Extrusion::execute()
       ModelAPI_AttributeReference>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
   if (!aFaceRef)
     return;
+  boost::shared_ptr<GeomAPI_Shape> aFace;
   boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
       ModelAPI_ResultConstruction>(aFaceRef->value());
-  if (!aConstr)
-    return;
-  boost::shared_ptr<GeomAPI_Shape> aFace = aConstr->shape();
-  if (!aFace)
+  if (aConstr) {
+    aFace = aConstr->shape();
+  }
+  if (!aFace) {
+    // Check for body
+    boost::shared_ptr<ModelAPI_ResultBody> aBody = boost::dynamic_pointer_cast<
+        ModelAPI_ResultBody>(aFaceRef->value());
+    if (aBody) 
+      aFace = aBody->shape();
+  }
+  if (!aFace) 
     return;
 
   double aSize = data()->real(FeaturesPlugin_Extrusion::SIZE_ID())->value();
index 806408d3332b570279e5c0e930cdc44a7a1a3b5a..67486266c1089c44e8e419e5b97472149cd53b98 100644 (file)
@@ -11,6 +11,7 @@ using namespace std;
 
 void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc)
 {
+  myDoc = theDoc;
   TCollection_ExtendedString aNewID(theDoc->id().c_str());
   if (!myIsInitialized || myComment->Get() != aNewID) {
     myComment->Set(TCollection_ExtendedString(theDoc->id().c_str()));
@@ -20,11 +21,7 @@ void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc
 
 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 boost::shared_ptr<ModelAPI_Document>();
+  return myDoc;
 }
 
 Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
index dc731701d86451c17889f99d3d7c2a454ace7138..6290e05a41c23c25e999de9d0ab45cd94dd2d61f 100644 (file)
@@ -18,6 +18,7 @@
 class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
 {
   Handle_TDataStd_Comment myComment;  ///< reference to document is identified as string-id
+  boost::shared_ptr<ModelAPI_Document> myDoc; ///< document referenced by this attribute (if already loaded)
  public:
   /// Defines the document referenced from this attribute
   MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc);
index 5e3088a441d78b91126d89a9d957e558355a1289..cfe40d5f72dd3f48f3a713c047023e6a8d36bf1f 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <TDataStd_Integer.hxx>
 #include <TDataStd_Comment.hxx>
+#include <TDataStd_UAttribute.hxx>
 #include <TDF_ChildIDIterator.hxx>
 #include <TDataStd_ReferenceArray.hxx>
 #include <TDataStd_HLabelArray1.hxx>
@@ -90,50 +91,50 @@ bool Model_Document::load(const char* theFileName)
   if (isError) {
     switch (aStatus) {
       case PCDM_RS_UnknownDocument:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownDocument"));
+        Events_Error::send(std::string("Can not open document: unknown format"));
         break;
       case PCDM_RS_AlreadyRetrieved:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_AlreadyRetrieved"));
+        Events_Error::send(std::string("Can not open document: already opened"));
         break;
       case PCDM_RS_AlreadyRetrievedAndModified:
         Events_Error::send(
-            std::string("Can not open document: PCDM_RS_AlreadyRetrievedAndModified"));
+            std::string("Can not open document: already opened and modified"));
         break;
       case PCDM_RS_NoDriver:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_NoDriver"));
+        Events_Error::send(std::string("Can not open document: driver library is not found"));
         break;
       case PCDM_RS_UnknownFileDriver:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_UnknownFileDriver"));
+        Events_Error::send(std::string("Can not open document: unknown driver for opening"));
         break;
       case PCDM_RS_OpenError:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_OpenError"));
+        Events_Error::send(std::string("Can not open document: file open error"));
         break;
       case PCDM_RS_NoVersion:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_NoVersion"));
+        Events_Error::send(std::string("Can not open document: invalid version"));
         break;
       case PCDM_RS_NoModel:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_NoModel"));
+        Events_Error::send(std::string("Can not open document: no data model"));
         break;
       case PCDM_RS_NoDocument:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_NoDocument"));
+        Events_Error::send(std::string("Can not open document: no document inside"));
         break;
       case PCDM_RS_FormatFailure:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_FormatFailure"));
+        Events_Error::send(std::string("Can not open document: format failure"));
         break;
       case PCDM_RS_TypeNotFoundInSchema:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_TypeNotFoundInSchema"));
+        Events_Error::send(std::string("Can not open document: invalid object"));
         break;
       case PCDM_RS_UnrecognizedFileFormat:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_UnrecognizedFileFormat"));
+        Events_Error::send(std::string("Can not open document: unrecognized file format"));
         break;
       case PCDM_RS_MakeFailure:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_MakeFailure"));
+        Events_Error::send(std::string("Can not open document: make failure"));
         break;
       case PCDM_RS_PermissionDenied:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_PermissionDenied"));
+        Events_Error::send(std::string("Can not open document: permission denied"));
         break;
       case PCDM_RS_DriverFailure:
-        Events_Error::send(std::string("Can not open document: PCDM_RS_DriverFailure"));
+        Events_Error::send(std::string("Can not open document: driver failure"));
         break;
       default:
         Events_Error::send(std::string("Can not open document: unknown error"));
@@ -172,14 +173,14 @@ bool Model_Document::save(const char* theFileName)
   if (!isDone) {
     switch (aStatus) {
       case PCDM_SS_DriverFailure:
-        Events_Error::send(std::string("Can not save document: PCDM_SS_DriverFailure"));
+        Events_Error::send(std::string("Can not save document: save driver-library failure"));
         break;
       case PCDM_SS_WriteFailure:
-        Events_Error::send(std::string("Can not save document: PCDM_SS_WriteFailure"));
+        Events_Error::send(std::string("Can not save document: file writing failure"));
         break;
       case PCDM_SS_Failure:
       default:
-        Events_Error::send(std::string("Can not save document: PCDM_SS_Failure"));
+        Events_Error::send(std::string("Can not save document"));
         break;
     }
   }
@@ -253,10 +254,11 @@ void Model_Document::finishOperation()
   if (!myDoc->HasOpenCommand() && myNestedNum != -1)
     boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
         ->setCheckTransactions(false);  // for nested transaction commit
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  Events_Loop* aLoop = Events_Loop::loop();
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   if (!myDoc->HasOpenCommand() && myNestedNum != -1)
     boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
         ->setCheckTransactions(true);  // for nested transaction commit
@@ -654,6 +656,9 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
   // after all updates, sends a message that groups of features were created or updated
   boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
     ->setCheckTransactions(false);
+  Events_Loop* aLoop = Events_Loop::loop();
+  aLoop->activateFlushes(false);
+
   // update all objects by checking are they of labels or not
   std::set<FeaturePtr> aNewFeatures, aKeptFeatures;
   TDF_ChildIDIterator aLabIter(featuresLabel(), TDataStd_Comment::GetID());
@@ -709,7 +714,7 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
         ModelAPI_EventCreator::get()->sendDeleted(aThis, ModelAPI_Feature::group());
       }
       // results of this feature must be redisplayed (hided)
-      static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+      static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
       const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
       std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
       for (; aRIter != aResults.cend(); aRIter++) {
@@ -725,11 +730,14 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated)
   }
 
   myExecuteFeatures = false;
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-  if (theMarkUpdated)
-    Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
-  Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
+  aLoop->activateFlushes(true);
+
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+  if (theMarkUpdated) {
+    aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  }
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
   boost::static_pointer_cast<Model_PluginManager>(Model_PluginManager::get())
     ->setCheckTransactions(true);
   myExecuteFeatures = true;
@@ -756,10 +764,16 @@ void Model_Document::storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData
   }
 }
 
+static const Standard_GUID ID_CONSTRUCTION("b59fa408-8ab1-42b8-980c-af5adeebe7e4");
+static const Standard_GUID ID_BODY("c1148e9a-9b17-4e9c-9160-18e918fd0013");
+static const Standard_GUID ID_PART("1b3319b9-3e0a-4298-a1dc-3fb5aaf9be59");
+
 boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+  TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+  TDataStd_UAttribute::Set(aLab, ID_CONSTRUCTION);
+  ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultConstruction> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
@@ -774,7 +788,9 @@ boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstructio
 boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+  TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+  TDataStd_UAttribute::Set(aLab, ID_BODY);
+  ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultBody> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
@@ -789,7 +805,9 @@ boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
 boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
     const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
 {
-  ObjectPtr anOldObject = object(resultLabel(theFeatureData, theIndex));
+  TDF_Label aLab = resultLabel(theFeatureData, theIndex);
+  TDataStd_UAttribute::Set(aLab, ID_PART);
+  ObjectPtr anOldObject = object(aLab);
   boost::shared_ptr<ModelAPI_ResultPart> aResult;
   if (anOldObject) {
     aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
@@ -835,13 +853,21 @@ void Model_Document::updateResults(FeaturePtr theFeature)
   int aResSize = theFeature->results().size();
   TDF_ChildIterator aLabIter(resultLabel(theFeature->data(), 0).Father());
   for(; aLabIter.More(); aLabIter.Next()) {
-    // here must be at least Name
+    // here must be GUID of the feature
     int aResIndex = aLabIter.Value().Tag() - 1;
-    if (aLabIter.Value().FindChild(TAG_FEATURE_ARGUMENTS).HasAttribute() && 
-        aResSize <= aResIndex) 
-    {
-      ResultBodyPtr aNewBody = createBody(theFeature->data(), aResIndex);
-      theFeature->setResult(aNewBody, aResIndex);
+    ResultPtr aNewBody;
+    if (aResSize <= aResIndex) {
+      TDF_Label anArgLab = aLabIter.Value();
+      if (anArgLab.IsAttribute(ID_BODY)) {
+        aNewBody = createBody(theFeature->data(), aResIndex);
+      } else if (anArgLab.IsAttribute(ID_PART)) {
+        aNewBody = createPart(theFeature->data(), aResIndex);
+      } else if (!anArgLab.IsAttribute(ID_CONSTRUCTION)) {
+        Events_Error::send("Unknown type of result if found in the document");
+      }
+      if (aNewBody) {
+        theFeature->setResult(aNewBody, aResIndex);
+      }
     }
   }
 }
index aecaac06f6957d58d434df93ed1b501c2b49c34b..cdafeb6d0e7ae59a9603ea6b3063d17a5e577a27 100644 (file)
@@ -5,6 +5,7 @@
 #include <Model_ResultPart.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_PluginManager.h>
 
 boost::shared_ptr<ModelAPI_Document> Model_ResultPart::partDoc()
 {
@@ -27,3 +28,17 @@ void Model_ResultPart::setData(boost::shared_ptr<ModelAPI_Data> theData)
     data()->addAttribute(DOC_REF(), ModelAPI_AttributeDocRef::type());
   }
 }
+
+void Model_ResultPart::activate()
+{
+  boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(DOC_REF());
+  
+  if (!aDocRef->value()) {  // create (or open) a document if it is not yet created
+    boost::shared_ptr<ModelAPI_Document> aDoc = document()->subDocument(data()->name());
+    if (aDoc) {
+      aDocRef->setValue(aDoc);
+    }
+  }
+  if (aDocRef->value())
+    ModelAPI_PluginManager::get()->setCurrentDocument(aDocRef->value());
+}
index af0f385e8289946c1c90c738e0ad6cd3b3545d6b..e26413c3fb13d0b69c59395070c7bee3cd0b3212 100644 (file)
@@ -23,7 +23,10 @@ class Model_ResultPart : public ModelAPI_ResultPart
   /// Part has no stored feature: this method returns NULL
   MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
 
- protected:
+  /// Sets this document as current and if it is not loaded yet, loads it
+  MODEL_EXPORT virtual void activate();
+
+protected:
   /// makes a result on a temporary feature (an action)
   Model_ResultPart();
 
index 9b76e5f5aa0607669fa9092b29248f07b9ba0eaa..9df4d10f0769a687844a6b8c8c1bd8a9fe58b63b 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelAPI_Validator.h>
 #include <Events_Loop.h>
 #include <Events_LongOp.h>
+#include <Events_Error.h>
 
 using namespace std;
 
@@ -98,7 +99,13 @@ bool Model_Update::updateFeature(FeaturePtr theFeature)
           !theFeature->isPersistentResult()) {
         ModelAPI_ValidatorsFactory* aFactory = ModelAPI_PluginManager::get()->validators();
         if (aFactory->validate(theFeature)) {
-          theFeature->execute();
+          try {
+            theFeature->execute();
+          } catch(...) {
+            Events_Error::send(
+              "Feature " + theFeature->getKind() + " has failed during the execution");
+            theFeature->eraseResults();
+          }
         } else {
           theFeature->eraseResults();
         }
index 91167b871b71331c26b305d006d64570a62f1ae7..2d4838c17252f4feed9cfb8d078d21e0514f01ad 100644 (file)
@@ -24,7 +24,7 @@ class ModelAPI_Document;
 class ModelAPI_Object
 {
   boost::shared_ptr<ModelAPI_Data> myData;  ///< manager of the data model of a feature
-  boost::shared_ptr<ModelAPI_Document> myDoc;  ///< document this feature belongs to
+  boost::shared_ptr<ModelAPI_Document> myDoc;  ///< document this object belongs to
  public:
   /// By default object is displayed in the object browser.
   virtual bool isInHistory()
index ca52304cc36c2e0712fdf82e3a7d88696d17291a..bd7a7deeab05c1e9ae8f50d67010e80c513137dc 100644 (file)
@@ -41,6 +41,9 @@ class ModelAPI_ResultPart : public ModelAPI_Result
 
   /// Returns the part-document of this result
   virtual boost::shared_ptr<ModelAPI_Document> partDoc() = 0;
+
+  /// Sets this document as current and if it is not loaded yet, loads it
+  virtual void activate() = 0;
 };
 
 //! Pointer on feature object
index 157ccb45d74fd5737bcdfd4387bc2dd7a2c090cc..5e447ef1deeeaa74f9fd8cc17ccc4dba815d6e4a 100644 (file)
@@ -110,8 +110,6 @@ bool ModuleBase_WidgetPoint2D::storeValue() const
 
   ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
   bool isBlocked = that->blockSignals(true);
-  double aX = myXSpin->value();
-  double aY = myYSpin->value();
   aPoint->setValue(myXSpin->value(), myYSpin->value());
   updateObject(myFeature);
   that->blockSignals(isBlocked);
index edb6ddac3f0c0de9f9c2828c877b975b0f31f9b3..e01c02bb0814c803cc5421576be65547e9479e15 100644 (file)
@@ -26,14 +26,16 @@ void PartSetPlugin_Part::execute()
     aResult = document()->createPart(data());
     setResult(aResult);
   }
+  /*
   boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aResult->data()->docRef(
       ModelAPI_ResultPart::DOC_REF());
-
+  
   if (!aDocRef->value()) {  // create a document if not yet created
     boost::shared_ptr<ModelAPI_Document> aPartSetDoc =
         ModelAPI_PluginManager::get()->rootDocument();
     aDocRef->setValue(aPartSetDoc->subDocument(data()->name()));
   }
+  */
 }
 
 boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd()
index e8ea4bfbed0c10497c1a1b40e82b36023e3b74cf..97a08e13403e3f60850dd654e88b9b832bfeb917 100644 (file)
@@ -36,26 +36,24 @@ void SketchPlugin_ConstraintDistance::execute()
   AttributeDoublePtr anAttr_Value = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
       aData->attribute(SketchPlugin_Constraint::VALUE()));
 
-  if (!anAttr_Value->isInitialized()) {
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
-        aData, SketchPlugin_Constraint::ENTITY_A());
-    boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
-        aData, SketchPlugin_Constraint::ENTITY_B());
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
+      aData, SketchPlugin_Constraint::ENTITY_A());
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
+      aData, SketchPlugin_Constraint::ENTITY_B());
 
-    if (aPoint_A && aPoint_B) {  // both points
-      anAttr_Value->setValue(aPoint_A->pnt()->distance(aPoint_B->pnt()));
-    } else {
-      if (!aPoint_A && aPoint_B) {  //Line and point
-        boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
-            aData, SketchPlugin_Constraint::ENTITY_A());
-        if (aLine)
-          anAttr_Value->setValue(aLine->distanceToPoint(aPoint_B->pnt()));
-      } else if (aPoint_A && !aPoint_B) {  // Point and line
-        boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
-            aData, SketchPlugin_Constraint::ENTITY_B());
-        if (aLine)
-          anAttr_Value->setValue(aLine->distanceToPoint(aPoint_A->pnt()));
-      }
+  if (aPoint_A && aPoint_B) {  // both points
+    anAttr_Value->setValue(aPoint_A->pnt()->distance(aPoint_B->pnt()));
+  } else {
+    if (!aPoint_A && aPoint_B) {  //Line and point
+      boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+          aData, SketchPlugin_Constraint::ENTITY_A());
+      if (aLine)
+        anAttr_Value->setValue(aLine->distanceToPoint(aPoint_B->pnt()));
+    } else if (aPoint_A && !aPoint_B) {  // Point and line
+      boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+          aData, SketchPlugin_Constraint::ENTITY_B());
+      if (aLine)
+        anAttr_Value->setValue(aLine->distanceToPoint(aPoint_A->pnt()));
     }
   }
 }
index 94f23ae872d71596462cfc77dc844f7ee91c4cbf..e7ed5411ccb608c54e03e606d0b20b994ed4c0dd 100644 (file)
@@ -31,25 +31,21 @@ void SketchPlugin_ConstraintLength::initAttributes()
 
 void SketchPlugin_ConstraintLength::execute()
 {
-  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized()
-      && !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
-
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
-        ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
-    if (aFeature) {
-      // set length value
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<
-          GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
-      boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<
-          GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
-
-      double aLenght = aPoint1->pnt()->distance(aPoint2->pnt());
-
-      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
-          ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
-      aValueAttr->setValue(aLenght);
-    }
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
+  if (aFeature) {
+    // set length value
+    boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
+    boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<
+        GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
+
+    double aLenght = aPoint1->pnt()->distance(aPoint2->pnt());
+
+    boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
+    aValueAttr->setValue(aLenght);
   }
 }
 
index dcbd7c9ae7fdd9b092edfcf10bf0526cf2b516a4..133bc91bb74e8639694c2193eb7e372e1b58518d 100644 (file)
@@ -34,32 +34,28 @@ void SketchPlugin_ConstraintRadius::initAttributes()
 
 void SketchPlugin_ConstraintRadius::execute()
 {
-  if (data()->attribute(SketchPlugin_Constraint::ENTITY_A())->isInitialized()
-      && !data()->attribute(SketchPlugin_Constraint::VALUE())->isInitialized()) {
-
-    boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
-        ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
-    FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
-    if (aFeature) {
-      double aRadius = 0;
-      boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
-      if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
-        AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-            aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
-        if (anAttribute)
-          aRadius = anAttribute->value();
-      } else if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
-        boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
-            GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
-        boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
-            GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
-        if (aCenterAttr && aStartAttr)
-          aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
-      }
-      boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
-          ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
-      aValueAttr->setValue(aRadius);
+  boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
+  if (aFeature) {
+    double aRadius = 0;
+    boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
+    if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
+      AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+          aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
+      if (anAttribute)
+        aRadius = anAttribute->value();
+    } else if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
+      boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
+      boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+          GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
+      if (aCenterAttr && aStartAttr)
+        aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
     }
+    boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+        ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
+    aValueAttr->setValue(aRadius);
   }
 }
 
index 7880ff0338e266cc96f291e85eac542d462fb652..2d135af004a96510b752f87fe7a533187ea759e4 100644 (file)
@@ -20,7 +20,7 @@ bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
 
   // If the object is not a line then it is accepted
   const ModelAPI_ResultValidator* aLineValidator =
-      dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("Model_ResultLineValidator"));
+      dynamic_cast<const ModelAPI_ResultValidator*>(aFactory->validator("SketchPlugin_ResultLineValidator"));
   if (!aLineValidator->isValid(theObject))
     return true;
 
index 4c1d80a06369662d3922fdbc5648174a9d7268ef..a077a466cc7a1e48273d86acbd007b14f58e1b2f 100644 (file)
       <feature id="SketchConstraintCoincidence" title="Coincident" tooltip="Create constraint for the coincidence of two points" internal="1"/>
 
       <feature id="SketchConstraintDistance" title="Distance" tooltip="Create constraint for the distance from a point to an object">
-        <label title="Select point and another feature (point or point on line) between which to calculate distance" tooltip="Select point and another feature (point or point on line) between which to calculate distance"/>
-        <feature_or_attribute_selector id="ConstraintEntityA" label="First object" tooltip="Select an point in the viewer">
+        <label title="Select objects for distance difinition. Following objects can be accepted: point, line end point, line, center of circle or arc."/>
+        <feature_or_attribute_selector id="ConstraintEntityA" label="First object" tooltip="Select point, line end point, line, center of circle or arc.">
           <validator id="SketchPlugin_ResultPointValidator"/>
           <validator id="SketchPlugin_ResultLineValidator"/>
         </feature_or_attribute_selector>
-        <feature_or_attribute_selector id="ConstraintEntityB" label="Last object" tooltip="Select an point in the viewer">
+        <feature_or_attribute_selector id="ConstraintEntityB" label="Last object" tooltip="Select point, line end point, line, center of circle or arc.">
           <validator id="SketchPlugin_ResultPointValidator"/>
           <validator id="SketchPlugin_ResultLineValidator"/>
           <validator id="SketchPlugin_DistanceAttrValidator" parameters="ConstraintEntityA"/>
index 914cce3217c605a514e13a57b1ea4b27ce35734a..c24669c70ad97414ff895c6f29031f73544156da 100644 (file)
@@ -46,6 +46,9 @@ void XGUI_ContextMenuMgr::createActions()
   aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show"), this);
   addAction("SHOW_CMD", aAction);
 
+  aAction = new QAction(QIcon(":pictures/eye_pencil.png"), tr("Show only"), this);
+  addAction("SHOW_ONLY_CMD", aAction);
+
   aAction = new QAction(QIcon(":pictures/eye_pencil_closed.png"), tr("Hide"), this);
   addAction("HIDE_CMD", aAction);
 }
@@ -121,8 +124,10 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
         } else {
           if (aDisplayer->isVisible(aObject))
             aMenu->addAction(action("HIDE_CMD"));
-          else
+          else {
             aMenu->addAction(action("SHOW_CMD"));
+          }
+          aMenu->addAction(action("SHOW_ONLY_CMD"));
         }
       } else {  // If feature is 0 the it means that selected root object (document)
         if (aMgr->currentDocument() != aMgr->rootDocument())
@@ -145,6 +150,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
       if (hasResult) {
         aMenu->addAction(action("SHOW_CMD"));
         aMenu->addAction(action("HIDE_CMD"));
+        aMenu->addAction(action("SHOW_ONLY_CMD"));
       }
       if (hasFeature)
         aMenu->addAction(action("DELETE_CMD"));
index 26def2f04855d27112bc55dee573509876f2d47d..840ade6713d7b7b0bc4d782e98141fed06be057e 100644 (file)
@@ -279,25 +279,22 @@ void XGUI_Displayer::setSelected(const QList<ObjectPtr>& theResults, const bool
     updateViewer();
 }
 
-/*void XGUI_Displayer::EraseAll(const bool isUpdateViewer)
+void XGUI_Displayer::eraseAll(const bool isUpdateViewer)
  {
- Handle(AIS_InteractiveContext) ic = AISContext();
-
- AIS_ListOfInteractive aList;
- ic->DisplayedObjects(aList);
- AIS_ListIteratorOfListOfInteractive anIter(aList);
- for (; anIter.More(); anIter.Next()) {
- if ((anIter.Value()->DynamicType() == STANDARD_TYPE(AIS_Trihedron)))
- continue;
-
- // erase an object
- Handle(AIS_InteractiveObject) anIO = anIter.Value();
- ic->Erase(anIO, false);
+   Handle(AIS_InteractiveContext) ic = AISContext();
+
+   ResultToAISMap::iterator aIt;
+   for (aIt = myResult2AISObjectMap.begin(); aIt != myResult2AISObjectMap.end(); aIt++) {
+     // erase an object
+     boost::shared_ptr<GeomAPI_AISObject> aAISObj = (*aIt).second;
+     Handle(AIS_InteractiveObject) anIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
+     if (!anIO.IsNull())
+      ic->Remove(anIO, false);
+   }
+   myResult2AISObjectMap.clear();
+   if (isUpdateViewer)
+     updateViewer();
  }
- myResult2AISObjectMap.clear();
- if (isUpdateViewer)
- updateViewer();
- }*/
 
 void XGUI_Displayer::eraseDeletedResults(const bool isUpdateViewer)
 {
index 5c54857d07bf4cab3ef6ca813907ce91e2703f94..7d0970659d54dd6457c062562df919c0b58362c0 100644 (file)
@@ -97,7 +97,7 @@ class XGUI_EXPORT XGUI_Displayer
 
   /// Erase all presentations
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-  //void EraseAll(const bool isUpdateViewer = true);
+  void eraseAll(const bool isUpdateViewer = true);
 
   /// Erase AIS interactive objects, which has an empty feature in the internal map
   /// \param isUpdateViewer the parameter whether the viewer should be update immediatelly
index 88e625e36297aa367d362e2d540796259eb35786..53f324b40362976fcd209799b4ee63a346e70b32 100644 (file)
@@ -152,6 +152,7 @@ bool XGUI_OperationMgr::canStopOperation()
 void XGUI_OperationMgr::onCommitOperation()
 {
   ModuleBase_Operation* anOperation = currentOperation();
+  anOperation->onWidgetActivated(NULL);
   if (anOperation)
     anOperation->commit();
 }
index 6e55108e33192a07163142b8508a02825b0cd6bc..f363da6b5203f3e0e91d31481098f072bd6f36c0 100644 (file)
@@ -17,10 +17,10 @@ class QKeyEvent;
 
 /**\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
+ * \brief Operation manager. Servers to manipulate to the workshop operations. Contains a stack
+ * of started operations. In simple case, if only one operation 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.
+ * started one. In that case, the previous active operation becomes 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.
  */
index 16adcadf747f9e3fbfcf66828a8913dae2443fa9..6a5ffdc9630f705ebb68b740bcd1619990824a6d 100644 (file)
@@ -333,7 +333,13 @@ int XGUI_PartDataModel::rowCount(const QModelIndex& parent) const
   }
   switch (parent.internalId()) {
     case MyRoot:
-      return 3 + partDocument()->size(ModelAPI_Feature::group());
+      {
+        DocumentPtr aDoc = partDocument();
+        if (aDoc)
+          return 3 + aDoc->size(ModelAPI_Feature::group());
+        else 
+          return 0;
+      }
     case ParamsFolder:
       return partDocument()->size(ModelAPI_ResultParameters::group());
     case ConstructFolder:
index be21a28256d55f988f769f812c1bfb8aaca47be8..fec644039bdd94d6cdf17f3becf425bfc5402230 100644 (file)
@@ -960,6 +960,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     showObjects(aObjects, true);
   else if (theId == "HIDE_CMD")
     showObjects(aObjects, false);
+  else if (theId == "SHOW_ONLY_CMD")
+    showOnlyObjects(aObjects);
 }
 
 //**************************************************************
@@ -986,6 +988,8 @@ void XGUI_Workshop::onWidgetValuesChanged()
 //**************************************************************
 void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
 {
+  if (theFeature)
+    theFeature->activate();
   changeCurrentDocument(theFeature);
   myObjectBrowser->activatePart(theFeature);
 }
@@ -1050,6 +1054,14 @@ void XGUI_Workshop::showObjects(const QList<ObjectPtr>& theList, bool isVisible)
   myDisplayer->updateViewer();
 }
 
+//**************************************************************
+void XGUI_Workshop::showOnlyObjects(const QList<ObjectPtr>& theList)
+{
+  myDisplayer->eraseAll(false);
+  showObjects(theList, true);
+}
+
+
 //**************************************************************
 void XGUI_Workshop::updateCommandsOnViewSelection()
 {
@@ -1103,6 +1115,8 @@ void XGUI_Workshop::displayAllResults()
 //**************************************************************
 void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc)
 {
+  if (!theDoc)
+    return;
   displayGroupResults(theDoc, ModelAPI_ResultConstruction::group());
   displayGroupResults(theDoc, ModelAPI_ResultBody::group());
 }
index 458b8a4c415a9a35c8d358ce98d574adc325900a..95644a07fb1f25913f4141afd7223d137fce8680 100644 (file)
@@ -154,6 +154,9 @@ Q_OBJECT
   //! Show the given features in 3d Viewer
   void showObjects(const QList<ObjectPtr>& theList, bool isVisible);
 
+  //! Show the given features in 3d Viewer
+  void showOnlyObjects(const QList<ObjectPtr>& theList);
+
   ModuleBase_IModule* module() const
   {
     return myModule;