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_WidgetPoint2dAngle.h>
10 #include <PartSet_WidgetShapeSelector.h>
11 #include <PartSet_WidgetMultiSelector.h>
12 #include <PartSet_WidgetEditor.h>
13 #include "PartSet_SketcherMgr.h"
14 #include "PartSet_MenuMgr.h"
16 #include <ModuleBase_Operation.h>
17 #include <ModuleBase_IViewer.h>
18 #include <ModuleBase_IViewWindow.h>
19 #include <ModuleBase_IPropertyPanel.h>
20 #include <ModuleBase_WidgetEditor.h>
21 #include <ModuleBase_FilterFactory.h>
22 #include <GeomValidators_ShapeType.h>
23 #include <GeomValidators_Face.h>
24 #include <GeomValidators_ConstructionComposite.h>
27 #include <ModelAPI_Object.h>
28 #include <ModelAPI_Events.h>
29 #include <ModelAPI_Validator.h>
30 #include <ModelAPI_Data.h>
31 #include <ModelAPI_Session.h>
32 #include <ModelAPI_ShapeValidator.h>
34 #include <GeomDataAPI_Point2D.h>
35 #include <GeomDataAPI_Point.h>
36 #include <GeomDataAPI_Dir.h>
38 #include <XGUI_Displayer.h>
39 #include <XGUI_Workshop.h>
40 #include <XGUI_OperationMgr.h>
41 #include <XGUI_PropertyPanel.h>
42 #include <XGUI_ModuleConnector.h>
43 #include <XGUI_ContextMenuMgr.h>
44 #include <XGUI_Tools.h>
46 #include <SketchPlugin_Feature.h>
47 #include <SketchPlugin_Sketch.h>
48 #include <SketchPlugin_Line.h>
49 #include <SketchPlugin_Arc.h>
50 #include <SketchPlugin_Circle.h>
51 #include <SketchPlugin_Point.h>
52 #include <SketchPlugin_ConstraintLength.h>
53 #include <SketchPlugin_ConstraintDistance.h>
54 #include <SketchPlugin_ConstraintParallel.h>
55 #include <SketchPlugin_ConstraintPerpendicular.h>
56 #include <SketchPlugin_ConstraintRadius.h>
58 #include <SketcherPrs_SymbolPrs.h>
59 #include <SketcherPrs_Tools.h>
61 #include <Events_Loop.h>
62 #include <Config_PropManager.h>
63 #include <Config_Keywords.h>
65 #include <StdSelect_TypeOfFace.hxx>
66 #include <TopoDS_Vertex.hxx>
68 #include <TopoDS_Shape.hxx>
69 #include <BRep_Tool.hxx>
70 #include <AIS_Dimension.hxx>
73 #include <QMouseEvent>
76 #include <QApplication>
77 #include <QMessageBox>
78 #include <QMainWindow>
80 #include <GeomAlgoAPI_FaceBuilder.h>
81 #include <GeomDataAPI_Dir.h>
87 /*!Create and return new instance of XGUI_Module*/
88 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
90 return new PartSet_Module(theWshop);
93 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
94 : ModuleBase_IModule(theWshop),
95 myRestartingMode(RM_None), myVisualLayerId(0)
97 mySketchMgr = new PartSet_SketcherMgr(this);
99 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
100 XGUI_Workshop* aWorkshop = aConnector->workshop();
102 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
103 connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
104 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
105 this, SLOT(onOperationActivatedByPreselection()));
107 ModuleBase_IViewer* aViewer = theWshop->viewer();
108 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
109 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
110 connect(aViewer, SIGNAL(viewTransformed(int)),
111 SLOT(onViewTransformed(int)));
113 myMenuMgr = new PartSet_MenuMgr(this);
116 PartSet_Module::~PartSet_Module()
118 if (!myDocumentShapeFilter.IsNull())
119 myDocumentShapeFilter.Nullify();
122 void PartSet_Module::registerValidators()
124 //Registering of validators
125 SessionPtr aMgr = ModelAPI_Session::get();
126 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
127 aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
128 aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
129 aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
130 aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
131 aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
132 aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
133 aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
134 aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
135 aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
136 aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
138 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
139 aFactory->registerValidator("PartSet_DifferentShapes", new ModelAPI_ShapeValidator);
141 aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
142 aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
144 aFactory->registerValidator("GeomValidators_ConstructionComposite",
145 new GeomValidators_ConstructionComposite);
147 aFactory->registerValidator("PartSet_SketchEntityValidator",
148 new PartSet_SketchEntityValidator);
150 aFactory->registerValidator("PartSet_SameTypeAttr",
151 new PartSet_SameTypeAttrValidator);
154 void PartSet_Module::registerFilters()
156 //Registering of selection filters
157 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
158 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
161 void PartSet_Module::registerProperties()
163 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
165 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
166 Config_Prop::Integer, SKETCH_WIDTH);
169 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
171 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
172 mySketchMgr->commitNestedSketch(theOperation);
175 if (theOperation->isEditOperation())
177 // the selection is cleared after commit the create operation
178 // in order to do not use the same selected objects in the restarted operation
179 // for common behaviour, the selection is cleared even if the operation is not restarted
180 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
181 if (!aContext.IsNull())
182 aContext->ClearSelected();
184 /// Restart sketcher operations automatically
185 FeaturePtr aFeature = theOperation->feature();
186 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
187 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
188 if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed ||
189 myRestartingMode == RM_EmptyFeatureUsed)) {
190 myLastOperationId = theOperation->id();
191 myLastFeature = myRestartingMode == RM_LastFeatureUsed ? theOperation->feature() : FeaturePtr();
193 launchOperation(myLastOperationId);
195 breakOperationSequence();
198 void PartSet_Module::breakOperationSequence()
200 myLastOperationId = "";
201 myLastFeature = FeaturePtr();
202 myRestartingMode = RM_None;
205 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
207 breakOperationSequence();
210 void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
212 // Install the document filter before any other filter
213 if (myDocumentShapeFilter.IsNull())
214 myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
215 myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
217 ModuleBase_IModule::sendOperation(theOperation);
220 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
222 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
223 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
224 aViewer->AddZLayer(myVisualLayerId);
225 mySketchMgr->startSketch(theOperation);
227 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
228 mySketchMgr->startNestedSketch(theOperation);
232 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
234 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
235 mySketchMgr->stopSketch(theOperation);
236 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
237 aViewer->RemoveZLayer(myVisualLayerId);
240 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
241 mySketchMgr->stopNestedSketch(theOperation);
243 myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
246 ModuleBase_Operation* PartSet_Module::currentOperation() const
248 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
249 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
250 return anOpMgr->currentOperation();
253 bool PartSet_Module::canUndo() const
255 bool aCanUndo = false;
256 SessionPtr aMgr = ModelAPI_Session::get();
257 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
258 aCanUndo = !aMgr->isOperation();
259 if (!aCanUndo) // check the enable state additionally by sketch manager
260 aCanUndo = aMgr->canUndo();
265 bool PartSet_Module::canRedo() const
267 bool aCanRedo = false;
268 SessionPtr aMgr = ModelAPI_Session::get();
269 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
270 aCanRedo = !aMgr->isOperation();
271 if (!aCanRedo) // check the enable state additionally by sketch manager
272 aCanRedo = aMgr->canRedo();
277 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
279 // the sketch manager put the restriction to the objects display
280 return mySketchMgr->canDisplayObject(theObject);
284 bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
286 return myMenuMgr->addViewerItems(theMenu, theStdActions);
289 void PartSet_Module::activeSelectionModes(QIntList& theModes)
292 if (mySketchMgr->activeSketch().get())
293 PartSet_SketcherMgr::sketchSelectionModes(theModes);
296 bool PartSet_Module::isMouseOverWindow()
298 return mySketchMgr->isMouseOverWindow();
301 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
303 ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel();
304 if (PartSet_SketcherMgr::isSketchOperation(theOperation) && (theOperation->isEditOperation())) {
305 // we have to manually activate the sketch label in edit mode
306 aPanel->activateWidget(aPanel->modelWidgets().first());
310 // Restart last operation type
311 if ((theOperation->id() == myLastOperationId) && myLastFeature) {
312 ModuleBase_ModelWidget* aWgt = aPanel->activeWidget();
313 if (theOperation->id().toStdString() == SketchPlugin_Line::ID()) {
314 // Initialise new line with first point equal to end of previous
315 PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
317 std::shared_ptr<ModelAPI_Data> aData = myLastFeature->data();
318 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
319 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
321 aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
322 PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), theOperation->feature(),
323 aWgt->attributeID(), aPoint->x(), aPoint->y());
324 aPanel->activateNextWidget(aPnt2dWgt);
329 // Start editing constraint
330 if (theOperation->isEditOperation()) {
331 // TODO: #391 - to be removed
332 std::string aId = theOperation->id().toStdString();
333 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation) &&
334 PartSet_SketcherMgr::isDistanceOperation(theOperation)) {
335 // Find and activate widget for management of point for dimension line position
336 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
337 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
338 PartSet_WidgetPoint2D* aPntWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
340 aPanel->activateWidget(aPntWgt);
350 void PartSet_Module::onSelectionChanged()
352 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
356 bool isSketcherOp = false;
357 // An edit operation is enable only if the current opeation is the sketch operation
358 if (mySketchMgr->activeSketch()) {
359 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
360 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
363 // Editing of constraints can be done on selection
364 ModuleBase_ISelection* aSelect = myWorkshop->selection();
365 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
366 if (aSelected.size() == 1) {
367 ModuleBase_ViewerPrs aPrs = aSelected.first();
368 ObjectPtr aObject = aPrs.object();
369 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
371 std::string aId = aFeature->getKind();
372 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
373 (aId == SketchPlugin_ConstraintLength::ID()) ||
374 (aId == SketchPlugin_ConstraintDistance::ID())) {
375 editFeature(aFeature);
382 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
384 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
385 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
386 anOpMgr->onKeyReleased(theEvent);
389 void PartSet_Module::onEnterReleased()
391 myRestartingMode = RM_EmptyFeatureUsed;
394 void PartSet_Module::onOperationActivatedByPreselection()
396 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
397 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
398 // Set final definitions if they are necessary
399 //propertyPanelDefined(aOperation);
401 /// Commit sketcher operations automatically
402 anOperation->commit();
406 void PartSet_Module::onNoMoreWidgets()
408 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
410 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
411 if (myRestartingMode != RM_Forbided)
412 myRestartingMode = RM_LastFeatureUsed;
413 anOperation->commit();
418 void PartSet_Module::onVertexSelected()
420 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
421 if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) {
422 /// If last line finished on vertex the lines creation sequence has to be break
423 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
424 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
425 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
426 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
427 bool aFoundWidget = false;
428 bool aFoundObligatory = false;
429 for (; anIt != aLast && !aFoundObligatory; anIt++) {
431 aFoundWidget = *anIt == anActiveWidget;
433 aFoundObligatory = (*anIt)->isObligatory();
435 if (!aFoundObligatory)
436 myRestartingMode = RM_Forbided;
440 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
441 Config_WidgetAPI* theWidgetApi, std::string theParentId)
443 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
444 XGUI_Workshop* aWorkshop = aConnector->workshop();
445 ModuleBase_ModelWidget* aWgt = NULL;
446 if (theType == "sketch-start-label") {
447 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent,
448 theWidgetApi, theParentId, mySketchMgr->isConstraintsShown());
449 aLabelWgt->setWorkshop(aWorkshop);
450 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
451 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
452 connect(aLabelWgt, SIGNAL(showConstraintToggled(bool)),
453 mySketchMgr, SLOT(onShowConstraintsToggle(bool)));
455 } else if (theType == "sketch-2dpoint_selector") {
456 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, theWidgetApi, theParentId);
457 aPointWgt->setWorkshop(aWorkshop);
458 aPointWgt->setSketch(mySketchMgr->activeSketch());
459 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
461 } if (theType == "point2ddistance") {
462 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent, theWidgetApi, theParentId);
463 aDistanceWgt->setWorkshop(aWorkshop);
464 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
466 } if(theType == "point2dangle") {
467 PartSet_WidgetPoint2dAngle* anAngleWgt = new PartSet_WidgetPoint2dAngle(theParent, theWidgetApi, theParentId);
468 anAngleWgt->setWorkshop(aWorkshop);
469 anAngleWgt->setSketch(mySketchMgr->activeSketch());
472 if (theType == "sketch_shape_selector") {
473 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
474 new PartSet_WidgetShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
475 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
476 aWgt = aShapeSelectorWgt;
477 } if (theType == "sketch_multi_selector") {
478 PartSet_WidgetMultiSelector* aShapeSelectorWgt =
479 new PartSet_WidgetMultiSelector(theParent, workshop(), theWidgetApi, theParentId);
480 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
481 aWgt = aShapeSelectorWgt;
483 if (theType == WDG_DOUBLEVALUE_EDITOR) {
484 aWgt = new PartSet_WidgetEditor(theParent, workshop(), theWidgetApi, theParentId);
490 bool PartSet_Module::deleteObjects()
492 // 1. check whether the delete should be processed in the module
493 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
494 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
495 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
496 if (!isSketchOp && !isNestedOp)
499 // 2. find selected presentations
500 // selected objects should be collected before the current operation abort because
501 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
502 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
503 XGUI_Workshop* aWorkshop = aConnector->workshop();
504 ModuleBase_ISelection* aSel = workshop()->selection();
505 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
506 // if there are no selected objects in the viewer, that means that the selection in another
507 // place cased this method. It is necessary to return the false value to understande in above
508 // method that delete is not processed
509 if (aSelectedObj.count() == 0)
512 // avoid delete of the objects, which are not belong to the current sketch
513 // in order to do not delete results of other sketches
514 QObjectPtrList aSketchObjects;
515 QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
516 for ( ; anIt != aLast; anIt++) {
517 ObjectPtr anObject = *anIt;
518 if (mySketchMgr->isObjectOfSketch(anObject))
519 aSketchObjects.append(anObject);
521 // if the selection contains only local selected presentations from other sketches,
522 // the Delete operation should not be done at all
523 if (aSketchObjects.size() == 0)
526 // the active nested sketch operation should be aborted unconditionally
528 anOperation->abort();
530 // 3. start operation
531 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
532 SessionPtr aMgr = ModelAPI_Session::get();
533 aMgr->startOperation(aDescription.toStdString());
535 // 4. delete features
536 // sketch feature should be skipped, only sub-features can be removed
537 // when sketch operation is active
538 std::set<FeaturePtr> anIgnoredFeatures;
539 anIgnoredFeatures.insert(mySketchMgr->activeSketch());
540 aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures);
543 aWorkshop->displayer()->updateViewer();
544 aMgr->finishOperation();
550 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
552 Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
553 if (!anAIS.IsNull()) {
554 Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
555 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
556 if (!aDim.IsNull()) {
557 aCtx->SetZLayer(aDim, myVisualLayerId);
559 Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
561 aCtx->SetZLayer(aCons, myVisualLayerId);
566 void PartSet_Module::onViewTransformed(int theTrsfType)
568 // Set length of arrows constant in pixel size
569 // if the operation is panning or rotate or panglobal then do nothing
570 if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
573 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
574 //Handle(V3d_View) aView = aViewer->activeView();
576 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
577 XGUI_Workshop* aWorkshop = aConnector->workshop();
578 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
579 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
581 Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
582 Handle(V3d_View) aView;
584 for (aV3dViewer->InitDefinedViews();
585 aV3dViewer->MoreDefinedViews();
586 aV3dViewer->NextDefinedViews()) {
587 Handle(V3d_View) aV = aV3dViewer->DefinedView();
588 double aS = aV->Scale();
596 double aLen = aView->Convert(20);
598 SketcherPrs_Tools::setArrowSize(aLen);
599 bool isModified = false;
600 QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
601 foreach (AISObjectPtr aAIS, aPrsList) {
602 Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
604 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
605 if (!aDim.IsNull()) {
606 aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
607 aContext->Redisplay(aDim, false);
612 aDisplayer->updateViewer();