]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2027 Sketcher Trim Feature: split shapes by highlighted point is moved from... BR_Sketcher_Trim_Feature_1
authornds <nds@opencascade.com>
Thu, 9 Mar 2017 13:31:44 +0000 (16:31 +0300)
committernds <nds@opencascade.com>
Thu, 9 Mar 2017 13:31:44 +0000 (16:31 +0300)
Trim Line/Arc features: code correction.

src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.cpp
src/PartSet/PartSet_WidgetFeaturePointSelector.h
src/PartSet/PartSet_WidgetSubShapeSelector.cpp
src/PartSet/PartSet_WidgetSubShapeSelector.h
src/SketchPlugin/CMakeLists.txt

index 7f7c8765ecc9cc3e5d552b99ac49a7f53fb6e7a0..1df2c7f8745f37b64881a809f7885f922452a77e 100644 (file)
@@ -718,7 +718,6 @@ void GeomAlgoAPI_ShapeTools::splitShape(const std::shared_ptr<GeomAPI_Shape>& th
   }
   aBOP.AddArgument(aBaseEdge);
 
-  //std::list<std::shared_ptr<GeomAPI_Pnt> >::const_iterator aPtIt = thePoints.begin();
   PointToRefsMap::const_iterator aPIt = thePointsInfo.begin();
   for (; aPIt != thePointsInfo.end(); ++aPIt) {
     std::shared_ptr<GeomAPI_Pnt> aPnt = aPIt->first;
index e72db6c832ed4d5da19c26afaffb712246653aa6..eaa7f58e2123c5d385a150842cce833b8dbaed46 100644 (file)
 #include <ModuleBase_IViewWindow.h>
 #include <ModuleBase_IWorkshop.h>
 #include <ModuleBase_IModule.h>
-#include <ModelGeomAlgo_Point2D.h>
 
 #include "PartSet_WidgetFeaturePointSelector.h"
 #include "PartSet_Tools.h"
 
-#include <SketchPlugin_ConstraintCoincidence.h>
-#include <SketchPlugin_Constraint.h>
+//#include <SketchPlugin_ConstraintCoincidence.h>
+//#include <SketchPlugin_Constraint.h>
 #include <SketchPlugin_Point.h>
 #include <SketchPlugin_Trim.h>
 
@@ -53,13 +52,10 @@ PartSet_WidgetFeaturePointSelector::PartSet_WidgetFeaturePointSelector(QWidget*
                                                          const Config_WidgetAPI* theData)
 : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData)
 {
-  myUseGraphicIntersection = theData->getBooleanAttribute("use_graphic_intersection", false);
-  //myCurrentSubShape = std::shared_ptr<ModuleBase_ViewerPrs>(new ModuleBase_ViewerPrs());
 }
 
 PartSet_WidgetFeaturePointSelector::~PartSet_WidgetFeaturePointSelector()
 {
-  //myCashedShapes.clear();
 }
 
 //********************************************************************
@@ -115,7 +111,6 @@ void PartSet_WidgetFeaturePointSelector::deactivate()
   aSStyle->SetColor(mySelectionColor);
   aContext->SetSelectionStyle(aSStyle);
 #endif
-  //myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true);
 }
 
 //********************************************************************
