+ QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+ QList<ModuleBase_ViewerPrs> aHighlighted = theSelection->getHighlighted();
+ // commented: the next code is commented because the nearestFeature check the highlighting
+ // and selection inside
+ //if (aHasShift && (aSelected.size() > 0)) {
+ // foreach(ModuleBase_ViewerPrs aPrs, aHighlighted)
+ // aSelected.append(aPrs);
+ //}
+ //if (aHasShift && aSelected.size() > 0)
+ // return;
+
+ // there should be a start of operation, which uses the pre-highlighted objects,
+ // the selected ones are collected here and are processed by a mouse move
+ //if (aHighlighted.size() == 1) {
+ //if (aSelected.size() > 0) {
+ // ObjectPtr aFeature = aSelected.first().object();
+ // if (aFeature) {
+ // commented: end
+ Handle(V3d_View) aView = theViewer->activeView();
+ ObjectPtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(), aView, feature(),
+ aSelected, aHighlighted);
+ if (aFeature)
+ restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
+ //}
+ //}
+ //else
+ // myFeatures = aHighlighted;
+ //else
+ //myFeatures = aSelected;
+ }
+}
+
+
+void PartSet_OperationSketch::selectionChanged(ModuleBase_ISelection* theSelection)
+{
+ if (hasSketchPlane())
+ return;
+
+ QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+ if (!aSelected.empty()) {
+ ModuleBase_ViewerPrs aPrs = aSelected.first();
+ // We have to select a plane before any operation
+ TopoDS_Shape aShape = aPrs.shape();
+ if (!aShape.IsNull()) {
+ boost::shared_ptr<GeomAPI_Dir> aDir = setSketchPlane(aShape);
+ flushUpdated();
+ emit featureConstructed(feature(), FM_Hide);
+ // If selection is not a sketcher presentation then it has to be stored as
+ // External shape
+ if (feature() != aPrs.object()) {
+ //boost::shared_ptr<SketchPlugin_Sketch> aSketch =
+ // boost::dynamic_pointer_cast<SketchPlugin_Sketch>(feature());
+ DataPtr aData = feature()->data();
+ AttributeSelectionPtr aSelAttr =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+ (aData->attribute(SketchPlugin_Feature::EXTERNAL_ID()));
+ if (aSelAttr) {
+ ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
+ if (aRes) {
+ GeomShapePtr aShapePtr(new GeomAPI_Shape());
+ aShapePtr->setImpl(new TopoDS_Shape(aShape));
+ aSelAttr->setValue(aRes, aShapePtr);
+ }
+ }
+ } else {
+ // Turn viewer to the plane
+ emit planeSelected(aDir->x(), aDir->y(), aDir->z());