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