#include <ModuleBase_WidgetFactory.h>
#include <ModuleBase_Tools.h>
#include <ModuleBase_IViewer.h>
+#include<ModuleBase_FilterFactory.h>
#include <Config_Common.h>
#include <Config_FeatureMessage.h>
#include <Config_PointerMessage.h>
#include <Config_ModuleReader.h>
#include <Config_PropManager.h>
+#include <Config_SelectionFilterMessage.h>
#include <QApplication>
#include <QFileDialog>
QMap<QString, QString> XGUI_Workshop::myIcons;
-std::string XGUI_Workshop::featureIconStr(const FeaturePtr& theFeature)
-{
- std::string aKind = theFeature->getKind();
- QString aId(aKind.c_str());
- if (!myIcons.contains(aId))
- return std::string();
-
- return myIcons[aId].toStdString();
-}
QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
{
QIcon anIcon;
- QString anIconString = featureIconStr(theFeature).c_str();
+ std::string aKind = theFeature->getKind();
+ QString aId(aKind.c_str());
+ if (!myIcons.contains(aId))
+ return anIcon;
+
+ QString anIconString = myIcons[aId];
ModelAPI_ExecState aState = theFeature->data()->execState();
switch(aState) {
}
break;
case ModelAPI_StateExecFailed: {
- anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png",
- 12, 12, anIconString);
+ anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png", anIconString);
}
break;
case ModelAPI_StateInvalidArgument: {
anIcon = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
- 12, 12, anIconString);
+ anIconString);
}
break;
default: break;
aLoop->registerListener(this, Events_Loop::eventByName("CurrentDocumentChanged"));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
registerValidators();
+
// Calling of loadCustomProps before activating module is required
// by Config_PropManger to restore user-defined path to plugins
XGUI_Preferences::loadCustomProps();
// If not found then activate global document
activatePart(ResultPartPtr());
- } else {
+ }
+ else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SELFILTER_LOADED)) {
+ std::shared_ptr<Config_SelectionFilterMessage> aMsg =
+ std::dynamic_pointer_cast<Config_SelectionFilterMessage>(theMessage);
+ if (aMsg) {
+ if (aMsg->attributeId().empty()) { // feature validator
+ moduleConnector()->selectionFilters()->assignFilter(aMsg->selectionFilterId(), aMsg->featureId(), aMsg->attributeId());
+ } else { // attribute validator
+ moduleConnector()->selectionFilters()->assignFilter(aMsg->selectionFilterId(), aMsg->featureId(), aMsg->attributeId());
+ }
+ }
+ }
+
+
+ else {
//Show error dialog if error message received.
std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);
if (anAppError) {