]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into SketchSolver
authorazv <azv@opencascade.com>
Tue, 1 Jul 2014 06:23:08 +0000 (10:23 +0400)
committerazv <azv@opencascade.com>
Tue, 1 Jul 2014 06:23:08 +0000 (10:23 +0400)
1  2 
src/PartSet/PartSet_Module.cpp
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp

index 1cef3112f2c00cc61e0f8e0d4b31df7b45b5c319,65172c482b5c6b440b6957c9e75f5afab36eb998..75d9692019797317976d556efe95a77c1ab7fe94
@@@ -40,7 -40,9 +40,7 @@@
  #include <Events_Error.h>
  
  #include <GeomAPI_Shape.h>
 -
 -#include <AIS_ListOfInteractive.hxx>
 -//#include <AIS_DimensionSelectionMode.hxx>
 +#include <GeomAPI_AISObject.h>
  
  #include <QObject>
  #include <QMouseEvent>
@@@ -389,8 -391,6 +389,6 @@@ ModuleBase_Operation* PartSet_Module::c
      connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
              this, SLOT(onMultiSelectionEnabled(bool)));
  
-     connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
-             this, SLOT(onMultiSelectionEnabled(bool)));
      connect(aPreviewOp, SIGNAL(stopSelection(const QFeatureList&, const bool)),
              this, SLOT(onStopSelection(const QFeatureList&, const bool)));
      connect(aPreviewOp, SIGNAL(setSelection(const QFeatureList&)),
@@@ -437,8 -437,7 +435,8 @@@ void PartSet_Module::visualizePreview(F
        boost::dynamic_pointer_cast<SketchPlugin_Feature>(theFeature);
      if (aSPFeature)
      {
 -      Handle(AIS_InteractiveObject) anAIS = aSPFeature->getAISShape(aDisplayer->getAISObject(theFeature));
 +      boost::shared_ptr<GeomAPI_AISObject> anAIS = 
 +        aSPFeature->getAISObject(aDisplayer->getAISObject(theFeature));
        aDisplayer->redisplay(theFeature, anAIS, false);
      }
    }
index 9d2cda07ba75f07aca6484a297c04332382a88e5,37c0fb3fec68b16ec85985f087f50f55969eff62..593716ed9f2c6cea4cebf9eb3719950cdabbef1e
@@@ -41,7 -41,9 +41,9 @@@ const boost::shared_ptr<GeomAPI_Shape>
      // compute a circle point in 3D view
      boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = 
        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(data()->attribute(CIRCLE_ATTR_CENTER));
-     if (aCenterAttr->isInitialized()) {
+     AttributeDoublePtr aRadiusAttr = 
+       boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
+     if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
        boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
        // make a visible point
        boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
@@@ -54,8 -56,6 +56,6 @@@
        if (aHasPlane) {
          boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
          // compute the circle radius
-         AttributeDoublePtr aRadiusAttr = 
-           boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(CIRCLE_ATTR_RADIUS));
          double aRadius = aRadiusAttr->value();
  
          boost::shared_ptr<GeomAPI_Shape> aCircleShape = 
    return getPreview();
  }
  
 +boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Circle::getAISObject(
 +                                boost::shared_ptr<GeomAPI_AISObject> thePrevious)
 +{
 +  return prepareAISShape(thePrevious);
 +}
 +
  void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
  {
    boost::shared_ptr<ModelAPI_Data> aData = data();
index 50506850e5dc305db18fb8bafe4383e81de3d843,9a4f1f1c4d7a2ce9e2e9888170f3dd3b79a47fdd..7bc0ec60084671eb3367d3baf5f3986fecbec408
@@@ -5,7 -5,6 +5,7 @@@
  #include "SketchPlugin_Sketch.h"
  #include <ModelAPI_Data.h>
  #include <ModelAPI_AttributeRefList.h>
 +#include <GeomAPI_AISObject.h>
  #include <GeomAPI_XYZ.h>
  #include <GeomDataAPI_Dir.h>
  #include <GeomDataAPI_Point.h>
  #include <GeomAlgoAPI_CompoundBuilder.h>
  #include <GeomAlgoAPI_SketchBuilder.h>
  
 -#include <AIS_InteractiveObject.hxx>
 -#include <AIS_Shape.hxx>
  
 -#include <Quantity_NameOfColor.hxx>
 -
 -const Quantity_NameOfColor SKETCH_PLANE_COLOR = Quantity_NOC_CHOCOLATE; /// the plane edge color
 -const int SKETCH_WIDTH = 4; /// the plane edge width
 +const int SKETCH_PLANE_COLOR = Colors::COLOR_BROWN; /// the plane edge color
 +const double SKETCH_WIDTH = 4.0; /// the plane edge width
  
  using namespace std;
  
@@@ -67,6 -70,8 +67,8 @@@ void SketchPlugin_Sketch::execute(
        aFeaturesPreview.push_back(aPreview);
    }
  
+   if (aFeaturesPreview.empty())
+     return ;
    std::list< boost::shared_ptr<GeomAPI_Shape> > aLoops;
    std::list< boost::shared_ptr<GeomAPI_Shape> > aWires;
    GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(),
    data()->store(aCompound);
  }
  
 -Handle(AIS_InteractiveObject) SketchPlugin_Sketch::getAISShape(Handle(AIS_InteractiveObject) thePrevious)
 +boost::shared_ptr<GeomAPI_AISObject> SketchPlugin_Sketch::getAISObject(
 +                                boost::shared_ptr<GeomAPI_AISObject> thePrevious)
  {
 -  Handle(AIS_InteractiveObject) anAIS = SketchPlugin_Feature::getAISShape(thePrevious);
 -  Handle(AIS_Shape) aShapeAIS = Handle(AIS_Shape)::DownCast(anAIS);
 -  aShapeAIS->SetColor(Quantity_Color(SKETCH_PLANE_COLOR));
 -  aShapeAIS->SetWidth(SKETCH_WIDTH);
 -  aShapeAIS->Redisplay();
 +  boost::shared_ptr<GeomAPI_AISObject> anAIS = prepareAISShape(thePrevious);
 +  anAIS->setColor(SKETCH_PLANE_COLOR);
 +  anAIS->setWidth(SKETCH_WIDTH);
 +  //anAIS->Redisplay();
    return anAIS;
  }