ModuleBase_WidgetValueFeature* aFeatureValue =
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
- setPoint(aFeatureValue->point());
- isDone = true;
+ boost::shared_ptr<GeomAPI_Pnt2d> aPoint = aFeatureValue->point();
+ if (aPoint) {
+ setPoint(aPoint);
+ isDone = true;
+ }
}
}
return isDone;
void PartSet_Module::launchOperation(const QString& theCmdId)
{
ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
- //PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- //if (aPreviewOp) {
- // XGUI_Displayer* aDisplayer = myWorkshop->displayer();
- // // Initialise operation with preliminary selection
- // std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
- // std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
- // aPreviewOp->initSelection(aSelected, aHighlighted);
- //}
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aPreviewOp) {
+ XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ // Initialise operation with preliminary selection
+ std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
+ std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+ aPreviewOp->initSelection(aSelected, aHighlighted);
+ }
sendOperation(anOperation);
}
void PartSet_OperationFeatureCreate::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
+ myPreSelection = theSelected;
}
void PartSet_OperationFeatureCreate::initFeature(FeaturePtr theFeature)
{
- //if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
- // return;
myInitFeature = theFeature;
}
void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
{
myActiveWidget = theWidget;
-
+ if (myPreSelection.size() > 0) {
+ const XGUI_ViewerPrs& aPrs = myPreSelection.front();
+ ModuleBase_WidgetValueFeature aValue;
+ aValue.setFeature(aPrs.feature());
+ if (myActiveWidget->setValue(&aValue)) {
+ myPreSelection.remove(aPrs);
+ emit activateNextWidget(myActiveWidget);
+ }
+ }
if (myInitFeature && myActiveWidget) {
ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
FeaturePtr mySketch; ///< the sketch of the feature
ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
+
+ std::list<XGUI_ViewerPrs> myPreSelection;
};
#endif
{
return myShape;
}
+
+bool XGUI_ViewerPrs::operator==(const XGUI_ViewerPrs& thePrs)
+{
+ bool aFeature = (myFeature.get() == thePrs.feature().get());
+ bool aOwner = (myOwner.Access() == thePrs.owner().Access());
+ bool aShape = myShape.IsEqual(thePrs.shape());
+ return aFeature && aOwner && aShape;
+}
/// \return a shape instance
const TopoDS_Shape& shape() const;
+ bool operator==(const XGUI_ViewerPrs&);
+
private:
FeaturePtr myFeature; /// the feature
Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner