]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
2.11 Constraint with a point from the intersection between an outer edge and plane...
authornds <nds@opencascade.com>
Fri, 12 Feb 2016 13:24:20 +0000 (16:24 +0300)
committernds <nds@opencascade.com>
Fri, 12 Feb 2016 13:24:20 +0000 (16:24 +0300)
src/PartSet/PartSet_SketcherMgr.cpp
src/SketchPlugin/SketchPlugin_IntersectionPoint.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp

index eba4621e367083dab64fae4c9e93d899e30e24e2..eaefdeb4afdcd7b0a249ce25e223cd166f13d621 100755 (executable)
@@ -85,6 +85,8 @@
 
 //#define DEBUG_CURSOR
 
+//#define DEBUG_INTERSECTION_POINT
+
 /// 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)
@@ -862,8 +864,9 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation)
   if (myPlaneFilter.IsNull()) 
     myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
 
+#ifndef DEBUG_INTERSECTION_POINT
   myModule->workshop()->viewer()->addSelectionFilter(myPlaneFilter);
-
+#endif
   bool aHasPlane = false;
   std::shared_ptr<GeomAPI_Pln> aPln;
   if (aFOperation->isEditOperation()) {
index 5c411427c1463dcaab3d427ace30188f567beb2b..8310bccf6e6b5465a99755a4d6fe35725ad7e0a6 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "SketchPlugin_IntersectionPoint.h"
 
-#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeSelection.h>
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
@@ -19,7 +19,7 @@ SketchPlugin_IntersectionPoint::SketchPlugin_IntersectionPoint()
 
 void SketchPlugin_IntersectionPoint::initDerivedClassAttributes()
 {
-  data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeRefAttr::typeId());
+  data()->addAttribute(EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection::typeId());
 
   SketchPlugin_Point::initDerivedClassAttributes();
 }
@@ -50,9 +50,9 @@ void SketchPlugin_IntersectionPoint::attributeChanged(const std::string& theID)
 
 void SketchPlugin_IntersectionPoint::computePoint()
 {
-  AttributeRefAttrPtr aLineRefAttr =
-      std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(attribute(EXTERNAL_LINE_ID()));
-  ResultPtr aLineResult = std::dynamic_pointer_cast<ModelAPI_Result>(aLineRefAttr->object());
+  AttributeSelectionPtr aLineAttr =
+      std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(attribute(EXTERNAL_LINE_ID()));
+  ResultPtr aLineResult = std::dynamic_pointer_cast<ModelAPI_Result>(aLineAttr->context());
   if (!aLineResult)
     return;
 
index 13d7138e1af1a97f1cd33ceb757e0601af5da4e6..b07e90ac46a1b4cbe0eda9a7cd4dd605f90f5aa8 100755 (executable)
@@ -692,12 +692,12 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut
                                                  const std::list<std::string>& theArguments,
                                                  std::string& theError) const
 {
-  if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) {
+  if (theAttribute->attributeType() != ModelAPI_AttributeSelection::typeId()) {
     theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed";
     return false;
   }
-  AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
-  ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aRefAttr->object());
+  AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+  ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anAttr->context());
   if (!aResult) {
     theError = "The attribute " + theAttribute->id() + " should be an object";
     return false;
@@ -713,7 +713,7 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut
 
   // find a sketch
   std::shared_ptr<SketchPlugin_Sketch> aSketch;
-  std::set<AttributePtr> aRefs = aRefAttr->owner()->data()->refsToMe();
+  std::set<AttributePtr> aRefs = anAttr->owner()->data()->refsToMe();
   std::set<AttributePtr>::const_iterator anIt = aRefs.begin();
   for (; anIt != aRefs.end(); ++anIt) {
     CompositeFeaturePtr aComp =
@@ -730,5 +730,5 @@ bool SketchPlugin_IntersectionValidator::isValid(const AttributePtr& theAttribut
 
   std::shared_ptr<GeomAPI_Pln> aPlane = aSketch->plane();
   std::shared_ptr<GeomAPI_Dir> aNormal = aPlane->direction();
-  return fabs(aNormal->dot(aLineDir)) > tolerance * tolerance;
+  return true;//fabs(aNormal->dot(aLineDir)) > tolerance * tolerance;
 }