return ModuleBase_ModelWidget::eventFilter(theObject, theEvent);
}
-void ModuleBase_WidgetPoint2D::initFromPrevious(FeaturePtr theFeature)
+bool ModuleBase_WidgetPoint2D::initFromPrevious(FeaturePtr theFeature)
{
if (myOptionParam.length() == 0)
- return;
+ return false;
boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(myOptionParam));
emit valuesChanged();
emit storedPoint2D(theFeature, myOptionParam);
+ return true;
}
+ return false;
}
/// \param theEvent the processed event
virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
- void initFromPrevious(FeaturePtr theFeature);
+ bool initFromPrevious(FeaturePtr theFeature);
signals:
/// Signal about the point 2d set to the feature
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);
+ //}
sendOperation(anOperation);
}
// refill the features list with avoiding of the features, obtained only by vertex shape (TODO)
std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
- aPreviewOp->init(theFeature, aSelected, aHighlighted);
+ aPreviewOp->initFeature(theFeature);
+ aPreviewOp->initSelection(aSelected, aHighlighted);
} else {
anOperation->setEditingFeature(theFeature);
}
return aModes;
}
-void PartSet_OperationFeatureCreate::init(FeaturePtr theFeature,
- const std::list<XGUI_ViewerPrs>& /*theSelected*/,
- const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
+ const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
{
- if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
- return;
+}
+
+void PartSet_OperationFeatureCreate::initFeature(FeaturePtr theFeature)
+{
+// if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND)
+// return;
myInitFeature = theFeature;
}
+
FeaturePtr PartSet_OperationFeatureCreate::sketch() const
{
return mySketch;
if (myInitFeature && myActiveWidget) {
ModuleBase_WidgetPoint2D* aWgt = dynamic_cast<ModuleBase_WidgetPoint2D*>(myActiveWidget);
- if (aWgt)
- aWgt->initFromPrevious(myInitFeature);
- myInitFeature = FeaturePtr();
- emit activateNextWidget(myActiveWidget);
+ if (aWgt && aWgt->initFromPrevious(myInitFeature)) {
+ myInitFeature = FeaturePtr();
+ emit activateNextWidget(myActiveWidget);
+ }
}
}
/// \return the selection mode
virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
- /// Initializes some fields accorging to the feature
+ /// Initializes the operation with previously created feature. It is used in sequental operations
+ virtual void initFeature(FeaturePtr theFeature);
+
+ /// Initialisation of operation with preliminary selection
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(FeaturePtr theFeature,
- const std::list<XGUI_ViewerPrs>& theSelected,
- const std::list<XGUI_ViewerPrs>& theHighlighted);
+ virtual void initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
+ const std::list<XGUI_ViewerPrs>& theHighlighted);
/// Returns the operation sketch feature
/// \returns the sketch instance
/// \return the selection mode
virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
- /// Initializes some fields accorging to the feature
+ /// Initializes the operation with previously created feature. It is used in sequental operations
+ virtual void initFeature(FeaturePtr theFeature) {}
+
+ /// Initialisation of operation with preliminary selection
/// \param theSelected the list of selected presentations
/// \param theHighlighted the list of highlighted presentations
- virtual void init(FeaturePtr theFeature,
- const std::list<XGUI_ViewerPrs>& theSelected,
- const std::list<XGUI_ViewerPrs>& theHighlighted) {}
+ virtual void initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
+ const std::list<XGUI_ViewerPrs>& theHighlighted) {}
/// Returns the operation sketch feature
/// \returns the sketch instance
QFeatureList XGUI_ModuleConnector::selectedFeatures() const
{
return myWorkshop->selector()->selectedFeatures();
-}
\ No newline at end of file
+}
+
class Handle_AIS_InteractiveContext;
class XGUI_Workshop;
+class XGUI_Displayer;
/**
* Implementation of IWorkshop interface which provides access to Workshop sevices at module level
virtual Handle(AIS_InteractiveContext) AISContext() const;
//! Returns list of currently selected data objects
- QFeatureList selectedFeatures() const;
+ virtual QFeatureList selectedFeatures() const;
private:
XGUI_Workshop* myWorkshop;