Salome HOME
ModuleBase_ViewerPrs is wrapped into shared_ptr.
authornds <nds@opencascade.com>
Wed, 6 Apr 2016 14:53:20 +0000 (17:53 +0300)
committernds <nds@opencascade.com>
Wed, 6 Apr 2016 14:57:33 +0000 (17:57 +0300)
45 files changed:
src/ModuleBase/ModuleBase_FilterValidated.cpp
src/ModuleBase/ModuleBase_ISelection.cpp
src/ModuleBase/ModuleBase_ISelection.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_ModelWidget.h
src/ModuleBase/ModuleBase_OperationFeature.cpp
src/ModuleBase/ModuleBase_OperationFeature.h
src/ModuleBase/ModuleBase_ViewerPrs.cpp
src/ModuleBase/ModuleBase_ViewerPrs.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.h
src/ModuleBase/ModuleBase_WidgetSelectorStore.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ModuleBase/ModuleBase_WidgetValidated.h
src/PartSet/PartSet_FilterInfinite.cpp
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/PartSet/PartSet_Validators.cpp
src/PartSet/PartSet_WidgetMultiSelector.cpp
src/PartSet/PartSet_WidgetMultiSelector.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2d.h
src/PartSet/PartSet_WidgetShapeSelector.cpp
src/PartSet/PartSet_WidgetShapeSelector.h
src/PartSet/PartSet_WidgetSketchCreator.cpp
src/PartSet/PartSet_WidgetSketchCreator.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Selection.h
src/XGUI/XGUI_SelectionMgr.cpp [changed mode: 0644->0755]

index 08314d734cc3cf2793e3e601ac6a9a53d891551d..a41f154631c91eb1fd185b56baa6c4fe58294553 100644 (file)
@@ -28,7 +28,7 @@ Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityO
       aCurrentWidget = myWorkshop->module()->activeWidget();
     ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
                                                                            (aCurrentWidget);
-    ModuleBase_ViewerPrs aPrs;
+    ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
     myWorkshop->selection()->fillPresentation(aPrs, theOwner);
 
     aValid = !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
index ab8008ad76442616ad8bf965630dffa447c99499..05bc1d6c1dbde197c76e1c23cf8e0dcd3d2cf051 100644 (file)
@@ -9,39 +9,40 @@
 #include <GeomAPI_Pnt.h>
 
 //********************************************************************
-void ModuleBase_ISelection::appendSelected(const QList<ModuleBase_ViewerPrs> theValues,
-                                           QList<ModuleBase_ViewerPrs>& theValuesTo)
+void ModuleBase_ISelection::appendSelected(const QList<ModuleBase_ViewerPrsPtr> theValues,
+                                           QList<ModuleBase_ViewerPrsPtr>& theValuesTo)
 {
   // collect the objects from the viewer
   QObjectPtrList anExistedObjects;
-  QList<ModuleBase_ViewerPrs>::const_iterator aPrsIt = theValuesTo.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator aPrsIt = theValuesTo.begin(),
                                               aPrsLast = theValuesTo.end();
   for (; aPrsIt != aPrsLast; aPrsIt++) {
-    if ((*aPrsIt).owner() && (*aPrsIt).object())
-      anExistedObjects.push_back((*aPrsIt).object());
+    if ((*aPrsIt)->owner() && (*aPrsIt)->object())
+      anExistedObjects.push_back((*aPrsIt)->object());
   }
 
 
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(),
                                               aLast = theValues.end();
   for (; anIt != aLast; anIt++) {
-    ObjectPtr anObject = (*anIt).object();
+    ObjectPtr anObject = (*anIt)->object();
     if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) {
-      theValuesTo.append(ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL));
+      theValuesTo.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
     }
   }
 
 }
 
 //********************************************************************
-ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrs& thePrs)
+ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   ResultPtr aResult;
 
-  if (thePrs.object().get())
-    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
-  else if (!thePrs.owner().IsNull()) {
-    ObjectPtr anObject = getSelectableObject(thePrs.owner());
+  if (thePrs->object().get())
+    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
+  else if (!thePrs->owner().IsNull()) {
+    ObjectPtr anObject = getSelectableObject(thePrs->owner());
     aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
   }
 
@@ -49,11 +50,11 @@ ResultPtr ModuleBase_ISelection::getResult(const ModuleBase_ViewerPrs& thePrs)
 }
 
 //********************************************************************
-GeomShapePtr ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrs& thePrs)
+GeomShapePtr ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   GeomShapePtr aShape;
 
-  const GeomShapePtr& aPrsShape = thePrs.shape();
+  const GeomShapePtr& aPrsShape = thePrs->shape();
   // if only result is selected, an empty shape is set to the model
   if (!aPrsShape.get() || aPrsShape->isNull()) {
   }
@@ -68,14 +69,15 @@ GeomShapePtr ModuleBase_ISelection::getShape(const ModuleBase_ViewerPrs& thePrs)
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_ISelection::getViewerPrs(const QObjectPtrList& theObjects)
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_ISelection::getViewerPrs(const QObjectPtrList& theObjects)
 {
-  QList<ModuleBase_ViewerPrs> aSelectedPrs;
+  QList<ModuleBase_ViewerPrsPtr> aSelectedPrs;
   QObjectPtrList::const_iterator anIt = theObjects.begin(), aLast = theObjects.end();
   for (; anIt != aLast; anIt++) {
     ObjectPtr anObject = *anIt;
     if (anObject.get() != NULL) {
-      aSelectedPrs.append(ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL));
+      aSelectedPrs.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
     }
   }
   return aSelectedPrs;
@@ -83,12 +85,12 @@ QList<ModuleBase_ViewerPrs> ModuleBase_ISelection::getViewerPrs(const QObjectPtr
 
 //********************************************************************
 void ModuleBase_ISelection::filterSelectionOnEqualPoints
-                                              (QList<ModuleBase_ViewerPrs>& theSelected)
+                                              (QList<ModuleBase_ViewerPrsPtr>& theSelected)
 {
-  QList<ModuleBase_ViewerPrs> aCandidatesToRemove;
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(),
+  QList<ModuleBase_ViewerPrsPtr> aCandidatesToRemove;
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theSelected.begin(),
                                               aLast = theSelected.end();
-  QList<ModuleBase_ViewerPrs>::const_iterator aSubIt;
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator aSubIt;
   for (; anIt != aLast; anIt++) {
     aSubIt = anIt;
     aSubIt++;
@@ -99,19 +101,19 @@ void ModuleBase_ISelection::filterSelectionOnEqualPoints
       }
     }
   }
-  QList<ModuleBase_ViewerPrs>::const_iterator aRemIt = aCandidatesToRemove.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator aRemIt = aCandidatesToRemove.begin(),
                                               aRemLast = aCandidatesToRemove.end();
   for (; aRemIt != aRemLast; aRemIt++) {
     theSelected.removeAll(*aRemIt);
   }
 }
 
-bool ModuleBase_ISelection::isEqualVertices(const ModuleBase_ViewerPrs thePrs1,
-                                            const ModuleBase_ViewerPrs thePrs2)
+bool ModuleBase_ISelection::isEqualVertices(const ModuleBase_ViewerPrsPtr thePrs1,
+                                            const ModuleBase_ViewerPrsPtr thePrs2)
 {
   bool isEqual = false;
-  Handle(StdSelect_BRepOwner) anOwner1 = Handle(StdSelect_BRepOwner)::DownCast(thePrs1.owner());
-  Handle(StdSelect_BRepOwner) anOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs2.owner());
+  Handle(StdSelect_BRepOwner) anOwner1 = Handle(StdSelect_BRepOwner)::DownCast(thePrs1->owner());
+  Handle(StdSelect_BRepOwner) anOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs2->owner());
 
   if (!anOwner1.IsNull() && anOwner1->HasShape() &&
       !anOwner2.IsNull() && anOwner2->HasShape()) {
index 0f9c0cb68c9489ef566dba972e8392ba03ab2974..fbfa973a6cd99e2419ecc59006cacc062622a8b8 100644 (file)
@@ -36,23 +36,23 @@ class ModuleBase_ISelection
 
   /// Returns a list of viewer selected presentations
   /// \return list of presentations
-  virtual QList<ModuleBase_ViewerPrs> getSelected(const SelectionPlace& thePlace = Browser) const = 0;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getSelected(const SelectionPlace& thePlace = Browser) const = 0;
 
   /// The values are appended to the first parameter list if the first list does not contain an item
   /// with the same object
   /// \param theValues a list of new values
   /// \param theValuesTo a list, that will be changed
-  static void appendSelected(const QList<ModuleBase_ViewerPrs> theValues,
-                             QList<ModuleBase_ViewerPrs>& theValuesTo);
+  static void appendSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>> theValues,
+                             QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValuesTo);
 
   /// Returns a list of viewer highlited presentations
   /// \return list of presentations
-  virtual QList<ModuleBase_ViewerPrs> getHighlighted() const = 0;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const = 0;
 
   /// Fills the viewer presentation parameters by the parameters from the owner
   /// \param thePrs a container for selection
   /// \param theOwner a selection owner