@@ -151,15 +146,10 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature(
   bool aFilled = false;
   if (theSelectedPrs.get() && theSelectedPrs->object().get()) {
     ObjectPtr anObject = theSelectedPrs->object();
-    //if (myCashedShapes.find(anObject) == myCashedShapes.end())
-    //  fillObjectShapes(anObject);
-    //const std::set<GeomShapePtr>& aShapes = myCashedShapes[anObject];
-    //if (!aShapes.empty()) {
     gp_Pnt aPnt = PartSet_Tools::convertClickToPoint(theEvent->pos(), theWindow->v3dView());
     double aX, anY;
     Handle(V3d_View) aView = theWindow->v3dView();
     PartSet_Tools::convertTo2D(aPnt, mySketch, aView, aX, anY);
-    //std::shared_ptr<GeomAPI_Pnt> aPoint = PartSet_Tools::convertTo3D(aX, anY, mySketch);
 
     std::shared_ptr<ModelAPI_AttributeReference> aRef =
                             std::dynamic_pointer_cast<ModelAPI_AttributeReference>(
@@ -169,7 +159,6 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature(
     std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
                     std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
                     feature()->data()->attribute(SketchPlugin_Trim::ENTITY_POINT()));
-    //std::shared_ptr<GeomAPI_Pnt2d> aPoint2D = anAttributePoint->pnt();
     anAttributePoint->setValue(aX, anY);
     // redisplay AIS presentation in viewer
 #ifndef HIGHLIGHT_STAYS_PROBLEM
@@ -178,50 +167,10 @@ bool PartSet_WidgetFeaturePointSelector::fillFeature(
 #endif
     updateObject(feature());
     aFilled = true;
-
-    /*
-        std::set<GeomShapePtr>::const_iterator anIt = aShapes.begin(), aLast = aShapes.end();
-        for (; anIt != aLast; anIt++) {
-          GeomShapePtr aBaseShape = *anIt;
-          std::shared_ptr<GeomAPI_Pnt> aProjectedPoint;
-          if (ModelGeomAlgo_Point2D::isPointOnEdge(aBaseShape, aPoint, aProjectedPoint)) {
-            XGUI_Tools::workshop(myWorkshop)->displayer()->clearSelected(false);
-            if (myCurrentSubShape->object() != anObject ||
-                myCurrentSubShape->shape() != aBaseShape) {
-              myCurrentSubShape->setObject(anObject);
-              myCurrentSubShape->setShape(aBaseShape);
-
-              ModuleBase_IModule* aModule = myWorkshop->module();
-
-
-              if (!aModule->isCustomPrsActivated(ModuleBase_IModule::CustomizeHighlightedObjects))
-                aModule->activateCustomPrs(myFeature,
-                                           ModuleBase_IModule::CustomizeHighlightedObjects, true);
-              aModule->customizeObject(myFeature,
-                                       ModuleBase_IModule::CustomizeHighlightedObjects, true);
-            }
-            else
-              XGUI_Tools::workshop(myWorkshop)->displayer()->updateViewer();
-            break;
-          }
-        }*/
-      //}
-    //}
   }
   return aFilled;
 }
 
-//********************************************************************
-/*void PartSet_WidgetFeaturePointSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs,
-                                                      ObjectPtr& theObject,
-                                                      GeomShapePtr& theShape)
-{
-  ModuleBase_ISelection* aSelection = myWorkshop->selection();
-  theObject = aSelection->getResult(thePrs);
-  if (!theObject.get() && myCurrentSubShape->object())
-    theObject = myCurrentSubShape->object();
-}*/
-
 //********************************************************************
 QList<ModuleBase_ViewerPrsPtr> PartSet_WidgetFeaturePointSelector::getAttributeSelection() const
 {
@@ -234,122 +183,7 @@ bool PartSet_WidgetFeaturePointSelector::setSelection(
                                           QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
                                           const bool theToValidate)
 {
-  return false;
-  //return !theValues.empty();
-
-  /*ObjectPtr aBaseObject = myCurrentSubShape->object();
-  GeomShapePtr aBaseShape = myCurrentSubShape->shape();
-  bool aResult = aBaseObject.get() && aBaseShape.get();
-  // firstly set the selection to the attribute
-  if (aResult) {
-    QList<ModuleBase_ViewerPrsPtr> aValues;
-    aValues.append(myCurrentSubShape);
-    aResult = ModuleBase_WidgetShapeSelector::setSelection(aValues, theToValidate);
-  }
-  // secondly fill additional attributes
-  if (aResult) {
-    aResult = false;
-    if (aBaseShape->shapeType() == GeomAPI_Shape::EDGE) {
-      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aBaseShape));
-
-      std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
-      std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
-
-      std::shared_ptr<GeomDataAPI_Point2D> aFirstPointAttr, aLastPointAttr;
-      /// find the points in base feature attributes
-      FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject);
-      std::list<AttributePtr> a2DPointAttributes = aBaseFeature->data()->attributes(
-                                                        GeomDataAPI_Point2D::typeId());
-      std::list<AttributePtr>::const_iterator anIt = a2DPointAttributes.begin(),
-                                              aLast = a2DPointAttributes.end();
-      for (; anIt != aLast; anIt++) {
-        std::shared_ptr<GeomDataAPI_Point2D> anAttributePoint =
-                                      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
-        std::shared_ptr<GeomAPI_Pnt2d> aPoint2D = anAttributePoint->pnt();
-        std::shared_ptr<GeomAPI_Pnt> aPoint3D = PartSet_Tools::convertTo3D(aPoint2D->x(),
-                                                                   aPoint2D->y(), mySketch);
-        if (aFirstPnt->isEqual(aPoint3D))
-          aFirstPointAttr = anAttributePoint;
-        else if (aLastPnt->isEqual(aPoint3D))
-          aLastPointAttr = anAttributePoint;
-      }
-
-      /// find the points in coincident features
-      PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject];
-      PntToAttributesMap::const_iterator
-        aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
-      for (PntToAttributesMap::const_iterator aRIt = aRefAttributes.begin(),
-           aRLast = aRefAttributes.end(); aRIt != aRLast; aRIt++) {
-        std::shared_ptr<GeomDataAPI_Point2D> anAttribute = aRIt->first;
-        std::shared_ptr<GeomAPI_Pnt> aPoint = aRIt->second;
-        if (!aFirstPointAttr.get() && aFirstPnt->isEqual(aPoint))
-          aFirstPointAttr = anAttribute;
-        if (!aLastPointAttr.get() && aLastPnt->isEqual(aPoint))
-          aLastPointAttr = anAttribute;
-        if (aFirstPointAttr.get() && aLastPointAttr.get())
-          break;
-      }
-
-      /// find the points in objects that intersect the base feature
-      ObjectPtr aFirstPointObject, aLastPointObject;
-      if (myUseGraphicIntersection && (!aFirstPointAttr.get() || !aLastPointAttr.get())) {
-        PntToObjectsMap aRefObjects = myCashedObjects[aBaseObject];
-        PntToObjectsMap::const_iterator
-          anObjectIt = aRefObjects.begin(), anObjectLast = aRefObjects.end();
-        for (; anObjectIt != anObjectLast; anObjectIt++) {
-          std::list< std::shared_ptr<ModelAPI_Object> > anObjects = anObjectIt->second;
-          if (anObjects.empty())
-            continue;
-          std::shared_ptr<ModelAPI_Object> anObject = anObjects.front();
-          std::shared_ptr<GeomAPI_Pnt> aPoint = anObjectIt->first;
-          if (!aFirstPointAttr.get() && !aFirstPointObject.get() && aFirstPnt->isEqual(aPoint))
-            aFirstPointObject = anObject;
-          if (!aLastPointAttr.get() && !aLastPointObject.get() && aLastPnt->isEqual(aPoint))
-            aLastPointObject = anObject;
-          if (aFirstPointAttr.get() && aLastPointAttr.get())
-            break;
-        }
-      }
-
-      if ((!aFirstPointAttr.get() && !aFirstPointObject.get()) ||
-          (!aLastPointAttr.get() && !aLastPointObject.get()))
-        return false;
-
-      FeaturePtr aFeature = feature();
-      AttributeRefAttrPtr anAPointAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-                                          aFeature->attribute(SketchPlugin_Constraint::ENTITY_A()));
-      AttributeRefAttrPtr aBPointAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
-                                          aFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      if (aFirstPointAttr.get())
-        anAPointAttr->setAttr(aFirstPointAttr);
-      else
-        anAPointAttr->setObject(aFirstPointObject);
-
-      if (aLastPointAttr.get())
-        aBPointAttr->setAttr(aLastPointAttr);
-      else
-        aBPointAttr->setObject(aLastPointObject);
-
-      if (myUseGraphicIntersection) {
-        // fill geometrical points
-        AttributePtr anAPointAttr = aFeature->attribute(SketchPlugin_Trim::ENTITY_A_POINT());
-        AttributePtr aBPointAttr = aFeature->attribute(SketchPlugin_Trim::ENTITY_B_POINT());
-        if (anAPointAttr.get() && aBPointAttr.get()) {
-          std::shared_ptr<GeomAPI_Pln> aPlane = PartSet_Tools::sketchPlane(sketch());
-
-          std::shared_ptr<GeomDataAPI_Point2D> anAPoint =
-                                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAPointAttr);
-          anAPoint->setValue(aFirstPnt->to2D(aPlane));
-
-          std::shared_ptr<GeomDataAPI_Point2D> aBPoint =
-                                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aBPointAttr);
-          aBPoint->setValue(aLastPnt->to2D(aPlane));
-        }
-      }
-      aResult = true;
-    }
-  }
-  return aResult;*/
+  // false is returned to do not emit focus out widget by selected sub-shape
   return false;
 }
 
@@ -361,74 +195,3 @@ void PartSet_WidgetFeaturePointSelector::setPreSelection(
   if (fillFeature(thePreSelected, theWnd, theEvent))
     mouseReleased(theWnd, theEvent);
 }
-
-//********************************************************************
-/*bool PartSet_WidgetFeaturePointSelector::isValidSelectionCustom(
-                                         const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
-{
-   // as we are modfying the attribute in move, we should not check validity here, by highlight
-  return false;
-}*/
-
-//********************************************************************
-/*void PartSet_WidgetFeaturePointSelector::getHighlighted(
-                           QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues)
-{
-  if (myCurrentSubShape.get() && myCurrentSubShape->object().get())
-    theValues.append(myCurrentSubShape);
-}*/
-
-//********************************************************************
-/*void PartSet_WidgetFeaturePointSelector::fillObjectShapes(const ObjectPtr& theObject)
-{
-  std::set<std::shared_ptr<GeomAPI_Shape> > aShapes;
-  std::map<std::shared_ptr<GeomDataAPI_Point2D>, std::shared_ptr<GeomAPI_Pnt> > aPointToAttributes;
-   std::map<std::shared_ptr<GeomAPI_Pnt>,
-                              std::list< std::shared_ptr<ModelAPI_Object> > > aPointToObjects;
-
-  std::set<std::shared_ptr<GeomDataAPI_Point2D> > aRefAttributes;
-  // current feature
-  FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-  std::set<ResultPtr> anEdgeShapes;
-  // edges on feature
-  ModelAPI_Tools::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeShapes);
-  if (!anEdgeShapes.empty()) {
-    GeomShapePtr aFeatureShape = (*anEdgeShapes.begin())->shape();
-
-    // coincidences to the feature
-    std::list<std::shared_ptr<GeomAPI_Pnt> > aPoints;
-
-    ModelGeomAlgo_Point2D::getPointsOfReference(aFeature, SketchPlugin_ConstraintCoincidence::ID(),
-                         aRefAttributes, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID());
-    // layed on feature coincidences to divide it on several shapes
-    CompositeFeaturePtr aSketch = sketch();
-    std::shared_ptr<ModelAPI_Data> aData = aSketch->data();
-    std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
-        aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
-    std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-        aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
-    std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-        aData->attribute(SketchPlugin_Sketch::NORM_ID()));
-    std::shared_ptr<GeomAPI_Dir> aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
-    ModelGeomAlgo_Point2D::getPointsInsideShape(aFeatureShape, aRefAttributes, aC->pnt(),
-                                                aX->dir(), aY, aPoints, aPointToAttributes);
-
-    // intersection points
-    if (myUseGraphicIntersection) {
-      std::list<FeaturePtr> aFeatures;
-      for (int i = 0; i < aSketch->numberOfSubs(); i++) {
-        FeaturePtr aFeature = aSketch->subFeature(i);
-        if (aFeature.get())
-          aFeatures.push_back(aFeature);
-      }
-      ModelGeomAlgo_Point2D::getPointsIntersectedShape(aFeature, aFeatures, aPoints,
-                                                       aPointToObjects);
-    }
-    GeomAlgoAPI_ShapeTools::splitShape(aFeatureShape, aPoints, aShapes);
-  }
-  myCashedShapes[theObject] = aShapes;
-  myCashedReferences[theObject] = aPointToAttributes;
-  if (myUseGraphicIntersection)
-    myCashedObjects[theObject] = aPointToObjects;
-}
-*/
index 503c0bc8b574f4a157195a2f9f16aa9e7bf83a97..cfb6329db434cfa06b72ef1f975dc0d7104fb75d 100644 (file)
@@ -18,9 +18,6 @@
 
 #include <QObject>
 
-#include <set>
-#include <map>
-
 class ModuleBase_IWorkshop;
 class Config_WidgetAPI;
 class ModuleBase_IViewWindow;
@@ -99,28 +96,6 @@ Q_OBJECT
                                ModuleBase_IViewWindow* theWnd,
                                QMouseEvent* theEvent);
 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 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 std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
-  //                              ObjectPtr& theObject,
-  //                              GeomShapePtr& theShape);
-  //void fillObjectShapes(const ObjectPtr& theObject);
-
-  /// 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 std::shared_ptr<ModuleBase_ViewerPrs>& thePrs,
-  //                              ObjectPtr& theObject,
-  //                              GeomShapePtr& theShape);
-
   /// 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
@@ -134,20 +109,9 @@ protected:
   bool fillFeature(const std::shared_ptr<ModuleBase_ViewerPrs>& theSelectedPrs,
                    ModuleBase_IViewWindow* theWnd,
                    QMouseEvent* theEvent);
-  //std::shared_ptr<ModuleBase_ViewerPrs> myCurrentSubShape;
-  //std::map<ObjectPtr, std::set<GeomShapePtr> > myCashedShapes;
-
-  //typedef std::map<std::shared_ptr<GeomDataAPI_Point2D>,
-  //                 std::shared_ptr<GeomAPI_Pnt> > PntToAttributesMap;
-  //std::map<ObjectPtr, PntToAttributesMap> myCashedReferences;
-
-  //typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
-  //           std::list< std::shared_ptr<ModelAPI_Object> > > PntToObjectsMap;
-  //std::map<ObjectPtr, PntToObjectsMap> myCashedObjects;
 
   /// Pointer to a sketch
   CompositeFeaturePtr mySketch;
-  bool myUseGraphicIntersection;
   Quantity_Color myHighlightColor;
   Quantity_Color mySelectionColor;
 };
index e9d157a1da87b7e7704fbacf528d3b306129a093..b0e41e4f12abdd87875542e32bb014df8ab0210e 100755 (executable)
@@ -26,7 +26,6 @@
 #include <SketchPlugin_ConstraintCoincidence.h>
 #include <SketchPlugin_Constraint.h>
 #include <SketchPlugin_Point.h>
-#include <SketchPlugin_Trim.h>
 
 #include <ModuleBase_IViewWindow.h>
 #include <ModuleBase_IWorkshop.h>
@@ -46,7 +45,6 @@ PartSet_WidgetSubShapeSelector::PartSet_WidgetSubShapeSelector(QWidget* theParen
                                                          const Config_WidgetAPI* theData)
 : ModuleBase_WidgetShapeSelector(theParent, theWorkshop, theData)
 {
-  myUseGraphicIntersection = theData->getBooleanAttribute("use_graphic_intersection", false);
   myCurrentSubShape = std::shared_ptr<ModuleBase_ViewerPrs>(new ModuleBase_ViewerPrs());
 }
 
@@ -165,7 +163,7 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
       std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
 
       std::shared_ptr<GeomDataAPI_Point2D> aFirstPointAttr, aLastPointAttr;
-      /// find the points in base feature attributes
+      /// find the points in feature attributes
       FeaturePtr aBaseFeature = ModelAPI_Feature::feature(aBaseObject);
       std::list<AttributePtr> a2DPointAttributes = aBaseFeature->data()->attributes(
                                                         GeomDataAPI_Point2D::typeId());
@@ -187,8 +185,7 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
       PntToAttributesMap aRefAttributes = myCashedReferences[aBaseObject];
       PntToAttributesMap::const_iterator
         aRIt = aRefAttributes.begin(), aRLast = aRefAttributes.end();
-      for (PntToAttributesMap::const_iterator aRIt = aRefAttributes.begin(),
-           aRLast = aRefAttributes.end(); aRIt != aRLast; aRIt++) {
+      for (; aRIt != aRLast; aRIt++) {
         std::shared_ptr<GeomDataAPI_Point2D> anAttribute = aRIt->first;
         std::shared_ptr<GeomAPI_Pnt> aPoint = aRIt->second;
         if (!aFirstPointAttr.get() && aFirstPnt->isEqual(aPoint))
@@ -198,30 +195,7 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
         if (aFirstPointAttr.get() && aLastPointAttr.get())
           break;
       }
-
-      /// find the points in objects that intersect the base feature
-      ObjectPtr aFirstPointObject, aLastPointObject;
-      if (myUseGraphicIntersection && (!aFirstPointAttr.get() || !aLastPointAttr.get())) {
-        PntToObjectsMap aRefObjects = myCashedObjects[aBaseObject];
-        PntToObjectsMap::const_iterator
-          anObjectIt = aRefObjects.begin(), anObjectLast = aRefObjects.end();
-        for (; anObjectIt != anObjectLast; anObjectIt++) {
-          std::list< std::shared_ptr<ModelAPI_Object> > anObjects = anObjectIt->second;
-          if (anObjects.empty())
-            continue;
-          std::shared_ptr<ModelAPI_Object> anObject = anObjects.front();
-          std::shared_ptr<GeomAPI_Pnt> aPoint = anObjectIt->first;
-          if (!aFirstPointAttr.get() && !aFirstPointObject.get() && aFirstPnt->isEqual(aPoint))
-            aFirstPointObject = anObject;
-          if (!aLastPointAttr.get() && !aLastPointObject.get() && aLastPnt->isEqual(aPoint))
-            aLastPointObject = anObject;
-          if (aFirstPointAttr.get() && aLastPointAttr.get())
-            break;
-        }
-      }
-
-      if ((!aFirstPointAttr.get() && !aFirstPointObject.get()) ||
-          (!aLastPointAttr.get() && !aLastPointObject.get()))
+      if (!aFirstPointAttr.get() || !aLastPointAttr)
         return false;
 
       FeaturePtr aFeature = feature();
@@ -229,32 +203,8 @@ bool PartSet_WidgetSubShapeSelector::setSelection(
                                           aFeature->attribute(SketchPlugin_Constraint::ENTITY_A()));
       AttributeRefAttrPtr aBPointAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
                                           aFeature->attribute(SketchPlugin_Constraint::ENTITY_B()));
-      if (aFirstPointAttr.get())
-        anAPointAttr->setAttr(aFirstPointAttr);
-      else
-        anAPointAttr->setObject(aFirstPointObject);
-
-      if (aLastPointAttr.get())
-        aBPointAttr->setAttr(aLastPointAttr);
-      else
-        aBPointAttr->setObject(aLastPointObject);
-
-      /*if (myUseGraphicIntersection) {
-        // fill geometrical points
-        AttributePtr anAPointAttr = aFeature->attribute(SketchPlugin_Trim::ENTITY_A_POINT());
-        AttributePtr aBPointAttr = aFeature->attribute(SketchPlugin_Trim::ENTITY_B_POINT());
-        if (anAPointAttr.get() && aBPointAttr.get()) {
-          std::shared_ptr<GeomAPI_Pln> aPlane = PartSet_Tools::sketchPlane(sketch());
-
-          std::shared_ptr<GeomDataAPI_Point2D> anAPoint =
-                                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAPointAttr);
-          anAPoint->setValue(aFirstPnt->to2D(aPlane));
-
-          std::shared_ptr<GeomDataAPI_Point2D> aBPoint =
-                                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aBPointAttr);
-          aBPoint->setValue(aLastPnt->to2D(aPlane));
-        }
-      }*/
+      anAPointAttr->setAttr(aFirstPointAttr);
+      aBPointAttr->setAttr(aLastPointAttr);
       aResult = true;
     }
   }
