From 09035b0acf896e39f5c720c1bfd0e8f67ae345ac Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 4 Jun 2014 15:25:58 +0400 Subject: [PATCH] An attempt to use the feature kind instead of direct text. May be, later the dependency to PartSetPlugin will be removed from XGUI includes. --- src/ModuleBase/ModuleBase_SelectorWidget.cpp | 1 + src/XGUI/CMakeLists.txt | 1 + src/XGUI/XGUI_ContextMenuMgr.cpp | 4 +++- src/XGUI/XGUI_Workshop.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ModuleBase/ModuleBase_SelectorWidget.cpp b/src/ModuleBase/ModuleBase_SelectorWidget.cpp index 7ac7ba946..728f7c6ab 100644 --- a/src/ModuleBase/ModuleBase_SelectorWidget.cpp +++ b/src/ModuleBase/ModuleBase_SelectorWidget.cpp @@ -131,6 +131,7 @@ void ModuleBase_SelectorWidget::onSelectionChanged() return; // TODO: Check that the selection corresponds to selection type + // TODO: Use the feature kind definition like SKETCH_KIND instead of the direct text if (aFeature->getKind().compare("Sketch") != 0) return; diff --git a/src/XGUI/CMakeLists.txt b/src/XGUI/CMakeLists.txt index c23054513..1775cb125 100644 --- a/src/XGUI/CMakeLists.txt +++ b/src/XGUI/CMakeLists.txt @@ -117,6 +117,7 @@ INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Events ${PROJECT_SOURCE_DIR}/src/ModelAPI ${PROJECT_SOURCE_DIR}/src/Model ${PROJECT_SOURCE_DIR}/src/ModuleBase + ${PROJECT_SOURCE_DIR}/src/PartSetPlugin ${CAS_INCLUDE_DIRS}) LINK_DIRECTORIES($ENV{PYTHON_LIB_DIR}) diff --git a/src/XGUI/XGUI_ContextMenuMgr.cpp b/src/XGUI/XGUI_ContextMenuMgr.cpp index 32c961026..b114aa315 100644 --- a/src/XGUI/XGUI_ContextMenuMgr.cpp +++ b/src/XGUI/XGUI_ContextMenuMgr.cpp @@ -5,6 +5,8 @@ #include "XGUI_SelectionMgr.h" #include "XGUI_Displayer.h" +#include "PartSetPlugin_Part.h" + #include #include #include @@ -96,7 +98,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const FeaturePtr aFeature = aFeatures.first(); //Process Feature if (aFeature) { - if (aFeature->getKind() == "Part") { + if (aFeature->getKind() == PARTSET_PART_KIND) { ObjectPtr aObject = boost::dynamic_pointer_cast(aFeature); DocumentPtr aFeaDoc = aObject->featureRef()->data()->docRef("PartDocument")->value(); if (aMgr->currentDocument() == aFeaDoc) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index dfe77c6f8..25f3b5317 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include #include #include @@ -228,7 +230,7 @@ void XGUI_Workshop::processEvent(const Events_Message* theMessage) bool aHasPart = false; for (aIt = aFeatures.begin(); aIt != aFeatures.end(); ++aIt) { FeaturePtr aFeature = (*aIt); - if (aFeature->getKind() == "Part") { + if (aFeature->getKind() == PARTSET_PART_KIND) { aHasPart = true; break; } @@ -809,7 +811,7 @@ void XGUI_Workshop::deleteFeatures(QFeatureList theList) PluginManagerPtr aMgr = ModelAPI_PluginManager::get(); aMgr->rootDocument()->startOperation(); foreach (FeaturePtr aFeature, theList) { - if (aFeature->getKind() == "Part") { + if (aFeature->getKind() == PARTSET_PART_KIND) { DocumentPtr aDoc; if (!XGUI_Tools::isModelObject(aFeature)) { aDoc = aFeature->data()->docRef("PartDocument")->value(); -- 2.39.2