-  virtual void fillPresentation(ModuleBase_ViewerPrs& thePrs,
+  virtual void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
                                 const Handle_SelectMgr_EntityOwner& theOwner) const = 0;
 
   /**
@@ -89,35 +89,35 @@ class ModuleBase_ISelection
   //! If the shape is equal to the shape of selected object, it returns an empty shape
   //! \param thePrs a selected object
   //! \return a shape
-  MODULEBASE_EXPORT ResultPtr getResult(const ModuleBase_ViewerPrs& thePrs);
+  MODULEBASE_EXPORT ResultPtr getResult(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   //! Return the shape from the viewer presentation.
   //! If the shape is equal to the shape of selected object, it returns an empty shape
   //! \param thePrs a selected object
   //! \return a shape
-  MODULEBASE_EXPORT GeomShapePtr getShape(const ModuleBase_ViewerPrs& thePrs);
+  MODULEBASE_EXPORT GeomShapePtr getShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   //! Return the IO from the viewer presentation.
   //! \param thePrs a selected object
   //! \return an interactive object
-  virtual MODULEBASE_EXPORT Handle(AIS_InteractiveObject) getIO(const ModuleBase_ViewerPrs& thePrs) = 0;
+  virtual MODULEBASE_EXPORT Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
 
   //! Wraps the object list into the viewer prs list
   //! \param theObjects a list of objects
   //! \return a list of prs, where only object is not empty
-  static MODULEBASE_EXPORT QList<ModuleBase_ViewerPrs> getViewerPrs(
+  static MODULEBASE_EXPORT QList<std::shared_ptr<ModuleBase_ViewerPrs>> getViewerPrs(
                                                        const QObjectPtrList& theObjects);
 
   /// Removes selection items where owners have equal vertices. The first
   /// owner with the qual vertex stays in the list.
   static MODULEBASE_EXPORT void filterSelectionOnEqualPoints
-                                              (QList<ModuleBase_ViewerPrs>& theSelected);
+                                              (QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected);
 private:
   /// Returns true if the presentations have an owner with a vertex and these vertices are equal.
   /// \param thePrs1 the first viewer selected presentation
   /// \param thePrs2 the second viewer selected presentation
-  static bool isEqualVertices(const ModuleBase_ViewerPrs thePrs1,
-                              const ModuleBase_ViewerPrs thePrs2);
+  static bool isEqualVertices(const std::shared_ptr<ModuleBase_ViewerPrs> thePrs1,
+                              const std::shared_ptr<ModuleBase_ViewerPrs> thePrs2);
 };
 
 #endif
index caeb3dbbd293d16d158c1b59a1298afeff68a876..3c0fa44d14d622eaf264738d09d60db16b493025 100644 (file)
@@ -99,7 +99,7 @@ Q_OBJECT
   //! Select features clearing previous selection. 
   //! If the list is empty then selection will be cleared
   //! \param theValues a list of presentations
-  virtual void setSelected(const QList<ModuleBase_ViewerPrs>& theValues) = 0;
+  virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
 
    /// Update of commands status
   virtual void updateCommandStatus() = 0;
index 279d1e77453e2894f4d00cfe3be094c14ce54dc2..3da454d0ed46935cb369a35ebbe1f90a2e93a7b2 100644 (file)
@@ -104,7 +104,7 @@ Q_OBJECT
   /// This value should be processed in the widget according to the needs
   /// \param theValues the wrapped selection values
   /// \param theToValidate the boolean value whether the value should be checked by filters
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate)
   {
     return false;
@@ -112,7 +112,7 @@ Q_OBJECT
 
   /// Returns values which should be highlighted when the whidget is active
   /// \param theValues a list of presentations
-  virtual void getHighlighted(QList<ModuleBase_ViewerPrs>& theValues) {};
+  virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) {};
 
   /// Restore value from attribute data to the widget's control. Emits signals before and after store
   /// \return True in success
index 0cc1cfea1087925ca846efb76b5241045590d377..f6838a0494f216f1ca46cdda78d7145e2c9ae429 100755 (executable)
@@ -412,11 +412,11 @@ FeaturePtr ModuleBase_OperationFeature::previousCurrentFeature()
 void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelection,
                                          ModuleBase_IViewer* theViewer)
 {
-  QList<ModuleBase_ViewerPrs> aPreSelected;
+  QList<ModuleBase_ViewerPrsPtr> aPreSelected;
   // Check that the selected result are not results of operation feature
   FeaturePtr aFeature = feature();
   if (aFeature) {
-    QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
+    QList<ModuleBase_ViewerPrsPtr> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
 
     std::list<ResultPtr> aResults = aFeature->results();
     QObjectPtrList aResList;
@@ -424,8 +424,8 @@ void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelect
     for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
       aResList.append(*aIt);
 
-    foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
-      if ((!aResList.contains(aPrs.object())) && (aPrs.object() != aFeature))
+    foreach (ModuleBase_ViewerPrsPtr aPrs, aSelected) {
+      if ((!aResList.contains(aPrs->object())) && (aPrs->object() != aFeature))
         aPreSelected.append(aPrs);
     }
   } else
@@ -434,7 +434,7 @@ void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelect
   setPreselection(aPreSelected);
 }
 
-void ModuleBase_OperationFeature::setPreselection(const QList<ModuleBase_ViewerPrs>& theValues)
+void ModuleBase_OperationFeature::setPreselection(const QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   clearPreselection();
   myPreSelection = theValues;
index b6f5c95fd9315781f5733538f360a8b629c0cf30..48c374a65c4a55be5db7537d35e890485b78e447 100755 (executable)
@@ -100,7 +100,7 @@ Q_OBJECT
 
   /// Fill internal map by preselection
   /// \param theValues a list of preselection
-  void setPreselection(const QList<ModuleBase_ViewerPrs>& theValues);
+  void setPreselection(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// \brief Set property pane to the operation
   /// \param theProp a property panel instance
@@ -177,7 +177,7 @@ Q_OBJECT
   bool myIsEditing;
 
   /// List of pre-selected object 
-  QList<ModuleBase_ViewerPrs> myPreSelection;
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myPreSelection;
 
   /// If the operation works with feature which is sub-feature of another one
   /// then this variable has to be initialised by parent feature 
index f11b3b0773ef0330cb50669abf288b9dbd95a923..43b584bdbf67370ef90f271d031edb1ed798acf7 100644 (file)
@@ -8,11 +8,6 @@
 
 #include <ModuleBase_ResultPrs.h>
 
-ModuleBase_ViewerPrs::ModuleBase_ViewerPrs()
-{
-
-}
-
 ModuleBase_ViewerPrs::ModuleBase_ViewerPrs(ObjectPtr theResult, 
                                            const GeomShapePtr& theShape, 
                                            Handle_SelectMgr_EntityOwner theOwner) 
@@ -43,7 +38,8 @@ bool ModuleBase_ViewerPrs::operator==(const ModuleBase_ViewerPrs& thePrs)
     Handle(StdSelect_BRepOwner) anOwner1 = Handle(StdSelect_BRepOwner)::DownCast(myOwner);
     Handle(StdSelect_BRepOwner) anOwner2 = Handle(StdSelect_BRepOwner)::DownCast(thePrs.owner());
     if (!anOwner1.IsNull() && !anOwner2.IsNull())
-      isEqualOwner = anOwner1->Shape() == anOwner2->Shape();
+      isEqualOwner = (anOwner1->Shape().IsNull() && anOwner2->Shape().IsNull()) ||
+                      anOwner1->Shape().IsEqual(anOwner2->Shape());
   }
 
   if (isEqualResult && isEqualShape &&
@@ -56,7 +52,8 @@ bool ModuleBase_ViewerPrs::operator==(const ModuleBase_ViewerPrs& thePrs)
     Handle(ModuleBase_BRepOwner) aCSolidOwner2 = Handle(ModuleBase_BRepOwner)::DownCast(thePrs.owner());
     isEqualIO = !aCSolidOwner1.IsNull() && !aCSolidOwner2.IsNull();
     if (!aCSolidOwner1.IsNull() && !aCSolidOwner1.IsNull())
-      isEqualOwner = aCSolidOwner1->Shape() == aCSolidOwner1->Shape();
+      isEqualOwner = (aCSolidOwner1->Shape().IsNull() && aCSolidOwner2->Shape().IsNull()) ||
+                      aCSolidOwner1->Shape().IsEqual(aCSolidOwner2->Shape());
   }
 
   return isEqualResult && isEqualShape && isEqualOwner && isEqualIO;
index 39513240bce2657b4936570109be66bc48a2ac54..7a3112b42059c1fe495904aff02dd5deaffbf1c8 100644 (file)
 class ModuleBase_ViewerPrs
 {
  public:
-  /// Constructor
-  MODULEBASE_EXPORT ModuleBase_ViewerPrs();
-
   /// Constructor
   /// \param theResult an object
   /// \param theShape a viewer shape
   /// \param theOwner a selection owner
-  MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult, const GeomShapePtr& theShape,
-                       Handle_SelectMgr_EntityOwner theOwner);
+  MODULEBASE_EXPORT ModuleBase_ViewerPrs(ObjectPtr theResult = ObjectPtr(),
+                                         const GeomShapePtr& theShape = GeomShapePtr(),
+                                         Handle_SelectMgr_EntityOwner theOwner = NULL);
 
   /// Destructor
   MODULEBASE_EXPORT virtual ~ModuleBase_ViewerPrs();
@@ -110,4 +108,6 @@ class ModuleBase_ViewerPrs
   Handle(AIS_InteractiveObject) myInteractive;  /// interactive object
 };
 
+typedef std::shared_ptr<ModuleBase_ViewerPrs> ModuleBase_ViewerPrsPtr;
+
 #endif
index 157eb4f9a8154fadc5608d32532c7177037e9e5b..8e278515111d0b1c5a9542112b30f0b70d5f3edc 100755 (executable)
@@ -215,19 +215,19 @@ bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
 }
 
 //********************************************************************
-bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                                   const bool theToValidate)
 {
-  QList<ModuleBase_ViewerPrs> aSkippedValues;
+  QList<ModuleBase_ViewerPrsPtr> aSkippedValues;
 
   /// remove unused objects from the model attribute.
   /// It should be performed before new attributes append.
   removeUnusedAttributeObjects(theValues);
 
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
   bool isDone = false;
   for (; anIt != aLast; anIt++) {
-    ModuleBase_ViewerPrs aValue = *anIt;
+    ModuleBase_ViewerPrsPtr aValue = *anIt;
     bool aProcessed = false;
     if (!theToValidate || isValidInFilters(aValue)) {
       aProcessed = setSelectionCustom(aValue);
@@ -253,7 +253,7 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& t
 }
 
 //********************************************************************
-void ModuleBase_WidgetMultiSelector::getHighlighted(QList<ModuleBase_ViewerPrs>& theValues)
+void ModuleBase_WidgetMultiSelector::getHighlighted(QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   std::set<int> anAttributeIds;
   getSelectedAttributeIndices(anAttributeIds);
@@ -262,7 +262,7 @@ void ModuleBase_WidgetMultiSelector::getHighlighted(QList<ModuleBase_ViewerPrs>&
 }
 
 //********************************************************************
-bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aValid = ModuleBase_WidgetSelector::isValidSelectionCustom(thePrs);
   if (aValid) {
@@ -340,7 +340,7 @@ QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
 void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
 {
   activateSelectionAndFilters(true);
-  QList<ModuleBase_ViewerPrs> anEmptyList;
+  QList<ModuleBase_ViewerPrsPtr> anEmptyList;
   // This method will call Selection changed event which will call onSelectionChanged
   // To clear mySelection, myListControl and storeValue()
   // So, we don't need to call it
@@ -400,9 +400,9 @@ void ModuleBase_WidgetMultiSelector::setCurrentShapeType(const TopAbs_ShapeEnum
   }
 }
 
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetMultiSelector::getAttributeSelection() const
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetMultiSelector::getAttributeSelection() const
 {
-  QList<ModuleBase_ViewerPrs> aSelected;
+  QList<ModuleBase_ViewerPrsPtr> aSelected;
   convertIndicesToViewerSelection(std::set<int>(), aSelected);
   return aSelected;
 }
@@ -523,7 +523,7 @@ void ModuleBase_WidgetMultiSelector::getSelectedAttributeIndices(std::set<int>&
 }
 
 void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<int> theAttributeIds,
-                                                      QList<ModuleBase_ViewerPrs>& theValues) const
+                                                      QList<ModuleBase_ViewerPrsPtr>& theValues) const
 {
   if(myFeature.get() == NULL)
     return;
@@ -540,7 +540,8 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<in
       AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
       ResultPtr anObject = anAttr->context();
       if (anObject.get())
-        theValues.append(ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL));
+        theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, anAttr->value(), NULL)));
     }
   }
   else if (aType == ModelAPI_AttributeRefList::typeId()) {
@@ -551,7 +552,8 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<in
         continue;
       ObjectPtr anObject = aRefListAttr->object(i);
       if (anObject.get()) {
-        theValues.append(ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL));
+        theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
       }
     }
   }
@@ -568,14 +570,15 @@ void ModuleBase_WidgetMultiSelector::convertIndicesToViewerSelection(std::set<in
       AttributePtr anAttribute = aRefAttrListAttr->attribute(i);
       if (anAttribute.get()) {
         GeomShapePtr aGeomShape = ModuleBase_Tools::getShape(anAttribute, myWorkshop);
-        theValues.append(ModuleBase_ViewerPrs(anObject, aGeomShape, NULL));
+        theValues.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, aGeomShape, NULL)));
       }
     }
   }
 }
 
 void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects
-                                                 (QList<ModuleBase_ViewerPrs>& theValues)
+                                                 (QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   std::map<ObjectPtr, std::set<GeomShapePtr> > aGeomSelection = convertSelection(theValues);
   DataPtr aData = myFeature->data();
@@ -608,11 +611,11 @@ void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects
   }
   else if (aType == ModelAPI_AttributeRefAttrList::typeId()) {
     std::set<AttributePtr> anAttributes;
-    QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+    QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
     ObjectPtr anObject;
     GeomShapePtr aShape;
     for (; anIt != aLast; anIt++) {
-      ModuleBase_ViewerPrs aPrs = *anIt;
+      ModuleBase_ViewerPrsPtr aPrs = *anIt;
       getGeomSelection(aPrs, anObject, aShape);
       AttributePtr anAttr = myWorkshop->module()->findAttribute(anObject, aShape);
       if (anAttr.get() && anAttributes.find(anAttr) == anAttributes.end())
@@ -637,17 +640,17 @@ void ModuleBase_WidgetMultiSelector::removeUnusedAttributeObjects
 }
 
 std::map<ObjectPtr, std::set<GeomShapePtr> > ModuleBase_WidgetMultiSelector::convertSelection
-                                                     (QList<ModuleBase_ViewerPrs>& theValues)
+                                                     (QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   // convert prs list to objects map
   std::map<ObjectPtr, std::set<GeomShapePtr> > aGeomSelection;
   std::set<GeomShapePtr> aShapes;
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
   ObjectPtr anObject;
   GeomShapePtr aShape;
   GeomShapePtr anEmptyShape(new GeomAPI_Shape());
   for (; anIt != aLast; anIt++) {
-    ModuleBase_ViewerPrs aPrs = *anIt;
+    ModuleBase_ViewerPrsPtr aPrs = *anIt;
     getGeomSelection(aPrs, anObject, aShape);
     aShapes.clear();
     if (aGeomSelection.find(anObject) != aGeomSelection.end()) // found
index 42e789bfd21071febee62286da6aabb0a997bcbd..ee15240eddb5c033c2d59421d58b76c04b216c26 100755 (executable)
@@ -70,17 +70,17 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Widge
   /// This value should be processed in the widget according to the needs
   /// \param theValues the wrapped selection values
   /// \param theToValidate a validation of the values flag
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Returns values which should be highlighted when the whidget is active
   /// \param theValues a list of presentations
-  virtual void getHighlighted(QList<ModuleBase_ViewerPrs>& theValues);
+  virtual void getHighlighted(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Returns true if the event is processed. The default implementation is empty, returns false.
   virtual bool processDelete();
@@ -125,7 +125,7 @@ protected:
   /// Return the attribute values wrapped in a list of viewer presentations
   /// \return a list of viewer presentations, which contains an attribute result and
   /// a shape. If the attribute do not uses the shape, it is empty
-  virtual QList<ModuleBase_ViewerPrs> getAttributeSelection() const;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
 
   /// Fills the list control by the attribute values
   void updateSelectionList();
@@ -144,17 +144,17 @@ protected:
   /// \param theAttributeIds indices in attribute list to be returned
   /// \param theValues the result presentations, filled with object and shape of an attribute item
   void convertIndicesToViewerSelection(std::set<int> theAttributeIds,
-                                       QList<ModuleBase_ViewerPrs>& theValues) const;
+                                       QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) const;
 
   /// Iterates throgh the model attribute list and remove elements which do not present in the list
   /// \param theValues the wrapped selection values
-  virtual void removeUnusedAttributeObjects(QList<ModuleBase_ViewerPrs>& theValues);
+  virtual void removeUnusedAttributeObjects(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Converts viewer presentation selection list to objects and shapes map
   /// \param theValues the wrapped selection values
   /// \return selection list
   std::map<ObjectPtr, std::set<GeomShapePtr> > convertSelection
-                                          (QList<ModuleBase_ViewerPrs>& theValues);
+                                          (QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Returns true if the object and shape present in the container
   /// \param theObject a model object, a set of shapes is searched by it
index fbfe2b7997c8ebfce714ad7d30f35f4f6a5323ee..4d8034ed8dbf77a14acd0c696290cd7d8c2e2644 100755 (executable)
@@ -32,7 +32,7 @@ ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector()
 }
 
 //********************************************************************
-void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs,
                                                       ObjectPtr& theObject,
                                                       GeomShapePtr& theShape)
 {
@@ -44,7 +44,7 @@ void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrs& the
 //********************************************************************
 void ModuleBase_WidgetSelector::onSelectionChanged()
 {
-  QList<ModuleBase_ViewerPrs> aSelected = getFilteredSelected();
+  QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
   bool isDone = setSelection(aSelected, true/*false*/);
   updateOnSelectionChanged(isDone);
 }
