]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #591 - Highlight of the first argument of constraints
authornds <natalia.donis@opencascade.com>
Wed, 1 Jul 2015 12:17:41 +0000 (15:17 +0300)
committernds <natalia.donis@opencascade.com>
Wed, 1 Jul 2015 12:17:41 +0000 (15:17 +0300)
Crash fix in sketch manager when find a dected owner.

src/PartSet/PartSet_CustomPrs.cpp
src/PartSet/PartSet_CustomPrs.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationPrs.cpp
src/PartSet/PartSet_OperationPrs.h
src/PartSet/PartSet_SketcherMgr.cpp

index 3ae846074aac11e4ce844db2f5855c18c430fcba..2990969e94f9d4c6355deb77b5b44c6aadcc44b1 100755 (executable)
 PartSet_CustomPrs::PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop)
   : myWorkshop(theWorkshop)
 {
+  Handle(PartSet_OperationPrs) myOperationPrs = new PartSet_OperationPrs(); /// AIS presentation for the feature of operation
 }
 
-void PartSet_CustomPrs::setCustomized(const ObjectPtr& theObject)
+void PartSet_CustomPrs::setCustomized(const FeaturePtr& theFeature)
 {
-/*  QMap<ResultPtr, QList<GeomShapePtr> > aNewCustomized;
+
+  myOperationPrs->setFeature(theFeature);
+  /*  QMap<ResultPtr, QList<GeomShapePtr> > aNewCustomized;
 
   QList<GeomShapePtr> aShapeList;
   ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
@@ -117,7 +120,7 @@ bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr
                                               std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs)
 {
   bool isDone = false;
-  if (myCustomized.contains(theResult)) {
+  /*if (myCustomized.contains(theResult)) {
     std::vector<int> aColor = Config_PropManager::color("Visualization", "operation_parameter_color",
                                                         OPERATION_PARAMETER_COLOR);
     isDone = thePrs->setColor(aColor[0], aColor[1], aColor[2]);
@@ -136,7 +139,7 @@ bool PartSet_CustomPrs::customisePresentation(ResultPtr theResult, AISObjectPtr
         }
       }
     }
-    thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*/
+    thePrs->setPointMarker(5, 5.); // Set point as a '+' symbol*+/
   }
   /*
   std::vector<int> aColor;
index df17bea094ce83c8a5a220bec0af83f1e0286260..6d23847da06499aba618bd1afad6c66e11d87b61 100755 (executable)
@@ -8,9 +8,11 @@
 #define PartSet_CustomPrs_H
 
 #include "PartSet.h"
+#include "PartSet_OperationPrs.h"
 
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Result.h>
+#include <ModelAPI_Feature.h>
 
 #include <GeomAPI_ICustomPrs.h>
 #include <GeomAPI_AISObject.h>
@@ -31,15 +33,17 @@ public:
   PARTSET_EXPORT PartSet_CustomPrs(ModuleBase_IWorkshop* theWorkshop);
   PARTSET_EXPORT virtual ~PartSet_CustomPrs() {};
 
-  void setCustomized(const ObjectPtr& theObject);
+  /// Set the feature is customized
+  /// \param theObject a feature object
+  void setCustomized(const FeaturePtr& theObject);
 
   /// Modifies the given presentation in the custom way.
   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
                                      std::shared_ptr<GeomAPI_ICustomPrs> theCustomPrs);
 private:
   ModuleBase_IWorkshop* myWorkshop; /// current workshop
-
-  QMap<ResultPtr, QList<GeomShapePtr> > myCustomized; /// objects, which are customized
+  Handle(PartSet_OperationPrs) myOperationPrs; /// AIS presentation for the feature of operation
+  //QMap<ResultPtr, QList<GeomShapePtr> > myCustomized; /// objects, which are customized
 };
 
 #endif
index e6ee9c5b714b88810e3a9e5b2beb1273c7784114..cc9afc0d8ca1ae5e90cf096f0b1ad4d887c85eb5 100644 (file)
@@ -720,12 +720,12 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
     aDisplayer->updateViewer();
 }
 
-void PartSet_Module::setCustomized(const ObjectPtr& theObject)
+void PartSet_Module::setCustomized(const FeaturePtr& theFeature)
 {
  std::shared_ptr<PartSet_CustomPrs> aCustomPrs =
                         std::dynamic_pointer_cast<PartSet_CustomPrs>(myCustomPrs);
  if (aCustomPrs.get())
-   aCustomPrs->setCustomized(theObject);
+   aCustomPrs->setCustomized(theFeature);
 }
 
 bool PartSet_Module::customizeObject(ObjectPtr theObject)
index 3f9dd010e8b9a485e797a9af5b19ade6daf57d9a..ee0595b132bb9708b9b73abeefb5d555ea752f2b 100644 (file)
@@ -145,8 +145,8 @@ public:
   virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
 
   /// Set the object with the object results are customized
-  /// \param theObject an object
-  void setCustomized(const ObjectPtr& theObject);
+  /// \param theFeature a feature
+  void setCustomized(const FeaturePtr& theFeature);
 
   /** Update the object presentable properties such as color, lines width and other
   * If the object is result with the color attribute value set, it is used,
index 6bcdb1c16d3ab01fe6126a70ae3570722e91b7d5..4539ebbd2129e573d619ebb1b3a3dd399373b148 100755 (executable)
@@ -6,19 +6,23 @@
 
 #include "PartSet_OperationPrs.h"
 
-#include <ModelAPI_Tools.h>
-#include <ModelAPI_ResultConstruction.h>
-#include <GeomAPI_PlanarEdges.h>
+//#include <ModelAPI_Tools.h>
+//#include <ModelAPI_ResultConstruction.h>
+//#include <GeomAPI_PlanarEdges.h>
 
-#include <BRep_Builder.hxx>
-#include <Prs3d_IsoAspect.hxx>
-#include <TopoDS_Builder.hxx>
+//#include <BRep_Builder.hxx>
+//#include <Prs3d_IsoAspect.hxx>
+//#include <TopoDS_Builder.hxx>
 
 IMPLEMENT_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape);
 IMPLEMENT_STANDARD_RTTIEXT(PartSet_OperationPrs, ViewerData_AISShape);
 
-PartSet_OperationPrs::PartSet_OperationPrs(FeaturePtr theFeature)
-  : ViewerData_AISShape(TopoDS_Shape()), myFeature(theFeature)
+PartSet_OperationPrs::PartSet_OperationPrs()
+  : ViewerData_AISShape(TopoDS_Shape()), myFeature(FeaturePtr())
+{
+}
+
+void PartSet_OperationPrs::setFeature(FeaturePtr theFeature)
 {
 /*  std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
   std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr = 
index 9d2cc93b03bc1ea3272bca9b6bfff9b67f2e3056..e1536510127c65221dd6f44e18463570e0608ac0 100755 (executable)
@@ -27,9 +27,15 @@ class PartSet_OperationPrs : public ViewerData_AISShape
 public:
   /// Constructor
   /// \param theResult a result object
-  Standard_EXPORT PartSet_OperationPrs(FeaturePtr theFeature);
+  Standard_EXPORT PartSet_OperationPrs();
+
+  /// set the operation feature. It is used in Compute method to group the feature parameter shapes
+  /// theFeature a feature
+  void setFeature(FeaturePtr theFeature);
+
 
   DEFINE_STANDARD_RTTI(PartSet_OperationPrs)
+
 protected:
   /// Redefinition of virtual function
   Standard_EXPORT virtual void Compute(
index cb21c0190208f85632af711ff9c2bb9bd3a5488b..e0c1940c944aefe70469436fd39e228aa56184bb 100644 (file)
@@ -834,7 +834,7 @@ void PartSet_SketcherMgr::stopNestedSketch(ModuleBase_Operation* theOp)
   myIsMouseOverViewProcessed = true;
   operationMgr()->onValidateOperation();
 
-  myModule->setCustomized(ObjectPtr());
+  myModule->setCustomized(FeaturePtr());
 }
 
 void PartSet_SketcherMgr::commitNestedSketch(ModuleBase_Operation* theOperation)