//********************************************************************
bool ModuleBase_WidgetSelector::storeValue(ObjectPtr theObject) const
{
+ FeaturePtr aSelectedFeature = ModuleBase_Tools::feature(mySelectedObject);
+ if (aSelectedFeature == theObject) // In order to avoid selection of the same object
+ return false;
+
DataPtr aData = theObject->data();
boost::shared_ptr<ModelAPI_AttributeReference> aRef =
boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(attributeID()));
mySelectedObject = aObject;
if (mySelectedObject) {
updateSelectionName();
- activateSelection(false);
+ myActivateBtn->setChecked(false);
raisePanel();
} else {
myTextLine->setText("");
{
if (theObj == myTextLine) {
if (theEvent->type() == QEvent::Polish) {
- activateSelection(myActivateOnStart);
+ myActivateBtn->setChecked(myActivateOnStart);
onSelectionChanged();
}
}
std::set<ObjectPtr > aFeatures = aUpdMsg->objects();
std::set<ObjectPtr >::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
- aDisplayer->deactivate(*anIt, false);
+ aDisplayer->deactivate(*anIt);
FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
if (aFeature)
myModule->activateFeature(aFeature, false);
XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
//disconnect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
// this, SLOT(onStorePoint2D(ObjectPtr, const std::string&)));
+ } else {
+ // Activate results of current feature for selection
+ FeaturePtr aFeature = theOperation->feature();
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+ aDisplayer->activate(*aIt);
+ }
}
}
aPreviewOp->initSelection(aSelected, aHighlighted);
} else {
anOperation->setEditingFeature(aFeature);
+ //Deactivate result of current feature in order to avoid its selection
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+ aDisplayer->deactivate(*aIt);
+ }
}
sendOperation(anOperation);
myWorkshop->actionsMgr()->updateCheckState();
updateViewer();
}
-void XGUI_Displayer::deactivate(ObjectPtr theObject, bool toUpdate)
+void XGUI_Displayer::deactivate(ObjectPtr theObject)
{
if (isVisible(theObject)) {
Handle(AIS_InteractiveContext) aContext = AISContext();
}
}
+void XGUI_Displayer::activate(ObjectPtr theObject)
+{
+ if (isVisible(theObject)) {
+ Handle(AIS_InteractiveContext) aContext = AISContext();
+
+ boost::shared_ptr<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+ Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+ aContext->Activate(anAIS);
+ }
+}
+
void XGUI_Displayer::stopSelection(const QList<ObjectPtr>& theResults, const bool isStop,
const bool isUpdateViewer)
{
/// \return feature the feature or NULL if it not visualized
ObjectPtr getObject(Handle(AIS_InteractiveObject) theIO) const;
- void deactivate(ObjectPtr theFeature, bool toUpdate);
+ void deactivate(ObjectPtr theFeature);
+
+ void activate(ObjectPtr theFeature);
protected:
/// Deactivate local selection