]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
It corrects the validator parameter from the entrity to viewerprs in order to validat...
authornds <natalia.donis@opencascade.com>
Mon, 13 Apr 2015 06:22:08 +0000 (09:22 +0300)
committernds <natalia.donis@opencascade.com>
Mon, 13 Apr 2015 06:22:08 +0000 (09:22 +0300)
It removes filters.

35 files changed:
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_FilterCustom.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterCustom.h [deleted file]
src/ModuleBase/ModuleBase_FilterFace.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterFace.h [deleted file]
src/ModuleBase/ModuleBase_FilterLinearEdge.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterLinearEdge.h [deleted file]
src/ModuleBase/ModuleBase_FilterMulti.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterMulti.h [deleted file]
src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h [deleted file]
src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.h [deleted file]
src/ModuleBase/ModuleBase_FilterShapeType.cpp [deleted file]
src/ModuleBase/ModuleBase_FilterShapeType.h [deleted file]
src/ModuleBase/ModuleBase_FilterValidated.cpp
src/ModuleBase/ModuleBase_ViewerFilters.cpp
src/ModuleBase/ModuleBase_ViewerFilters.h
src/ModuleBase/ModuleBase_ViewerPrs.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetMultiSelector.h
src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp
src/ModuleBase/ModuleBase_WidgetShapeSelector.h
src/ModuleBase/ModuleBase_WidgetValidated.cpp
src/ModuleBase/ModuleBase_WidgetValidated.h
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_FilterSketchEntity.cpp [deleted file]
src/PartSet/PartSet_FilterSketchEntity.h [deleted file]
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Workshop.cpp

