1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #include "PartSet_Module.h"
4 #include <PartSet_WidgetSketchLabel.h>
5 #include <PartSet_Validators.h>
6 #include <PartSet_Tools.h>
7 #include <PartSet_WidgetPoint2d.h>
8 #include <PartSet_WidgetPoint2dDistance.h>
9 #include <PartSet_WidgetShapeSelector.h>
10 #include <PartSet_WidgetConstraintShapeSelector.h>
11 #include <PartSet_WidgetEditor.h>
12 #include "PartSet_SketcherMgr.h"
13 #include "PartSet_MenuMgr.h"
15 #include <ModuleBase_Operation.h>
16 #include <ModuleBase_IViewer.h>
17 #include <ModuleBase_IViewWindow.h>
18 #include <ModuleBase_IPropertyPanel.h>
19 #include <ModuleBase_WidgetEditor.h>
20 #include <ModuleBase_FilterFactory.h>
21 #include <ModuleBase_FilterLinearEdge.h>
22 #include <ModuleBase_FilterFace.h>
23 #include <ModuleBase_FilterMulti.h>
24 #include <ModuleBase_FilterCustom.h>
25 #include <ModuleBase_FilterNoConsructionSubShapes.h>
26 #include <GeomValidators_Edge.h>
27 #include <GeomValidators_EdgeOrVertex.h>
28 #include <GeomValidators_Face.h>
29 #include <GeomValidators_ConstructionComposite.h>
31 #include <PartSet_FilterSketchEntity.h>
33 #include <ModelAPI_Object.h>
34 #include <ModelAPI_Events.h>
35 #include <ModelAPI_Validator.h>
36 #include <ModelAPI_Data.h>
37 #include <ModelAPI_Session.h>
38 #include <ModelAPI_ShapeValidator.h>
40 #include <GeomDataAPI_Point2D.h>
41 #include <GeomDataAPI_Point.h>
42 #include <GeomDataAPI_Dir.h>
44 #include <XGUI_Displayer.h>
45 #include <XGUI_Workshop.h>
46 #include <XGUI_OperationMgr.h>
47 #include <XGUI_PropertyPanel.h>
48 #include <XGUI_ModuleConnector.h>
49 #include <XGUI_ContextMenuMgr.h>
50 #include <XGUI_Tools.h>
52 #include <SketchPlugin_Feature.h>
53 #include <SketchPlugin_Sketch.h>
54 #include <SketchPlugin_Line.h>
55 #include <SketchPlugin_Arc.h>
56 #include <SketchPlugin_Circle.h>
57 #include <SketchPlugin_Point.h>
58 #include <SketchPlugin_ConstraintLength.h>
59 #include <SketchPlugin_ConstraintDistance.h>
60 #include <SketchPlugin_ConstraintParallel.h>
61 #include <SketchPlugin_ConstraintPerpendicular.h>
62 #include <SketchPlugin_ConstraintRadius.h>
64 #include <SketcherPrs_SymbolPrs.h>
65 #include <SketcherPrs_Tools.h>
67 #include <Events_Loop.h>
68 #include <Config_PropManager.h>
69 #include <Config_Keywords.h>
71 #include <StdSelect_TypeOfFace.hxx>
72 #include <TopoDS_Vertex.hxx>
74 #include <TopoDS_Shape.hxx>
75 #include <BRep_Tool.hxx>
76 #include <AIS_Dimension.hxx>
79 #include <QMouseEvent>
82 #include <QApplication>
83 #include <QMessageBox>
84 #include <QMainWindow>
86 #include <GeomAlgoAPI_FaceBuilder.h>
87 #include <GeomDataAPI_Dir.h>
93 /*!Create and return new instance of XGUI_Module*/
94 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
96 return new PartSet_Module(theWshop);
99 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
100 : ModuleBase_IModule(theWshop),
101 myRestartingMode(RM_None), myVisualLayerId(0)
103 mySketchMgr = new PartSet_SketcherMgr(this);
105 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
106 XGUI_Workshop* aWorkshop = aConnector->workshop();
108 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
109 connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
110 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
111 this, SLOT(onOperationActivatedByPreselection()));
113 ModuleBase_IViewer* aViewer = theWshop->viewer();
114 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
115 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
116 connect(aViewer, SIGNAL(viewTransformed(int)),
117 SLOT(onViewTransformed(int)));
119 myMenuMgr = new PartSet_MenuMgr(this);
122 PartSet_Module::~PartSet_Module()
124 if (!myDocumentShapeFilter.IsNull())
125 myDocumentShapeFilter.Nullify();
128 void PartSet_Module::registerValidators()
130 //Registering of validators
131 SessionPtr aMgr = ModelAPI_Session::get();
132 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
133 aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
134 aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
135 aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
136 aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
137 aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
138 aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
139 aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
140 aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
141 aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
142 aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
144 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
145 aFactory->registerValidator("PartSet_DifferentShapes", new ModelAPI_ShapeValidator);
147 aFactory->registerValidator("GeomValidators_Edge", new GeomValidators_Edge);
148 aFactory->registerValidator("GeomValidators_EdgeOrVertex",
149 new GeomValidators_EdgeOrVertex);
150 aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
152 aFactory->registerValidator("GeomValidators_ConstructionComposite",
153 new GeomValidators_ConstructionComposite);
155 aFactory->registerValidator("PartSet_SketchEntityValidator",
156 new PartSet_SketchEntityValidator);
158 aFactory->registerValidator("PartSet_SameTypeAttr",
159 new PartSet_SameTypeAttrValidator);
162 void PartSet_Module::registerFilters()
164 //Registering of selection filters
165 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
166 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
168 //aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
169 //aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
170 //aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
171 //Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
172 //aFactory->registerFilter("NoConstructionSubShapesFilter",
173 // new ModuleBase_FilterCustom(aSelectFilter));
174 //Handle(SelectMgr_Filter) aSelectFilter = new PartSet_FilterSketchEntity(workshop());
175 //aFactory->registerFilter("SketchEntityFilter", new ModuleBase_FilterCustom(aSelectFilter));
178 void PartSet_Module::registerProperties()
180 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
182 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
183 Config_Prop::Integer, SKETCH_WIDTH);
186 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
188 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
189 mySketchMgr->commitNestedSketch(theOperation);
192 if (theOperation->isEditOperation())
194 // the selection is cleared after commit the create operation
195 // in order to do not use the same selected objects in the restarted operation
196 // for common behaviour, the selection is cleared even if the operation is not restarted
197 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
198 if (!aContext.IsNull())
199 aContext->ClearSelected();
201 /// Restart sketcher operations automatically
202 FeaturePtr aFeature = theOperation->feature();
203 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
204 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
205 if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed ||
206 myRestartingMode == RM_EmptyFeatureUsed)) {
207 myLastOperationId = theOperation->id();
208 myLastFeature = myRestartingMode == RM_LastFeatureUsed ? theOperation->feature() : FeaturePtr();
210 launchOperation(myLastOperationId);
212 breakOperationSequence();
215 void PartSet_Module::breakOperationSequence()
217 myLastOperationId = "";
218 myLastFeature = FeaturePtr();
219 myRestartingMode = RM_None;
222 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
224 breakOperationSequence();
227 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
229 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
230 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
231 aViewer->AddZLayer(myVisualLayerId);
232 mySketchMgr->startSketch(theOperation);
234 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
235 mySketchMgr->startNestedSketch(theOperation);
238 if (myDocumentShapeFilter.IsNull())
239 myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
240 myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
243 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
245 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
246 mySketchMgr->stopSketch(theOperation);
247 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
248 aViewer->RemoveZLayer(myVisualLayerId);
251 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
252 mySketchMgr->stopNestedSketch(theOperation);
254 myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
257 ModuleBase_Operation* PartSet_Module::currentOperation() const
259 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
260 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
261 return anOpMgr->currentOperation();
264 bool PartSet_Module::canUndo() const
266 bool aCanUndo = false;
267 SessionPtr aMgr = ModelAPI_Session::get();
268 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
269 aCanUndo = !aMgr->isOperation();
270 if (!aCanUndo) // check the enable state additionally by sketch manager
271 aCanUndo = aMgr->canUndo();
276 bool PartSet_Module::canRedo() const
278 bool aCanRedo = false;
279 SessionPtr aMgr = ModelAPI_Session::get();
280 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
281 aCanRedo = !aMgr->isOperation();
282 if (!aCanRedo) // check the enable state additionally by sketch manager
283 aCanRedo = aMgr->canRedo();
288 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
290 // the sketch manager put the restriction to the objects display
291 return mySketchMgr->canDisplayObject(theObject);
295 bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
297 return myMenuMgr->addViewerItems(theMenu, theStdActions);
300 bool PartSet_Module::isMouseOverWindow()
302 return mySketchMgr->isMouseOverWindow();
305 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
307 ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel();
308 if (PartSet_SketcherMgr::isSketchOperation(theOperation) && (theOperation->isEditOperation())) {
309 // we have to manually activate the sketch label in edit mode
310 aPanel->activateWidget(aPanel->modelWidgets().first());
314 // Restart last operation type
315 if ((theOperation->id() == myLastOperationId) && myLastFeature) {
316 ModuleBase_ModelWidget* aWgt = aPanel->activeWidget();
317 if (theOperation->id().toStdString() == SketchPlugin_Line::ID()) {
318 // Initialise new line with first point equal to end of previous
319 PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
321 std::shared_ptr<ModelAPI_Data> aData = myLastFeature->data();
322 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
323 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
325 aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
326 PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), theOperation->feature(),
327 aWgt->attributeID(), aPoint->x(), aPoint->y());
328 aPanel->activateNextWidget(aPnt2dWgt);
333 // Start editing constraint
334 if (theOperation->isEditOperation()) {
335 // TODO: #391 - to be removed
336 std::string aId = theOperation->id().toStdString();
337 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation) &&
338 PartSet_SketcherMgr::isDistanceOperation(theOperation)) {
339 // Find and activate widget for management of point for dimension line position
340 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
341 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
342 PartSet_WidgetPoint2D* aPntWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
344 aPanel->activateWidget(aPntWgt);
354 void PartSet_Module::onSelectionChanged()
356 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
360 bool isSketcherOp = false;
361 // An edit operation is enable only if the current opeation is the sketch operation
362 if (mySketchMgr->activeSketch()) {
363 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
364 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
367 // Editing of constraints can be done on selection
368 ModuleBase_ISelection* aSelect = myWorkshop->selection();
369 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
370 if (aSelected.size() == 1) {
371 ModuleBase_ViewerPrs aPrs = aSelected.first();
372 ObjectPtr aObject = aPrs.object();
373 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
375 std::string aId = aFeature->getKind();
376 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
377 (aId == SketchPlugin_ConstraintLength::ID()) ||
378 (aId == SketchPlugin_ConstraintDistance::ID())) {
379 editFeature(aFeature);
386 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
388 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
389 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
390 anOpMgr->onKeyReleased(theEvent);
393 void PartSet_Module::onEnterReleased()
395 myRestartingMode = RM_EmptyFeatureUsed;
398 void PartSet_Module::onOperationActivatedByPreselection()
400 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
401 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
402 // Set final definitions if they are necessary
403 //propertyPanelDefined(aOperation);
405 /// Commit sketcher operations automatically
406 anOperation->commit();
410 void PartSet_Module::onNoMoreWidgets()
412 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
414 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
415 if (myRestartingMode != RM_Forbided)
416 myRestartingMode = RM_LastFeatureUsed;
417 anOperation->commit();
422 void PartSet_Module::onVertexSelected()
424 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
425 if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) {
426 /// If last line finished on vertex the lines creation sequence has to be break
427 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
428 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
429 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
430 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
431 bool aFoundWidget = false;
432 bool aFoundObligatory = false;
433 for (; anIt != aLast && !aFoundObligatory; anIt++) {
435 aFoundWidget = *anIt == anActiveWidget;
437 aFoundObligatory = (*anIt)->isObligatory();
439 if (!aFoundObligatory)
440 myRestartingMode = RM_Forbided;
444 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
445 Config_WidgetAPI* theWidgetApi, std::string theParentId)
447 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
448 XGUI_Workshop* aWorkshop = aConnector->workshop();
449 ModuleBase_ModelWidget* aWgt = NULL;
450 if (theType == "sketch-start-label") {
451 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent,
452 theWidgetApi, theParentId, mySketchMgr->isConstraintsShown());
453 aLabelWgt->setWorkshop(aWorkshop);
454 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
455 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
456 connect(aLabelWgt, SIGNAL(showConstraintToggled(bool)),
457 mySketchMgr, SLOT(onShowConstraintsToggle(bool)));
459 } else if (theType == "sketch-2dpoint_selector") {
460 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, theWidgetApi, theParentId);
461 aPointWgt->setWorkshop(aWorkshop);
462 aPointWgt->setSketch(mySketchMgr->activeSketch());
463 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
465 } if (theType == "point2ddistance") {
466 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent, theWidgetApi, theParentId);
467 aDistanceWgt->setWorkshop(aWorkshop);
468 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
470 } if (theType == "sketch_shape_selector") {
471 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
472 new PartSet_WidgetShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
473 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
474 aWgt = aShapeSelectorWgt;
475 } if (theType == "sketch_constraint_shape_selector") {
476 PartSet_WidgetConstraintShapeSelector* aConstraintShapeSelectorWgt =
477 new PartSet_WidgetConstraintShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
478 aConstraintShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
479 aWgt = aConstraintShapeSelectorWgt;
480 } if (theType == WDG_DOUBLEVALUE_EDITOR) {
481 aWgt = new PartSet_WidgetEditor(theParent, workshop(), theWidgetApi, theParentId);
487 bool PartSet_Module::deleteObjects()
489 // 1. check whether the delete should be processed in the module
490 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
491 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
492 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
493 if (!isSketchOp && !isNestedOp)
496 // 2. find selected presentations
497 // selected objects should be collected before the current operation abort because
498 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
499 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
500 XGUI_Workshop* aWorkshop = aConnector->workshop();
501 ModuleBase_ISelection* aSel = workshop()->selection();
502 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
503 // if there are no selected objects in the viewer, that means that the selection in another
504 // place cased this method. It is necessary to return the false value to understande in above
505 // method that delete is not processed
506 if (aSelectedObj.count() == 0)
509 // the active nested sketch operation should be aborted unconditionally
511 anOperation->abort();
513 // 3. start operation
514 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
515 SessionPtr aMgr = ModelAPI_Session::get();
516 aMgr->startOperation(aDescription.toStdString());
518 // 4. delete features
519 // sketch feature should be skipped, only sub-features can be removed
520 // when sketch operation is active
521 std::set<FeaturePtr> anIgnoredFeatures;
522 anIgnoredFeatures.insert(mySketchMgr->activeSketch());
523 aWorkshop->deleteFeatures(aSelectedObj, anIgnoredFeatures);
526 aWorkshop->displayer()->updateViewer();
527 aMgr->finishOperation();
533 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
535 Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
536 if (!anAIS.IsNull()) {
537 Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
538 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
539 if (!aDim.IsNull()) {
540 aCtx->SetZLayer(aDim, myVisualLayerId);
542 Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
544 aCtx->SetZLayer(aCons, myVisualLayerId);
549 void PartSet_Module::onViewTransformed(int theTrsfType)
551 // Set length of arrows constant in pixel size
552 // if the operation is panning or rotate or panglobal then do nothing
553 if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
556 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
557 Handle(V3d_View) aView = aViewer->activeView();
559 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
560 XGUI_Workshop* aWorkshop = aConnector->workshop();
561 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
562 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
564 double aLen = aView->Convert(15);
566 SketcherPrs_Tools::setArrowSize(aLen);
567 bool isModified = false;
568 QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
569 foreach (AISObjectPtr aAIS, aPrsList) {
570 Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
572 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
573 if (!aDim.IsNull()) {
574 aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
575 aContext->Redisplay(aDim, false);
580 aDisplayer->updateViewer();