Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom.git into Dev_0.7.1
authorsbh <sergey.belash@opencascade.com>
Wed, 21 Jan 2015 13:30:12 +0000 (16:30 +0300)
committersbh <sergey.belash@opencascade.com>
Wed, 21 Jan 2015 13:30:12 +0000 (16:30 +0300)
20 files changed:
CMakeLists.txt
msvc10_env.bat
src/ConstructionPlugin/ConstructionPlugin_Axis.cpp
src/ConstructionPlugin/axis_widget.xml
src/GeomAPI/GeomAPI_AISObject.cpp
src/GeomAPI/GeomAPI_AISObject.h
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
src/Model/Model_Document.cpp
src/Model/Model_Session.cpp
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_FilterCustom.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_FilterCustom.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/XGUI/XGUI_Displayer.cpp

index 20f1d10bc9b8ccce3e2a56cb114dfae1fe518611..5e8f11ec9ae2b3b96418cf15435ba1707305c8b6 100644 (file)
@@ -39,9 +39,9 @@ IF(UNIX)
   ENDIF(CMAKE_COMPILER_IS_GNUCC)
 ENDIF(UNIX)
 
-IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
+#IF(CMAKE_BUILD_TYPE MATCHES Release)
   ADD_SUBDIRECTORY (doc)
-ENDIF(CMAKE_BUILD_TYPE MATCHES RELEASE)
+#ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
 ADD_SUBDIRECTORY (src/Config)
 ADD_SUBDIRECTORY (src/Events)
 ADD_SUBDIRECTORY (src/Model)
index 5822d74684ba99233c2f0178300f2b4c5faf481b..f5707a410c41f4d60803f03574684e7a87e8799d 100644 (file)
@@ -115,11 +115,6 @@ set PATH=%CMAKEDIR%\bin;%PATH%
 @SET PATH=%PDIR%\swig-2.0.9\bin;%PATH%
 @REM -------------------------
 
-@REM BOOST
-@REM @SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0
-@REM @SET PATH=%BOOST_ROOT_DIR%\lib;%PATH%
-@REM -------------------------
-
 @REM -------------------------
 @SET SOLVESPACE_ROOT_DIR=%PDIR%\solvespace-2.0
 @SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH%
@@ -134,6 +129,11 @@ set PATH=%CMAKEDIR%\bin;%PATH%
 @SET PATH=%PDIR%\pthreads-2.9.1\lib;%PATH%
 @REM -------------------------
 
+@REM -------------------------
+@REM DOXYGEN 
+@SET DOXYGEN_ROOT_DIR=%PDIR%\doxygen-1.8.3.1
+@SET PATH=%DOXYGEN_ROOT_DIR%\bin;%PATH%
+@REM -------------------------
 
 @REM -------------------------
 @REM SUIT
index 7315289b3c52227ee9495b438debb8b4041f2b5a..f0e45a5bf0bb9bc8cedc988e6cc0a6612ec6ca6b 100644 (file)
@@ -52,4 +52,5 @@ void ConstructionPlugin_Axis::customisePresentation(AISObjectPtr thePrs)
 {
   thePrs->setColor(0, 0, 0);
   thePrs->setLineStyle(3);
+  thePrs->redisplay();
 }
\ No newline at end of file
index 7729b2a9e51d5ede7286f932ff9046706a44e046..f612a83d08e470a660ae85390bfd57f6d2badecc 100644 (file)
@@ -6,11 +6,14 @@
     icon=":icons/point.png"
     tooltip="Select a first point"
     shape_types="vertex">
+    <selection_filter id="NoConstructionSubShapesFilter"/>
   </shape_selector>
   <shape_selector id="secondPoint"
     label="Second point"
     icon=":icons/point.png"
     tooltip="Select a second point"
     shape_types="vertex">
+    <selection_filter id="NoConstructionSubShapesFilter"/>
+    <validator id="PartSet_DifferentObjects"/>
   </shape_selector>
 </source>
index 6be05290b1d06ac86d6ad5cc2c7f8c252ea6cc94..aea1179d62076fc4aaddd0a1c44f53950acf8787 100644 (file)
@@ -253,6 +253,14 @@ void GeomAPI_AISObject::createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
   }
 }
 