index fd7878d103757eb542a6e5705a89b46c650ff25c..f74124ea6effb801fcb7ea0e9ac2499ad026052d 100644 (file)
@@ -6,14 +6,7 @@ SET(CMAKE_AUTOMOC ON)
 SET(PROJECT_HEADERS
        ModuleBase.h
        ModuleBase_Filter.h
-       ModuleBase_FilterCustom.h
-       ModuleBase_FilterFace.h
        ModuleBase_FilterFactory.h
-       ModuleBase_FilterLinearEdge.h
-       ModuleBase_FilterMulti.h
-       ModuleBase_FilterNoConsructionSubShapes.h
-       ModuleBase_FilterNoDegeneratedEdge.h
-       ModuleBase_FilterShapeType.h
        ModuleBase_FilterValidated.h
        ModuleBase_Tools.h
        ModuleBase_IModule.h
@@ -57,14 +50,7 @@ SET(PROJECT_HEADERS
 
 SET(PROJECT_SOURCES
        ModuleBase_Filter.cpp
-       ModuleBase_FilterCustom.cpp
-       ModuleBase_FilterFace.cpp
        ModuleBase_FilterFactory.cpp
-       ModuleBase_FilterLinearEdge.cpp
-       ModuleBase_FilterMulti.cpp
-       ModuleBase_FilterNoConsructionSubShapes.cpp
-       ModuleBase_FilterNoDegeneratedEdge.cpp
-       ModuleBase_FilterShapeType.cpp
        ModuleBase_FilterValidated.cpp
        ModuleBase_Tools.cpp
        ModuleBase_IModule.cpp
diff --git a/src/ModuleBase/ModuleBase_FilterCustom.cpp b/src/ModuleBase/ModuleBase_FilterCustom.cpp
deleted file mode 100644 (file)
index 49ea31e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterCustom.cpp
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterCustom.h"
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-ModuleBase_FilterCustom::ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter)
-: ModuleBase_Filter()
-{
-  myFilter = theFilter;
-}
-
-void ModuleBase_FilterCustom::createFilter()
-{
-}
-
-void ModuleBase_FilterCustom::setArguments(const std::list<std::string>& theArguments)
-{
-}
diff --git a/src/ModuleBase/ModuleBase_FilterCustom.h b/src/ModuleBase/ModuleBase_FilterCustom.h
deleted file mode 100644 (file)
index 6de1620..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterCustom.h
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterCustom_H
-#define ModuleBase_FilterCustom_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-/**
-* \ingroup GUI
-* This is a child of ModuleBase_Filter to be used in the factory of filters. Despite of other
-* child it does not create the internal filter itself, it get it from the constructor argument.
-* This is useful for custom filters, which are not the standard OCC filters. It is not necessary
-* to redefine the ModuleBase_Filter. The filter is realized and put here as the class parameter.
-*/
-
-class ModuleBase_FilterCustom: public ModuleBase_Filter
-{
-public:
-  /**
-   * Constructor
-   * \param theFilter an OCC filter to be used in the parent base filter
-   */
-  MODULEBASE_EXPORT ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter); 
-
-  /**
-   * Sets the arguments to the filter. Currently it is not used in this filter.
-   * \param theArguments a list of arguments
-   */
-  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
-  /**
-   * It creates an OCC filter. The realization is empty because the filter is set through the constructor
-   */
-  virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterCustom
diff --git a/src/ModuleBase/ModuleBase_FilterFace.cpp b/src/ModuleBase/ModuleBase_FilterFace.cpp
deleted file mode 100644 (file)
index 3e65445..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterFace.cpp
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterFace.h"
-
-#include <StdSelect_FaceFilter.hxx>
-#include <StdSelect_TypeOfFace.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, StdSelect_TypeOfFace> FaceTypes;
-static FaceTypes MyFaceTypes;
-
-StdSelect_TypeOfFace ModuleBase_FilterFace::faceType(const std::string& theType)
-{
-  if (MyFaceTypes.count() == 0) {
-    MyFaceTypes["plane"] = StdSelect_Plane;
-    MyFaceTypes["cylinder"] = StdSelect_Cylinder;
-  }
-  QString aType = QString(theType.c_str()).toLower();
-  if (MyFaceTypes.contains(aType))
-    return MyFaceTypes[aType];
-  Events_Error::send("Face type defined in XML is not implemented!");
-  return StdSelect_AnyFace;
-}
-
-void ModuleBase_FilterFace::createFilter()
-{
-  myFilter = new StdSelect_FaceFilter(StdSelect_AnyFace);
-}
-
-void ModuleBase_FilterFace::setArguments(const std::list<std::string>& theArguments)
-{
-  if (theArguments.size()!= 1)
-    return;
-
-  std::string anArgument = theArguments.front();
-  Handle(StdSelect_FaceFilter) aFilter = Handle(StdSelect_FaceFilter)::DownCast(getFilter());
-  if (!aFilter.IsNull())
-    aFilter->SetType(faceType(anArgument));
-}
diff --git a/src/ModuleBase/ModuleBase_FilterFace.h b/src/ModuleBase/ModuleBase_FilterFace.h
deleted file mode 100644 (file)
index f3a6ef4..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterFace.h
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterFace_H
-#define ModuleBase_FilterFace_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by faces
-*/
-class ModuleBase_FilterFace: public ModuleBase_Filter
-{
-public:
-  /// Convert string to StdSelect_TypeOfFace value
-  /// \param theType a string value
-  static MODULEBASE_EXPORT StdSelect_TypeOfFace faceType(const std::string& theType);
-
-  /// Constructor
-  MODULEBASE_EXPORT ModuleBase_FilterFace(): 
-      ModuleBase_Filter() {}
-
-  /**
-   * Sets the arguments to the filter.
-   * \param theArguments a list of arguments
-   */
-  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
-  /**
-   * It creates an OCC face filter
-   */
-  virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterFace
diff --git a/src/ModuleBase/ModuleBase_FilterLinearEdge.cpp b/src/ModuleBase/ModuleBase_FilterLinearEdge.cpp
deleted file mode 100644 (file)
index a5634cb..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterLinearEdge.cpp
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterLinearEdge.h"
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <StdSelect_TypeOfEdge.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, StdSelect_TypeOfEdge> EdgeTypes;
-static EdgeTypes MyEdgeTypes;
-
-StdSelect_TypeOfEdge ModuleBase_FilterLinearEdge::edgeType(const std::string& theType)
-{
-  if (MyEdgeTypes.count() == 0) {
-    MyEdgeTypes["line"] = StdSelect_Line;
-    MyEdgeTypes["circle"] = StdSelect_Circle;
-  }
-  QString aType = QString(theType.c_str()).toLower();
-  if (MyEdgeTypes.contains(aType))
-    return MyEdgeTypes[aType];
-  Events_Error::send("Edge type defined in XML is not implemented!");
-  return StdSelect_AnyEdge;
-}
-
-void ModuleBase_FilterLinearEdge::createFilter()
-{
-  myFilter = new StdSelect_EdgeFilter(StdSelect_AnyEdge);
-}
-
-void ModuleBase_FilterLinearEdge::setArguments(const std::list<std::string>& theArguments)
-{
-  if (theArguments.size()!= 1)
-    return;
-
-  std::string anArgument = theArguments.front();
-  Handle(StdSelect_EdgeFilter) aFilter = Handle(StdSelect_EdgeFilter)::DownCast(getFilter());
-  if (!aFilter.IsNull())
-    aFilter->SetType(edgeType(anArgument));
-}
diff --git a/src/ModuleBase/ModuleBase_FilterLinearEdge.h b/src/ModuleBase/ModuleBase_FilterLinearEdge.h
deleted file mode 100644 (file)
index 0efb1a5..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterLinearEdge.h
-// Created:     10 Dec 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterLinearEdge_H
-#define ModuleBase_FilterLinearEdge_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfEdge.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by linear edges
-*/
-class ModuleBase_FilterLinearEdge: public ModuleBase_Filter
-{
-public:
-  /// Convert string to StdSelect_TypeOfFace value
-  /// \param theType a string value
-  static MODULEBASE_EXPORT StdSelect_TypeOfEdge edgeType(const std::string& theType);
-
-  /// Constructor
-  MODULEBASE_EXPORT ModuleBase_FilterLinearEdge(): 
-      ModuleBase_Filter() {}
-
-  /**
-   * Sets the arguments to the filter.
-   * \param theArguments a list of arguments
-   */
-  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
-  /**
-   * It creates an OCC edge filter
-   */
-  virtual void createFilter();
-
-};
-
-#endif //ModuleBase_FilterLinearEdge
diff --git a/src/ModuleBase/ModuleBase_FilterMulti.cpp b/src/ModuleBase/ModuleBase_FilterMulti.cpp
deleted file mode 100644 (file)
index 6fcab0a..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterMulti.cpp
-// Created:     12 Jan 2015
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterMulti.h"
-
-#include "ModuleBase_FilterLinearEdge.h"
-#include "ModuleBase_FilterShapeType.h"
-
-#include <SelectMgr_OrFilter.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-ModuleBase_Filter* ModuleBase_FilterMulti::findFilter(const std::string& theType)
-{
-  ModuleBase_Filter* aFilter = 0;
-
-  if (theType == "line") {
-    aFilter = new ModuleBase_FilterLinearEdge();
-    std::list<std::string> anArguments;
-    anArguments.push_back(theType);
-    aFilter->setArguments(anArguments);
-  }
-  if (theType == "vertex") {
-    aFilter = new ModuleBase_FilterShapeType();
-    std::list<std::string> anArguments;
-    anArguments.push_back(theType);
-    aFilter->setArguments(anArguments);
-  }
-
-  return aFilter;
-}
-
-void ModuleBase_FilterMulti::createFilter()
-{
-  myFilter = new SelectMgr_OrFilter();
-
-  // set filter arguments
-  Handle(SelectMgr_OrFilter) anOrFilter = Handle(SelectMgr_OrFilter)::DownCast(myFilter);
-  if (anOrFilter.IsNull())
-    return;
-
-  std::list<std::string>::const_iterator anIt = myArguments.begin(),
-                                         aLast = myArguments.end();
-  for (; anIt != aLast; ++anIt) {
-    std::string aType = *anIt;
-    ModuleBase_Filter* aFilter = findFilter(aType);
-    if (aFilter) {
-      anOrFilter->Add(aFilter->getFilter());
-    }
-  }
-}
-
-void ModuleBase_FilterMulti::setArguments(const std::list<std::string>& theArguments)
-{
-  myArguments.clear();
-  myArguments = theArguments;
-}
diff --git a/src/ModuleBase/ModuleBase_FilterMulti.h b/src/ModuleBase/ModuleBase_FilterMulti.h
deleted file mode 100644 (file)
index 5b9e7dd..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterMulti.h
-// Created:     12 Jan 2015
-// Author:      Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterMulti_H
-#define ModuleBase_FilterMulti_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* An implementation of filter which support using of several filters according to OR statement
-*/
-class ModuleBase_FilterMulti: public ModuleBase_Filter
-{
-  /**
-   * Creates a new filter according to the given type
-   * It is only for internal use.
-   * This class creates the sub-filters now. It is possible to use the filter factory for this.
-   * \param theType a type of the created filter
-   */
-  ModuleBase_Filter* findFilter(const std::string& theType);
-  
-public:
-  MODULEBASE_EXPORT ModuleBase_FilterMulti(): 
-      ModuleBase_Filter() {}
-
-  /**
-   * Sets the arguments to the filter.
-   * \param theArguments a list of arguments
-   */
-  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
-  /**
-   * It creates an OCC face filter
-   */
-  virtual void createFilter();
-
-protected:
-  /// the filter arguments
-  std::list<std::string> myArguments; 
-};
-
-#endif //ModuleBase_FilterMulti
diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.cpp
deleted file mode 100644 (file)
index c9c49f7..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_ViewerFilters.cpp
-// Created:     07 Okt 2014
-// Author:      Vitaly SMETANNIKOV
-
-
-#include "ModuleBase_FilterNoConsructionSubShapes.h"
-#include "ModuleBase_IWorkshop.h"
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_ResultConstruction.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-
-#include <StdSelect_BRepOwner.hxx>
-
-#include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <Geom_Curve.hxx>
-
-#include <ModelAPI_CompositeFeature.h>
-#include <GeomAPI_ICustomPrs.h>
-
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-
-Standard_Boolean ModuleBase_FilterNoConsructionSubShapes::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
-  // global selection should be ignored, the filter processes only selected sub-shapes
-  Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
-  if (!aShapeOwner.IsNull()) {
-    if (!aShapeOwner->ComesFromDecomposition())
-      return Standard_True;
-  }
-
-  if (theOwner->HasSelectable()) {
-    Handle(AIS_InteractiveObject) aAisObj = 
-      Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-    if (!aAisObj.IsNull()) {
-      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
-      aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
-      ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
-
-      ResultConstructionPtr aConstr = 
-        std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
-      if (aConstr != NULL) {
-        // it provides selection only on compositie features, construction without composite
-        // feature is not selectable
-        FeaturePtr aFeature = ModelAPI_Feature::feature(aConstr);
-        CompositeFeaturePtr aComposite = 
-          std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
-        return aComposite && aComposite->numberOfSubs() > 0;
-      }
-      else
-        return Standard_True;
-    }
-  }
-  return Standard_False;
-}
-
diff --git a/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h b/src/ModuleBase/ModuleBase_FilterNoConsructionSubShapes.h
deleted file mode 100644 (file)
index e2d4cbf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_ViewerFilters.h
-// Created:     07 Okt 2014
-// Author:      Vitaly SMETANNIKOV
-
-
-#ifndef ModuleBase_FilterNoConsructionSubShapes_H
-#define ModuleBase_FilterNoConsructionSubShapes_H
-
-#include <QStringList>
-
-#include <SelectMgr_Filter.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
-class ModuleBase_IWorkshop;
-
-/**
-* \ingroup GUI
-* \class ModuleBase_FilterNoConsructionSubShapes
-* A filter which provides filtering of selection in 3d viewer.
-* Installing of this filter lets to select objects which belong to 
-* currently active document or to global document
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
-class ModuleBase_FilterNoConsructionSubShapes: public SelectMgr_Filter
-{
-public:
-  /// Constructor
-  /// \param theWorkshop instance of workshop interface
-  Standard_EXPORT ModuleBase_FilterNoConsructionSubShapes(ModuleBase_IWorkshop* theWorkshop):
-      SelectMgr_Filter(), myWorkshop(theWorkshop) {}
-
-  /**
-   * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
-   * of if the selected result is a construction and the result feature is composite and has sub-elements.
-   * \param theOwner the result of selection
-   * \return whether the owner is selectable in the viewer
-  */
-  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
-  DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes)
-
-protected:
-  /// Instance of workshop interface
-  ModuleBase_IWorkshop* myWorkshop;
-};
-
-#endif
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.cpp b/src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.cpp
deleted file mode 100644 (file)
index 1fb5a57..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_ViewerFilters.cpp
-// Created:     10 Feb 2015
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterNoDegeneratedEdge.h"
-
-#include <StdSelect_BRepOwner.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <BRep_Tool.hxx>
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-
-ModuleBase_FilterNoDegeneratedEdge::ModuleBase_FilterNoDegeneratedEdge()
-: StdSelect_EdgeFilter(StdSelect_AnyEdge)
-{
-}
-
-Standard_Boolean ModuleBase_FilterNoDegeneratedEdge::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
-  bool isEdge = StdSelect_EdgeFilter::IsOk(theOwner);
-  if (isEdge) {
-    Handle(StdSelect_BRepOwner) anOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
-    if (!anOwner.IsNull() && anOwner->HasShape()) {
-      const TopoDS_Shape& aShape = anOwner->Shape();
-      if (BRep_Tool::Degenerated(TopoDS::Edge(aShape)))
-        return Standard_False;
-    }
-  }
-  return isEdge;
-}
-
diff --git a/src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.h b/src/ModuleBase/ModuleBase_FilterNoDegeneratedEdge.h
deleted file mode 100644 (file)
index b61f001..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_ViewerFilters.h
-// Created:     10 Feb 2015
-// Author:      Natalia ERMOLAEVA
-
-
-#ifndef ModuleBase_FilterNoDegeneratedEdge_H
-#define ModuleBase_FilterNoDegeneratedEdge_H
-
-#include <QStringList>
-
-#include <StdSelect_EdgeFilter.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
-/**
-* \ingroup GUI
-* \class ModuleBase_FilterNoDegeneratedEdge
-* An edge filter, which additionally filters degenerative edges.
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoDegeneratedEdge, StdSelect_EdgeFilter);
-class ModuleBase_FilterNoDegeneratedEdge: public StdSelect_EdgeFilter
-{
-public:
-  /// Constructor
-  Standard_EXPORT ModuleBase_FilterNoDegeneratedEdge();
-
-  /**
-   * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
-   * of if the selected result is a construction and the result feature is composite and has sub-elements.
-   * \param theOwner the result of selection
-   * \return whether the owner is selectable in the viewer
-  */
-  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
-  DEFINE_STANDARD_RTTI(ModuleBase_FilterNoDegeneratedEdge)
-
-protected:
-};
-
-#endif
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_FilterShapeType.cpp b/src/ModuleBase/ModuleBase_FilterShapeType.cpp
deleted file mode 100644 (file)
index 2b981f7..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterShapeType.cpp
-// Created:     12 Jan 2015
-// Author:      Natalia ERMOLAEVA
-
-
-#include "ModuleBase_FilterShapeType.h"
-
-#include <StdSelect_ShapeTypeFilter.hxx>
-#include <TopAbs_ShapeEnum.hxx>
-
-#include <Events_Error.h>
-
-#include <QString>
-#include <QMap>
-
-typedef QMap<QString, TopAbs_ShapeEnum> FaceTypes;
-static FaceTypes MyShapeTypes;
-
-TopAbs_ShapeEnum ModuleBase_FilterShapeType::shapeType(const std::string& theType)
-{
-  if (MyShapeTypes.count() == 0) {
-    MyShapeTypes["vertex"] = TopAbs_VERTEX;
-  }
-  QString aType = QString(theType.c_str()).toLower();
-  if (MyShapeTypes.contains(aType))
-    return MyShapeTypes[aType];
-  Events_Error::send("Shape type defined in XML is not implemented!");
-  return TopAbs_SHAPE;
-}
-
-ModuleBase_FilterShapeType::ModuleBase_FilterShapeType()
-: ModuleBase_Filter(), myShapeType(TopAbs_SHAPE)
-{
-}
-
-void ModuleBase_FilterShapeType::createFilter()
-{
-  myFilter = new StdSelect_ShapeTypeFilter(myShapeType);
-}
-
-void ModuleBase_FilterShapeType::setArguments(const std::list<std::string>& theArguments)
-{
-  if (theArguments.size()!= 1)
-    return;
-  myShapeType = shapeType(theArguments.front());
-}
diff --git a/src/ModuleBase/ModuleBase_FilterShapeType.h b/src/ModuleBase/ModuleBase_FilterShapeType.h
deleted file mode 100644 (file)
index 771217c..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        ModuleBase_FilterShapeType.h
-// Created:     12 Jan 2015
-// Author:      Natalia ERMOLAEVA
-
-#ifndef ModuleBase_FilterShapeType_H
-#define ModuleBase_FilterShapeType_H
-
-#include "ModuleBase.h"
-
-#include "ModuleBase_Filter.h"
-
-#include <StdSelect_TypeOfFace.hxx>
-
-/**
-* \ingroup GUI
-* A class of a viewer filter by shape type
-*/
-class ModuleBase_FilterShapeType: public ModuleBase_Filter
-{
-public:
-  /// Constructor 
-  /// \param theType type of shape
-  static MODULEBASE_EXPORT TopAbs_ShapeEnum shapeType(const std::string& theType);
-
-  MODULEBASE_EXPORT ModuleBase_FilterShapeType();
-
-  /**
-   * Sets the arguments to the filter.
-   * \param theArguments a list of arguments
-   */
-  MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
-
-protected:
-  /**
-   * It creates an OCC face filter
-   */
-  virtual void createFilter();
-
-private:
-  /// the shape type of the filter
-  TopAbs_ShapeEnum myShapeType; 
-};
-
-#endif //ModuleBase_FilterShapeType
index 5bb26dac55ac995691f02fc411ba322317e6ba63..28a43c3d7ee28b0d3bd7046a9817bff49ca87e82 100644 (file)
@@ -9,8 +9,10 @@
 
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelection.h>
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_WidgetValidated.h>
+#include <ModuleBase_ViewerPrs.h>
 
 IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterValidated, SelectMgr_Filter);
 IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterValidated, SelectMgr_Filter);
