#include <ModelAPI_AttributeRefList.h>
#endif
+//#define DEBUG_OPERATION_START
+
#ifdef _DEBUG
#include <QDebug>
#endif
return true;
std::string anError = ModelAPI_Tools::getFeatureError(myFeature);
+ ModuleBase_Tools::translate(myFeature->getKind(), anError);
return anError.empty();
}
myVisualizedObjects.clear();
// store hidden result features
- std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
ObjectPtr anObject = *aIt;
return;
// store hidden result features
- std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt) {
ObjectPtr anObject = *aIt;
if (aFeature) {
if (aFeature == theObj)
return true;
- std::list<ResultPtr> aResults = aFeature->results();
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
- if (theObj == (*aIt))
- return true;
+ ResultPtr aResult = *aIt;
+ if (theObj == aResult)
+ return true;
}
#ifdef DEBUG_DO_NOT_ACTIVATE_SUB_FEATURE
if (aFeature->isMacro()) {
bool ModuleBase_OperationFeature::start()
{
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::start -- begin");
+#endif
setIsModified(false);
QString anId = getDescription()->operationId();
if (myIsEditing) {
// in order to update commands status in the workshop, to be exact the feature action
// to be unchecked
abort();
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::start -- end : IMPOSSIBLE to start");
+#endif
return false;
}
}
//Already called startOperation();
emit started();
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::start -- end");
+#endif
return true;
}
void ModuleBase_OperationFeature::abort()
{
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::abort -- begin");
+#endif
+
emit beforeAborted();
// the viewer update should be blocked in order to avoid the features blinking before they are
Events_Loop::loop()->send(aMsg);
emit aborted();
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::abort -- end");
+#endif
}
bool ModuleBase_OperationFeature::commit()
{
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::commit -- begin");
+#endif
ModuleBase_IPropertyPanel* aPanel = propertyPanel();
if (aPanel) {
ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
emit committed();
afterCommitOperation();
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::commit -- end : IMPOSSIBLE to commit");
+#endif
return true;
}
+#ifdef DEBUG_OPERATION_START
+ qDebug("ModuleBase_OperationFeature::commit -- end");
+#endif
return false;
}
aWgt = (*aWIt);
if (aWgt->attributeID() == theGreedAttributeId) {
aPropertyPanel->setPreselectionWidget(aWgt);
- aWgt->setSelection(myPreSelection, true);
- aPropertyPanel->setPreselectionWidget(NULL);
- aFilledWgt = aWgt;
- break;
+ if (aWgt->setSelection(myPreSelection, true)) {
+ aPropertyPanel->setPreselectionWidget(NULL);
+ aFilledWgt = aWgt;
+ break;
+ }
+ else { // do not process invalid for greed widget selection
+ break;
+ }
}
}
}
return myPreviousCurrentFeature;
}
-void ModuleBase_OperationFeature::initSelection(ModuleBase_ISelection* theSelection,
- ModuleBase_IViewer* theViewer)
+void ModuleBase_OperationFeature::initSelection(const QList<ModuleBase_ViewerPrsPtr>& thePreSelected)
{
- QList<ModuleBase_ViewerPrsPtr> aPreSelected;
+ QObjectPtrList aCurrentFeatureResults;
+
// Check that the selected result are not results of operation feature
FeaturePtr aFeature = feature();
if (aFeature) {
- QList<ModuleBase_ViewerPrsPtr> aSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
-
- std::list<ResultPtr> aResults = aFeature->results();
- QObjectPtrList aResList;
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(aFeature, aResults);
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
- aResList.append(*aIt);
-
- foreach (ModuleBase_ViewerPrsPtr aPrs, aSelected) {
- if ((!aResList.contains(aPrs->object())) && (aPrs->object() != aFeature))
+ aCurrentFeatureResults.append(*aIt);
+ }
+
+ if (aCurrentFeatureResults.empty()) /// filtering of selection is not necessary
+ setPreselection(thePreSelected);
+ else { // create preselection list without results of current feature
+ QList<ModuleBase_ViewerPrsPtr> aPreSelected;
+ foreach (ModuleBase_ViewerPrsPtr aPrs, thePreSelected) {
+ if ((!aCurrentFeatureResults.contains(aPrs->object())) && (aPrs->object() != aFeature))
aPreSelected.append(aPrs);
}
- } else
- aPreSelected = theSelection->getSelected(ModuleBase_ISelection::AllControls);
-
- setPreselection(aPreSelected);
+ setPreselection(aPreSelected);
+ }
}
void ModuleBase_OperationFeature::setPreselection(const QList<ModuleBase_ViewerPrsPtr>& theValues)
for (aWIt = aWidgets.constBegin(); aWIt != aWidgets.constEnd(); ++aWIt) {
ModuleBase_ModelWidget* aWgt = (*aWIt);
connect(aWgt, SIGNAL(valuesChanged()), this, SLOT(onValuesChanged()));
+ connect(aWgt, SIGNAL(valueStateChanged(int)), this, SLOT(onValueStateChanged(int)));
}
}