@@ -69,9 +69,9 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone)
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetSelector::getAttributeSelection() const
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetSelector::getAttributeSelection() const
 {
-  return QList<ModuleBase_ViewerPrs>();
+  return QList<ModuleBase_ViewerPrsPtr>();
 }
 
 //********************************************************************
@@ -153,7 +153,7 @@ void ModuleBase_WidgetSelector::activateCustom()
 }
 
 //********************************************************************
-bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs);
   ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
@@ -169,7 +169,7 @@ bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPr
 }
 
 //********************************************************************
-bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   ObjectPtr anObject;
   GeomShapePtr aShape;
index a470aa8759fd39564922bdbb8a253213c3a066cb..152b76f1ef24478427f85b7c1de3cc833201e614 100755 (executable)
@@ -49,11 +49,11 @@ Q_OBJECT
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Fills the attribute with the value of the selected owner
   /// \param thePrs a selected owner
-  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// The methiod called when widget is deactivated
   virtual void deactivate();
@@ -75,7 +75,7 @@ protected:
   /// \return a list of viewer presentations, which contains an attribute result and
   /// a shape. If the attribute do not uses the shape, it is empty
   // NDS: has body is temporary
-  virtual QList<ModuleBase_ViewerPrs> getAttributeSelection() const;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
 
   /// Retunrs a list of possible shape types
   /// \return a list of shapes
@@ -100,7 +100,7 @@ protected:
   /// \param thePrs a selection
   /// \param theObject an output object
   /// \param theShape a shape of the selection
-  virtual void getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+  virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
                                 ObjectPtr& theObject,
                                 GeomShapePtr& theShape);
 
index a3584e3019f41040116e715b7b6b8f8f9c3fc7ec..ed727db8c02fedcea12a8b50790adda52a278049 100755 (executable)
@@ -19,26 +19,26 @@ class ModuleBase_IWorkshop;
 * \ingroup GUI
   Provides for an attribute backup of values. It is possible to store/ restore the attribute values.
 */
-class MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore
+class ModuleBase_WidgetSelectorStore
 {
  public:
 
   /// Constructor
-  ModuleBase_WidgetSelectorStore();
+  MODULEBASE_EXPORT ModuleBase_WidgetSelectorStore();
   /// Destructor
-  virtual ~ModuleBase_WidgetSelectorStore() {}
+  MODULEBASE_EXPORT virtual ~ModuleBase_WidgetSelectorStore() {}
 
   /// Creates a backup of the current values of the attribute
   /// \param theAttribute a model attribute which parameters are to be stored
   /// \param theWorkshop a current workshop
-  void storeAttributeValue(const AttributePtr& theAttribute,
-                           ModuleBase_IWorkshop* theWorkshop);
+  MODULEBASE_EXPORT void storeAttributeValue(const AttributePtr& theAttribute,
+                                             ModuleBase_IWorkshop* theWorkshop);
 
   /// Creates a backup of the current values of the attribute
   /// \param theAttribute a model attribute which parameters are to be restored
   /// \param theWorkshop a current workshop
-  void restoreAttributeValue(const AttributePtr& theAttribute,
-                             ModuleBase_IWorkshop* theWorkshop);
+  MODULEBASE_EXPORT void restoreAttributeValue(const AttributePtr& theAttribute,
+                                               ModuleBase_IWorkshop* theWorkshop);
 
 private:
   /// backup parameters of the model attribute. The class processes three types of attribute:
index 1bcedc636d2b0f5b1aab86c694cf2c79e844104c..ff003f0e8dcf78f50a60524b514f18570d85c844 100644 (file)
@@ -107,16 +107,17 @@ bool ModuleBase_WidgetShapeSelector::storeValueCustom() const
 }
 
 //********************************************************************
-bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                                   const bool theToValidate)
 {
   if (theValues.empty()) {
     // In order to make reselection possible, set empty object and shape should be done
-    setSelectionCustom(ModuleBase_ViewerPrs());
+    setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(new ModuleBase_ViewerPrs(
+                                                  ObjectPtr(), GeomShapePtr(), NULL)));
     return false;
   }
   // it removes the processed value from the parameters list
