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_WidgetMultiSelector.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 <GeomValidators_ShapeType.h>
22 #include <GeomValidators_Face.h>
23 #include <GeomValidators_ConstructionComposite.h>
26 #include <ModelAPI_Object.h>
27 #include <ModelAPI_Events.h>
28 #include <ModelAPI_Validator.h>
29 #include <ModelAPI_Data.h>
30 #include <ModelAPI_Session.h>
31 #include <ModelAPI_ShapeValidator.h>
33 #include <GeomDataAPI_Point2D.h>
34 #include <GeomDataAPI_Point.h>
35 #include <GeomDataAPI_Dir.h>
37 #include <XGUI_Displayer.h>
38 #include <XGUI_Workshop.h>
39 #include <XGUI_OperationMgr.h>
40 #include <XGUI_PropertyPanel.h>
41 #include <XGUI_ModuleConnector.h>
42 #include <XGUI_ContextMenuMgr.h>
43 #include <XGUI_Tools.h>
45 #include <SketchPlugin_Feature.h>
46 #include <SketchPlugin_Sketch.h>
47 #include <SketchPlugin_Line.h>
48 #include <SketchPlugin_Arc.h>
49 #include <SketchPlugin_Circle.h>
50 #include <SketchPlugin_Point.h>
51 #include <SketchPlugin_ConstraintLength.h>
52 #include <SketchPlugin_ConstraintDistance.h>
53 #include <SketchPlugin_ConstraintParallel.h>
54 #include <SketchPlugin_ConstraintPerpendicular.h>
55 #include <SketchPlugin_ConstraintRadius.h>
57 #include <SketcherPrs_SymbolPrs.h>
58 #include <SketcherPrs_Tools.h>
60 #include <Events_Loop.h>
61 #include <Config_PropManager.h>
62 #include <Config_Keywords.h>
64 #include <StdSelect_TypeOfFace.hxx>
65 #include <TopoDS_Vertex.hxx>
67 #include <TopoDS_Shape.hxx>
68 #include <BRep_Tool.hxx>
69 #include <AIS_Dimension.hxx>
72 #include <QMouseEvent>
75 #include <QApplication>
76 #include <QMessageBox>
77 #include <QMainWindow>
79 #include <GeomAlgoAPI_FaceBuilder.h>
80 #include <GeomDataAPI_Dir.h>
86 /*!Create and return new instance of XGUI_Module*/
87 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
89 return new PartSet_Module(theWshop);
92 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
93 : ModuleBase_IModule(theWshop),
94 myRestartingMode(RM_None), myVisualLayerId(0)
96 mySketchMgr = new PartSet_SketcherMgr(this);
98 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
99 XGUI_Workshop* aWorkshop = aConnector->workshop();
101 XGUI_OperationMgr* anOpMgr = aWorkshop->operationMgr();
102 connect(anOpMgr, SIGNAL(keyEnterReleased()), this, SLOT(onEnterReleased()));
103 connect(anOpMgr, SIGNAL(operationActivatedByPreselection()),
104 this, SLOT(onOperationActivatedByPreselection()));
106 ModuleBase_IViewer* aViewer = theWshop->viewer();
107 connect(aViewer, SIGNAL(keyRelease(ModuleBase_IViewWindow*, QKeyEvent*)),
108 this, SLOT(onKeyRelease(ModuleBase_IViewWindow*, QKeyEvent*)));
109 connect(aViewer, SIGNAL(viewTransformed(int)),
110 SLOT(onViewTransformed(int)));
112 myMenuMgr = new PartSet_MenuMgr(this);
115 PartSet_Module::~PartSet_Module()
117 if (!myDocumentShapeFilter.IsNull())
118 myDocumentShapeFilter.Nullify();
121 void PartSet_Module::registerValidators()
123 //Registering of validators
124 SessionPtr aMgr = ModelAPI_Session::get();
125 ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
126 aFactory->registerValidator("PartSet_DistanceSelection", new PartSet_DistanceSelection);
127 aFactory->registerValidator("PartSet_LengthSelection", new PartSet_LengthSelection);
128 aFactory->registerValidator("PartSet_PerpendicularSelection", new PartSet_PerpendicularSelection);
129 aFactory->registerValidator("PartSet_ParallelSelection", new PartSet_ParallelSelection);
130 aFactory->registerValidator("PartSet_RadiusSelection", new PartSet_RadiusSelection);
131 aFactory->registerValidator("PartSet_RigidSelection", new PartSet_RigidSelection);
132 aFactory->registerValidator("PartSet_CoincidentSelection", new PartSet_CoincidentSelection);
133 aFactory->registerValidator("PartSet_HVDirSelection", new PartSet_HVDirSelection);
134 aFactory->registerValidator("PartSet_TangentSelection", new PartSet_TangentSelection);
135 aFactory->registerValidator("PartSet_FilletSelection", new PartSet_FilletSelection);
137 aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator);
138 aFactory->registerValidator("PartSet_DifferentShapes", new ModelAPI_ShapeValidator);
140 aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
141 aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
143 aFactory->registerValidator("GeomValidators_ConstructionComposite",
144 new GeomValidators_ConstructionComposite);
146 aFactory->registerValidator("PartSet_SketchEntityValidator",
147 new PartSet_SketchEntityValidator);
149 aFactory->registerValidator("PartSet_SameTypeAttr",
150 new PartSet_SameTypeAttrValidator);
153 void PartSet_Module::registerFilters()
155 //Registering of selection filters
156 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
157 ModuleBase_FilterFactory* aFactory = aConnector->selectionFilters();
160 void PartSet_Module::registerProperties()
162 Config_PropManager::registerProp("Sketch planes", "planes_size", "Size", Config_Prop::Double,
164 Config_PropManager::registerProp("Sketch planes", "planes_thickness", "Thickness",
165 Config_Prop::Integer, SKETCH_WIDTH);
168 void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
170 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
171 mySketchMgr->commitNestedSketch(theOperation);
174 if (theOperation->isEditOperation())
176 // the selection is cleared after commit the create operation
177 // in order to do not use the same selected objects in the restarted operation
178 // for common behaviour, the selection is cleared even if the operation is not restarted
179 Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
180 if (!aContext.IsNull())
181 aContext->ClearSelected();
183 /// Restart sketcher operations automatically
184 FeaturePtr aFeature = theOperation->feature();
185 std::shared_ptr<SketchPlugin_Feature> aSPFeature =
186 std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
187 if (aSPFeature && (myRestartingMode == RM_LastFeatureUsed ||
188 myRestartingMode == RM_EmptyFeatureUsed)) {
189 myLastOperationId = theOperation->id();
190 myLastFeature = myRestartingMode == RM_LastFeatureUsed ? theOperation->feature() : FeaturePtr();
192 launchOperation(myLastOperationId);
194 breakOperationSequence();
197 void PartSet_Module::breakOperationSequence()
199 myLastOperationId = "";
200 myLastFeature = FeaturePtr();
201 myRestartingMode = RM_None;
204 void PartSet_Module::operationAborted(ModuleBase_Operation* theOperation)
206 breakOperationSequence();
209 void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
211 // Install the document filter before any other filter
212 if (myDocumentShapeFilter.IsNull())
213 myDocumentShapeFilter = new PartSet_GlobalFilter(myWorkshop);
214 myWorkshop->viewer()->addSelectionFilter(myDocumentShapeFilter);
216 ModuleBase_IModule::sendOperation(theOperation);
219 void PartSet_Module::operationStarted(ModuleBase_Operation* theOperation)
221 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
222 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
223 aViewer->AddZLayer(myVisualLayerId);
224 mySketchMgr->startSketch(theOperation);
226 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
227 mySketchMgr->startNestedSketch(theOperation);
231 void PartSet_Module::operationStopped(ModuleBase_Operation* theOperation)
233 if (PartSet_SketcherMgr::isSketchOperation(theOperation)) {
234 mySketchMgr->stopSketch(theOperation);
235 Handle(V3d_Viewer) aViewer = myWorkshop->viewer()->AISContext()->CurrentViewer();
236 aViewer->RemoveZLayer(myVisualLayerId);
239 else if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation)) {
240 mySketchMgr->stopNestedSketch(theOperation);
242 myWorkshop->viewer()->removeSelectionFilter(myDocumentShapeFilter);
245 ModuleBase_Operation* PartSet_Module::currentOperation() const
247 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
248 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
249 return anOpMgr->currentOperation();
252 bool PartSet_Module::canUndo() const
254 bool aCanUndo = false;
255 SessionPtr aMgr = ModelAPI_Session::get();
256 if (aMgr->hasModuleDocument() && aMgr->canUndo()) {
257 aCanUndo = !aMgr->isOperation();
258 if (!aCanUndo) // check the enable state additionally by sketch manager
259 aCanUndo = aMgr->canUndo();
264 bool PartSet_Module::canRedo() const
266 bool aCanRedo = false;
267 SessionPtr aMgr = ModelAPI_Session::get();
268 if (aMgr->hasModuleDocument() && aMgr->canRedo()) {
269 aCanRedo = !aMgr->isOperation();
270 if (!aCanRedo) // check the enable state additionally by sketch manager
271 aCanRedo = aMgr->canRedo();
276 bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
278 // the sketch manager put the restriction to the objects display
279 return mySketchMgr->canDisplayObject(theObject);
283 bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
285 return myMenuMgr->addViewerItems(theMenu, theStdActions);
288 void PartSet_Module::activeSelectionModes(QIntList& theModes)
291 if (mySketchMgr->activeSketch().get())
292 PartSet_SketcherMgr::sketchSelectionModes(theModes);
295 bool PartSet_Module::isMouseOverWindow()
297 return mySketchMgr->isMouseOverWindow();
300 void PartSet_Module::propertyPanelDefined(ModuleBase_Operation* theOperation)
302 ModuleBase_IPropertyPanel* aPanel = theOperation->propertyPanel();
303 if (PartSet_SketcherMgr::isSketchOperation(theOperation) && (theOperation->isEditOperation())) {
304 // we have to manually activate the sketch label in edit mode
305 aPanel->activateWidget(aPanel->modelWidgets().first());
309 // Restart last operation type
310 if ((theOperation->id() == myLastOperationId) && myLastFeature) {
311 ModuleBase_ModelWidget* aWgt = aPanel->activeWidget();
312 if (theOperation->id().toStdString() == SketchPlugin_Line::ID()) {
313 // Initialise new line with first point equal to end of previous
314 PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
316 std::shared_ptr<ModelAPI_Data> aData = myLastFeature->data();
317 std::shared_ptr<GeomDataAPI_Point2D> aPoint =
318 std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
320 aPnt2dWgt->setPoint(aPoint->x(), aPoint->y());
321 PartSet_Tools::setConstraints(mySketchMgr->activeSketch(), theOperation->feature(),
322 aWgt->attributeID(), aPoint->x(), aPoint->y());
323 aPanel->activateNextWidget(aPnt2dWgt);
328 // Start editing constraint
329 if (theOperation->isEditOperation()) {
330 // TODO: #391 - to be removed
331 std::string aId = theOperation->id().toStdString();
332 if (PartSet_SketcherMgr::isNestedSketchOperation(theOperation) &&
333 PartSet_SketcherMgr::isDistanceOperation(theOperation)) {
334 // Find and activate widget for management of point for dimension line position
335 QList<ModuleBase_ModelWidget*> aWidgets = aPanel->modelWidgets();
336 foreach (ModuleBase_ModelWidget* aWgt, aWidgets) {
337 PartSet_WidgetPoint2D* aPntWgt = dynamic_cast<PartSet_WidgetPoint2D*>(aWgt);
339 aPanel->activateWidget(aPntWgt);
349 void PartSet_Module::onSelectionChanged()
351 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
355 bool isSketcherOp = false;
356 // An edit operation is enable only if the current opeation is the sketch operation
357 if (mySketchMgr->activeSketch()) {
358 if (PartSet_Tools::sketchPlane(mySketchMgr->activeSketch()))
359 isSketcherOp = PartSet_SketcherMgr::isSketchOperation(aOperation);
362 // Editing of constraints can be done on selection
363 ModuleBase_ISelection* aSelect = myWorkshop->selection();
364 QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
365 if (aSelected.size() == 1) {
366 ModuleBase_ViewerPrs aPrs = aSelected.first();
367 ObjectPtr aObject = aPrs.object();
368 FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
370 std::string aId = aFeature->getKind();
371 if ((aId == SketchPlugin_ConstraintRadius::ID()) ||
372 (aId == SketchPlugin_ConstraintLength::ID()) ||
373 (aId == SketchPlugin_ConstraintDistance::ID())) {
374 editFeature(aFeature);
381 void PartSet_Module::onKeyRelease(ModuleBase_IViewWindow* theWnd, QKeyEvent* theEvent)
383 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
384 XGUI_OperationMgr* anOpMgr = aConnector->workshop()->operationMgr();
385 anOpMgr->onKeyReleased(theEvent);
388 void PartSet_Module::onEnterReleased()
390 myRestartingMode = RM_EmptyFeatureUsed;
393 void PartSet_Module::onOperationActivatedByPreselection()
395 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
396 if(anOperation && PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
397 // Set final definitions if they are necessary
398 //propertyPanelDefined(aOperation);
400 /// Commit sketcher operations automatically
401 anOperation->commit();
405 void PartSet_Module::onNoMoreWidgets()
407 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
409 if (PartSet_SketcherMgr::isNestedSketchOperation(anOperation)) {
410 if (myRestartingMode != RM_Forbided)
411 myRestartingMode = RM_LastFeatureUsed;
412 anOperation->commit();
417 void PartSet_Module::onVertexSelected()
419 ModuleBase_Operation* aOperation = myWorkshop->currentOperation();
420 if (aOperation->id().toStdString() == SketchPlugin_Line::ID()) {
421 /// If last line finished on vertex the lines creation sequence has to be break
422 ModuleBase_IPropertyPanel* aPanel = aOperation->propertyPanel();
423 ModuleBase_ModelWidget* anActiveWidget = aPanel->activeWidget();
424 const QList<ModuleBase_ModelWidget*>& aWidgets = aPanel->modelWidgets();
425 QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
426 bool aFoundWidget = false;
427 bool aFoundObligatory = false;
428 for (; anIt != aLast && !aFoundObligatory; anIt++) {
430 aFoundWidget = *anIt == anActiveWidget;
432 aFoundObligatory = (*anIt)->isObligatory();
434 if (!aFoundObligatory)
435 myRestartingMode = RM_Forbided;
439 ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& theType, QWidget* theParent,
440 Config_WidgetAPI* theWidgetApi, std::string theParentId)
442 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
443 XGUI_Workshop* aWorkshop = aConnector->workshop();
444 ModuleBase_ModelWidget* aWgt = NULL;
445 if (theType == "sketch-start-label") {
446 PartSet_WidgetSketchLabel* aLabelWgt = new PartSet_WidgetSketchLabel(theParent,
447 theWidgetApi, theParentId, mySketchMgr->isConstraintsShown());
448 aLabelWgt->setWorkshop(aWorkshop);
449 connect(aLabelWgt, SIGNAL(planeSelected(const std::shared_ptr<GeomAPI_Pln>&)),
450 mySketchMgr, SLOT(onPlaneSelected(const std::shared_ptr<GeomAPI_Pln>&)));
451 connect(aLabelWgt, SIGNAL(showConstraintToggled(bool)),
452 mySketchMgr, SLOT(onShowConstraintsToggle(bool)));
454 } else if (theType == "sketch-2dpoint_selector") {
455 PartSet_WidgetPoint2D* aPointWgt = new PartSet_WidgetPoint2D(theParent, theWidgetApi, theParentId);
456 aPointWgt->setWorkshop(aWorkshop);
457 aPointWgt->setSketch(mySketchMgr->activeSketch());
458 connect(aPointWgt, SIGNAL(vertexSelected()), this, SLOT(onVertexSelected()));
460 } if (theType == "point2ddistance") {
461 PartSet_WidgetPoint2dDistance* aDistanceWgt = new PartSet_WidgetPoint2dDistance(theParent, theWidgetApi, theParentId);
462 aDistanceWgt->setWorkshop(aWorkshop);
463 aDistanceWgt->setSketch(mySketchMgr->activeSketch());
465 } if (theType == "sketch_shape_selector") {
466 PartSet_WidgetShapeSelector* aShapeSelectorWgt =
467 new PartSet_WidgetShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
468 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
469 aWgt = aShapeSelectorWgt;
470 } if (theType == "sketch_multi_selector") {
471 PartSet_WidgetMultiSelector* aShapeSelectorWgt =
472 new PartSet_WidgetMultiSelector(theParent, workshop(), theWidgetApi, theParentId);
473 aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
474 aWgt = aShapeSelectorWgt;
476 if (theType == WDG_DOUBLEVALUE_EDITOR) {
477 aWgt = new PartSet_WidgetEditor(theParent, workshop(), theWidgetApi, theParentId);
483 bool PartSet_Module::deleteObjects()
485 // 1. check whether the delete should be processed in the module
486 ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
487 bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
488 isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
489 if (!isSketchOp && !isNestedOp)
492 // 2. find selected presentations
493 // selected objects should be collected before the current operation abort because
494 // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
495 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
496 XGUI_Workshop* aWorkshop = aConnector->workshop();
497 ModuleBase_ISelection* aSel = workshop()->selection();
498 QObjectPtrList aSelectedObj = aSel->selectedPresentations();
499 // if there are no selected objects in the viewer, that means that the selection in another
500 // place cased this method. It is necessary to return the false value to understande in above
501 // method that delete is not processed
502 if (aSelectedObj.count() == 0)
505 // avoid delete of the objects, which are not belong to the current sketch
506 // in order to do not delete results of other sketches
507 QObjectPtrList aSketchObjects;
508 QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
509 for ( ; anIt != aLast; anIt++) {
510 ObjectPtr anObject = *anIt;
511 if (mySketchMgr->isObjectOfSketch(anObject))
512 aSketchObjects.append(anObject);
514 // if the selection contains only local selected presentations from other sketches,
515 // the Delete operation should not be done at all
516 if (aSketchObjects.size() == 0)
519 // the active nested sketch operation should be aborted unconditionally
521 anOperation->abort();
523 // 3. start operation
524 QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
525 SessionPtr aMgr = ModelAPI_Session::get();
526 aMgr->startOperation(aDescription.toStdString());
528 // 4. delete features
529 // sketch feature should be skipped, only sub-features can be removed
530 // when sketch operation is active
531 std::set<FeaturePtr> anIgnoredFeatures;
532 anIgnoredFeatures.insert(mySketchMgr->activeSketch());
533 aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures);
536 aWorkshop->displayer()->updateViewer();
537 aMgr->finishOperation();
543 void PartSet_Module::onObjectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS)
545 Handle(AIS_InteractiveObject) anAIS = theAIS->impl<Handle(AIS_InteractiveObject)>();
546 if (!anAIS.IsNull()) {
547 Handle(AIS_InteractiveContext) aCtx = anAIS->GetContext();
548 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(anAIS);
549 if (!aDim.IsNull()) {
550 aCtx->SetZLayer(aDim, myVisualLayerId);
552 Handle(SketcherPrs_SymbolPrs) aCons = Handle(SketcherPrs_SymbolPrs)::DownCast(anAIS);
554 aCtx->SetZLayer(aCons, myVisualLayerId);
559 void PartSet_Module::onViewTransformed(int theTrsfType)
561 // Set length of arrows constant in pixel size
562 // if the operation is panning or rotate or panglobal then do nothing
563 if ((theTrsfType == 1) || (theTrsfType == 3) || (theTrsfType == 4))
566 ModuleBase_IViewer* aViewer = myWorkshop->viewer();
567 //Handle(V3d_View) aView = aViewer->activeView();
569 XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
570 XGUI_Workshop* aWorkshop = aConnector->workshop();
571 XGUI_Displayer* aDisplayer = aWorkshop->displayer();
572 Handle(AIS_InteractiveContext) aContext = aViewer->AISContext();
574 Handle(V3d_Viewer) aV3dViewer = aContext->CurrentViewer();
575 Handle(V3d_View) aView;
577 for (aV3dViewer->InitDefinedViews();
578 aV3dViewer->MoreDefinedViews();
579 aV3dViewer->NextDefinedViews()) {
580 Handle(V3d_View) aV = aV3dViewer->DefinedView();
581 double aS = aV->Scale();
589 double aLen = aView->Convert(20);
591 SketcherPrs_Tools::setArrowSize(aLen);
592 bool isModified = false;
593 QList<AISObjectPtr> aPrsList = aDisplayer->displayedPresentations();
594 foreach (AISObjectPtr aAIS, aPrsList) {
595 Handle(AIS_InteractiveObject) aAisObj = aAIS->impl<Handle(AIS_InteractiveObject)>();
597 Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast(aAisObj);
598 if (!aDim.IsNull()) {
599 aDim->DimensionAspect()->ArrowAspect()->SetLength(aLen);
600 aContext->Redisplay(aDim, false);
605 aDisplayer->updateViewer();