#include "XGUI_ViewerProxy.h"
#include "XGUI_Selection.h"
#include "XGUI_SalomeConnector.h"
+#include "XGUI_Tools.h"
#include <AppElements_MainWindow.h>
bool hasResult = false;
bool hasFeature = false;
bool hasParameter = false;
- foreach(ObjectPtr aObj, aObjects)
- {
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
-
- hasResult = (aResult.get() != NULL);
- hasFeature = (aFeature.get() != NULL);
- hasParameter = (aConstruction.get() != NULL);
- if (hasFeature && hasResult && hasParameter)
- break;
- }
+ XGUI_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+
//Process Feature
if (aSelected == 1) {
ObjectPtr aObject = aObjects.first();
#include <TopoDS_Shape.hxx>
#include <ModelAPI_Object.h>
+#include <ModelAPI_Result.h>
+#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Feature.h>
#include <GeomAPI_Shape.h>
#include <QDir>
}
}*/
+
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter)
+{
+ hasResult = false;
+ hasFeature = false;
+ hasParameter = false;
+ foreach(ObjectPtr aObj, theObjects) {
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
+
+ hasResult = (aResult.get() != NULL);
+ hasFeature = (aFeature.get() != NULL);
+ hasParameter = (aConstruction.get() != NULL);
+ if (hasFeature && hasResult && hasParameter)
+ break;
+ }
+}
+
+
}
#include <QRect>
#include <ModelAPI_Feature.h>
+#include <ModuleBase_Definitions.h>
#include <memory>
\param theFeature a feature
*/
std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
-}
+
+
+/*!
+Check types of objects which are in the given list
+\param theObjects the list of objects
+\param hasResult will be set to true if list contains Result objects
+\param hasFeature will be set to true if list contains Feature objects
+\param hasParameter will be set to true if list contains Parameter objects
+*/
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
+
+};
#endif
if (!isActiveOperationAborted())
return;
QObjectPtrList anObjects = mySelector->selection()->selectedObjects();
+ bool hasResult = false;
+ bool hasFeature = false;
+ bool hasParameter = false;
+ XGUI_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter);
+ if (!(hasFeature || hasParameter))
+ return;
+
// 1. start operation
QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text();
aDescription += tr(" %1");