- if ((aOperation->id().toStdString() == SketchPlugin_Line::ID()) &&
- (myEditingAttr.size() == 1) &&
- myEditingAttr.first()) {
- // probably we have prehighlighted point
- AttributePtr aAttr = myEditingAttr.first();
- std::string aAttrId = aAttr->id();
- ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
- QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
- // Find corresponded widget to provide dragging
- foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
- if (aWgt->attributeID() == aAttrId) {
- PartSet_WidgetPoint2D* aWgt2d = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
- if (aWgt2d) {
- aWgt2d->setPoint(aWgt2d->x() + dX, aWgt2d->y() + dY);
- break;
+ XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
+ XGUI_Displayer* aDisplayer = aConnector->workshop()->displayer();
+ // 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.
+ bool isEnableUpdateViewer = aDisplayer->enableUpdateViewer(false);
+
+ static Events_ID aMoveEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
+ //static Events_ID aUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+
+ FeatureToAttributesMap::const_iterator anIt = myFeature2AttributeMap.begin(),
+ aLast = myFeature2AttributeMap.end();
+ // 4. the features and attributes modification(move)
+ for (; anIt != aLast; anIt++) {
+ FeaturePtr aFeature = anIt.key();
+
+ AttributeList anAttributes = anIt.value();
+ // Process selection by attribute: the priority to the attribute
+ if (!anAttributes.empty()) {
+ AttributeList::const_iterator anAttIt = anAttributes.begin(), anAttLast = anAttributes.end();
+ for (; anAttIt != anAttLast; anAttIt++) {
+ AttributePtr anAttr = *anAttIt;
+ if (anAttr.get() == NULL)
+ continue;
+ std::string aAttrId = anAttr->id();
+ DataPtr aData = aFeature->data();
+ if (aData.get() != NULL) {
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(aAttrId));
+ if (aPoint.get() != NULL) {
+ bool isImmutable = aPoint->setImmutable(true);
+ aPoint->move(dX, dY);
+ ModelAPI_EventCreator::get()->sendUpdated(aFeature, aMoveEvent);
+ aPoint->setImmutable(isImmutable);
+ }