+ if (myFeatures.size() != 1) {
+ FeaturePtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(), theView, feature(),
+ myFeatures);
+ if (aFeature)
+ restartOperation(PartSet_OperationFeatureEditMulti::Type(), aFeature);
+ }
+}
+
+std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
+{
+ std::list<FeaturePtr> aFeaList;
+ FeaturePtr aFeature = feature();
+ if (!aFeature)
+ return aFeaList;
+
+ boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
+ if (!aData->isValid())
+ return std::list<FeaturePtr>();
+ boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+
+ std::list<ObjectPtr> aList = aRefList->list();
+ std::list<ObjectPtr>::iterator aIt;
+ for (aIt = aList.begin(); aIt != aList.end(); ++aIt) {
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
+ if (aFeature)
+ aFeaList.push_back(aFeature);
+ }
+ return aFeaList;
+}
+
+void PartSet_OperationSketch::stopOperation()
+{
+ PartSet_OperationSketchBase::stopOperation();
+ emit featureConstructed(feature(), FM_Hide);
+ emit closeLocalContext();
+
+ FeaturePtr aFeature = feature();
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+ ModelAPI_EventCreator::get()->sendUpdated(
+ *aIt, Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ }
+ //ModelAPI_EventCreator::get()->sendUpdated(aFeature,
+ // Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+}
+
+bool PartSet_OperationSketch::isNestedOperationsEnabled() const
+{
+ return hasSketchPlane();
+}
+
+void PartSet_OperationSketch::startOperation()
+{
+ PartSet_OperationSketchBase::startOperation();
+ if (!isEditOperation())
+ emit fitAllView();
+}
+
+bool PartSet_OperationSketch::hasSketchPlane() const
+{
+ bool aHasPlane = false;
+
+ if (feature()) {
+ boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
+ AttributeDoublePtr anAttr;
+ boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ aData->attribute(SketchPlugin_Sketch::NORM_ID()));
+ aHasPlane = aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0);
+ }
+ return aHasPlane;