+void GeomAPI_AISObject::redisplay()
+{
+  Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+  if (!anAIS.IsNull()) {
+    Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+    aContext->Redisplay(anAIS, false);
+  }
+}
 
 
 void GeomAPI_AISObject::setColor(const int& theColor)
index a76016bd6d738989f04238cb02037f5b291f17bb..c916320c093b70c4bfd9306df2fbee7c064ea3aa 100644 (file)
@@ -78,6 +78,10 @@ class GEOMAPI_EXPORT GeomAPI_AISObject : public GeomAPI_Interface
   void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
                    std::shared_ptr<GeomAPI_Pln> thePlane);
 
+  /** \brief Redisplays the current AIS object in the context
+   */
+  void redisplay();
+
   /** \brief Assigns the color for the shape
    *  \param[in] theColor index of the color
    */
index f57605c8c4fe2ee37f078ab46f0ea545f8d7d5e5..096dc4a96bc01d45798762380b297aa7325a315d 100644 (file)
@@ -7,6 +7,7 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Shape.h>
+#include <GeomAPI_Vertex.h>
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <BRep_Tool.hxx>
 #include <TopoDS_Vertex.hxx>
@@ -19,7 +20,7 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_PointBuilder::point(
   const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
   BRepBuilderAPI_MakeVertex aMaker(aPnt);
   TopoDS_Vertex aVertex = aMaker.Vertex();
-  std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+  std::shared_ptr<GeomAPI_Vertex> aRes(new GeomAPI_Vertex);
   aRes->setImpl(new TopoDS_Shape(aVertex));
   return aRes;
 }
index 65d4cb70bb76d66c9d87d07d71f9dcbe82702e46..fb6ebf8e46e9605955054ab3b3d86ed55851fd5e 100644 (file)
@@ -14,6 +14,7 @@
 #include <Model_ResultBody.h>
 #include <Model_ResultGroup.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_CompositeFeature.h>
 #include <Events_Loop.h>
 #include <Events_Error.h>
 
@@ -844,14 +845,21 @@ void Model_Document::synchronizeFeatures(const bool theMarkUpdated, const bool t
     }
   }
   // update results of thefeatures (after features created because they may be connected, like sketch and sub elements)
+  std::list<FeaturePtr> aComposites; // composites must be updated after their subs (issue 360)
   TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
   for (; aLabIter2.More(); aLabIter2.Next()) {
     TDF_Label aFeatureLabel = aLabIter2.Value()->Label();
     if (myObjs.IsBound(aFeatureLabel)) {  // a new feature is inserted
       FeaturePtr aFeature = myObjs.Find(aFeatureLabel);
+      if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature).get())
+        aComposites.push_back(aFeature);
       updateResults(aFeature);
     }
   }
+  std::list<FeaturePtr>::iterator aComposite = aComposites.begin();
+  for(; aComposite != aComposites.end(); aComposite++) {
+    updateResults(*aComposite);
+  }
 
   // check all features are checked: if not => it was removed
   NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myObjs);
index 7827db07c64db84db1b077ad47cbe93825dfac11..306c4d47eb451cf4e8d6200679b8e2b2ff3216af 100644 (file)
@@ -19,6 +19,7 @@
 #include <Config_AttributeMessage.h>
 #include <Config_ValidatorMessage.h>
 #include <Config_ModuleReader.h>
+#include <ModelAPI_ResultPart.h>
 
 #include <TDF_CopyTool.hxx>
 #include <TDF_DataSet.hxx>
@@ -235,7 +236,8 @@ Model_Session::Model_Session()
   ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session>(this));
   // register the configuration reading listener
   Events_Loop* aLoop = Events_Loop::loop();
-  static const Events_ID kFeatureEvent = Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
+  static const Events_ID kFeatureEvent = 
+    Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
   aLoop->registerListener(this, kFeatureEvent);
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), 0, true);
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), 0, true);
@@ -245,7 +247,8 @@ Model_Session::Model_Session()
 
 void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessage)
 {
-  static const Events_ID kFeatureEvent = Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
+  static const Events_ID kFeatureEvent = 
+    Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
   static const Events_ID kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
   if (theMessage->eventID() == kFeatureEvent) {
     const std::shared_ptr<Config_FeatureMessage> aMsg = 
@@ -285,6 +288,17 @@ void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessa
   } else {  // create/update/delete
     if (myCheckTransactions && !isOperation())
       Events_Error::send("Modification of data structure outside of the transaction");
+    // if part is deleted, make the root as the current document (on undo of Parts creations)
+    static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
+    if (theMessage->eventID() == kDeletedEvent) {
+      std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleted =
+        std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+      if (aDeleted && 
+          aDeleted->groups().find(ModelAPI_ResultPart::group()) != aDeleted->groups().end()) 
+      {
+        setActiveDocument(moduleDocument());
+      }
+    }
   }
 }
 
