myCustomPrs->activate(aFOperation->feature());
}
+void PartSet_Module::onOperationResumed(ModuleBase_Operation* theOperation)
+{
+ ModuleBase_IModule::onOperationResumed(theOperation);
+
+ ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+ if (aFOperation)
+ myCustomPrs->activate(aFOperation->feature());
+}
+
void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
{
myCustomPrs->deactivate();
/// Realizes some functionality by an operation start
/// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters
+ /// Activate the operation presentation
/// \param theOperation a started operation
virtual void onOperationStarted(ModuleBase_Operation* theOperation);
+ /// Realizes some functionality by an operation resume
+ /// Activate the operation presentation
+ /// \param theOperation a resumed operation
+ virtual void onOperationResumed(ModuleBase_Operation* theOperation);
+
/// Realizes some functionality by an operation commit
/// Restarts sketcher operation automatically of it is necessary
/// \param theOperation a committed operation
{
myFeatureShapes.clear();
getFeatureShapes(myFeatureShapes);
+
+ myFeatureResults.clear();
+ if (myFeature)
+ myFeatureResults = myFeature->results();
}
void PartSet_OperationPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
+ Quantity_Color aColor(1., 1., 0., Quantity_TOC_RGB); // yellow
+ SetColor(aColor);
+
thePresentation->Clear();
XGUI_Displayer* aDisplayer = workshop()->displayer();
StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
}
}
+
+ aColor = Quantity_Color(0., 1., 0., Quantity_TOC_RGB); // green
+ SetColor(aColor);
+
+ std::list<ResultPtr>::const_iterator aRIt = myFeatureResults.begin(),
+ aRLast = myFeatureResults.end();
+ for (; aRIt != aRLast; aRIt++) {
+ ResultPtr aResult = *aRIt;
+ if (!isVisible(aDisplayer, aResult))
+ continue;
+ GeomShapePtr aGeomShape = aResult->shape();
+ if (!aGeomShape.get())
+ continue;
+ TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+ // change deviation coefficient to provide more precise circle
+ ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
+ StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
+ }
}
void PartSet_OperationPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
#include <ModelAPI_Object.h>
#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
#include <ModelAPI_Attribute.h>
#include <ModuleBase_IWorkshop.h>
#include <QMap>
#include <QList>
+#include <list>
+
DEFINE_STANDARD_HANDLE(PartSet_OperationPrs, ViewerData_AISShape)
class XGUI_Workshop;
private:
ModuleBase_IWorkshop* myWorkshop;
FeaturePtr myFeature; /// Reference to a feature object
- QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes;
+ QMap<ObjectPtr, QList<GeomShapePtr> > myFeatureShapes; /// visualized shapes
+ std::list<ResultPtr> myFeatureResults; /// visualized feature results
};