#include <ModuleBase_IViewer.h>
#include <ModuleBase_IViewWindow.h>
#include <ModuleBase_ISelection.h>
+#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_WidgetValidator.h>
#include <Config_Keywords.h>
#include <Config_WidgetAPI.h>
ModuleBase_Tools::zeroMargins(aLayout);
aLayout->addWidget(myGroupBox);
setLayout(aLayout);
+
+ myWidgetValidator = new ModuleBase_WidgetValidator(this, myWorkshop);
+}
+
+bool PartSet_WidgetPoint2D::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& theValue)
+{
+ bool aValid = true;
+ /*if (getValidState(theValue, aValid)) {
+ return aValid;
+ }
+ aValid = isValidSelectionCustom(theValue);
+ if (aValid)
+ aValid = isValidSelectionForAttribute(theValue, attribute());
+
+ storeValidState(theValue, aValid);
+ */return aValid;
}
bool PartSet_WidgetPoint2D::resetCustom()
{
}
-bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
+bool PartSet_WidgetPoint2D::setSelection(QList<ModuleBase_ViewerPrsPtr>& theValues,
const bool theToValidate)
{
bool isDone = false;
if (theValues.empty())
return isDone;
- ModuleBase_ViewerPrs aValue = theValues.takeFirst();
- TopoDS_Shape aShape = aValue.shape();
- if (!aShape.IsNull()) {
+ ModuleBase_ViewerPrsPtr aValue = theValues.takeFirst();
+ GeomShapePtr aShape = aValue->shape();
+ if (aShape.get() && !aShape->isNull()) {
Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
double aX, aY;
- if (getPoint2d(aView, aShape, aX, aY)) {
+ const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
+ if (getPoint2d(aView, aTDShape, aX, aY)) {
isDone = setPoint(aX, aY);
PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY);
}
}
else if (canBeActivatedByMove()) {
if (feature()->getKind() == SketchPlugin_Line::ID()) {
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aValue.object());
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aValue->object());
// Initialize new line with first point equal to end of previous
if (aFeature.get()) {
std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
setPoint(aX, aY);
}
setValueState(Stored); // in case of edge selection, Apply state should also be updated
-
- FeaturePtr anObjectFeature = ModelAPI_Feature::feature(aObject);
- std::string anAuxiliaryAttribute = SketchPlugin_SketchEntity::AUXILIARY_ID();
- AttributeBooleanPtr anAuxiliaryAttr = std::dynamic_pointer_cast<ModelAPI_AttributeBoolean>(
- anObjectFeature->data()->attribute(anAuxiliaryAttribute));
- if (anAuxiliaryAttr.get())
- isAuxiliaryFeature = anAuxiliaryAttr->value();
+ isAuxiliaryFeature = PartSet_Tools::isAuxiliarySketchEntity(aObject);
}
// it is important to perform updateObject() in order to the current value is
// processed by Sketch Solver. Test case: line is created from a previous point