-  ModuleBase_ViewerPrs aValue = theValues.takeFirst();
+  ModuleBase_ViewerPrsPtr aValue = theValues.takeFirst();
   bool isDone = false;
 
   if (!theToValidate || isValidInFilters(aValue)) {
@@ -131,16 +132,16 @@ bool ModuleBase_WidgetShapeSelector::setSelection(QList<ModuleBase_ViewerPrs>& t
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetShapeSelector::getAttributeSelection() const
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetShapeSelector::getAttributeSelection() const
 {
-  QList<ModuleBase_ViewerPrs> aSelected;
+  QList<ModuleBase_ViewerPrsPtr> aSelected;
   if(myFeature) {
     DataPtr aData = myFeature->data();
     AttributePtr anAttribute = myFeature->attribute(attributeID());
 
     ObjectPtr anObject = ModuleBase_Tools::getObject(anAttribute);
     std::shared_ptr<GeomAPI_Shape> aShapePtr = getShape();
-    ModuleBase_ViewerPrs aPrs(anObject, aShapePtr, NULL);
+    ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs(anObject, aShapePtr, NULL));
     aSelected.append(aPrs);
   }
   return aSelected;
index ca7f636ecd77cdfbfc6276e1d95edef20e703f2b..35ce69e16362d6b2dd60216a2062cebc8892ffed 100644 (file)
@@ -74,7 +74,7 @@ Q_OBJECT
   /// It is redefined to check the value validity and if it is, fill the attribute with by value
   /// \param theValues the wrapped selection values
   /// \param theToValidate a flag on validation of the values
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Returns list of widget controls
@@ -105,7 +105,7 @@ Q_OBJECT
   /// Return the attribute values wrapped in a list of viewer presentations
   /// \return a list of viewer presentations, which contains an attribute result and
   /// a shape. If the attribute do not uses the shape, it is empty
-  virtual QList<ModuleBase_ViewerPrs> getAttributeSelection() const;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getAttributeSelection() const;
 
   //----------- Class members -------------
   protected:
index ad16435bc48ab2e085effda673c5a0dcdbde36a6..a78a1c893ec91d1fd1dfff115aab70e8b1c06a6b 100644 (file)
@@ -69,14 +69,14 @@ void ModuleBase_WidgetValidated::restoreAttributeValue(const AttributePtr& theAt
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aValid = true;
-  Handle(SelectMgr_EntityOwner) anOwner = thePrs.owner();
+  Handle(SelectMgr_EntityOwner) anOwner = thePrs->owner();
 
   // if an owner is null, the selection happens in the Object browser.
   // creates a selection owner on the base of object shape and the object AIS object
-  if (anOwner.IsNull() && thePrs.owner().IsNull() && thePrs.object().get()) {
+  if (anOwner.IsNull() && thePrs->owner().IsNull() && thePrs->object().get()) {
     ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
     if (aResult.get() && aResult->shape().get()) {
       // some results have no shape, e.g. the parameter one. So, they should not be validated
@@ -111,7 +111,7 @@ bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrs& th
   }
 
   // removes created owner
-  if (!anOwner.IsNull() && anOwner != thePrs.owner()) {
+  if (!anOwner.IsNull() && anOwner != thePrs->owner()) {
     anOwner.Nullify();
     myPresentedObject = ObjectPtr();
   }
@@ -125,7 +125,7 @@ AttributePtr ModuleBase_WidgetValidated::attribute() const
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& theValue)
+bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue)
 {
   bool aValid = false;
   if (getValidState(theValue, aValid)) {
@@ -140,7 +140,7 @@ bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& th
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_ViewerPrs& theValue,
+bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_ViewerPrsPtr& theValue,
                                                               const AttributePtr& theAttribute)
 {
   bool aValid = false;
@@ -176,7 +176,7 @@ bool ModuleBase_WidgetValidated::isValidSelectionForAttribute(const ModuleBase_V
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetValidated::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   return true;
 }
@@ -241,7 +241,7 @@ void ModuleBase_WidgetValidated::blockAttribute(const AttributePtr& theAttribute
 }
 
 //********************************************************************
-void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrs& theValue, const bool theValid)
+void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrsPtr& theValue, const bool theValid)
 {
   bool aValidPrs = myInvalidPrs.contains(theValue);
   bool anInvalidPrs = myInvalidPrs.contains(theValue);
@@ -267,7 +267,7 @@ void ModuleBase_WidgetValidated::storeValidState(const ModuleBase_ViewerPrs& the
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrs& theValue, bool& theValid)
+bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrsPtr& theValue, bool& theValid)
 {
   bool aValidPrs = myValidPrs.contains(theValue);
   bool anInvalidPrs = myInvalidPrs.contains(theValue);
@@ -281,12 +281,12 @@ bool ModuleBase_WidgetValidated::getValidState(const ModuleBase_ViewerPrs& theVa
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetValidated::getFilteredSelected()
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetValidated::getFilteredSelected()
 {
-  QList<ModuleBase_ViewerPrs> aSelected = myWorkshop->selection()->getSelected(
+  QList<ModuleBase_ViewerPrsPtr> aSelected = myWorkshop->selection()->getSelected(
                                                        ModuleBase_ISelection::Viewer);
 
-  QList<ModuleBase_ViewerPrs> anOBSelected = myWorkshop->selection()->getSelected(
+  QList<ModuleBase_ViewerPrsPtr> anOBSelected = myWorkshop->selection()->getSelected(
                                                        ModuleBase_ISelection::Browser);
   // filter the OB presentations
   filterPresentations(anOBSelected);
@@ -299,11 +299,11 @@ QList<ModuleBase_ViewerPrs> ModuleBase_WidgetValidated::getFilteredSelected()
 }
 
 //********************************************************************
-void ModuleBase_WidgetValidated::filterPresentations(QList<ModuleBase_ViewerPrs>& theValues)
+void ModuleBase_WidgetValidated::filterPresentations(QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
-  QList<ModuleBase_ViewerPrs> aValidatedValues;
+  QList<ModuleBase_ViewerPrsPtr> aValidatedValues;
 
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
   bool isDone = false;
   for (; anIt != aLast; anIt++) {
     if (isValidInFilters(*anIt))
@@ -316,16 +316,16 @@ void ModuleBase_WidgetValidated::filterPresentations(QList<ModuleBase_ViewerPrs>
 }
 
 //********************************************************************
-void ModuleBase_WidgetValidated::filterCompSolids(QList<ModuleBase_ViewerPrs>& theValues)
+void ModuleBase_WidgetValidated::filterCompSolids(QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   std::set<ResultCompSolidPtr> aCompSolids;
-  QList<ModuleBase_ViewerPrs> aValidatedValues;
+  QList<ModuleBase_ViewerPrsPtr> aValidatedValues;
 
   // Collect compsolids.
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
   for (; anIt != aLast; anIt++) {
-    const ModuleBase_ViewerPrs& aViewerPrs = *anIt;
-    ObjectPtr anObject = aViewerPrs.object();
+    const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt;
+    ObjectPtr anObject = aViewerPrs->object();
     ResultCompSolidPtr aResultCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(anObject);
     if(aResultCompSolid.get()) {
       aCompSolids.insert(aResultCompSolid);
@@ -335,8 +335,8 @@ void ModuleBase_WidgetValidated::filterCompSolids(QList<ModuleBase_ViewerPrs>& t
   // Filter sub-solids of compsolids.
   anIt = theValues.begin();
   for (; anIt != aLast; anIt++) {
-    const ModuleBase_ViewerPrs& aViewerPrs = *anIt;
-    ObjectPtr anObject = aViewerPrs.object();
+    const ModuleBase_ViewerPrsPtr& aViewerPrs = *anIt;
+    ObjectPtr anObject = aViewerPrs->object();
     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
     ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aResult);
     if(aResCompSolidPtr.get() && (aCompSolids.find(aResCompSolidPtr) != aCompSolids.end())) {
index 32f47d34e8091a2be31e25a6ab5300de79480dce..8b2ae15ba440f206f71ba7b03f1d27d4bc2f4bff 100644 (file)
@@ -51,7 +51,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   /// restored.The valid/invalid value is cashed.
   /// \param theValue a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue);
+  virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
   //! Returns data object by AIS
   ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
@@ -63,14 +63,14 @@ protected:
   /// Checks whether all active viewer filters validate the presentation
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  bool isValidInFilters(const ModuleBase_ViewerPrs& thePrs);
+  bool isValidInFilters(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Checks all attribute validators returns valid. It tries on the given selection
   /// to current attribute by setting the value inside and calling validators. After this,
   /// the previous attribute value is restored.The valid/invalid value is cashed.
   /// \param theValue a selected presentation in the view
   /// \return a boolean value
-  bool isValidSelectionForAttribute(const ModuleBase_ViewerPrs& theValue,
+  bool isValidSelectionForAttribute(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue,
                                     const AttributePtr& theAttribute);
 
   /// Retunrs attribute, which should be validated. In default implementation,
@@ -94,16 +94,16 @@ protected:
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Fills the attribute with the value of the selected owner
   /// \param thePrs a selected owner
-  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs) = 0;
+  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs) = 0;
 
   /// Returns a list of selected presentations in the viewer and object browser
   /// The presentations from the object browser are filtered by the AIS context filters
   /// \return a list of presentations
-  QList<ModuleBase_ViewerPrs> getFilteredSelected();
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> getFilteredSelected();
 
   /// It obtains selection filters from the workshop and activates them in the active viewer
   /// \param toActivate a flag about activation or deactivation the filters
@@ -134,22 +134,22 @@ protected:
   /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored
   /// \param theValue a viewer presentation
   /// \param theValid a valid state
-  bool getValidState(const ModuleBase_ViewerPrs& theValue, bool& theValid);
+  bool getValidState(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue, bool& theValid);
 
   /// Store the validity state of the presentation in an internal map
   /// \param theValue a viewer presentation
   /// \param theValid a valid state
-  void storeValidState(const ModuleBase_ViewerPrs& theValue, const bool theValid);
+  void storeValidState(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue, const bool theValid);
 
 private:
   /// Applies AIS context filters to the parameter list. The not approved presentations are
   /// removed from the parameters.
   /// \param theValues a list of presentations.
-  void filterPresentations(QList<ModuleBase_ViewerPrs>& theValues);
+  void filterPresentations(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Remove subshapes of compsolids if whole compsolid is present.
   /// \param theValues a list of presentations.
-  void filterCompSolids(QList<ModuleBase_ViewerPrs>& theValues);
+  void filterCompSolids(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
 protected:
   /// Reference to workshop
@@ -159,8 +159,8 @@ protected:
 
 private:
   ObjectPtr myPresentedObject; /// back up of the filtered object
-  QList<ModuleBase_ViewerPrs> myValidPrs; /// cash of valid selection presentations
-  QList<ModuleBase_ViewerPrs> myInvalidPrs; /// cash of invalid selection presentations
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs; /// cash of valid selection presentations
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs; /// cash of invalid selection presentations
 
   /// store to backup parameters of the model
   ModuleBase_WidgetSelectorStore* myAttributeStore;
index 7b8d328bac88f44067bb6cbdb6e478f5c09f3539..ce873e62e98affbbff489c2dee0036dde6a56d72 100755 (executable)
@@ -27,7 +27,7 @@ Standard_Boolean PartSet_FilterInfinite::IsOk(const Handle(SelectMgr_EntityOwner
 {
   Standard_Boolean aValid = Standard_True;
 
-  ModuleBase_ViewerPrs aPrs;
+  ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
   myWorkshop->selection()->fillPresentation(aPrs, theOwner);
   ResultPtr aResult = myWorkshop->selection()->getResult(aPrs);
   // to filter infinite construction results
index a970e4979bb85fa6464b2d42c0d4c6c440d26f37..ec2bc05b619b60b5d0bd3ac6f55bcf4667ef80fa 100644 (file)
@@ -119,25 +119,25 @@ bool PartSet_MenuMgr::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*
   bool hasAttribute = false;
   bool hasFeature = false;
 
-  QList<ModuleBase_ViewerPrs> aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
+  QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelection->getSelected(ModuleBase_ISelection::Viewer);
   ResultPtr aResult;
   FeaturePtr aFeature;
-  foreach(ModuleBase_ViewerPrs aPrs, aPrsList) {
-    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
+  foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) {
+    aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs->object());
     if (aResult.get() != NULL) {
-      const GeomShapePtr& aShape = aPrs.shape();
+      const GeomShapePtr& aShape = aPrs->shape();
       if (aShape.get() && aShape->isEqual(aResult->shape()))
         hasFeature = true;
       else
         hasAttribute = true;
     } else {
-      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aPrs.object());
+      aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aPrs->object());
       hasFeature = (aFeature.get() != NULL);
     }
   }
 
   if (aPrsList.size() == 1) {
-    const GeomShapePtr& aShape = aPrsList.first().shape();
+    const GeomShapePtr& aShape = aPrsList.first()->shape();
     if (aShape.get() && !aShape->isNull() && aShape->shapeType() == GeomAPI_Shape::VERTEX) {
       // Find 2d coordinates
       FeaturePtr aSketchFea = myModule->sketchMgr()->activeSketch();
@@ -148,7 +148,7 @@ bool PartSet_MenuMgr::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*
         std::shared_ptr<GeomAPI_Pnt2d> aSelPnt = PartSet_Tools::convertTo2D(aSketchFea, aPnt3d);
 
         // Find coincident in these coordinates
-        ObjectPtr aObj = aPrsList.first().object();
+        ObjectPtr aObj = aPrsList.first()->object();
         FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
         FeaturePtr aCoincident = PartSet_Tools::findFirstCoincidence(aFeature, aSelPnt);
         // If we have coincidence then add Detach menu
index a55a66c4844a8e60b56fb502f50e8b8dad8e6c76..cb741d4f0c169ebdfc68f0ff0ecbe534611372e3 100755 (executable)
@@ -565,14 +565,14 @@ bool PartSet_Module::createWidgets(ModuleBase_Operation* theOperation,
   if (mySketchMgr->activeSketch().get() && aFOperation && aPropertyPanel) {
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // click on a point in sketch leads here with the point is highlighted, not yet selected
-    QList<ModuleBase_ViewerPrs> aPreselection = aSelection->getHighlighted();
+    QList<ModuleBase_ViewerPrsPtr> aPreselection = aSelection->getHighlighted();
     if (aPreselection.size() == 1) {
-      ModuleBase_ViewerPrs aSelectedPrs = aPreselection[0];
-      ObjectPtr anObject = aSelectedPrs.object();
+      ModuleBase_ViewerPrsPtr aSelectedPrs = aPreselection[0];
+      ObjectPtr anObject = aSelectedPrs->object();
 
       FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
       FeaturePtr anOpFeature = aFOperation->feature();
-      GeomShapePtr aShape = aSelectedPrs.shape();
+      GeomShapePtr aShape = aSelectedPrs->shape();
       // click on the digit of dimension constrain comes here with an empty shape, so we need the check
       if (aFeature == anOpFeature && aShape.get() && !aShape->isNull()) {
         const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
@@ -612,10 +612,10 @@ void PartSet_Module::onSelectionChanged()
   if (isSketcherOp) {
     // Editing of constraints can be done on selection
     ModuleBase_ISelection* aSelect = myWorkshop->selection();
-    QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
+    QList<ModuleBase_ViewerPrsPtr> aSelected = aSelect->getSelected();
     if (aSelected.size() == 1) {
-      ModuleBase_ViewerPrs aPrs = aSelected.first();
-      ObjectPtr aObject = aPrs.object();
+      ModuleBase_ViewerPrsPtr aPrs = aSelected.first();
+      ObjectPtr aObject = aPrs->object();
       FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
       if (aFeature) {
         std::string aId = aFeature->getKind();
index 8b50a2ad57075d35fbd8993b4303882381964610..76e143c826b85faaf2e472c44602446afd8ed3c1 100755 (executable)
@@ -321,7 +321,7 @@ void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorksho
 {
   theObjectShapes.clear();
 
-  QList<ModuleBase_ViewerPrs> aValues;
+  QList<ModuleBase_ViewerPrsPtr> aValues;
   ModuleBase_IPropertyPanel* aPanel = theWorkshop->propertyPanel();
   if (aPanel) {
     ModuleBase_ModelWidget* aWidget = aPanel->activeWidget();
@@ -331,13 +331,13 @@ void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorksho
   }
 
   QList<GeomShapePtr> aShapes;
-  QList<ModuleBase_ViewerPrs>::const_iterator anIIt = aValues.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIIt = aValues.begin(),
                                               aILast = aValues.end();
   for (; anIIt != aILast; anIIt++) {
-    ModuleBase_ViewerPrs aPrs = *anIIt;
-    ObjectPtr anObject = aPrs.object();
+    ModuleBase_ViewerPrsPtr aPrs = *anIIt;
+    ObjectPtr anObject = aPrs->object();
 
-    GeomShapePtr aGeomShape = aPrs.shape();
+    GeomShapePtr aGeomShape = aPrs->shape();
     if (!aGeomShape.get() || aGeomShape->isNull()) {
       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
       if (aResult.get()) {
index 06fbec26cddd5bf4e0e5f2647c27293ae1e39cf2..8bb6f0083b6b9ec93f3ac70d95676d383dd40991 100755 (executable)
 //#define DEBUG_CURSOR
 
 /// Returns list of unique objects by sum of objects from List1 and List2
-/*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
-                                       const QList<ModuleBase_ViewerPrs>& theList2)
+/*QList<ModuleBase_ViewerPrsPtr> getSumList(const QList<ModuleBase_ViewerPrsPtr>& theList1,
+                                       const QList<ModuleBase_ViewerPrsPtr>& theList2)
 {
-  QList<ModuleBase_ViewerPrs> aRes;
-  foreach (ModuleBase_ViewerPrs aPrs, theList1) {
+  QList<ModuleBase_ViewerPrsPtr> aRes;
+  foreach (ModuleBase_ViewerPrsPtr aPrs, theList1) {
     if (!aRes.contains(aPrs))
       aRes.append(aPrs);
   }
-  foreach (ModuleBase_ViewerPrs aPrs, theList2) {
+  foreach (ModuleBase_ViewerPrsPtr aPrs, theList2) {
     if (!aRes.contains(aPrs))
       aRes.append(aPrs);
   }
 // \param theSketch a sketch to project a vertex shape of a presentation to the plane
 // and find the corresponded attribute
 // \param theFeatureList  an output list of features
-void fillFeatureList(const QList<ModuleBase_ViewerPrs>& theList,
+void fillFeatureList(const QList<ModuleBase_ViewerPrsPtr>& theList,
                      const FeaturePtr theSketch,
                      QList<FeaturePtr>& theFeatureList)
 {
-  QList<ModuleBase_ViewerPrs> aRes;
+  QList<ModuleBase_ViewerPrsPtr> aRes;
 
-  QList<ModuleBase_ViewerPrs>::const_iterator anIt = theList.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theList.begin(),
                                               aLast = theList.end();
   for (; anIt != aLast; anIt++)
   {
-    ModuleBase_ViewerPrs aPrs = *anIt;
-    FeaturePtr aFeature = ModelAPI_Feature::feature(aPrs.object());
+    ModuleBase_ViewerPrsPtr aPrs = *anIt;
+    FeaturePtr aFeature = ModelAPI_Feature::feature(aPrs->object());
     if (aFeature.get()  && !theFeatureList.contains(aFeature))
       theFeatureList.append(aFeature);
   }
@@ -1621,7 +1621,7 @@ void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
 
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   ModuleBase_ISelection* aSelect = aWorkshop->selection();
-  QList<ModuleBase_ViewerPrs> aHighlighted = aSelect->getHighlighted();
+  QList<ModuleBase_ViewerPrsPtr> aHighlighted = aSelect->getHighlighted();
 
   QList<FeaturePtr> aFeatureList;
   if (theHighlightedOnly) {
@@ -1630,7 +1630,7 @@ void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
   else {
     fillFeatureList(aHighlighted, myCurrentSketch, aFeatureList);
 
-    QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected(ModuleBase_ISelection::AllControls);
+    QList<ModuleBase_ViewerPrsPtr> aSelected = aSelect->getSelected(ModuleBase_ISelection::AllControls);
     fillFeatureList(aSelected, myCurrentSketch, aFeatureList);
   }
 
index f02f52b4ba2c59ff7d6114643966d28303c5aba0..84205e1a4f9ec5d4dcc8e6c506bc29e145e427f5 100755 (executable)
@@ -152,8 +152,9 @@ bool PartSet_SketcherReetntrantMgr::processMouseMoved(ModuleBase_IViewWindow* /*
         if (isLineFeature) {
           PartSet_WidgetPoint2D* aPoint2DWdg = dynamic_cast<PartSet_WidgetPoint2D*>(anActiveWidget);
           if (aPoint2DWdg) { // line, start point should be equal last point of the last feature line
-            QList<ModuleBase_ViewerPrs> aSelection;
-            aSelection.append(ModuleBase_ViewerPrs(aLastFeature, GeomShapePtr(), NULL));
+            QList<ModuleBase_ViewerPrsPtr> aSelection;
+            aSelection.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(aLastFeature, GeomShapePtr(), NULL)));
             aWidgetIsFilled = aPoint2DWdg->setSelection(aSelection, true);
           }
         }
index 2fdb1da74cfe562e41ac4de1edb64a936b73be95..96e50d7ac6c979b4abe48c8cb5bb5bc3a1397708 100755 (executable)
@@ -592,11 +592,11 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap
   return ResultPtr();
 }
 
-bool PartSet_Tools::isContainPresentation(const QList<ModuleBase_ViewerPrs>& theSelected,
-                                          const ModuleBase_ViewerPrs& thePrs)
+bool PartSet_Tools::isContainPresentation(const QList<ModuleBase_ViewerPrsPtr>& theSelected,
+                                          const ModuleBase_ViewerPrsPtr& thePrs)
 {
-  foreach (ModuleBase_ViewerPrs aPrs, theSelected) {
-    if (aPrs.object() == thePrs.object())
+  foreach (ModuleBase_ViewerPrsPtr aPrs, theSelected) {
+    if (aPrs->object() == thePrs->object())
       return true;
   }
   return false;
@@ -658,12 +658,12 @@ ResultPtr PartSet_Tools::findExternalVertex(CompositeFeaturePtr theSketch, std::
 }
 
 
-bool PartSet_Tools::hasVertexShape(const ModuleBase_ViewerPrs& thePrs, FeaturePtr theSketch,
+bool PartSet_Tools::hasVertexShape(const ModuleBase_ViewerPrsPtr& thePrs, FeaturePtr theSketch,
                                    Handle_V3d_View theView, double& theX, double& theY)
 {
   bool aHasVertex = false;
 
-  const GeomShapePtr& aShape = thePrs.shape();
+  const GeomShapePtr& aShape = thePrs->shape();
   if (aShape.get() && !aShape->isNull() && aShape->shapeType() == GeomAPI_Shape::VERTEX)
   {
     const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
index 489fa661577b729d14f4d39151aef766377668ba..292e4c84c31b8f68b0f756ad04837709812e03e4 100755 (executable)
@@ -179,8 +179,8 @@ public:
   /// \param theSelected a list of presentations
   /// \param thePrs a presentation to be found
   /// \return - result of check, true if the list contains the prs
-  static bool isContainPresentation(const QList<ModuleBase_ViewerPrs>& theSelected,
-                                    const ModuleBase_ViewerPrs& thePrs);
+  static bool isContainPresentation(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected,
+                                    const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Returns Result object if the given skietch contains external edge equal to the given
   /// \param theSketch - the sketch feature
@@ -200,7 +200,7 @@ public:
   /// \param theView a 3D view
   /// \param theX the output horizontal coordinate of the point
   /// \param theY the output vertical coordinate of the point
-  static bool hasVertexShape(const ModuleBase_ViewerPrs& thePrs, FeaturePtr theSketch,
+  static bool hasVertexShape(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs, FeaturePtr theSketch,
                              Handle_V3d_View theView, double& theX, double& theY);
 
 
index 4bf822bfd39cfb192da04656812a05d157907b64..9258568434ddd24225864a5315d53094676140fe 100755 (executable)
 
 int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 {
-  QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+  QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
   ModuleBase_ISelection::filterSelectionOnEqualPoints(aList);
 
   int aCount = 0;
-  foreach (ModuleBase_ViewerPrs aPrs, aList) {
-    const GeomShapePtr& aShape = aPrs.shape();
+  foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
+    const GeomShapePtr& aShape = aPrs->shape();
     if (aShape.get() && !aShape->isNull()) {
       if (aShape->shapeType() == GeomAPI_Shape::VERTEX)
         aCount++;
@@ -55,10 +55,10 @@ int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 
 int shapesNbLines(const ModuleBase_ISelection* theSelection)
 {
-  QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+  QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
   int aCount = 0;
-  foreach(ModuleBase_ViewerPrs aPrs, aList) {
-    const GeomShapePtr& aShape = aPrs.shape();
+  foreach(ModuleBase_ViewerPrsPtr aPrs, aList) {
+    const GeomShapePtr& aShape = aPrs->shape();
     if (aShape.get() && !aShape->isNull()) {
       if (aShape->shapeType() == GeomAPI_Shape::EDGE) {
         const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
@@ -156,11 +156,10 @@ bool PartSet_RadiusSelection::isValid(const ModuleBase_ISelection* theSelection,
   if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
     return isEmptySelectionValid(theOperation);
   } else {
-    QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
-    ModuleBase_ViewerPrs aPrs;
+    QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
     int aCount = 0;
-    foreach (ModuleBase_ViewerPrs aPrs, aList) {
-      const GeomShapePtr& aShape = aPrs.shape();
+    foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
+      const GeomShapePtr& aShape = aPrs->shape();
       if (aShape.get() && !aShape->isNull()) {
         if (aShape->shapeType() == GeomAPI_Shape::EDGE) {
           const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
@@ -182,7 +181,7 @@ bool PartSet_RigidSelection::isValid(const ModuleBase_ISelection* theSelection,
   if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
     return isEmptySelectionValid(theOperation);
   } else {
-    QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+    QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
     return (aList.count() == 1);
   }
 }
@@ -225,12 +224,12 @@ bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection
   if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
     return isEmptySelectionValid(theOperation);
   } else {
-    QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
+    QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
     if ((aList.size() == 0) || (aList.size() > 2))
       return false;
 
-    ModuleBase_ViewerPrs aPrs = aList.first();
-    const GeomShapePtr& aShape = aPrs.shape();
+    ModuleBase_ViewerPrsPtr aPrs = aList.first();
+    const GeomShapePtr& aShape = aPrs->shape();
     if (!aShape.get() || aShape->isNull() || aShape->shapeType() != GeomAPI_Shape::EDGE)
       return false;
     GeomAPI_Edge aEdge1(aShape);
@@ -239,7 +238,7 @@ bool PartSet_TangentSelection::isValid(const ModuleBase_ISelection* theSelection
       if (aList.size() == 2) {
         // Check second selection
         aPrs = aList.last();
-        const GeomShapePtr& aShape2 = aPrs.shape();
+        const GeomShapePtr& aShape2 = aPrs->shape();
         if (!aShape2.get() || aShape2->isNull() || aShape2->shapeType() != GeomAPI_Shape::EDGE)
           return false;
         GeomAPI_Edge aEdge2(aShape2);
@@ -272,12 +271,11 @@ bool PartSet_EqualSelection::isValid(const ModuleBase_ISelection* theSelection,
   if (theSelection->getSelected(ModuleBase_ISelection::Viewer).size() == 0) {
     return isEmptySelectionValid(theOperation);
   } else {
-    QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
-    ModuleBase_ViewerPrs aPrs;
+    QList<ModuleBase_ViewerPrsPtr> aList = theSelection->getSelected(ModuleBase_ISelection::Viewer);
     int aCount = 0;
     int aType = 0;
-    foreach (ModuleBase_ViewerPrs aPrs, aList) {
-      GeomShapePtr aShape = aPrs.shape();
+    foreach (ModuleBase_ViewerPrsPtr aPrs, aList) {
+      GeomShapePtr aShape = aPrs->shape();
       if (aShape.get() && aShape->isEdge()) {
         aCount++;
         GeomAPI_Edge aEdge(aShape);
index 380c7da3bf8f18361629e433d4e2f4a41ee80851..f3e429361a3b7433835353c590fc618281101cf3 100755 (executable)
@@ -43,7 +43,7 @@ PartSet_WidgetMultiSelector::~PartSet_WidgetMultiSelector()
 }
 
 //********************************************************************
-bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool PartSet_WidgetMultiSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aValid = ModuleBase_WidgetMultiSelector::isValidSelectionCustom(thePrs);
   if (aValid) {
@@ -62,7 +62,7 @@ void PartSet_WidgetMultiSelector::restoreAttributeValue(const AttributePtr& theA
   myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true);
 }
 
-void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs,
                                                    ObjectPtr& theObject,
                                                    GeomShapePtr& theShape)
 {
index 150f4c6fd784aba9fab7af1be443179270af9d60..d3d367119808ddb1d9ccd40091de652a8d9b47f2 100644 (file)
@@ -49,7 +49,7 @@ protected:
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Creates a backup of the current values of the attribute
   /// It should be realized in the specific widget because of different
@@ -61,7 +61,7 @@ protected:
   /// \param thePrs a selection
   /// \param theObject an output object
   /// \param theShape a shape of the selection
-  virtual void getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+  virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
                                 ObjectPtr& theObject,
                                 GeomShapePtr& theShape);
 
index 11f698ad1ff04c13d248213a37536284e136db61..f5e9903da932000e6eb492d1b706fa57b0751c93 100644 (file)
@@ -147,15 +147,15 @@ PartSet_WidgetPoint2D::~PartSet_WidgetPoint2D()
 {
 }
 
-bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                          const bool theToValidate)
 {
   bool isDone = false;
   if (theValues.empty())
     return isDone;
 
-  ModuleBase_ViewerPrs aValue = theValues.takeFirst();
-  GeomShapePtr aShape = aValue.shape();
+  ModuleBase_ViewerPrsPtr aValue = theValues.takeFirst();
+  GeomShapePtr aShape = aValue->shape();
   if (aShape.get() && !aShape->isNull()) {
     Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
     double aX, aY;
@@ -167,7 +167,7 @@ bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
   }
   else if (canBeActivatedByMove()) {
     if (feature()->getKind() == SketchPlugin_Line::ID()) {
-      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aValue.object());
+      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aValue->object());
       // Initialize new line with first point equal to end of previous
       if (aFeature.get()) {
         std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
index 711e37c1cecadc4d6f8f182a8ea1958bb8a0de9f..c685c5ca0cdc11536dec87ec9f88b2f0f73229c7 100755 (executable)
@@ -51,7 +51,7 @@ Q_OBJECT
   /// This value should be processed in the widget according to the needs
   /// \param theValues the wrapped widget values
   /// \param theToValidate a validation flag
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Select the internal content if it can be selected. It is empty in the default realization
index 499951c4a1bd5fb751b9e416c3a2291c8e9fe694..c291eb0ff7d6598923284f50fc0e19bd79921b1e 100755 (executable)
@@ -55,7 +55,7 @@ bool PartSet_WidgetShapeSelector::activateSelectionAndFilters(bool toActivate)
 }
 
 //********************************************************************
-bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aValid = ModuleBase_WidgetShapeSelector::isValidSelectionCustom(thePrs);
   if (aValid) {
@@ -65,7 +65,7 @@ bool PartSet_WidgetShapeSelector::isValidSelectionCustom(const ModuleBase_Viewer
   return aValid;
 }
 
-void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+void PartSet_WidgetShapeSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs,
                                                    ObjectPtr& theObject,
                                                    GeomShapePtr& theShape)
 {
index cb5a425adcac30cdf6d299c9cc34d297bdd6c33d..9f8c44da659c2da5c32ae7960639d612eea5936b 100644 (file)
@@ -49,13 +49,13 @@ protected:
   /// Checks the widget validity. By default, it returns true.
   /// \param thePrs a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Return an object and geom shape by the viewer presentation
   /// \param thePrs a selection
   /// \param theObject an output object
   /// \param theShape a shape of the selection
-  virtual void getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+  virtual void getGeomSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
                                 ObjectPtr& theObject,
                                 GeomShapePtr& theShape);
 
index 1f00cc5a1c02a5650d3142d432e0ca517d013342..91d36980b1b78cf63e6498c17f21bc763d2435fc 100644 (file)
@@ -125,7 +125,7 @@ void PartSet_WidgetSketchCreator::openExtrusionTransaction()
 }
 
 //********************************************************************
-bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrs& theValue)
+bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrsPtr& theValue)
 {
   bool aValid = false;
   if (myIsCustomAttribute) {
@@ -155,7 +155,7 @@ bool PartSet_WidgetSketchCreator::isValidSelection(const ModuleBase_ViewerPrs& t
 }
 
 //********************************************************************
-bool PartSet_WidgetSketchCreator::isValidSelectionCustom(const ModuleBase_ViewerPrs& theValue)
+bool PartSet_WidgetSketchCreator::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
 {
   return PartSet_WidgetSketchLabel::canFillSketch(theValue);
 }
@@ -254,16 +254,16 @@ bool PartSet_WidgetSketchCreator::hasSubObjects() const
   return aHasSubObjects;
 }
 
-bool PartSet_WidgetSketchCreator::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool PartSet_WidgetSketchCreator::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                                const bool theToValidate)
 {
   bool aDone = false;
   if (!startSketchOperation(theValues)) {
     myIsCustomAttribute = true;
-    QList<ModuleBase_ViewerPrs>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
+    QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(), aLast = theValues.end();
     bool aProcessed = false;
     for (; anIt != aLast; anIt++) {
-      ModuleBase_ViewerPrs aValue = *anIt;
+      ModuleBase_ViewerPrsPtr aValue = *anIt;
       if (!theToValidate || isValidInFilters(aValue))
         aProcessed = setSelectionCustom(aValue) || aProcessed;
     }
@@ -284,7 +284,7 @@ bool PartSet_WidgetSketchCreator::setSelection(QList<ModuleBase_ViewerPrs>& theV
 //********************************************************************
 void PartSet_WidgetSketchCreator::onSelectionChanged()
 {
-  QList<ModuleBase_ViewerPrs> aSelected = getFilteredSelected();
+  QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
   bool isDone = setSelection(aSelected, true/*false*/);
 }
 
@@ -293,14 +293,14 @@ void PartSet_WidgetSketchCreator::updateOnSelectionChanged(const bool theDone)
 {
 }
 
-bool PartSet_WidgetSketchCreator::startSketchOperation(const QList<ModuleBase_ViewerPrs>& theValues)
+bool PartSet_WidgetSketchCreator::startSketchOperation(const QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   bool aSketchStarted = false;
 
   if (theValues.size() != 1)
     return aSketchStarted;
 
-  ModuleBase_ViewerPrs aValue = theValues.front();
+  ModuleBase_ViewerPrsPtr aValue = theValues.front();
   if (!PartSet_WidgetSketchLabel::canFillSketch(aValue))
     return aSketchStarted;
 
@@ -318,7 +318,7 @@ bool PartSet_WidgetSketchCreator::startSketchOperation(const QList<ModuleBase_Vi
   // start edit operation for the sketch
   ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>
                                                             (myModule->createOperation("Sketch"));
-  QList<ModuleBase_ViewerPrs> aValues;
+  QList<ModuleBase_ViewerPrsPtr> aValues;
   aValues.push_back(aValue);
   aFOperation->setPreselection(aValues);
 
index d94e0d6d9dee4011ad7e5a44941bf74245095642..22d58f750a1f7a5344cf86b70b10e8078011e7c3 100644 (file)
@@ -55,7 +55,7 @@ public:
   /// This value should be processed in the widget according to the needs
   /// \param theValues the wrapped selection values
   /// \param theToValidate a validation of the values flag
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Editing mode depends on mode of current operation. This value is defined by it.
@@ -67,7 +67,7 @@ public:
   /// restored.The valid/invalid value is cashed.
   /// \param theValue a selected presentation in the view
   /// \return a boolean value
-  virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue);
+  virtual bool isValidSelection(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
 protected:
   /// If there is no operation in current session, start operation for modify parameters
@@ -77,7 +77,7 @@ protected:
   /// Checks whether the selection presentation contains preview planes
   /// \param theValue a selection information
   /// \return a boolean value
-  virtual bool isValidSelectionCustom(const ModuleBase_ViewerPrs& theValue);
+  virtual bool isValidSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue);
 
   /// Saves the internal parameters to the given feature
   /// \return True in success
@@ -127,7 +127,7 @@ private:
   /// Append new Sketch, set the selected plane for the sketch and start Edit operation.
   /// \param theValues a selection list
   /// \return true if the sketch is started
-  bool startSketchOperation(const QList<ModuleBase_ViewerPrs>& theValues);
+  bool startSketchOperation(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
   /// Sets the sub-object to list of base.
   static void setSketchObjectToList(const CompositeFeaturePtr& theFeature,
index 2524a9ba7f1f2bb0aa9d64457abfaaf4adde078a..74a7ee5e3074f3b350543905bab37d561f2442da 100644 (file)
@@ -132,7 +132,7 @@ PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel()
 {
 }
 
-bool PartSet_WidgetSketchLabel::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool PartSet_WidgetSketchLabel::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
                                              const bool theToValidate)
 {
   // do not use the given selection if the plane of the sketch has been already set.
@@ -141,7 +141,7 @@ bool PartSet_WidgetSketchLabel::setSelection(QList<ModuleBase_ViewerPrs>& theVal
   if (plane().get())
     return true;
 
-  ModuleBase_ViewerPrs aPrs = theValues.first();
+  ModuleBase_ViewerPrsPtr aPrs = theValues.first();
   bool aDone = setSelectionInternal(theValues, theToValidate);
   if (aDone)
     updateByPlaneSelected(aPrs);
@@ -157,11 +157,11 @@ QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
 
 void PartSet_WidgetSketchLabel::onSelectionChanged()
 {
-  QList<ModuleBase_ViewerPrs> aSelected = getFilteredSelected();
+  QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
 
   if (aSelected.empty())
     return;
-  ModuleBase_ViewerPrs aPrs = aSelected.first();
+  ModuleBase_ViewerPrsPtr aPrs = aSelected.first();
   bool aDone = setSelectionInternal(aSelected, false);
   if (aDone) {
     updateByPlaneSelected(aPrs);
@@ -209,19 +209,19 @@ void PartSet_WidgetSketchLabel::blockAttribute(const AttributePtr& theAttribute,
   }
 }
 
-bool PartSet_WidgetSketchLabel::setSelectionInternal(const QList<ModuleBase_ViewerPrs>& theValues,
+bool PartSet_WidgetSketchLabel::setSelectionInternal(const QList<ModuleBase_ViewerPrsPtr>& theValues,
                                                      const bool theToValidate)
 {
   bool aDone = false;
-  ModuleBase_ViewerPrs aValue;
   if (theValues.empty()) {
     // In order to make reselection possible, set empty object and shape should be done
-    setSelectionCustom(ModuleBase_ViewerPrs());
+    setSelectionCustom(std::shared_ptr<ModuleBase_ViewerPrs>(
+                              new ModuleBase_ViewerPrs(ObjectPtr(), GeomShapePtr(), NULL)));
     aDone = false;
   }
   else {
     // it removes the processed value from the parameters list
-    aValue = theValues.first();//.takeFirst();
+    ModuleBase_ViewerPrsPtr aValue = theValues.first();//.takeFirst();
     if (!theToValidate || isValidInFilters(aValue))
       aDone = setSelectionCustom(aValue);
   }
@@ -229,12 +229,12 @@ bool PartSet_WidgetSketchLabel::setSelectionInternal(const QList<ModuleBase_View
   return aDone;
 }
 
-void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs)
+void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   // 1. hide main planes if they have been displayed
   myPreviewPlanes->erasePreviewPlanes(myWorkshop);
   // 2. if the planes were displayed, change the view projection
-  const GeomShapePtr& aShape = thePrs.shape();
+  const GeomShapePtr& aShape = thePrs->shape();
   std::shared_ptr<GeomAPI_Shape> aGShape;
   std::shared_ptr<GeomAPI_Shape> aBaseShape;
 
@@ -340,16 +340,16 @@ void PartSet_WidgetSketchLabel::restoreAttributeValue(const AttributePtr& theAtt
   }
 }
 
-bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   return fillSketchPlaneBySelection(feature(), thePrs);
 }
 
-bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrs& thePrs)
+bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool aCanFillSketch = true;
   // avoid any selection on sketch object
-  ObjectPtr anObject = thePrs.object();
+  ObjectPtr anObject = thePrs->object();
   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
   if (aResult.get()) {
     FeaturePtr aFeature = ModelAPI_Feature::feature(aResult);
@@ -360,7 +360,7 @@ bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrs& thePrs
   if (aCanFillSketch) {
     std::shared_ptr<GeomAPI_Face> aGeomFace;
 
-    GeomShapePtr aGeomShape = thePrs.shape();
+    GeomShapePtr aGeomShape = thePrs->shape();
     if ((!aGeomShape.get() || aGeomShape->isNull()) && aResult.get()) {
       aGeomShape = aResult->shape();
     }
@@ -376,20 +376,20 @@ bool PartSet_WidgetSketchLabel::canFillSketch(const ModuleBase_ViewerPrs& thePrs
 }
 
 bool PartSet_WidgetSketchLabel::fillSketchPlaneBySelection(const FeaturePtr& theFeature,
-                                                           const ModuleBase_ViewerPrs& thePrs)
+                                                           const ModuleBase_ViewerPrsPtr& thePrs)
 {
   bool isOwnerSet = false;
 
-  const GeomShapePtr& aShape = thePrs.shape();
+  const GeomShapePtr& aShape = thePrs->shape();
   std::shared_ptr<GeomAPI_Dir> aDir;
 
-  if (thePrs.object() && (theFeature != thePrs.object())) {
+  if (thePrs->object() && (theFeature != thePrs->object())) {
     DataPtr aData = theFeature->data();
     AttributeSelectionPtr aSelAttr = 
       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
       (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
     if (aSelAttr) {
-      ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
+      ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs->object());
       if (aRes) {
         GeomShapePtr aShapePtr(new GeomAPI_Shape());
         if (!aShape.get() || aShape->isNull()) {  // selection happens in the OCC viewer
index e962135effef0c031509d86e19194322a59b4e1a..30efc49ec353e0f177d660dc41f78b4277d0f884 100644 (file)
@@ -55,7 +55,7 @@ public:
   /// It is redefined to do nothing if the plane of the sketch has been already set.
   /// \param theValues the wrapped selection values
   /// \param theToValidate a validation flag
-  virtual bool setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+  virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Returns list of widget controls
@@ -73,10 +73,10 @@ public:
   virtual void setHighlighted(bool) { /*do nothing*/ };
   virtual void enableFocusProcessing();
 
-  static bool canFillSketch(const ModuleBase_ViewerPrs& thePrs);
+  static bool canFillSketch(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   static bool fillSketchPlaneBySelection(const FeaturePtr& theFeature,
-                                         const ModuleBase_ViewerPrs& thePrs);
+                                         const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
 signals:
   /// Signal on plane selection
@@ -104,7 +104,7 @@ protected:
 
   /// Fills the attribute with the value of the selected owner
   /// \param thePrs a selected owner
-  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
+  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
   /// Saves the internal parameters to the given feature
   /// \return True in success
@@ -139,12 +139,12 @@ protected:
   /// It is redefined to do nothing if the plane of the sketch has been already set.
   /// \param theValues the wrapped selection values
   /// \param theToValidate a validation flag
-  bool setSelectionInternal(const QList<ModuleBase_ViewerPrs>& theValues,
+  bool setSelectionInternal(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                             const bool theToValidate);
 
   /// Erase preview planes, disconnect widget, change the view projection
   /// \param thePrs a selected presentation
-  void updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs);
+  void updateByPlaneSelected(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
  protected:
   /// Activate or deactivate selection
index 9c81a942c23d212e4b01fb03a5cea2362eccceae..6122c232f2af642a6f36549f55651ddac6879269 100644 (file)
@@ -308,14 +308,14 @@ void XGUI_ContextMenuMgr::updateViewerMenu()
 
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  QList<ModuleBase_ViewerPrs> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
+  QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
   if (aPrsList.size() > 0) {
     bool isVisible = false;
     bool isShading = false;
     bool canBeShaded = false;
     ObjectPtr aObject;
-    foreach(ModuleBase_ViewerPrs aPrs, aPrsList) {
-      aObject = aPrs.object();
+    foreach(ModuleBase_ViewerPrsPtr aPrs, aPrsList) {
+      aObject = aPrs->object();
       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
       if (aRes && aRes->isDisplayed()) {
         isVisible = true;
@@ -510,7 +510,7 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
       theMenu->addSeparator();
   }
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
-  QList<ModuleBase_ViewerPrs> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
+  QList<ModuleBase_ViewerPrsPtr> aPrsList = aSelMgr->selection()->getSelected(ModuleBase_ISelection::Viewer);
   int aSelected = aPrsList.size();
   QActionsList aActions;
 
@@ -528,7 +528,7 @@ void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
     theMenu->addSeparator();
   }
   if (aSelected == 1) {
-    ObjectPtr aObject = aPrsList.first().object();
+    ObjectPtr aObject = aPrsList.first()->object();
     if (aObject.get() != NULL) {
       std::string aName = aObject->groupName();
       if (myViewerMenu.contains(aName))
index 20e4c300c23b6d0d579649939a1a92b6f3831eef..bfb5ce29fc8303efdb18c09f4adacdd43b7dbd63 100644 (file)
@@ -541,7 +541,7 @@ bool XGUI_Displayer::isActive(ObjectPtr theObject) const
   aContext->ActivatedModes(anAIS, aModes);
   return aModes.Extent() > 0;
 }
-void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrs>& theValues, bool theUpdateViewer)
+void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrsPtr>& theValues, bool theUpdateViewer)
 {
   Handle(AIS_InteractiveContext) aContext = AISContext();
   if (aContext.IsNull())
@@ -549,13 +549,13 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrs>& theValues,
   if (aContext->HasOpenedContext()) {
     aContext->UnhilightSelected(false);
     aContext->ClearSelected(false);
-    foreach (ModuleBase_ViewerPrs aPrs, theValues) {
-      const GeomShapePtr& aGeomShape = aPrs.shape();
+    foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
+      const GeomShapePtr& aGeomShape = aPrs->shape();
       if (aGeomShape.get() && !aGeomShape->isNull()) {
         const TopoDS_Shape& aShape = aGeomShape->impl<TopoDS_Shape>();
         aContext->AddOrRemoveSelected(aShape, false);
       } else {
-        ObjectPtr anObject = aPrs.object();
+        ObjectPtr anObject = aPrs->object();
         ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
         if (aResult.get() && isVisible(aResult)) {
           AISObjectPtr anObj = myResult2AISObjectMap[aResult];
@@ -574,8 +574,8 @@ void XGUI_Displayer::setSelected(const  QList<ModuleBase_ViewerPrs>& theValues,
   } else {
     aContext->UnhilightCurrents(false);
     aContext->ClearCurrents(false);
-    foreach (ModuleBase_ViewerPrs aPrs, theValues) {
-      ObjectPtr anObject = aPrs.object();
+    foreach (ModuleBase_ViewerPrsPtr aPrs, theValues) {
+      ObjectPtr anObject = aPrs->object();
       ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
       if (aResult.get() && isVisible(aResult)) {
         AISObjectPtr anObj = myResult2AISObjectMap[aResult];
index 489508c2ca0f39e7f4bab6ab76080a6568ce5b3c..0ef3285f8fd2760ac8bdda2d1710d7a16f465a69 100644 (file)
@@ -92,7 +92,7 @@ class XGUI_EXPORT XGUI_Displayer: public QObject
   /// empty, select it, otherwise select the result.
   /// \param theValues a list of presentation to be selected
   /// \param theUpdateViewer the parameter whether the viewer should be update immediatelly
-  void setSelected(const  QList<ModuleBase_ViewerPrs>& theValues, bool theUpdateViewer = true);
+  void setSelected(const  QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues, bool theUpdateViewer = true);
 
   /// Unselect all objects
   void clearSelected();
index cf8ec1f37e3061a43ef07a30b8d492ba455b0902..f3e569bbaf231bd284f220896cd9e9a785d131af 100644 (file)
@@ -101,7 +101,7 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS)
   return anObject;
 }
 
-void XGUI_ModuleConnector::setSelected(const QList<ModuleBase_ViewerPrs>& theValues)
+void XGUI_ModuleConnector::setSelected(const QList<ModuleBase_ViewerPrsPtr>& theValues)
 {
   XGUI_Displayer* aDisp = myWorkshop->displayer();
   if (theValues.isEmpty()) {
index 4b2ed19f4b8cd6bb2100a6628e2a4108ce1d904f..58afc0aa29502ffa87b2ca021efb67fa33273b11 100644 (file)
@@ -79,7 +79,7 @@ Q_OBJECT
 
   //! Select features clearing previous selection. 
   //! If the list is empty then selection will be cleared
-  virtual void setSelected(const QList<ModuleBase_ViewerPrs>& theValues);
+  virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
 
    /// Update of commands status
   virtual void updateCommandStatus();
index 27fbd63de850028ad13b3f62c4df321f8c75891f..6e9a0abc94048dd58a0d298e4a63d0fcd8596c64 100644 (file)
@@ -37,9 +37,9 @@ XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop)
 {
 }
 
-QList<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(const SelectionPlace& thePlace) const
+QList<ModuleBase_ViewerPrsPtr> XGUI_Selection::getSelected(const SelectionPlace& thePlace) const
 {
-  QList<ModuleBase_ViewerPrs> aPresentations;
+  QList<ModuleBase_ViewerPrsPtr> aPresentations;
 
   switch (thePlace) {
     case Browser:
@@ -56,17 +56,17 @@ QList<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(const SelectionPlace& th
   return aPresentations;
 }
 
-Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrs& thePrs)
+Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrsPtr& thePrs)
 {
-  Handle(AIS_InteractiveObject) anIO = thePrs.interactive();
+  Handle(AIS_InteractiveObject) anIO = thePrs->interactive();
   if (anIO.IsNull()) {
-    Handle(SelectMgr_EntityOwner) anOwner = thePrs.owner();
+    Handle(SelectMgr_EntityOwner) anOwner = thePrs->owner();
     if (!anOwner.IsNull())
       anIO = Handle(AIS_InteractiveObject)::DownCast(anOwner->Selectable());
 
-    if (anIO.IsNull() && thePrs.object()) {
+    if (anIO.IsNull() && thePrs->object()) {
       XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-      AISObjectPtr anAISObject = aDisplayer->getAISObject(thePrs.object());
+      AISObjectPtr anAISObject = aDisplayer->getAISObject(thePrs->object());
       if (anAISObject.get())
         anIO = anAISObject->impl<Handle(AIS_InteractiveObject)>();
     }
@@ -74,13 +74,13 @@ Handle(AIS_InteractiveObject) XGUI_Selection::getIO(const ModuleBase_ViewerPrs&
   return anIO;
 }
 
-void XGUI_Selection::getSelectedInViewer(QList<ModuleBase_ViewerPrs>& thePresentations) const
+void XGUI_Selection::getSelectedInViewer(QList<ModuleBase_ViewerPrsPtr>& thePresentations) const
 {
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
   if (!aContext.IsNull() && aContext->HasOpenedContext()) {
     QList<long> aSelectedIds; // Remember of selected address in order to avoid duplicates
     for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
-      ModuleBase_ViewerPrs aPrs;
+      ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
       Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
 
       if (aSelectedIds.contains((long)anOwner.Access()))
@@ -95,14 +95,14 @@ void XGUI_Selection::getSelectedInViewer(QList<ModuleBase_ViewerPrs>& thePresent
   }
 }
 
-void XGUI_Selection::getSelectedInBrowser(QList<ModuleBase_ViewerPrs>& thePresentations) const
+void XGUI_Selection::getSelectedInBrowser(QList<ModuleBase_ViewerPrsPtr>& thePresentations) const
 {
   // collect the objects  of the parameter presentation to avoid a repeted objects in the result
   QObjectPtrList aPresentationObjects;
-  QList<ModuleBase_ViewerPrs>::const_iterator aPrsIt = thePresentations.begin(),
+  QList<ModuleBase_ViewerPrsPtr>::const_iterator aPrsIt = thePresentations.begin(),
                                               aPrsLast = thePresentations.end();
   for (; aPrsIt != aPrsLast; aPrsIt++) {
-    aPresentationObjects.push_back((*aPrsIt).object());
+    aPresentationObjects.push_back((*aPrsIt)->object());
   }
 
   QObjectPtrList anObjects = selectedObjects();
@@ -110,19 +110,20 @@ void XGUI_Selection::getSelectedInBrowser(QList<ModuleBase_ViewerPrs>& thePresen
   for (; anIt != aLast; anIt++) {
     ObjectPtr anObject = *anIt;
     if (anObject.get() != NULL && !aPresentationObjects.contains(anObject)) {
-      thePresentations.append(ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL));
+      thePresentations.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
     }
   }
 }
 
-void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
+void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrsPtr& thePrs,
                                       const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
-  thePrs.setOwner(theOwner);
+  thePrs->setOwner(theOwner);
 
   Handle(AIS_InteractiveObject) anIO = 
                            Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-  thePrs.setInteractive(anIO);
+  thePrs->setInteractive(anIO);
 
   // we should not check the appearance of this feature because there can be some selected shapes
   // for one feature
@@ -138,7 +139,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
     if (!aShape.IsNull()) {
       std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
       aGeomShape->setImpl(new TopoDS_Shape(aShape));
-      thePrs.setShape(aGeomShape);
+      thePrs->setShape(aGeomShape);
     }
   } else {
 #ifdef DEBUG_DELIVERY
@@ -156,7 +157,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
       if (!aEdge.IsNull()) {
         std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
         aGeomShape->setImpl(new TopoDS_Shape(aEdge));
-        thePrs.setShape(aGeomShape);
+        thePrs->setShape(aGeomShape);
       }
     } else {
       Handle(AIS_Point) aPoint = Handle(AIS_Point)::DownCast(anIO);
@@ -169,7 +170,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
         if (!aVertex.IsNull()) {
           std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
           aGeomShape->setImpl(new TopoDS_Shape(aVertex));
-          thePrs.setShape(aGeomShape);
+          thePrs->setShape(aGeomShape);
         }
       }
     }
@@ -188,19 +189,19 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
       ResultCompSolidPtr aCompSolid = ModelAPI_Tools::compSolidOwner(aResult);
       if (aCompSolid.get()) {
         GeomShapePtr aShape = aCompSolid->shape();
-        if (aShape.get() && aShape->isEqual(thePrs.shape())) {
-          thePrs.setObject(aCompSolid);
+        if (aShape.get() && aShape->isEqual(thePrs->shape())) {
+          thePrs->setObject(aCompSolid);
           return;
         }
       }
     }
   }
-  thePrs.setObject(aFeature);
+  thePrs->setObject(aFeature);
 }
 
-QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted() const
+QList<ModuleBase_ViewerPrsPtr> XGUI_Selection::getHighlighted() const
 {
-  QList<ModuleBase_ViewerPrs> aPresentations;
+  QList<ModuleBase_ViewerPrsPtr> aPresentations;
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
   if (aContext.IsNull())
     return aPresentations;
@@ -208,24 +209,24 @@ QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted() const
   QList<long> aSelectedIds; // Remember of selected address in order to avoid duplicates
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
-    ModuleBase_ViewerPrs aPrs;
+    ModuleBase_ViewerPrsPtr aPrs(new ModuleBase_ViewerPrs());
     Handle(AIS_InteractiveObject) anIO = aContext->DetectedInteractive();
     if (aSelectedIds.contains((long)anIO.Access()))
       continue;
     
     aSelectedIds.append((long)anIO.Access());
-    aPrs.setInteractive(anIO);
+    aPrs->setInteractive(anIO);
 
     ObjectPtr aResult = aDisplayer->getObject(anIO);
     // we should not check the appearance of this feature because there can be some selected shapes
     // for one feature
-    aPrs.setObject(aResult);
+    aPrs->setObject(aResult);
     if (aContext->HasOpenedContext()) {
       TopoDS_Shape aShape = aContext->DetectedShape();
       if (!aShape.IsNull()) {
         std::shared_ptr<GeomAPI_Shape> aGeomShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
         aGeomShape->setImpl(new TopoDS_Shape(aShape));
-        aPrs.setShape(aGeomShape);
+        aPrs->setShape(aGeomShape);
       }
     }
     aPresentations.push_back(aPrs);
index d81ef7edaee93256265560b29a70aafb891a7505..f1de36228944e8abd69cf3989926df66c5304427 100644 (file)
@@ -36,17 +36,17 @@ class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
 
   /// Returns a list of viewer selected presentations
   /// \return list of presentations
-  virtual QList<ModuleBase_ViewerPrs> getSelected(const SelectionPlace& thePlace = Browser) const;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getSelected(const SelectionPlace& thePlace = Browser) const;
 
   /// Fills the viewer presentation parameters by the parameters from the owner
   /// \param thePrs a container for selection
   /// \param theOwner a selection owner
-  virtual void fillPresentation(ModuleBase_ViewerPrs& thePrs,
+  virtual void fillPresentation(std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
                                 const Handle_SelectMgr_EntityOwner& theOwner) const;
 
   /// Returns a list of viewer highlited presentations
   /// \return list of presentations
-  virtual QList<ModuleBase_ViewerPrs> getHighlighted() const;
+  virtual QList<std::shared_ptr<ModuleBase_ViewerPrs>> getHighlighted() const;
 
   /**
    * Returns list of currently selected objects in object browser
@@ -93,18 +93,18 @@ class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
   //! Return the IO from the viewer presentation.
   //! \param thePrs a selected object
   //! \return an interactive object
-  virtual Handle(AIS_InteractiveObject) getIO(const ModuleBase_ViewerPrs& thePrs);
+  virtual Handle(AIS_InteractiveObject) getIO(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
 
 protected:
   /// Fills the list of presentations by objects selected in the viewer.
   /// \param thePresentations an output list of presentation
-  void getSelectedInViewer(QList<ModuleBase_ViewerPrs>& thePresentations) const;
+  void getSelectedInViewer(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePresentations) const;
   /// Fills the list of presentations by objects selected in the object browser.
   /// ViewerPrs contains only object parameter not empty.
   /// If the given list of presentations already has a viewer presentation with the same object
   /// as selected in the browser, a new item is not appended to the list of presentations.
   /// \param thePresentations an output list of presentation
-  void getSelectedInBrowser(QList<ModuleBase_ViewerPrs>& thePresentations) const;
+  void getSelectedInBrowser(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& thePresentations) const;
 
   /// Generates a vertex or edge by the give IO if it is an AIS created on trihedron
   /// \param theIO a selected object
old mode 100644 (file)
new mode 100755 (executable)
index fd7729f..75ac126
@@ -93,21 +93,22 @@ void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer)
 //**************************************************************
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {
-  QList<ModuleBase_ViewerPrs> aSelectedPrs =
+  QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
              myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
 
-  QList<ModuleBase_ViewerPrs> aTmpList = aSelectedPrs;
+  QList<ModuleBase_ViewerPrsPtr> aTmpList = aSelectedPrs;
   ObjectPtr aObject;
   FeaturePtr aFeature;
-  foreach(ModuleBase_ViewerPrs aPrs, aTmpList) {
-    aObject = aPrs.object();
+  foreach(ModuleBase_ViewerPrsPtr aPrs, aTmpList) {
+    aObject = aPrs->object();
     if (aObject.get()) {
       aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
       if (aFeature.get()) {
         const std::list<std::shared_ptr<ModelAPI_Result>> aResList = aFeature->results();
         std::list<ResultPtr>::const_iterator aIt;
         for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) {
-          aSelectedPrs.append(ModuleBase_ViewerPrs((*aIt), GeomShapePtr(), NULL));
+          aSelectedPrs.append(std::shared_ptr<ModuleBase_ViewerPrs>(
+               new ModuleBase_ViewerPrs((*aIt), GeomShapePtr(), NULL)));
         }
       }
     }
@@ -127,8 +128,8 @@ void XGUI_SelectionMgr::onViewerSelection()
   FeaturePtr aFeature;
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
   if (!aContext.IsNull()) {
-    QList<ModuleBase_ViewerPrs> aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer);
-    foreach(ModuleBase_ViewerPrs aPrs, aPresentations) {
+    QList<ModuleBase_ViewerPrsPtr> aPresentations = selection()->getSelected(ModuleBase_ISelection::Viewer);
+    foreach(ModuleBase_ViewerPrsPtr aPrs, aPresentations) {
       if (aPrs.object().get()) {
         aFeatures.append(aPrs.object());
         if (aPrs.shape().get()) {
@@ -152,7 +153,7 @@ void XGUI_SelectionMgr::onViewerSelection()
 //**************************************************************
 void XGUI_SelectionMgr::updateSelectionBy(const ModuleBase_ISelection::SelectionPlace& thePlace)
 {
-  QList<ModuleBase_ViewerPrs> aSelectedPrs =
+  QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
                myWorkshop->selector()->selection()->getSelected(thePlace);
   if (thePlace == ModuleBase_ISelection::Browser) {
     XGUI_Displayer* aDisplayer = myWorkshop->displayer();
@@ -168,7 +169,7 @@ void XGUI_SelectionMgr::clearSelection()
   myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
   myWorkshop->objectBrowser()->blockSignals(aBlocked);
   
-  QList<ModuleBase_ViewerPrs> aSelectedPrs =
+  QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
              myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
 
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();