- // 3. the flag to disable the update viewer should be set in order to avoid blinking in the
- // viewer happens by deselect/select the modified objects. The flag should be restored after
- // the selection processing. The update viewer should be also called.
- myPreviousUpdateViewerEnabled = aDisplayer->enableUpdateViewer(false);
+
+ QIntList aModes;
+ if (isActive) {
+ aModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
+ aModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
+ aModes.append(SketcherPrs_Tools::Sel_Constraint);
+ aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
+ aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
+ }
+ aDisplayer->activateObjects(aModes);
+}
+
+void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
+{
+ ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
+ ModuleBase_ISelection* aSelect = aWorkshop->selection();
+ QList<ModuleBase_ViewerPrs> aHighlighted = aSelect->getHighlighted();
+
+ QMap<FeaturePtr, QList<AttributePtr> > aFeature2AttributeMap;
+ if (theHighlightedOnly) {
+ fillFeature2Attribute(aHighlighted, aFeature2AttributeMap, myCurrentSketch);
+ }
+ else {
+ fillFeature2Attribute(aHighlighted, aFeature2AttributeMap, myCurrentSketch);
+
+ QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
+ fillFeature2Attribute(aSelected, aFeature2AttributeMap, myCurrentSketch);
+ }
+
+ // 1. it is necessary to save current selection in order to restore it after the features moving
+ myCurrentSelection.clear();
+ QMap<FeaturePtr, QList<AttributePtr> >::const_iterator anIt = aFeature2AttributeMap.begin(),
+ aLast = aFeature2AttributeMap.end();
+ for (; anIt != aLast; anIt++) {
+ FeaturePtr aFeature = anIt.key();
+ getCurrentSelection(aFeature, myCurrentSketch, aWorkshop, myCurrentSelection);
+ }
+ //qDebug(QString(" storeSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());