+void PartSet_OperationPrs::getResultShapes(const FeaturePtr& theFeature,
+ ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes,
+ const bool theListShouldBeCleared)
+{
+ if (theListShouldBeCleared)
+ theObjectShapes.clear();
+
+ if (!theFeature.get())
+ return;
+
+ XGUI_Displayer* aDisplayer = XGUI_Tools::workshop(theWorkshop)->displayer();
+
+ std::list<ResultPtr> aResults;
+ ModelAPI_Tools::allResults(theFeature, aResults);
+ std::list<ResultPtr>::const_iterator aRIt = aResults.begin(),
+ aRLast = aResults.end();
+ for (; aRIt != aRLast; aRIt++) {
+ ResultPtr aResult = *aRIt;
+ GeomShapePtr aGeomShape = aResult->shape();
+ appendShapeIfVisible(theWorkshop, aResult, aGeomShape, theObjectShapes);
+ }
+}
+
+void PartSet_OperationPrs::getHighlightedShapes(ModuleBase_IWorkshop* theWorkshop,
+ QMap<ObjectPtr, QList<GeomShapePtr> >& theObjectShapes)
+{
+ theObjectShapes.clear();
+
+ QList<ModuleBase_ViewerPrsPtr> aValues;
+ ModuleBase_ModelWidget* anActiveWidget = theWorkshop->module()->activeWidget();
+ if (anActiveWidget)
+ anActiveWidget->getHighlighted(aValues);
+
+ QList<GeomShapePtr> aShapes;
+ QList<ModuleBase_ViewerPrsPtr>::const_iterator anIIt = aValues.begin(),
+ aILast = aValues.end();
+ for (; anIIt != aILast; anIIt++) {
+ ModuleBase_ViewerPrsPtr aPrs = *anIIt;
+ ObjectPtr anObject = aPrs->object();
+
+ GeomShapePtr aGeomShape = aPrs->shape();
+ if (!aGeomShape.get() || aGeomShape->isNull()) {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
+ if (aResult.get()) {
+ aGeomShape = aResult->shape();
+ }
+ }
+ appendShapeIfVisible(theWorkshop, anObject, aGeomShape, theObjectShapes);
+ }
+}
+
+