]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Deactivate an arc AIS preview object.
authornds <natalia.donis@opencascade.com>
Thu, 6 Nov 2014 09:41:39 +0000 (12:41 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 6 Nov 2014 09:41:39 +0000 (12:41 +0300)
If the AIS exists immediatelly after the feature create, it is not deactivated because of Wokshop's realization.
The deactivation happens by the signal about the feature redisplay. The result on a signal about the feature create is display, but not the deactivate. In case of the AIS object exists immediatelly, the slot onFeatureCreated should be corrected to deactivate the AIS after display.

src/SketchPlugin/SketchPlugin_Arc.cpp

index 26eabc918463f9ca053fe91da0e936e01e6a33bb..7d25c48c3d10017323e923319605d9852c708817 100644 (file)
@@ -93,8 +93,6 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
   if (aSketch) {
     // if the feature is valid, the execute() method should be performed, AIS object is empty
     if (!isFeatureValid()) {
-      std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
-
       // compute a circle point in 3D view
       boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
           GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
@@ -114,21 +112,25 @@ AISObjectPtr SketchPlugin_Arc::getAISObject(AISObjectPtr thePrevious)
             boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
                                                             aCenter, aStartPoint, aStartPoint, aNormal);
             if (aCircleShape) {
+              std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
               // make a visible point
               boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
               aShapes.push_back(aCenterPointShape);
 
               aShapes.push_back(aCircleShape);
+              if (!aShapes.empty())
+              {
+                boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
+                AISObjectPtr anAIS = thePrevious;
+                if (!anAIS)
+                  anAIS = AISObjectPtr(new GeomAPI_AISObject);
+                anAIS->createShape(aCompound);
+                return anAIS;
+              }
             }
           }
         }
       }
-      boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
-      AISObjectPtr anAIS = thePrevious;
-      if (!anAIS)
-        anAIS = AISObjectPtr(new GeomAPI_AISObject);
-      anAIS->createShape(aCompound);
-      return anAIS;
     }
   }
   return AISObjectPtr();