ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
if (anOperation) {
ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel();
- ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
- if (!anActiveWidget)
- anActiveWidget = aPanel->preselectionWidget();
+ ModuleBase_ModelWidget* aCurrentWidget = aPanel->preselectionWidget();
+ if (!aCurrentWidget)
+ aCurrentWidget = aPanel->activeWidget();
ModuleBase_WidgetValidated* aWidgetValidated = dynamic_cast<ModuleBase_WidgetValidated*>
- (anActiveWidget);
+ (aCurrentWidget);
ModuleBase_ViewerPrs aPrs;
myWorkshop->selection()->fillPresentation(aPrs, theOwner);
// Author: Vitaly SMETANNIKOV
#include "ModuleBase_ResultPrs.h"
+#include "ModuleBase_Tools.h"
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultConstruction.h>
myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
if (!myOriginalShape.IsNull()) {
Set(myOriginalShape);
+
+ // change deviation coefficient to provide more precise circle
+ Handle(Prs3d_Drawer) aDrawer = Attributes();
+ Standard_Real aPrevDeviation = aDrawer->DeviationCoefficient();
+ //aDrawer->SetDeviationCoefficient(ModuleBase_Tools::defaultDeviationCoefficient());
+
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
+
+ //aDrawer->SetDeviationCoefficient(aPrevDeviation);
}
}
}
}
+double defaultDeviationCoefficient()
+{
+ return 1.e-5;
+}
}
\param hasSubFeature will be set to true if list contains Sub-Feature objects
*/
MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasSubFeature);
+
+/*! Returns the default deviation coefficient value
+\return double value
+*/
+MODULEBASE_EXPORT double defaultDeviationCoefficient();
}
#endif
#include "XGUI_ModuleConnector.h"
#include "XGUI_Displayer.h"
+#include "ModuleBase_Tools.h"
+
#include <ModelAPI_Result.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_AttributeRefAttr.h>
for (; aShIt != aShLast; aShIt++) {
GeomShapePtr aGeomShape = *aShIt;
TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
+ // change deviation coefficient to provide more precise circle
+ Standard_Real aPrevDeviation = aDrawer->DeviationCoefficient();
+ //aDrawer->SetDeviationCoefficient(ModuleBase_Tools::defaultDeviationCoefficient());
+
StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
+ //aDrawer->SetDeviationCoefficient(aPrevDeviation);
}
}
}
void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>& thePln)
{
+ if (myPlaneFilter.IsNull())
+ myPlaneFilter = new ModuleBase_ShapeInPlaneFilter();
+
myPlaneFilter->setPlane(thePln);
}
if (plane().get())
return true;
- return ModuleBase_WidgetValidated::setSelection(theValues, theToValidate);
+ ModuleBase_ViewerPrs aPrs = theValues.first();
+ bool aDone = ModuleBase_WidgetValidated::setSelection(theValues, theToValidate);
+ if (aDone)
+ updateByPlaneSelected(aPrs);
+
+ return aDone;
}
QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
return;
ModuleBase_ViewerPrs aPrs = aSelected.first();
- bool isDone = ModuleBase_WidgetValidated::setSelection(aSelected, false);
- if (!isDone)
- return;
+ bool aDone = ModuleBase_WidgetValidated::setSelection(aSelected, false);
+ if (aDone)
+ updateByPlaneSelected(aPrs);
+}
- // 3. hide main planes if they have been displayed
+void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs)
+{
+ // 1. hide main planes if they have been displayed
erasePreviewPlanes();
- // 4. if the planes were displayed, change the view projection
- TopoDS_Shape aShape = aPrs.shape();
+ // 2. if the planes were displayed, change the view projection
+ TopoDS_Shape aShape = thePrs.shape();
std::shared_ptr<GeomAPI_Shape> aGShape;
std::shared_ptr<GeomAPI_Shape> aBaseShape;
myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z());
}
- // 5. Clear text in the label
+ // 3. Clear text in the label
myLabel->setText("");
myLabel->setToolTip("");
disconnect(workshop()->selector(), SIGNAL(selectionChanged()),
this, SLOT(onSelectionChanged()));
- // 6. deactivate face selection filter
+ // 4. deactivate face selection filter
activateFilters(false);
- // 7. Clear selection mode and define sketching mode
+ // 5. Clear selection mode and define sketching mode
//XGUI_Displayer* aDisp = workshop()->displayer();
//aDisp->closeLocalContexts();
emit planeSelected(plane());
// the selection by any label deactivation, but need to switch it off by stop the sketch
activateSelection(true);
- // 8. Update sketcher actions
+ // 6. Update sketcher actions
XGUI_ActionsMgr* anActMgr = workshop()->actionsMgr();
anActMgr->update();
myWorkshop->viewer()->update();
/// The methiod called when widget is activated
virtual void activateCustom();
+ /// Erase preview planes, disconnect widget, change the view projection
+ /// \param thePrs a selected presentation
+ void updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs);
+
protected:
/// Activate or deactivate selection
void activateSelection(bool toActivate);
if (theOperation->getDescription()->hasXmlRepresentation()) { //!< No need for property panel
connectWithOperation(theOperation);
setPropertyPanel(theOperation);
+ // filling the operation values by the current selection
+ // if the operation can be commited after the controls filling, the method perform should
+ // be stopped. Otherwise unnecessary presentations can be shown(e.g. operation prs in sketch)
+ if (!theOperation->isEditOperation()) {
+ theOperation->activateByPreselection();
+ if (operationMgr()->currentOperation() != theOperation)
+ return;
+ }
}
updateCommandStatus();
deactivateActiveObject(*anIt, false);
if (anObjects.size() > 0)
myDisplayer->updateViewer();
-
- // filling the operation values by the selection in the viewer
- // it should be perfomed at the end of the method because it can commit the operation
- // if after the controls fill, the operation becomes valid
- if (!theOperation->isEditOperation())
- theOperation->activateByPreselection();
}
//******************************************************