index 149ae47970144176f6e8d610b843808e4009e629..6d7fc7cf2afa9aa7dd63e79f81c563f5c42459f1 100644 (file)
@@ -6,11 +6,13 @@ SET(CMAKE_AUTOMOC ON)
 SET(PROJECT_HEADERS
        ModuleBase.h
        ModuleBase_Filter.h
+       ModuleBase_FilterCustom.h
        ModuleBase_FilterFace.h
        ModuleBase_FilterFactory.h
        ModuleBase_FilterLinearEdge.h
-    ModuleBase_FilterMulti.h
-    ModuleBase_FilterShapeType.h
+       ModuleBase_FilterMulti.h
+       ModuleBase_FilterNoConsructionSubShapes.h
+       ModuleBase_FilterShapeType.h
        ModuleBase_Tools.h
        ModuleBase_IModule.h
        ModuleBase_Operation.h
@@ -44,11 +46,13 @@ SET(PROJECT_HEADERS
 
 SET(PROJECT_SOURCES
        ModuleBase_Filter.cpp
+       ModuleBase_FilterCustom.cpp
        ModuleBase_FilterFace.cpp
        ModuleBase_FilterFactory.cpp
        ModuleBase_FilterLinearEdge.cpp
-    ModuleBase_FilterMulti.cpp
-    ModuleBase_FilterShapeType.cpp
+       ModuleBase_FilterMulti.cpp
+       ModuleBase_FilterNoConsructionSubShapes.cpp
+       ModuleBase_FilterShapeType.cpp
        ModuleBase_Tools.cpp
        ModuleBase_IModule.cpp
        ModuleBase_IWorkshop.cpp
@@ -73,11 +77,11 @@ SET(PROJECT_SOURCES
 )
 
 SET(PROJECT_LIBRARIES
-    Config
-    ModelAPI
+       Config
+       ModelAPI
        GeomAPI
        GeomAlgoAPI
-    ${QT_LIBRARIES}
+       ${QT_LIBRARIES}
        ${CAS_VIEWER}
        ${CAS_KERNEL}
        ${CAS_SHAPE}
diff --git a/src/ModuleBase/ModuleBase_FilterCustom.cpp b/src/ModuleBase/ModuleBase_FilterCustom.cpp
new file mode 100644 (file)
index 0000000..49ea31e
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModuleBase_FilterCustom.cpp
+// Created:     10 Dec 2014
+// Author:      Natalia ERMOLAEVA
+
+
+#include "ModuleBase_FilterCustom.h"
+
+#include <StdSelect_EdgeFilter.hxx>
+#include <StdSelect_TypeOfEdge.hxx>
+
+#include <Events_Error.h>
+
+#include <QString>
+#include <QMap>
+
+ModuleBase_FilterCustom::ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter)
+: ModuleBase_Filter()
+{
+  myFilter = theFilter;
+}
+
+void ModuleBase_FilterCustom::createFilter()
+{
+}
+
+void ModuleBase_FilterCustom::setArguments(const std::list<std::string>& theArguments)
+{
+}
diff --git a/src/ModuleBase/ModuleBase_FilterCustom.h b/src/ModuleBase/ModuleBase_FilterCustom.h
new file mode 100644 (file)
index 0000000..6683207
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModuleBase_FilterCustom.h
+// Created:     10 Dec 2014
+// Author:      Natalia ERMOLAEVA
+
+#ifndef ModuleBase_FilterCustom_H
+#define ModuleBase_FilterCustom_H
+
+#include "ModuleBase.h"
+
+#include "ModuleBase_Filter.h"
+
+/**
+* This is a child of ModuleBase_Filter to be used in the factory of filters. Despite of other
+* child it does not create the internal filter itself, it get it from the constructor argument.
+* This is useful for custom filters, which are not the standard OCC filters. It is not necessary
+* to redefine the ModuleBase_Filter. The filter is realized and put here as the class parameter.
+*/
+
+class ModuleBase_FilterCustom: public ModuleBase_Filter
+{
+public:
+  /**
+   * Constructor
+   * \param theFilter an OCC filter to be used in the parent base filter
+   */
+  MODULEBASE_EXPORT ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter); 
+
+  /**
+   * Sets the arguments to the filter. Currently it is not used in this filter.
+   * \param theArguments a list of arguments
+   */
+  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
+
+protected:
+  /**
+   * It creates an OCC filter. The realization is empty because the filter is set through the constructor
+   */
+  virtual void createFilter();
+
+};
+
+#endif //ModuleBase_FilterCustom
diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp
new file mode 100644 (file)
index 0000000..feaac1c
--- /dev/null
@@ -0,0 +1,63 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModuleBase_ViewerFilters.cpp
+// Created:     07 Okt 2014
+// Author:      Vitaly SMETANNIKOV
+
+
+#include "ModuleBase_FilterNoConsructionSubShapes.h"
+#include "ModuleBase_IWorkshop.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_ResultConstruction.h>
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+
+#include <StdSelect_BRepOwner.hxx>
+
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <Geom_Curve.hxx>
+
+#include <ModelAPI_CompositeFeature.h>
+#include <GeomAPI_ICustomPrs.h>
+
+
+IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+
+Standard_Boolean ModuleBase_FilterNoConsructionSubShapes::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+  // global selection should be ignored, the filter processes only selected sub-shapes
+  Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+  if (!aShapeOwner.IsNull()) {
+    if (!aShapeOwner->ComesFromDecomposition())
+      return Standard_True;
+  }
+
+  if (theOwner->HasSelectable()) {
+    Handle(AIS_InteractiveObject) aAisObj = 
+      Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+    if (!aAisObj.IsNull()) {
+      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+      aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
+      ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
+
+      ResultConstructionPtr aConstr = 
+        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+      if (aConstr != NULL) {
+        // it provides selection only on compositie features, construction without composite
+        // feature is not selectable
+        FeaturePtr aFeature = ModelAPI_Feature::feature(aConstr);
+        CompositeFeaturePtr aComposite = 
+          std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
+        return aComposite && aComposite->numberOfSubs() > 0;
+      }
+    }
+  }
+  return Standard_False;
+}
+
diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h
new file mode 100644 (file)
index 0000000..49b1127
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        ModuleBase_ViewerFilters.h
+// Created:     07 Okt 2014
+// Author:      Vitaly SMETANNIKOV
+
+
+#ifndef ModuleBase_FilterNoConsructionSubShapes_H
+#define ModuleBase_FilterNoConsructionSubShapes_H
+
+#include <QStringList>
+
+#include <SelectMgr_Filter.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+class ModuleBase_IWorkshop;
+
+/**
+* A filter which provides filtering of selection in 3d viewer.
+* Installing of this filter lets to select objects which belong to 
+* currently active document or to global document
+*/
+DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+class ModuleBase_FilterNoConsructionSubShapes: public SelectMgr_Filter
+{
+public:
+  Standard_EXPORT ModuleBase_FilterNoConsructionSubShapes(ModuleBase_IWorkshop* theWorkshop):
+      SelectMgr_Filter(), myWorkshop(theWorkshop) {}
+
+  /**
+   * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
+   * of if the selected result is a construction and the result feature is composite and has sub-elements.
+   * \param theOwner the result of selection
+   * \return whether the owner is selectable in the viewer
+  */
+  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+
+  DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes)
+
+protected:
+  ModuleBase_IWorkshop* myWorkshop;
+};
+
+#endif
\ No newline at end of file
index f3d2807da7e7cc1134801ec7acc6511f59741451..5ee8ac64a38bd0bab91c132eb4b3a475fdebfac9 100644 (file)
@@ -37,7 +37,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
                                                                const Config_WidgetAPI* theData,
                                                                const std::string& theParentId)
     : ModuleBase_ModelWidget(theParent, theData, theParentId),
