From c97d43b7eb01000c13b064da2d4119801fc3fb71 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 31 Mar 2015 14:56:51 +0300 Subject: [PATCH] Preselection of two points for distance operation. The selected object is empty, so the first condition is not correct. All this checks should be done in the attribute validator. --- .../ModuleBase_WidgetShapeSelector.cpp | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp index ef46fa062..1721da469 100644 --- a/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetShapeSelector.cpp @@ -407,16 +407,17 @@ bool ModuleBase_WidgetShapeSelector::setSelection(const Handle_SelectMgr_EntityO ModuleBase_ViewerPrs aPrs; myWorkshop->selection()->fillPresentation(aPrs, theOwner); + // It should be checked by corresponded validator ObjectPtr aObject = aPrs.object(); - ObjectPtr aCurrentObject = GeomValidators_Tools::getObject(myFeature->attribute(attributeID())); + /*ObjectPtr aCurrentObject = GeomValidators_Tools::getObject(myFeature->attribute(attributeID())); if ((!aCurrentObject) && (!aObject)) - return false; + return false;*/ + // It should be checked by corresponded validator // Check that the selected object is result (others can not be accepted) - ResultPtr aRes = std::dynamic_pointer_cast(aObject); + /*ResultPtr aRes = std::dynamic_pointer_cast(aObject); if (!aRes) return false; - if (myFeature) { // We can not select a result of our feature const std::list>& aResList = myFeature->results(); @@ -426,16 +427,21 @@ bool ModuleBase_WidgetShapeSelector::setSelection(const Handle_SelectMgr_EntityO return false; } } + */ + // It should be checked by corresponded validator + /* // Check that object belongs to active document or PartSet DocumentPtr aDoc = aRes->document(); SessionPtr aMgr = ModelAPI_Session::get(); if (!(aDoc == aMgr->activeDocument()) && !(aDoc == aMgr->moduleDocument())) - return false; + return false;*/ + // It should be checked by corresponded validator // Check that the result has a shape - GeomShapePtr aShape = ModelAPI_Tools::shape(aRes); + GeomShapePtr aShape; + /*aShape = ModelAPI_Tools::shape(aRes); if (!aShape) - return false; + return false;*/ // Get sub-shapes from local selection if (!aPrs.shape().IsNull()) { -- 2.39.2