@@ -25,6 +27,9 @@ Standard_Boolean ModuleBase_FilterValidated::IsOk(const Handle(SelectMgr_EntityO
   ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
   ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
                                                                           (anActiveWidget);
-  return !aWidgetValidated || aWidgetValidated->isValid(theOwner);
+  ModuleBase_ViewerPrs aPrs;
+  myWorkshop->selection()->fillPresentation(aPrs, theOwner);
+
+  return !aWidgetValidated || aWidgetValidated->isValidSelection(aPrs);
 }
 
index 1e56112a7ebf23a03a1c47737af88e9a23831ca2..81f84dda6641d9c604cbac02c90ef19374fd4ecb 100644 (file)
@@ -92,32 +92,3 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti
   }
   return Standard_False;
 }
-
-
-IMPLEMENT_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-
-
-//TODO (VSV): Check bug in OCCT: Filter result is ignored (bug25340)
-Standard_Boolean ModuleBase_ObjectTypesFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
-  Standard_Boolean isOk = ModuleBase_ShapeDocumentFilter::IsOk(theOwner);
-  if (isOk && theOwner->HasSelectable()) {
-    Handle(AIS_InteractiveObject) aAisObj = 
-      Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-    if (!aAisObj.IsNull()) {
-      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
-      aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
-      ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
-
-      foreach (QString aType, myTypes) {
-        if (aType.toLower() == "construction") {
-          ResultConstructionPtr aConstr = 
-            std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
-          return (aConstr != NULL);
-        } // ToDo: Process other types of objects
-      }
-    }
-  }
-  return Standard_False;
-}
index 1a215a4fccf47f483077f70688bd45c1da19628e..a5d404ee81a84d850261c5a506c4244e8cd2b57e 100644 (file)
@@ -75,33 +75,4 @@ private:
   gp_Pln myPlane;
 };
 
