#include <ModuleBase_Operation.h>
#include <ModelAPI_Object.h>
+#include <ModelAPI_Data.h>
+#include <GeomDataAPI_Point2D.h>
+#include <PartSet_Tools.h>
+
#include <XGUI_MainWindow.h>
#include <XGUI_Displayer.h>
#include <XGUI_Viewer.h>
this, SLOT(onKeyRelease(QKeyEvent*)));
connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)),
this, SLOT(onMouseDoubleClick(QMouseEvent*)));
-
}
PartSet_Module::~PartSet_Module()
XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
connect(aPreviewOp, SIGNAL(focusActivated(const std::string&)),
aPropPanel, SLOT(onFocusActivated(const std::string&)));
+
+ connect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
+ this, SLOT(onStorePoint2D(FeaturePtr, const std::string&)), Qt::UniqueConnection);
}
}
XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel();
disconnect(aPreviewOp, SIGNAL(focusActivated(const std::string&)),
aPropPanel, SLOT(onFocusActivated(const std::string&)));
+ //disconnect(aPropPanel, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
+ // this, SLOT(onStorePoint2D(FeaturePtr, const std::string&)));
}
}
}
// }
}
+
+void PartSet_Module::onStorePoint2D(FeaturePtr theFeature, const std::string& theAttribute)
+{
+ PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
+ myWorkshop->operationMgr()->currentOperation());
+ if (!aPreviewOp)
+ return;
+
+ boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theFeature->data()->attribute(theAttribute));
+
+ PartSet_Tools::setConstraints(aPreviewOp->sketch(), theFeature, theAttribute,
+ aPoint->x(), aPoint->y());
+}
/// \param theMode the mode appeared on the feature
void onFeatureConstructed(FeaturePtr theFeature,
int theMode);
+
+ /// Slot which reacts to the point 2d set to the feature. Creates a constraint
+ /// \param the feature
+ /// \param the attribute of the feature
+ void onStorePoint2D(FeaturePtr theFeature, const std::string& theAttribute);
+
protected:
/// Creates a new operation
/// \param theCmdId the operation name
#include <XGUI_Constants.h>
#include <XGUI_PropertyPanel.h>
+#include <ModuleBase_WidgetPoint2D.h>
#include <QWidget>
#include <QVBoxLayout>
connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
this, SLOT(onActivateNextWidget(ModuleBase_ModelWidget*)));
+
+ ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
+ if (aPointWidget)
+ connect(aPointWidget, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)),
+ this, SIGNAL(storedPoint2D(FeaturePtr, const std::string&)));
}
ModuleBase_ModelWidget* aLastWidget = theWidgets.last();
if (aLastWidget) {
/// \param theWidget the activated widget
void widgetActivated(ModuleBase_ModelWidget* theWidget);
+ /// Signal about the point 2d set to the feature
+ /// \param the feature
+ /// \param the attribute of the feature
+ void storedPoint2D(FeaturePtr theFeature, const std::string& theAttribute);
+
protected:
/// Activate the widget, which means the focus on the widget.
/// The signal about the widget activation is emitted