Salome HOME
Issue #1368: Creation of a Qt panel. Code improvement.
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_WidgetSketchLabel.cpp
4 // Created:     07 July 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #include "PartSet_WidgetSketchLabel.h"
8 #include "PartSet_Tools.h"
9 #include "PartSet_Module.h"
10
11 #include "SketchPlugin_SketchEntity.h"
12
13 #include <XGUI_Workshop.h>
14 #include <XGUI_Displayer.h>
15 #include <XGUI_SelectionMgr.h>
16 #include <XGUI_Selection.h>
17 #include <XGUI_ViewerProxy.h>
18 #include <XGUI_ActionsMgr.h>
19 #include <XGUI_ModuleConnector.h>
20
21 #include <ModuleBase_Operation.h>
22 #include <ModuleBase_ViewerPrs.h>
23 #include <ModuleBase_Tools.h>
24 #include <ModuleBase_IModule.h>
25
26 #include <ModelAPI_ResultBody.h>
27 #include <ModelAPI_Tools.h>
28
29 #include <GeomAlgoAPI_FaceBuilder.h>
30 #include <GeomAlgoAPI_ShapeTools.h>
31 #include <GeomDataAPI_Point.h>
32 #include <GeomDataAPI_Dir.h>
33 #include <GeomAPI_XYZ.h>
34
35 #include <SketchPlugin_Sketch.h>
36 #include <SketcherPrs_Tools.h>
37
38 #include <Precision.hxx>
39 #include <gp_Pln.hxx>
40 #include <gp_Pnt.hxx>
41 #include <gp_Dir.hxx>
42 #include <AIS_Shape.hxx>
43 #include <AIS_DimensionSelectionMode.hxx>
44
45 #include <Config_WidgetAPI.h>
46 #include <Config_PropManager.h>
47
48 #include <QLabel>
49 #include <QApplication>
50 #include <QVBoxLayout>
51 #include <QCheckBox>
52 #include <QGroupBox>
53 #include <QPushButton>
54 #include <QStackedWidget>
55
56
57 PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent,
58                         ModuleBase_IWorkshop* theWorkshop,
59                         const Config_WidgetAPI* theData,
60                         const QMap<PartSet_Tools::ConstraintVisibleState, bool>& toShowConstraints)
61 : ModuleBase_WidgetValidated(theParent, theWorkshop, theData),
62   myPreviewDisplayed(false)
63 {
64   QVBoxLayout* aLayout = new QVBoxLayout(this);
65   ModuleBase_Tools::zeroMargins(aLayout);
66
67   myStackWidget = new QStackedWidget(this);
68   myStackWidget->setContentsMargins(0,0,0,0);
69   aLayout->addWidget(myStackWidget);
70
71   // Define label for plane selection
72   QWidget* aFirstWgt = new QWidget(this);
73
74   QString aText = QString::fromStdString(theData->getProperty("title"));
75   QLabel* aLabel = new QLabel(aText, aFirstWgt);
76   aLabel->setWordWrap(true);
77   QString aTooltip = QString::fromStdString(theData->getProperty("tooltip"));
78   aLabel->setToolTip(aTooltip);
79   aLabel->setIndent(5);
80
81   aLayout = new QVBoxLayout(aFirstWgt);
82   ModuleBase_Tools::zeroMargins(aLayout);
83   aLayout->addWidget(aLabel);
84
85   myStackWidget->addWidget(aFirstWgt);
86
87   // Define widget for sketch manmagement
88   QWidget* aSecondWgt = new QWidget(this);
89   aLayout = new QVBoxLayout(aSecondWgt);
90   ModuleBase_Tools::zeroMargins(aLayout);
91
92   QGroupBox* aViewBox = new QGroupBox(tr("Sketcher plane"), this);
93   QVBoxLayout* aViewLayout = new QVBoxLayout(aViewBox);
94
95   myViewInverted = new QCheckBox(tr("Reversed"), aViewBox);
96   aViewLayout->addWidget(myViewInverted);
97
98   QPushButton* aSetViewBtn = new QPushButton(QIcon(":icons/plane_view.png"), tr("Set plane view"), aViewBox);
99   connect(aSetViewBtn, SIGNAL(clicked(bool)), this, SLOT(onSetPlaneView()));
100   aViewLayout->addWidget(aSetViewBtn);
101
102   aLayout->addWidget(aViewBox);
103
104   QMap<PartSet_Tools::ConstraintVisibleState, QString> aStates;
105   aStates[PartSet_Tools::Geometrical] = tr("Show geometrical constraints");
106   aStates[PartSet_Tools::Dimensional] = tr("Show dimensional constraints");
107
108   QMap<PartSet_Tools::ConstraintVisibleState, QString>::const_iterator anIt = aStates.begin(),
109                                                         aLast = aStates.end();
110   for (; anIt != aLast; anIt++) {
111     QCheckBox* aShowConstraints = new QCheckBox(anIt.value(), this);
112     connect(aShowConstraints, SIGNAL(toggled(bool)), this, SLOT(onShowConstraint(bool)));
113     aLayout->addWidget(aShowConstraints);
114
115     PartSet_Tools::ConstraintVisibleState aState = anIt.key();
116     myShowConstraints[aState] = aShowConstraints;
117
118     if (toShowConstraints.contains(aState))
119       aShowConstraints->setChecked(toShowConstraints[aState]);
120   }
121
122   myStackWidget->addWidget(aSecondWgt);
123   //setLayout(aLayout);
124 }
125
126 PartSet_WidgetSketchLabel::~PartSet_WidgetSketchLabel()
127 {
128 }
129
130 bool PartSet_WidgetSketchLabel::setSelection(QList<ModuleBase_ViewerPrs>& theValues,
131                                              const bool theToValidate)
132 {
133   // do not use the given selection if the plane of the sketch has been already set.
134   // If this check is absent, a selected plane in the viewer can be set in the sketch
135   // even if the sketch is built on another plane.
136   if (plane().get())
137     return true;
138
139   ModuleBase_ViewerPrs aPrs = theValues.first();
140   bool aDone = ModuleBase_WidgetValidated::setSelection(theValues, theToValidate);
141   if (aDone)
142     updateByPlaneSelected(aPrs);
143
144   return aDone;
145 }
146
147 QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
148 {
149   QList<QWidget*> aResult;
150   aResult << myStackWidget;
151   return aResult;
152 }
153
154 void PartSet_WidgetSketchLabel::onSelectionChanged()
155 {
156   QList<ModuleBase_ViewerPrs> aSelected = getFilteredSelected();
157
158   if (aSelected.empty())
159     return;
160   ModuleBase_ViewerPrs aPrs = aSelected.first();
161
162   bool aDone = ModuleBase_WidgetValidated::setSelection(aSelected, false);
163   if (aDone) {
164     updateByPlaneSelected(aPrs);
165     updateObject(myFeature);
166   }
167 }
168
169 void PartSet_WidgetSketchLabel::onShowConstraint(bool theOn)
170 {
171   QCheckBox* aSenderCheckBox = qobject_cast<QCheckBox*>(sender());
172
173   QMap<PartSet_Tools::ConstraintVisibleState, QCheckBox*>::const_iterator
174                           anIt = myShowConstraints.begin(), aLast = myShowConstraints.end();
175
176   PartSet_Tools::ConstraintVisibleState aState = PartSet_Tools::Geometrical;
177   bool aFound = false;
178   for (; anIt != aLast && !aFound; anIt++) {
179     aFound = anIt.value() == aSenderCheckBox;
180     if (aFound)
181       aState = anIt.key();
182   }
183   if (aFound)
184     emit showConstraintToggled(aState, theOn);
185 }
186
187 void PartSet_WidgetSketchLabel::blockAttribute(const bool& theToBlock, bool& isFlushesActived,
188                                                bool& isAttributeSetInitializedBlocked)
189 {
190   ModuleBase_WidgetValidated::blockAttribute(theToBlock, isFlushesActived,
191                                              isAttributeSetInitializedBlocked);
192   // We do not restore the previous state of isAttributeSetInitializedBlocked for each of
193   // attributes. It it is necessary, these states should be append to the method attributes
194   // or stored in the widget
195
196   std::list<AttributePtr> anAttributes = myFeature->data()->attributes("");
197   std::list<AttributePtr>::const_iterator anIt = anAttributes.begin(), aLast = anAttributes.end();
198   QStringList aValues;
199   for(; anIt != aLast; anIt++) {
200     AttributePtr anAttribute = *anIt;
201     if (theToBlock)
202       anAttribute->blockSetInitialized(true);
203     else
204       anAttribute->blockSetInitialized(isAttributeSetInitializedBlocked);
205   }
206 }
207
208 void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs& thePrs)
209 {
210   // 1. hide main planes if they have been displayed
211   erasePreviewPlanes();
212   // 2. if the planes were displayed, change the view projection
213   TopoDS_Shape aShape = thePrs.shape();
214   std::shared_ptr<GeomAPI_Shape> aGShape;
215   std::shared_ptr<GeomAPI_Shape> aBaseShape;
216
217   DataPtr aData = feature()->data();
218   AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
219                             (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
220
221   // selection happens in OCC viewer
222   if (!aShape.IsNull()) {
223     aGShape =  std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
224     aGShape->setImpl(new TopoDS_Shape(aShape));
225
226     if (aSelAttr && aSelAttr->context()) {
227       aBaseShape = aSelAttr->context()->shape();
228     }
229   }
230   else { // selection happens in OCC viewer(on body) of in the OB browser
231     if (aSelAttr) {
232       aGShape = aSelAttr->value();
233     }
234   }
235   if (aGShape.get() != NULL) {
236     // get plane parameters
237     std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
238     std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
239     gp_XYZ aXYZ = aDir->impl<gp_Dir>().XYZ();
240     double aTwist = 0.0;
241
242     // orienting projection is not needed: it is done in GeomAlgoAPI_FaceBuilder::plane
243     /*if (aGShape->impl<TopoDS_Shape>().Orientation() == TopAbs_REVERSED) {
244       aXYZ.Reverse();
245     }*/
246
247     // Rotate view if the sketcher plane is selected only from preview planes
248     // Preview planes are created only if there is no any shape
249     bool aRotate = Config_PropManager::boolean("Sketch planes", "rotate_to_plane", "false");
250     if (aRotate) {
251       myWorkshop->viewer()->setViewProjection(aXYZ.X(), aXYZ.Y(), aXYZ.Z(), aTwist);
252       PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
253       if (aModule)
254         aModule->onViewTransformed();
255     }
256   }
257   // 3. Clear text in the label
258   myStackWidget->setCurrentIndex(1);
259   //myLabel->setText("");
260   //myLabel->setToolTip("");
261   disconnect(workshop()->selector(), SIGNAL(selectionChanged()), 
262               this, SLOT(onSelectionChanged()));
263   // 4. deactivate face selection filter
264   activateFilters(false);
265
266   // 5. Clear selection mode and define sketching mode
267   //XGUI_Displayer* aDisp = workshop()->displayer();
268   //aDisp->closeLocalContexts();
269   emit planeSelected(plane());
270   // after the plane is selected in the sketch, the sketch selection should be activated
271   // it can not be performed in the sketch label widget because, we don't need to switch off
272   // the selection by any label deactivation, but need to switch it off by stop the sketch
273   activateSelection(true);
274
275   // 6. Update sketcher actions
276   XGUI_ActionsMgr* anActMgr = workshop()->actionsMgr();
277   myWorkshop->updateCommandStatus();
278   myWorkshop->viewer()->update();
279 }
280
281 std::shared_ptr<GeomAPI_Pln> PartSet_WidgetSketchLabel::plane() const
282 {
283   CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
284   return PartSet_Tools::sketchPlane(aSketch);
285 }
286
287 bool PartSet_WidgetSketchLabel::focusTo()
288 {
289   ModuleBase_Tools::setFocus(myStackWidget, "PartSet_WidgetSketchLabel::focusTo()");
290   return true;
291 }
292
293 void PartSet_WidgetSketchLabel::enableFocusProcessing()
294 {
295   myStackWidget->installEventFilter(this);
296 }
297
298 void PartSet_WidgetSketchLabel::storeAttributeValue()
299 {
300   ModuleBase_WidgetValidated::storeAttributeValue();
301 }
302
303 void PartSet_WidgetSketchLabel::restoreAttributeValue(const bool theValid)
304 {
305   ModuleBase_WidgetValidated::restoreAttributeValue(theValid);
306
307   // it is not necessary to save the previous plane value because the plane is chosen once
308   DataPtr aData = feature()->data();
309   AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
310     (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
311   if (aSelAttr) {
312     ResultPtr anEmptyResult;
313     GeomShapePtr anEmptyShape;
314     aSelAttr->setValue(anEmptyResult, anEmptyShape);
315   }
316 }
317
318 bool PartSet_WidgetSketchLabel::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
319 {
320   bool isOwnerSet = false;
321
322   const TopoDS_Shape& aShape = thePrs.shape();
323   std::shared_ptr<GeomAPI_Dir> aDir;
324
325   if (thePrs.object() && (feature() != thePrs.object())) {
326     DataPtr aData = feature()->data();
327     AttributeSelectionPtr aSelAttr = 
328       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
329       (aData->attribute(SketchPlugin_SketchEntity::EXTERNAL_ID()));
330     if (aSelAttr) {
331       ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
332       if (aRes) {
333         GeomShapePtr aShapePtr(new GeomAPI_Shape());
334         if (aShape.IsNull()) {  // selection happens in the OCC viewer
335           aShapePtr = ModelAPI_Tools::shape(aRes);
336         }
337         else { // selection happens in OB browser
338           aShapePtr->setImpl(new TopoDS_Shape(aShape));
339         }
340         if (aShapePtr.get() != NULL) {
341           aSelAttr->setValue(aRes, aShapePtr);
342           isOwnerSet = true;
343         }
344       }
345     }
346   }
347   else if (!aShape.IsNull()) {
348     aDir = setSketchPlane(aShape);
349     isOwnerSet = aDir.get();
350   }
351   return isOwnerSet;
352 }
353
354 void PartSet_WidgetSketchLabel::activateCustom()
355 {
356   std::shared_ptr<GeomAPI_Pln> aPlane = plane();
357   if (aPlane.get()) {
358     myStackWidget->setCurrentIndex(1);
359     activateSelection(true);
360     return;
361   }
362
363   myStackWidget->setCurrentIndex(0);
364   bool aBodyIsVisualized = false;
365   XGUI_Displayer* aDisp = workshop()->displayer();
366   QObjectPtrList aDisplayed = aDisp->displayedObjects();
367   foreach (ObjectPtr anObj, aDisplayed) {
368     ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
369     if (aResult.get() != NULL) {
370       aBodyIsVisualized = aResult->groupName() == ModelAPI_ResultBody::group();
371       if (aBodyIsVisualized)
372         break;
373     }
374   }
375
376   if (!aBodyIsVisualized) {
377     // We have to select a plane before any operation
378     showPreviewPlanes();
379   }
380   activateSelection(true);
381
382   //myLabel->setText(myText);
383   //myLabel->setToolTip(myTooltip);
384
385   connect(workshop()->selector(), SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
386   activateFilters(true);
387 }
388
389 void PartSet_WidgetSketchLabel::deactivate()
390 {
391   ModuleBase_ModelWidget::deactivate();
392   bool aHidePreview = myPreviewDisplayed;
393   erasePreviewPlanes();
394   activateSelection(false);
395
396   activateFilters(false);
397   if (aHidePreview)
398     myWorkshop->viewer()->update();
399 }
400
401 void PartSet_WidgetSketchLabel::activateSelection(bool toActivate)
402 {
403   if (toActivate) {
404     QIntList aModes;
405     std::shared_ptr<GeomAPI_Pln> aPlane = plane();
406     if (aPlane.get()) {
407       myWorkshop->module()->activeSelectionModes(aModes);
408     }
409     else {
410       aModes << TopAbs_FACE;
411     }
412     myWorkshop->activateSubShapesSelection(aModes);
413   } else {
414     myWorkshop->deactivateSubShapesSelection();
415   }
416 }
417
418 void PartSet_WidgetSketchLabel::erasePreviewPlanes()
419 {
420   if (myPreviewDisplayed) {
421     XGUI_Displayer* aDisp = workshop()->displayer();
422     aDisp->eraseAIS(myYZPlane, false);
423     aDisp->eraseAIS(myXZPlane, false);
424     aDisp->eraseAIS(myXYPlane, false);
425     myPreviewDisplayed = false;
426   }
427 }
428
429 void PartSet_WidgetSketchLabel::showPreviewPlanes()
430 {
431   if (myPreviewDisplayed)
432     return;
433
434   if (!myYZPlane) { // If planes are not created
435     // Create Preview
436     std::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
437     std::shared_ptr<GeomAPI_Dir> aYZDir(new GeomAPI_Dir(1, 0, 0));
438     // -1, not 1 for correct internal sketch coords (issue 898)
439     std::shared_ptr<GeomAPI_Dir> aXZDir(new GeomAPI_Dir(0, -1, 0));
440     std::shared_ptr<GeomAPI_Dir> aXYDir(new GeomAPI_Dir(0, 0, 1));
441
442     std::vector<int> aYZRGB, aXZRGB, aXYRGB;
443     aYZRGB = Config_PropManager::color("Visualization", "yz_plane_color",
444                                                         YZ_PLANE_COLOR);
445     aXZRGB = Config_PropManager::color("Visualization", "xz_plane_color",
446                                                         XZ_PLANE_COLOR);
447     aXYRGB = Config_PropManager::color("Visualization", "xy_plane_color",
448                                                         XY_PLANE_COLOR);
449     int aR[] = {aYZRGB[0], aYZRGB[1], aYZRGB[2]};
450     int aG[] = {aXZRGB[0], aXZRGB[1], aXZRGB[2]};
451     int aB[] = {aXYRGB[0], aXYRGB[1], aXYRGB[2]};
452
453     myYZPlane = createPreviewPlane(anOrigin, aYZDir, aR);
454     myXZPlane = createPreviewPlane(anOrigin, aXZDir, aG);
455     myXYPlane = createPreviewPlane(anOrigin, aXYDir, aB);
456   }
457   XGUI_Displayer* aDisp = workshop()->displayer();
458   aDisp->displayAIS(myYZPlane, true, false);
459   aDisp->displayAIS(myXZPlane, true, false);
460   aDisp->displayAIS(myXYPlane, true, false);
461   myPreviewDisplayed = true;
462 }
463
464
465 AISObjectPtr PartSet_WidgetSketchLabel::createPreviewPlane(std::shared_ptr<GeomAPI_Pnt> theOrigin, 
466                                                            std::shared_ptr<GeomAPI_Dir> theNorm, 
467                                                            const int theRGB[3])
468 {
469   double aSize = Config_PropManager::integer("Sketch planes", "planes_size", PLANE_SIZE);
470   std::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(theOrigin, theNorm, aSize);
471   AISObjectPtr aAIS = AISObjectPtr(new GeomAPI_AISObject());
472   aAIS->createShape(aFace);
473   aAIS->setWidth(Config_PropManager::integer("Sketch planes", "planes_thickness", SKETCH_WIDTH));
474   aAIS->setColor(theRGB[0], theRGB[1], theRGB[2]);
475   return aAIS;
476 }
477
478
479 std::shared_ptr<GeomAPI_Dir> PartSet_WidgetSketchLabel::setSketchPlane(const TopoDS_Shape& theShape)
480 {
481   if (theShape.IsNull())
482     return std::shared_ptr<GeomAPI_Dir>();
483
484   // get selected shape
485   std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
486   aGShape->setImpl(new TopoDS_Shape(theShape));
487
488
489
490   // get plane parameters
491   std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
492   if (!aPlane.get())
493     return std::shared_ptr<GeomAPI_Dir>();
494
495   // set plane parameters to feature
496   std::shared_ptr<ModelAPI_Data> aData = feature()->data();
497   double anA, aB, aC, aD;
498   aPlane->coefficients(anA, aB, aC, aD);
499
500   // calculate attributes of the sketch
501   std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
502   std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
503   std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
504   aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
505   std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
506   // X axis is preferable to be dirX on the sketch
507   const double tol = Precision::Confusion();
508   bool isX = fabs(anA - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
509   std::shared_ptr<GeomAPI_Dir> aTempDir(
510       isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
511   std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
512   std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
513
514   std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
515       aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
516   anOrigin->setValue(anOrigPnt);
517   std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
518       aData->attribute(SketchPlugin_Sketch::NORM_ID()));
519   aNormal->setValue(aNormDir);
520   std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
521       aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
522   aDirX->setValue(aXDir);
523   std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
524   return aDir;
525 }
526
527 XGUI_Workshop* PartSet_WidgetSketchLabel::workshop() const
528 {
529   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
530   return aConnector->workshop();
531 }
532
533
534 void PartSet_WidgetSketchLabel::onSetPlaneView()
535 {
536   std::shared_ptr<GeomAPI_Pln> aPlane = plane();
537   if (aPlane.get()) {
538     std::shared_ptr<GeomAPI_Dir> aDirection = aPlane->direction();
539     gp_Dir aDir = aDirection->impl<gp_Dir>();
540     if (myViewInverted->isChecked())
541       aDir.Reverse();
542     myWorkshop->viewer()->setViewProjection(aDir.X(), aDir.Y(), aDir.Z(), 0.);
543     PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
544     if (aModule)
545       aModule->onViewTransformed();
546   }
547 }