-
-/**
-* \class ModuleBase_ObjectTypesFilter
-* \ingroup GUI
-* A filter which provides filtering of selection in 3d viewer.
-* Installing of this filter lets to select only object of requested type
-* Accepts following objects types:
-* - "construction" - to select ModelAPI_ResultConstruction objects
-*/
-DEFINE_STANDARD_HANDLE(ModuleBase_ObjectTypesFilter, SelectMgr_Filter);
-class ModuleBase_ObjectTypesFilter: public ModuleBase_ShapeDocumentFilter
-{
-public:
-  /// Constructor
-  /// \param theWorkshop instance of workshop interface
-  /// \param theTypes list of object types
-  Standard_EXPORT ModuleBase_ObjectTypesFilter(ModuleBase_IWorkshop* theWorkshop, const QStringList& theTypes): 
-      ModuleBase_ShapeDocumentFilter(theWorkshop), myTypes(theTypes) {}
-
-  /// Returns True if the given owner is acceptable for selection
-  /// \param theOwner the selected owner
-  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
-  DEFINE_STANDARD_RTTI(ModuleBase_ObjectTypesFilter)
-private:
-  /// List of object types
-  QStringList myTypes;
-};
-
-#endif
\ No newline at end of file
+#endif
index cd8751fe7e69a9f425f5d61564502afb51cc851a..ebc274981b54077b325eb8bf2da61d533b97140d 100644 (file)
@@ -47,7 +47,7 @@ class ModuleBase_ViewerPrs
 
   /// Sets the object.
   /// \param theResult an object instance
-  void setFeature(ObjectPtr theResult)
+  void setObject(ObjectPtr theResult)
   {
     myResult = theResult;
   }
@@ -100,6 +100,14 @@ class ModuleBase_ViewerPrs
     return myInteractive;
   }
 
+  /// Returns true if all presentation fields are empty
+  /// \return boolean value
+  bool isEmpty() const
+  {
+    return myShape.IsNull() &&
+           myOwner.IsNull() && !myResult.get();
+  }
+
   /// Returns True if the current object is equal to the given one
   /// \param thePrs an object to compare
   bool operator==(const ModuleBase_ViewerPrs& thePrs)