-      myWorkshop(theWorkshop), myIsActive(false), myUseSubShapes(false)
+      myWorkshop(theWorkshop), myIsActive(false)
 {
   myMainWidget = new QWidget(theParent);
   QGridLayout* aMainLay = new QGridLayout(myMainWidget);
index 111b27f0d8a5e487e043b1e1e50c2d3de09033e0..bf8f8841a021a813aaf3ed2af162f98639370ded 100644 (file)
@@ -83,7 +83,6 @@ protected slots:
   ModuleBase_IWorkshop* myWorkshop;
 
   /// If true then local selector has to be activated in context
-  bool myUseSubShapes;
   bool myIsActive;
 
   typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
index bea20b3fc8423f3a79361ae8453596bd343cb08b..361f6383d8507a66b94c38457a95eab6c878f4f5 100644 (file)
@@ -365,12 +365,23 @@ bool ModuleBase_WidgetShapeSelector::acceptObjectType(const ObjectPtr theObject)
 //********************************************************************
 void ModuleBase_WidgetShapeSelector::updateSelectionName()
 {
-  if (mySelectedObject) {
-    std::string aName = mySelectedObject->data()->name();
-    myTextLine->setText(QString::fromStdString(aName));
-  } else {
-    if (myIsActive) {
-      myTextLine->setText("");
+  DataPtr aData = myFeature->data();
+  bool isNameUpdated = false;
+  if (aData.get() != NULL) {
+    AttributeSelectionPtr aSelect = aData->selection(attributeID());
+    if (aSelect) {
+      myTextLine->setText(QString::fromStdString(aSelect->namingName()));
+      isNameUpdated = true;
+    }
+  }
+  if (!isNameUpdated) {
+    if (mySelectedObject) {
+      std::string aName = mySelectedObject->data()->name();
+      myTextLine->setText(QString::fromStdString(aName));
+    } else {
+      if (myIsActive) {
+        myTextLine->setText("");
+      }
     }
   }
 }
index d5f96e489e9d191e8fed9c98b59fe79e9642ca0c..797fcd11602a123fecb98dfdaa01720fccb55adb 100644 (file)
@@ -18,7 +18,8 @@
 #include <ModuleBase_FilterLinearEdge.h>
 #include <ModuleBase_FilterFace.h>
 #include <ModuleBase_FilterMulti.h>
-
+#include <ModuleBase_FilterCustom.h>
+#include <ModuleBase_FilterNoConsructionSubShapes.h>
 
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Events.h>
@@ -126,6 +127,9 @@ void PartSet_Module::registerFilters()
   aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
   aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
   aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
+  Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
+  aFactory->registerFilter("NoConstructionSubShapesFilter",
+            new ModuleBase_FilterCustom(aSelectFilter));
 }
 
 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation) 
index bd9a98be5be667b2989e0bb8cb8b7df8fc45127d..86137696a5b3ee3751119d125c495eb4767e36d2 100644 (file)
@@ -40,11 +40,14 @@ bool PartSet_WidgetShapeSelector::storeValue() const
       if (aRefAttr) {
         TopoDS_Shape aShape = myShape->impl<TopoDS_Shape>();
         AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(mySelectedObject, aShape, mySketch);
-        if (mySelectedObject)
-          aRefAttr->setObject(mySelectedObject);
+        // this is an alternative, whether the attribute should be set or object in the attribute
+        // the first check is the attribute because the object already exist
+        // the object is set only if there is no selected attribute
+        // test case is - preselection for distance operation, which contains two points selected on lines
         if (aPntAttr)
           aRefAttr->setAttr(aPntAttr);
-
+        else if (mySelectedObject)
+          aRefAttr->setObject(mySelectedObject);
         updateObject(myFeature);
         return true;
       }
index a8f9dcad990baa4b7a0fe56252615dd0231c3458..8dd2d2e25f8388fe9bfa1a9a30b20ec45e2a5d23 100644 (file)
@@ -217,12 +217,14 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
       Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
       if (!aShapePrs.IsNull()) {
         std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
-        const TopoDS_Shape& aShape = aShapePrs->Shape();
-        std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
-        anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
+        if (aShapePtr.get()) {
+          const TopoDS_Shape& aShape = aShapePrs->Shape();
+          std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
+          anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
 
-        if (aShapePtr->isEqual(anAISShapePtr))
-          return;
+          if (aShapePtr->isEqual(anAISShapePtr))
+            return;
+        }
       }
     }
     aContext->Redisplay(aAISIO, false);