@@ -275,21 +225,16 @@ void PartSet_WidgetSubShapeSelector::fillObjectShapes(const ObjectPtr& theObject
 {
   std::set<std::shared_ptr<GeomAPI_Shape> > aShapes;
   std::map<std::shared_ptr<GeomDataAPI_Point2D>, std::shared_ptr<GeomAPI_Pnt> > aPointToAttributes;
-   std::map<std::shared_ptr<GeomAPI_Pnt>,
-                              std::list< std::shared_ptr<ModelAPI_Object> > > aPointToObjects;
-
   std::set<std::shared_ptr<GeomDataAPI_Point2D> > aRefAttributes;
   // current feature
   FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
-  std::set<ResultPtr> anEdgeShapes;
   // edges on feature
-  ModelAPI_Tools::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeShapes);
-  if (!anEdgeShapes.empty()) {
-    GeomShapePtr aFeatureShape = (*anEdgeShapes.begin())->shape();
+  std::set<ResultPtr> anEdgeResults;
+  ModelAPI_Tools::shapesOfType(aFeature, GeomAPI_Shape::EDGE, anEdgeResults);
+  if (!anEdgeResults.empty()) {
+    GeomShapePtr aFeatureShape = (*anEdgeResults.begin())->shape();
 
     // coincidences to the feature
-    std::list<std::shared_ptr<GeomAPI_Pnt> > aPoints;
-
     ModelGeomAlgo_Point2D::getPointsOfReference(aFeature, SketchPlugin_ConstraintCoincidence::ID(),
                          aRefAttributes, SketchPlugin_Point::ID(), SketchPlugin_Point::COORD_ID());
     // layed on feature coincidences to divide it on several shapes
@@ -302,25 +247,13 @@ void PartSet_WidgetSubShapeSelector::fillObjectShapes(const ObjectPtr& theObject
     std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
         aData->attribute(SketchPlugin_Sketch::NORM_ID()));
     std::shared_ptr<GeomAPI_Dir> aY(new GeomAPI_Dir(aNorm->dir()->cross(aX->dir())));
+    std::list<std::shared_ptr<GeomAPI_Pnt> > aPoints;
     ModelGeomAlgo_Point2D::getPointsInsideShape_p(aFeatureShape, aRefAttributes, aC->pnt(),
                                                 aX->dir(), aY, aPoints, aPointToAttributes);
 
-    // intersection points
-    /*if (myUseGraphicIntersection) {
-      std::list<FeaturePtr> aFeatures;
-      for (int i = 0; i < aSketch->numberOfSubs(); i++) {
-        FeaturePtr aFeature = aSketch->subFeature(i);
-        if (aFeature.get())
-          aFeatures.push_back(aFeature);
-      }
-      ModelGeomAlgo_Point2D::getPointsIntersectedShape(aFeature, aFeatures, aPoints,
-                                                       aPointToObjects);
-    }*/
     GeomAlgoAPI_ShapeTools::splitShape_p(aFeatureShape, aPoints, aShapes);
   }
   myCashedShapes[theObject] = aShapes;
   myCashedReferences[theObject] = aPointToAttributes;
-  if (myUseGraphicIntersection)
-    myCashedObjects[theObject] = aPointToObjects;
 }
 
index 4b86b46af346973b01484455cd79dbae1f7a5fed..376ffb139fe863b2b7e6b989aa9ffce090063ce5 100644 (file)
@@ -119,13 +119,8 @@ protected:
                    std::shared_ptr<GeomAPI_Pnt> > PntToAttributesMap;
   std::map<ObjectPtr, PntToAttributesMap> myCashedReferences;
 
-  typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
-             std::list< std::shared_ptr<ModelAPI_Object> > > PntToObjectsMap;
-  std::map<ObjectPtr, PntToObjectsMap> myCashedObjects;
-
   /// Pointer to a sketch
   CompositeFeaturePtr mySketch;
-  bool myUseGraphicIntersection;
 };
 
 #endif
\ No newline at end of file
index f925617772c56dfded9c2293b1873f64e9eb3a06..d42a75c1818f40bdfb821563bbb9e44b00e3d686 100644 (file)
@@ -146,7 +146,6 @@ ADD_UNIT_TESTS(TestSketchPointLine.py
                TestHighload.py
                TestSnowflake.py
                TestArcBehavior.py
-               Test1924.py
                TestRemoveSketch.py
                Test1061.py
                Test1673.py