index 53f0352756df1ebd3c712260df79170dbc05b39d..6ae74c0618d7761da3439185f7aa22ac871f5e54 100644 (file)
@@ -196,19 +196,15 @@ void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/)
 }
 
 //********************************************************************
-bool ModuleBase_WidgetMultiSelector::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetMultiSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {
-  ModuleBase_ViewerPrs aPrs;
-  ModuleBase_ISelection* aSelection = myWorkshop->selection();
-  aSelection->fillPresentation(aPrs, theOwner);
-
-  const TopoDS_Shape& aTDSShape = aPrs.shape();
+  const TopoDS_Shape& aTDSShape = thePrs.shape();
   if (aTDSShape.IsNull())
     return false;
   GeomShapePtr aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
   aShape->setImpl(new TopoDS_Shape(aTDSShape));
 
-  ObjectPtr anObject = aSelection->getSelectableObject(theOwner);
+  ObjectPtr anObject = myWorkshop->selection()->getSelectableObject(thePrs.owner());
   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
   if (myFeature) {
     // We can not select a result of our feature
@@ -276,9 +272,8 @@ void ModuleBase_WidgetMultiSelector::onSelectionChanged()
   aSelectionListAttr->clear();
   if (aSelected.size() > 0) {
     foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
-      Handle(SelectMgr_EntityOwner) anOwner = aPrs.owner();
-      if (isValid(anOwner)) {
-        setSelection(anOwner);
+      if (isValidSelection(aPrs)) {
+        setSelectionCustom(aPrs);
       }
     }
   }
index 49ae66b6b85f47e9a333df3dc701ae8c954a0785..5f2bf3498abd470eb50efc4edb46858e94c5b3b6 100644 (file)
@@ -74,7 +74,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_Widge
 
   /// Fills the attribute with the value of the selected owner
   /// \param theOwner a selected owner
-  virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
 
  public slots:
   /// Slot is called on selection type changed
index 34eb3e189061b69be8b7fff28f62e7a3f76034b5..fcd1e26c235a71ee76ff6f2951e93ec334f0eda0 100644 (file)
@@ -215,9 +215,8 @@ void ModuleBase_WidgetShapeSelector::onSelectionChanged()
   //QObjectPtrList aObjects = myWorkshop->selection()->selectedPresentations();
   QList<ModuleBase_ViewerPrs> aSelected = myWorkshop->selection()->getSelected();
   if (aSelected.size() > 0) {
-    Handle(SelectMgr_EntityOwner) anOwner = aSelected.first().owner();
-    if (isValid(anOwner)) {
-      setSelection(anOwner);
+    if (isValidSelection(aSelected.first())) {
+      setSelectionCustom(aSelected.first());
       // the updateObject method should be called to flush the updated sigal. The workshop listens it,
       // calls validators for the feature and, as a result, updates the Apply button state.
       updateObject(myFeature);
@@ -401,14 +400,12 @@ void ModuleBase_WidgetShapeSelector::restoreAttributeValue(bool theValid)
 }
 
 //********************************************************************
-bool ModuleBase_WidgetShapeSelector::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetShapeSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {
   bool isDone = false;
 
-  ModuleBase_ViewerPrs aPrs;
-  myWorkshop->selection()->fillPresentation(aPrs, theOwner);
   // It should be checked by corresponded validator
-  ObjectPtr aObject = aPrs.object();
+  ObjectPtr aObject = thePrs.object();
   ObjectPtr aCurrentObject = GeomValidators_Tools::getObject(myFeature->attribute(attributeID()));
   /*
   if ((!aCurrentObject) && (!aObject))
@@ -444,9 +441,9 @@ bool ModuleBase_WidgetShapeSelector::setSelection(const Handle_SelectMgr_EntityO
     return false;
 
   // Get sub-shapes from local selection
-  if (!aPrs.shape().IsNull()) {
+  if (!thePrs.shape().IsNull()) {
     aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
-    aShape->setImpl(new TopoDS_Shape(aPrs.shape()));
+    aShape->setImpl(new TopoDS_Shape(thePrs.shape()));
   }
   // Check that the selection corresponds to selection type
   if (!acceptSubShape(aShape))
index fe28323b13cfcfbeaed6176775a83eb165da0c86..8890912dae42a59db05507b8953b4ded9ab54856 100644 (file)
@@ -84,7 +84,7 @@ Q_OBJECT
 
   /// Fills the attribute with the value of the selected owner
   /// \param theOwner a selected owner
-  virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
 
   /// The methiod called when widget is deactivated
   virtual void deactivate();
index 445190ae55919592ff55cb894ab71b64c62040c1..0c84fa8e9ad0e4b86512fe7b60ccb88dfa32a470 100644 (file)
@@ -31,9 +31,8 @@ bool ModuleBase_WidgetValidated::setSelection(ModuleBase_ViewerPrs theValue)
 {
   bool isDone = false;
 
-  Handle(SelectMgr_EntityOwner) anOwner = theValue.owner();
-  if (isValid(anOwner)) {
-    isDone = setSelection(anOwner);
+  if (isValidSelection(theValue)) {
+    isDone = setSelectionCustom(theValue);
     updateObject(myFeature);
     emit valuesChanged();
   }
@@ -41,7 +40,7 @@ bool ModuleBase_WidgetValidated::setSelection(ModuleBase_ViewerPrs theValue)
 }
 
 //********************************************************************
-bool ModuleBase_WidgetValidated::isValid(const Handle_SelectMgr_EntityOwner& theOwner)
+bool ModuleBase_WidgetValidated::isValidSelection(const ModuleBase_ViewerPrs& theValue)
 {
   DataPtr aData = myFeature->data();
   AttributePtr anAttribute = myFeature->attribute(attributeID());
@@ -57,7 +56,7 @@ bool ModuleBase_WidgetValidated::isValid(const Handle_SelectMgr_EntityOwner& the
   storeAttributeValue();
 
   // saves the owner value to the widget attribute
-  bool aValid = setSelection(theOwner);
+  bool aValid = setSelectionCustom(theValue);
 
   if (aValid)
     // checks the attribute validity
index 31e7b81ac27a43e2167c06f44355b97db40e129a..eb0f8fa7fc2a4505ffcbc873bc40a4c36f68cbff 100644 (file)
@@ -41,7 +41,7 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   /// Checks all widget validator if the owner is valid
   /// \param theOwner a selected owner in the view
   /// \return a boolean value
-  bool isValid(const Handle_SelectMgr_EntityOwner& theOwner);
+  bool isValidSelection(const ModuleBase_ViewerPrs& theValue);
 
   /// Set the given wrapped value to the current widget
   /// This value should be processed in the widget according to the needs
@@ -64,7 +64,7 @@ protected:
 
   /// Fills the attribute with the value of the selected owner
   /// \param theOwner a selected owner
-  virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner) = 0;
+  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs) = 0;
 
   virtual void removePresentations() {};
 
index 76fc4c119760c0d1dd9c5995a916045024df3689..58d1a210c8c328a23fef83ab645fcb621957682e 100644 (file)
@@ -16,7 +16,6 @@ SET(PROJECT_HEADERS
        PartSet_WidgetPoint2dDistance.h
        PartSet_WidgetShapeSelector.h
        PartSet_Filters.h
-       PartSet_FilterSketchEntity.h
        PartSet_SketcherMgr.h
        PartSet_MenuMgr.h
 )
@@ -31,7 +30,6 @@ SET(PROJECT_SOURCES
        PartSet_WidgetPoint2dDistance.cpp
        PartSet_WidgetShapeSelector.cpp
        PartSet_Filters.cpp
-       PartSet_FilterSketchEntity.cpp
        PartSet_SketcherMgr.cpp
        PartSet_MenuMgr.cpp
 )
diff --git a/src/PartSet/PartSet_FilterSketchEntity.cpp b/src/PartSet/PartSet_FilterSketchEntity.cpp
deleted file mode 100644 (file)
index 04b5f4f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_FilterSketchEntity.cpp
-// Created:     13 Mar 2015
-// Author:      Natalia ERMOLAEVA
-
-#include "PartSet_FilterSketchEntity.h"
-
-#include <ModuleBase_IWorkshop.h>
-
-#include <ModelAPI_Feature.h>
-#include <FeaturesPlugin_Group.h>
-
-#include <SketchPlugin_Sketch.h>
-
-#include <AIS_InteractiveObject.hxx>
-#include <AIS_Shape.hxx>
-
-
-IMPLEMENT_STANDARD_HANDLE(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-IMPLEMENT_STANDARD_RTTIEXT(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-
-Standard_Boolean PartSet_FilterSketchEntity::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
-{
-  if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
-    if (theOwner->HasSelectable()) {
-      Handle(AIS_InteractiveObject) aAisObj = 
-        Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-      if (!aAisObj.IsNull()) {
-        std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
-        aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
-        ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
-        if (aObj) {
-          FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
-
-          if (aFeature->getKind() == SketchPlugin_Sketch::ID())
-            return Standard_True;
-        }
-      }
-    }
-  }
-  return Standard_False;
-}
diff --git a/src/PartSet/PartSet_FilterSketchEntity.h b/src/PartSet/PartSet_FilterSketchEntity.h
deleted file mode 100644 (file)
index 62849e6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        PartSet_FilterSketchEntity.h
-// Created:     13 Mar 2015
-// Author:      Natalia ERMOLAEVA
-
-#ifndef PartSet_FilterSketchEntity_H
-#define PartSet_FilterSketchEntity_H
-
-#include <ModuleBase_ViewerFilters.h>
-
-/**
-* \class PartSet_FilterSketchEntity
-* \ingroup Modules
-* A class which filters groups object in addition to documents (see issue #310)
-*/
-DEFINE_STANDARD_HANDLE(PartSet_FilterSketchEntity, ModuleBase_ShapeDocumentFilter);
-class PartSet_FilterSketchEntity: public ModuleBase_ShapeDocumentFilter
-{
-public:
-  /// Constructor
-  /// \param theWorkshop a pointer to workshop
-  PartSet_FilterSketchEntity(ModuleBase_IWorkshop* theWorkshop)
-    : ModuleBase_ShapeDocumentFilter(theWorkshop) {}
-
-  /// Returns True if selected presentation can be selected
-  /// \param theOwner an owner of the persentation
-  Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
-
-  DEFINE_STANDARD_RTTI(PartSet_FilterSketchEntity)
-};
-
-#endif
\ No newline at end of file
index 60ab634a785d3722796b414c8cbc176039bd2249..a38f41b65a24baa598eafd38c2526b9f120fbaae 100644 (file)
 #include <ModuleBase_IPropertyPanel.h>
 #include <ModuleBase_WidgetEditor.h>
 #include <ModuleBase_FilterFactory.h>
-#include <ModuleBase_FilterLinearEdge.h>
-#include <ModuleBase_FilterFace.h>
-#include <ModuleBase_FilterMulti.h>
-#include <ModuleBase_FilterCustom.h>
-#include <ModuleBase_FilterNoConsructionSubShapes.h>
 #include <GeomValidators_Edge.h>
 #include <GeomValidators_EdgeOrVertex.h>
 #include <GeomValidators_Face.h>
 #include <GeomValidators_ConstructionComposite.h>
 
-#include <PartSet_FilterSketchEntity.h>
 
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Events.h>
@@ -163,15 +157,6 @@ void PartSet_Module::registerFilters()
   //Registering of selection filters
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
   ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
-
-  //aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
-  //aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
-  //aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
-  //Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
-  //aFactory->registerFilter("NoConstructionSubShapesFilter",
-  //          new ModuleBase_FilterCustom(aSelectFilter));
-  //Handle(SelectMgr_Filter) aSelectFilter = new PartSet_FilterSketchEntity(workshop());
-  //aFactory->registerFilter("SketchEntityFilter", new ModuleBase_FilterCustom(aSelectFilter));
 }
 
 void PartSet_Module::registerProperties()
index 99c9b3e3813630ca33da0a9a61223e6c9ba63593..207aee541f8eab4098baa9d5352f13d168db45f3 100644 (file)
@@ -71,6 +71,7 @@
 #include <QMouseEvent>
 #include <QApplication>
 
+//#define DEBUG_DO_NOT_BY_ENTER
 
 /// Returns list of unique objects by sum of objects from List1 and List2
 /*QList<ModuleBase_ViewerPrs> getSumList(const QList<ModuleBase_ViewerPrs>& theList1,
@@ -166,8 +167,11 @@ void PartSet_SketcherMgr::onEnterViewPort()
   myIsMouseOverWindow = true;
   myIsPropertyPanelValueChanged = false;
 
-  if (!isNestedCreateOperation(getCurrentOperation()))
-    return;
+  #ifdef DEBUG_DO_NOT_BY_ENTER
+  return;
+  #endif
+  //if (!isNestedCreateOperation(getCurrentOperation()))
+  //  return;
 }
 
 void PartSet_SketcherMgr::onLeaveViewPort()
@@ -176,6 +180,10 @@ void PartSet_SketcherMgr::onLeaveViewPort()
   myIsMouseOverWindow = false;
   myIsPropertyPanelValueChanged = false;
 
+  #ifdef DEBUG_DO_NOT_BY_ENTER
+  return;
+  #endif
+
   if (!isNestedCreateOperation(getCurrentOperation()))
     return;
   // the method should be performed if the popup menu is called,
@@ -790,7 +798,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
       aCanDisplay = false;
   }
   else { // there are no an active sketch
-    // 2. sketch sub-features should not visualized if the sketch operatio is not active
+    // 2. sketch sub-features should not visualized if the sketch operation is not active
     FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
     if (aFeature.get() != NULL) {
       std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
@@ -806,6 +814,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
   // a. the property panel values modification
   // b. the popup menu activated
   // c. widget editor control
+  #ifndef DEBUG_DO_NOT_BY_ENTER
   if (aCanDisplay && isNestedCreateOperation(getCurrentOperation())) {
     ModuleBase_Operation* aOperation = getCurrentOperation();
     ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
@@ -819,6 +828,7 @@ bool PartSet_SketcherMgr::canDisplayObject(const ObjectPtr& theObject) const
       aCanDisplay = myIsPropertyPanelValueChanged || myIsMouseOverWindow;
     }
   }
+  #endif
   return aCanDisplay;
 }
 
@@ -991,6 +1001,10 @@ ModuleBase_Operation* PartSet_SketcherMgr::getCurrentOperation() const
 void PartSet_SketcherMgr::visualizeFeature(ModuleBase_Operation* theOperation,
                                            const bool isToDisplay)
 {
+  #ifdef DEBUG_DO_NOT_BY_ENTER
+  return;
+  #endif
+
   if (!theOperation || theOperation->isEditOperation())
     return;
 
index 5570182990f55b7a8ff0fab76f7f4f73bf630ebb..42d4cd3edecc0d737ba7f675269b026f89cea5c1 100644 (file)
@@ -21,6 +21,9 @@
 #include <ModuleBase_Tools.h>
 #include <ModuleBase_IModule.h>
 
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_Tools.h>
+
 #include <GeomAlgoAPI_FaceBuilder.h>
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Dir.h>
@@ -89,55 +92,70 @@ QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
   return aResult;
 }
 
-void PartSet_WidgetSketchLabel::onPlaneSelected()
+void PartSet_WidgetSketchLabel::onSelectionChanged()
 {
-
+  ModuleBase_ViewerPrs aPrs;
+  // 1. find selected presentation either in the viewer or in OB
   XGUI_Selection* aSelection = myWorkshop->selector()->selection();
   QList<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+  // the selection in OCC viewer - the selection of a face in the viewer
+  // it can be th main plane's face of a face on a visualized body
   if (!aSelected.empty()) {
-    ModuleBase_ViewerPrs aPrs = aSelected.first();
-    Handle(SelectMgr_EntityOwner) anOwner = aSelected.first().owner();
-    if (isValid(anOwner)) {
-      setSelection(anOwner);
-
-      TopoDS_Shape aShape = aPrs.shape();
-      if (!aShape.IsNull()) {
-        erasePreviewPlanes();
-        DataPtr aData = feature()->data();
-        AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
-                                  (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
-        if (aSelAttr) {
-          GeomShapePtr aShapePtr = aSelAttr->value();
-          if (aShapePtr.get() == NULL || aShapePtr->isNull()) {
-            std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
-            aGShape->setImpl(new TopoDS_Shape(aShape));
-            // get plane parameters
-            std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
-            std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
-
-            myWorkshop->viewer()->setViewProjection(aDir->x(), aDir->y(), aDir->z());
-          }
-        }
+    aPrs = aSelected.first();
+  }
+  else {
+    // the selection in Object Browser: the plane object can be used as sketch plane
+    QObjectPtrList anObjects = aSelection->selectedObjects();
+    if (!anObjects.empty()) {
+      aPrs.setObject(anObjects.first());
+    }
+  }
+  if (aPrs.isEmpty())
+    return;
 
-        // Clear text in the label
-        myLabel->setText("");
-        myLabel->setToolTip("");
-        disconnect(myWorkshop->selector(), SIGNAL(selectionChanged()), 
-                   this, SLOT(onPlaneSelected()));
-        activateFilters(myWorkshop->module()->workshop(), false);
-
-        // Clear selection mode and define sketching mode
-        //XGUI_Displayer* aDisp = myWorkshop->displayer();
-        //aDisp->closeLocalContexts();
-        emit planeSelected(plane());
-        //setSketchingMode();
-
-        // Update sketcher actions
-        XGUI_ActionsMgr* anActMgr = myWorkshop->actionsMgr();
-        anActMgr->update();
-        myWorkshop->viewer()->update();
+  if (isValidSelection(aPrs)) {
+    // 2. set the selection to sketch
+    setSelectionCustom(aPrs);
+    // 3. hide main planes if they have been displayed
+    erasePreviewPlanes();
+    // 4. if the planes were displayed, change the view projection
+    TopoDS_Shape aShape = aPrs.shape();
+    if (!aShape.IsNull()) {
+      DataPtr aData = feature()->data();
+      AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+                                (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
+      if (aSelAttr) {
+        GeomShapePtr aShapePtr = aSelAttr->value();
+        if (aShapePtr.get() == NULL || aShapePtr->isNull()) {
+          //TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
+          std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
+          aGShape->setImpl(new TopoDS_Shape(aShape));
+          // get plane parameters
+          std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
+          std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+
+          myWorkshop->viewer()->setViewProjection(aDir->x(), aDir->y(), aDir->z());
+        }
       }
     }
+    // 5. Clear text in the label
+    myLabel->setText("");
+    myLabel->setToolTip("");
+    disconnect(myWorkshop->selector(), SIGNAL(selectionChanged()), 
+               this, SLOT(onSelectionChanged()));
+    // 6. deactivate face selection filter
+    activateFilters(myWorkshop->module()->workshop(), false);
+
+    // 7. Clear selection mode and define sketching mode
+    //XGUI_Displayer* aDisp = myWorkshop->displayer();
+    //aDisp->closeLocalContexts();
+    emit planeSelected(plane());
+    //setSketchingMode();
+
+    // 8. Update sketcher actions
+    XGUI_ActionsMgr* anActMgr = myWorkshop->actionsMgr();
+    anActMgr->update();
+    myWorkshop->viewer()->update();
   }
 }
 
@@ -176,26 +194,28 @@ void PartSet_WidgetSketchLabel::restoreAttributeValue(const bool theValid)
   }
 }
 
-bool PartSet_WidgetSketchLabel::setSelection(const Handle_SelectMgr_EntityOwner& theOwner)
+bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
 {
   bool isOwnerSet = false;
 
-  ModuleBase_ViewerPrs aPrs;
-  myWorkshop->selector()->selection()->fillPresentation(aPrs, theOwner);
-
-  const TopoDS_Shape& aShape = aPrs.shape();
+  const TopoDS_Shape& aShape = thePrs.shape();
   std::shared_ptr<GeomAPI_Dir> aDir;
 
-  if (aPrs.object() && (feature() != aPrs.object())) {
+  if (thePrs.object() && (feature() != thePrs.object())) {
     DataPtr aData = feature()->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>(aPrs.object());
+      ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
       if (aRes) {
         GeomShapePtr aShapePtr(new GeomAPI_Shape());
-        aShapePtr->setImpl(new TopoDS_Shape(aShape));
+        if (aShape.IsNull()) {
+          aShapePtr = ModelAPI_Tools::shape(aRes);
+        }
+        else {
+          aShapePtr->setImpl(new TopoDS_Shape(aShape));
+        }
         aSelAttr->setValue(aRes, aShapePtr);
         isOwnerSet = true;
       }
@@ -211,31 +231,40 @@ bool PartSet_WidgetSketchLabel::setSelection(const Handle_SelectMgr_EntityOwner&
 void PartSet_WidgetSketchLabel::activateCustom()
 {
   std::shared_ptr<GeomAPI_Pln> aPlane = plane();
-  if (aPlane) {
+  bool aBodyIsVisualized = false;
+  XGUI_Displayer* aDisp = myWorkshop->displayer();
+  QObjectPtrList aDisplayed = aDisp->displayedObjects();
+  foreach (ObjectPtr anObj, aDisplayed) {
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
+    if (aResult.get() != NULL) {
+      aBodyIsVisualized = aResult->groupName() == ModelAPI_ResultBody::group();
+      if (aBodyIsVisualized)
+        break;
+    }
+  }
+
+  if (aPlane || aBodyIsVisualized) {
     //setSketchingMode();
     // In order to avoid Opening/Closing of context too often
     // it can be useful for a delay on the property panel filling
     // it is possible that it is not necessary anymore, but it requires a check
     //mySelectionTimer->start(20);
+    //setSketchingMode();
   } else {
     // We have to select a plane before any operation
     showPreviewPlanes();
+  }
+  QIntList aModes;
+  aModes << TopAbs_FACE;
+  aDisp->activateObjects(aModes);
 
-    XGUI_Displayer* aDisp = myWorkshop->displayer();
-    //aDisp->openLocalContext();
-    //aDisp->activateObjects(QIntList());
-    QIntList aModes;
-    aModes << TopAbs_FACE;
-    aDisp->activateObjects(aModes);
-
-    myLabel->setText(myText);
-    myLabel->setToolTip(myTooltip);
+  myLabel->setText(myText);
+  myLabel->setToolTip(myTooltip);
 
-    connect(myWorkshop->selector(), SIGNAL(selectionChanged()), this, SLOT(onPlaneSelected()));
-    activateFilters(myWorkshop->module()->workshop(), true);
+  connect(myWorkshop->selector(), SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+  activateFilters(myWorkshop->module()->workshop(), true);
 
-    aDisp->updateViewer();
-  }
+  aDisp->updateViewer();
 }
 
 void PartSet_WidgetSketchLabel::deactivate()
index 0207199bbdfa78399e60c0d038d1a779cb329793..ab7cd18eb35737396accc48f7e5b4be2a0cb4471 100644 (file)
@@ -97,7 +97,7 @@ protected:
 
   /// Fills the attribute with the value of the selected owner
   /// \param theOwner a selected owner
-  virtual bool setSelection(const Handle_SelectMgr_EntityOwner& theOwner);
+  virtual bool setSelectionCustom(const ModuleBase_ViewerPrs& thePrs);
 
   /// Saves the internal parameters to the given feature
   /// \return True in success
@@ -110,8 +110,8 @@ protected:
   virtual void activateCustom();
 
  private slots:
-   /// Slot on plane selection
-  void onPlaneSelected();
+   /// Slot on change selection
+  void onSelectionChanged();
 
   /// Set sketch specific mode of selection
   //void setSketchingMode();
index 0eff27bb2944ec5c70e7539661fc943330c15904..c30e93d56f11d84742e596fcf9566716b6674fa2 100644 (file)
@@ -243,7 +243,6 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
           const TopoDS_Shape& aShape = aShapePrs->Shape();
           std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
           anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
-
           isEqualShapes = aShapePtr->isEqual(anAISShapePtr);
         }
       }
@@ -251,8 +250,8 @@ void XGUI_Displayer::redisplay(ObjectPtr theObject, bool isUpdateViewer)
     // Customization of presentation
     bool isCustomized = customizeObject(theObject);
     #ifdef DEBUG_FEATURE_REDISPLAY
-      qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
-        arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
+      //qDebug(QString("Redisplay: %1, isEqualShapes=%2, isCustomized=%3").
+      //  arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
     #endif
     if (!isEqualShapes || isCustomized) {
       aContext->Redisplay(aAISIO, false);
index 56eea5db52da72f63a9015db7f11bcf6328bd031..3f93b29ac9002770b910a309d33f48634a344c63 100644 (file)
@@ -93,7 +93,7 @@ void XGUI_Selection::fillPresentation(ModuleBase_ViewerPrs& thePrs,
      
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   ObjectPtr aFeature = aDisplayer->getObject(anIO);
-  thePrs.setFeature(aFeature);
+  thePrs.setObject(aFeature);
 }
 
 QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted() const
@@ -115,7 +115,7 @@ QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted() const
     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.setFeature(aResult);
+    aPrs.setObject(aResult);
     if (aContext->HasOpenedContext()) {
       TopoDS_Shape aShape = aContext->DetectedShape();
       if (!aShape.IsNull())
index 7571de5f16faa9364bbcfb140ca71fe808a66f33..08d66b704b7a38d7572d071074ce7897b7511dc2 100644 (file)
@@ -93,8 +93,8 @@
 #include <dlfcn.h>
 #endif
 
-//#define DEBUG_FEATURE_CREATED
-//#define DEBUG_FEATURE_REDISPLAY
+#define DEBUG_FEATURE_CREATED
+#define DEBUG_FEATURE_REDISPLAY
 
 QMap<QString, QString> XGUI_Workshop::myIcons;
 
@@ -565,6 +565,10 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectU
         ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
         if (aOperation && aOperation->hasObject(aObj)) {
           ModuleBase_Operation* aOperation = myOperationMgr->currentOperation();
+          #ifdef DEBUG_FEATURE_REDISPLAY
+            QString anObjInfo = ModuleBase_Tools::objectInfo((aObj));
+            qDebug(QString("  display object = %1").arg(anObjInfo).toStdString().c_str());
+          #endif
           if (displayObject(aObj)) {
             // Deactivate object of current operation from selection
             if (myDisplayer->isActive(aObj))