Salome HOME
Issue 0019818: EDF 703 SMESH VISU : Display Mesh Groups names in viewer (as a caption)
[modules/smesh.git] / src / OBJECT / SMESH_Actor.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SMESH OBJECT : interactive object for SMESH visualization
23 //  File   : SMESH_Actor.cxx
24 //  Author : Nicolas REJNERI
25 //  Module : SMESH
26
27
28 #include "SMESH_ActorDef.h"
29 #include "SMESH_ActorUtils.h"
30 #include "SMESH_DeviceActor.h"
31 #include "SMESH_ObjectDef.h"
32 #include "SMESH_ControlsDef.hxx"
33 #include "VTKViewer_ExtractUnstructuredGrid.h"
34 #include "VTKViewer_FramedTextActor.h"
35 #include "SALOME_InteractiveObject.hxx"
36
37 #include "SUIT_Session.h"
38 #include "SUIT_ResourceMgr.h"
39
40 #include <vtkProperty.h>
41 #include <vtkTimeStamp.h>
42 #include <vtkObjectFactory.h>
43 #include <vtkShrinkPolyData.h>
44 #include <vtkMergeFilter.h>
45
46 #include <vtkMatrix4x4.h>
47 #include <vtkUnstructuredGrid.h>
48 #include <vtkPointData.h>
49 #include <vtkCellData.h>
50
51 #include <vtkMapper.h>
52 #include <vtkRenderer.h>
53
54 #include <vtkCell.h>
55 #include <vtkIdList.h>
56 #include <vtkIntArray.h>
57
58 #include <vtkActor2D.h>
59 #include <vtkProperty2D.h>
60 #include <vtkPolyData.h>
61 #include <vtkMaskPoints.h>
62 #include <vtkCellCenters.h>
63 #include <vtkTextProperty.h>
64 #include <vtkLabeledDataMapper.h>
65 #include <vtkSelectVisiblePoints.h>
66
67 #include <vtkScalarBarActor.h>
68 #include <vtkLookupTable.h>
69
70 #include <vtkMath.h>
71 #include <vtkPlane.h>
72 #include <vtkImplicitBoolean.h>
73 #include <vtkImplicitFunctionCollection.h>
74
75 #include "utilities.h"
76
77 #ifdef _DEBUG_
78 static int MYDEBUG = 1;
79 #else
80 static int MYDEBUG = 0;
81 #endif
82
83 static int aLineWidthInc = 2;
84 static int aPointSizeInc = 2;
85
86
87 SMESH_ActorDef* SMESH_ActorDef::New(){
88   return new SMESH_ActorDef();
89 }
90
91
92 SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj, 
93                               const char* theEntry, 
94                               const char* theName,
95                               int theIsClear)
96 {
97   SMESH_ActorDef* anActor = SMESH_ActorDef::New();
98   if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
99     anActor->Delete();
100     anActor = NULL;
101   }
102   if( anActor )
103     anActor->UpdateScalarBar();
104   return anActor;
105 }
106
107
108 SMESH_ActorDef::SMESH_ActorDef()
109 {
110   if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
111
112   myTimeStamp = vtkTimeStamp::New();
113
114   myIsPointsVisible = false;
115
116   myIsShrinkable = false;
117   myIsShrunk = false;
118
119   myIsFacesOriented = false;
120
121   myControlsPrecision = -1;
122   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
123   
124   if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
125     myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
126
127   vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
128   vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
129
130   vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
131   VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
132
133   //Definition 2D and 3D divices of the actor
134   //-----------------------------------------
135   vtkFloatingPointType anRGB[3] = {1,1,1};
136   mySurfaceProp = vtkProperty::New();
137   SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
138   mySurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
139
140   myBackSurfaceProp = vtkProperty::New();
141   SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
142   myBackSurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
143
144   my2DActor = SMESH_DeviceActor::New();
145   my2DActor->SetUserMatrix(aMatrix);
146   my2DActor->PickableOff();
147   my2DActor->SetProperty(mySurfaceProp);
148   my2DActor->SetBackfaceProperty(myBackSurfaceProp);
149   my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
150   aFilter = my2DActor->GetExtractUnstructuredGrid();
151   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
152   aFilter->RegisterCellsWithType(VTK_TRIANGLE);
153   aFilter->RegisterCellsWithType(VTK_POLYGON);
154   aFilter->RegisterCellsWithType(VTK_QUAD);
155   aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
156   aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
157
158   my2DExtProp = vtkProperty::New();
159   my2DExtProp->DeepCopy(mySurfaceProp);
160   SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
161   anRGB[0] = 1 - anRGB[0];
162   anRGB[1] = 1 - anRGB[1];
163   anRGB[2] = 1 - anRGB[2];
164   my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
165
166   my2DExtActor = SMESH_DeviceActor::New();
167   my2DExtActor->SetUserMatrix(aMatrix);
168   my2DExtActor->PickableOff();
169   my2DExtActor->SetProperty(my2DExtProp);
170   my2DExtActor->SetBackfaceProperty(my2DExtProp);
171   my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
172   aFilter = my2DExtActor->GetExtractUnstructuredGrid();
173   aFilter->RegisterCellsWithType(VTK_TRIANGLE);
174   aFilter->RegisterCellsWithType(VTK_POLYGON);
175   aFilter->RegisterCellsWithType(VTK_QUAD);
176   aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
177   aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
178
179   my3DActor = SMESH_DeviceActor::New();
180   my3DActor->SetUserMatrix(aMatrix);
181   my3DActor->PickableOff();
182   my3DActor->SetProperty(mySurfaceProp);
183   my3DActor->SetBackfaceProperty(myBackSurfaceProp);
184   my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
185   aFilter = my3DActor->GetExtractUnstructuredGrid();
186   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
187   aFilter->RegisterCellsWithType(VTK_TETRA);
188   aFilter->RegisterCellsWithType(VTK_VOXEL);
189   aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
190   aFilter->RegisterCellsWithType(VTK_WEDGE);
191   aFilter->RegisterCellsWithType(VTK_PYRAMID);
192   aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
193   aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
194   aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
195   aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
196
197   //Definition 1D divice of the actor
198   //---------------------------------
199   myEdgeProp = vtkProperty::New();
200   myEdgeProp->SetAmbient(1.0);
201   myEdgeProp->SetDiffuse(0.0);
202   myEdgeProp->SetSpecular(0.0);
203   SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
204   myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
205   myEdgeProp->SetLineWidth(aLineWidth);
206
207   my1DActor = SMESH_DeviceActor::New();
208   my1DActor->SetUserMatrix(aMatrix);
209   my1DActor->PickableOff();
210   my1DActor->SetHighlited(true);
211   my1DActor->SetProperty(myEdgeProp);
212   my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
213   aFilter = my1DActor->GetExtractUnstructuredGrid();
214   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
215   aFilter->RegisterCellsWithType(VTK_LINE);
216   aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
217
218   my1DProp = vtkProperty::New();
219   my1DProp->DeepCopy(myEdgeProp);
220   my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
221   my1DProp->SetPointSize(aPointSize);
222   
223   my1DExtProp = vtkProperty::New();
224   my1DExtProp->DeepCopy(myEdgeProp);
225   anRGB[0] = 1 - anRGB[0];
226   anRGB[1] = 1 - anRGB[1];
227   anRGB[2] = 1 - anRGB[2];
228   my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
229   my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
230   my1DExtProp->SetPointSize(aPointSize + aPointSizeInc);
231
232   my1DExtActor = SMESH_DeviceActor::New();
233   my1DExtActor->SetUserMatrix(aMatrix);
234   my1DExtActor->PickableOff();
235   my1DExtActor->SetHighlited(true);
236   my1DExtActor->SetVisibility(false);
237   my1DExtActor->SetProperty(my1DExtProp);
238   my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
239   aFilter = my1DExtActor->GetExtractUnstructuredGrid();
240   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
241   aFilter->RegisterCellsWithType(VTK_LINE);
242   aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
243
244
245   //Definition 0D divice of the actor
246   //---------------------------------
247   myNodeProp = vtkProperty::New();
248   SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
249   myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
250   myNodeProp->SetPointSize(aPointSize);
251
252   myNodeActor = SMESH_DeviceActor::New();
253   myNodeActor->SetUserMatrix(aMatrix);
254   myNodeActor->SetStoreClippingMapping(true);
255   myNodeActor->PickableOff();
256   myNodeActor->SetVisibility(false);
257   myNodeActor->SetProperty(myNodeProp);
258   myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
259   aFilter = myNodeActor->GetExtractUnstructuredGrid();
260   aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
261   
262   myNodeExtProp = vtkProperty::New();
263   myNodeExtProp->DeepCopy(myNodeProp);
264   anRGB[0] = 1 - anRGB[0];
265   anRGB[1] = 1 - anRGB[1];
266   anRGB[2] = 1 - anRGB[2];
267   myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
268   myNodeExtProp->SetPointSize(aPointSize);
269
270   myNodeExtActor = SMESH_DeviceActor::New();
271   myNodeExtActor->SetUserMatrix(aMatrix);
272   myNodeExtActor->SetStoreClippingMapping(true);
273   myNodeExtActor->PickableOff();
274   myNodeExtActor->SetHighlited(true);
275   myNodeExtActor->SetVisibility(false);
276   myNodeExtActor->SetProperty(myNodeExtProp);
277   myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
278   aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
279   aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
280   aFilter->RegisterCellsWithType(VTK_VERTEX);
281
282   //Definition of Pickable and Highlitable engines
283   //----------------------------------------------
284
285   myBaseActor = SMESH_DeviceActor::New();
286   myBaseActor->SetUserMatrix(aMatrix);
287   myBaseActor->SetStoreGemetryMapping(true);
288   myBaseActor->GetProperty()->SetOpacity(0.0);
289
290   myPickableActor = myBaseActor;
291   
292   myHighlightProp = vtkProperty::New();
293   myHighlightProp->SetAmbient(1.0);
294   myHighlightProp->SetDiffuse(0.0);
295   myHighlightProp->SetSpecular(0.0);
296   SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
297   myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
298   myHighlightProp->SetPointSize(aPointSize);
299   myHighlightProp->SetRepresentation(1);
300  
301   myPreselectProp = vtkProperty::New();
302   myPreselectProp->SetAmbient(1.0);
303   myPreselectProp->SetDiffuse(0.0);
304   myPreselectProp->SetSpecular(0.0);
305   SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
306   myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
307   myPreselectProp->SetPointSize(aPointSize);
308   myPreselectProp->SetRepresentation(1);
309
310   myHighlitableActor = SMESH_DeviceActor::New();
311   myHighlitableActor->SetUserMatrix(aMatrix);
312   myHighlitableActor->PickableOff();
313   myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
314
315   myName = "";
316   myIO = NULL;
317
318   myControlMode = eNone;
319   myControlActor = my2DActor;
320
321   //Definition of myScalarBarActor
322   //------------------------------
323   myLookupTable = vtkLookupTable::New();
324   //Fix for Bug PAL5195 - SMESH764: 
325   //Controls - Aspect Ratio: incorrect colors of the best and worst values
326   myLookupTable->SetHueRange(0.667,0.0);
327
328   myScalarBarActor = vtkScalarBarActor::New();
329   myScalarBarActor->SetVisibility(false);
330   myScalarBarActor->SetLookupTable(myLookupTable);
331
332   //Fix for Bug 13314:
333   //Incorrect "Min value" in Scalar Bar in Mesh:
334   //  myScalarBarActor->SetLabelFormat("%.4g");
335   // changes was commented because of regression bug IPAL 19981
336
337   mgr = SUIT_Session::session()->resourceMgr();
338   if( !mgr )
339     return;
340
341   //Definition of points numbering pipeline
342   //---------------------------------------
343   myPointsNumDataSet = vtkUnstructuredGrid::New();
344
345   myPtsMaskPoints = vtkMaskPoints::New();
346   myPtsMaskPoints->SetInput(myPointsNumDataSet);
347   myPtsMaskPoints->SetOnRatio(1);
348
349   myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
350   myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
351   myPtsSelectVisiblePoints->SelectInvisibleOff();
352   myPtsSelectVisiblePoints->SetTolerance(0.1);
353     
354   myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
355   myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
356   myPtsLabeledDataMapper->SetLabelFormat("%g");
357   myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
358     
359   vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
360   aPtsTextProp->SetFontFamilyToTimes();
361   static int aPointsFontSize = 10;
362   aPtsTextProp->SetFontSize(aPointsFontSize);
363   aPtsTextProp->SetBold(1);
364   aPtsTextProp->SetItalic(0);
365   aPtsTextProp->SetShadow(0);
366   myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
367   aPtsTextProp->Delete();
368   
369   myEntityMode = eAllEntity;
370
371   myIsPointsLabeled = false;
372
373   myPointLabels = vtkActor2D::New();
374   myPointLabels->SetMapper(myPtsLabeledDataMapper);
375   myPointLabels->GetProperty()->SetColor(1,1,1);
376   myPointLabels->SetVisibility(myIsPointsLabeled);
377
378
379   //Definition of cells numbering pipeline
380   //---------------------------------------
381   myCellsNumDataSet = vtkUnstructuredGrid::New();
382
383   myCellCenters = vtkCellCenters::New();
384   myCellCenters->SetInput(myCellsNumDataSet);
385
386   myClsMaskPoints = vtkMaskPoints::New();
387   myClsMaskPoints->SetInput(myCellCenters->GetOutput());
388   myClsMaskPoints->SetOnRatio(1);
389     
390   myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
391   myClsSelectVisiblePoints->SetInput(myClsMaskPoints->GetOutput());
392   myClsSelectVisiblePoints->SelectInvisibleOff();
393   myClsSelectVisiblePoints->SetTolerance(0.1);
394     
395   myClsLabeledDataMapper = vtkLabeledDataMapper::New();
396   myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
397   myClsLabeledDataMapper->SetLabelFormat("%g");
398   myClsLabeledDataMapper->SetLabelModeToLabelScalars();
399     
400   vtkTextProperty* aClsTextProp = vtkTextProperty::New();
401   aClsTextProp->SetFontFamilyToTimes();
402   static int aCellsFontSize = 12;
403   aClsTextProp->SetFontSize(aCellsFontSize);
404   aClsTextProp->SetBold(1);
405   aClsTextProp->SetItalic(0);
406   aClsTextProp->SetShadow(0);
407   myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
408   aClsTextProp->Delete();
409     
410   myIsCellsLabeled = false;
411
412   myCellsLabels = vtkActor2D::New();
413   myCellsLabels->SetMapper(myClsLabeledDataMapper);
414   myCellsLabels->GetProperty()->SetColor(0,1,0);
415   myCellsLabels->SetVisibility(myIsCellsLabeled);
416
417   // Clipping planes
418   myImplicitBoolean = vtkImplicitBoolean::New();
419   myImplicitBoolean->SetOperationTypeToIntersection();
420
421   // Set color of the name actor
422   SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
423   myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
424 }
425
426
427 SMESH_ActorDef::~SMESH_ActorDef()
428 {
429   if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
430
431   myScalarBarActor->Delete();
432   myLookupTable->Delete();
433
434   mySurfaceProp->Delete();
435   myBackSurfaceProp->Delete();
436
437   myEdgeProp->Delete();
438   myHighlightProp->Delete();
439   myPreselectProp->Delete();
440
441   myNodeProp->Delete();
442   myNodeExtProp->Delete();
443  
444   my1DProp->Delete();
445   my1DActor->Delete();
446
447   my1DExtProp->Delete();
448   my1DExtActor->Delete();
449
450   my2DActor->Delete();
451   my2DExtProp->Delete();
452   my2DExtActor->Delete();
453   my3DActor->Delete();
454
455   myNodeActor->Delete();
456   myBaseActor->Delete();
457
458   myNodeExtActor->Delete();
459   
460   myHighlitableActor->Delete();
461
462   //Deleting of pints numbering pipeline
463   //---------------------------------------
464   myPointsNumDataSet->Delete();
465
466   // commented: porting to vtk 5.0
467   //  myPtsLabeledDataMapper->RemoveAllInputs();
468   myPtsLabeledDataMapper->Delete();
469
470   // commented: porting to vtk 5.0
471   //  myPtsSelectVisiblePoints->UnRegisterAllOutputs();
472   myPtsSelectVisiblePoints->Delete();
473
474   // commented: porting to vtk 5.0
475   //  myPtsMaskPoints->UnRegisterAllOutputs();
476   myPtsMaskPoints->Delete();
477
478   myPointLabels->Delete();
479
480
481   //Deleting of cells numbering pipeline
482   //---------------------------------------
483   myCellsNumDataSet->Delete();
484
485   myClsLabeledDataMapper->RemoveAllInputs();
486   myClsLabeledDataMapper->Delete();
487
488   // commented: porting to vtk 5.0
489   //  myClsSelectVisiblePoints->UnRegisterAllOutputs();
490   myClsSelectVisiblePoints->Delete();
491
492   // commented: porting to vtk 5.0
493   //  myClsMaskPoints->UnRegisterAllOutputs();
494   myClsMaskPoints->Delete();
495
496   // commented: porting to vtk 5.0
497   //  myCellCenters->UnRegisterAllOutputs();
498   myCellCenters->Delete();
499
500   myCellsLabels->Delete();
501
502   myImplicitBoolean->Delete();
503
504   myTimeStamp->Delete();
505 }
506
507
508 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
509 {
510   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
511   myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
512
513   if ( myIsPointsLabeled )
514   {
515     myPointsNumDataSet->ShallowCopy(aGrid);
516     vtkDataSet *aDataSet = myPointsNumDataSet;
517     
518     int aNbElem = aDataSet->GetNumberOfPoints();
519     
520     vtkIntArray *anArray = vtkIntArray::New();
521     anArray->SetNumberOfValues( aNbElem );
522     
523     for ( int anId = 0; anId < aNbElem; anId++ )
524     {
525       int aSMDSId = myVisualObj->GetNodeObjId( anId );
526       anArray->SetValue( anId, aSMDSId );
527     }
528     
529     aDataSet->GetPointData()->SetScalars( anArray );
530     anArray->Delete();
531     myPtsMaskPoints->SetInput( aDataSet );
532     myPointLabels->SetVisibility( GetVisibility() );
533   }
534   else
535   {
536     myPointLabels->SetVisibility( false );
537   }
538   SetRepresentation(GetRepresentation());
539   myTimeStamp->Modified();
540 }
541
542
543 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
544 {
545   vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
546   myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
547   if(myIsCellsLabeled){
548     myCellsNumDataSet->ShallowCopy(aGrid);
549     vtkDataSet *aDataSet = myCellsNumDataSet;
550     int aNbElem = aDataSet->GetNumberOfCells();
551     vtkIntArray *anArray = vtkIntArray::New();
552     anArray->SetNumberOfValues(aNbElem);
553     for(int anId = 0; anId < aNbElem; anId++){
554       int aSMDSId = myVisualObj->GetElemObjId(anId);
555       anArray->SetValue(anId,aSMDSId);
556     }
557     aDataSet->GetCellData()->SetScalars(anArray);
558     myCellCenters->SetInput(aDataSet);
559     myCellsLabels->SetVisibility(GetVisibility());
560   }else{
561     myCellsLabels->SetVisibility(false);
562   }
563   myTimeStamp->Modified();
564 }
565
566
567 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
568 {
569   myIsFacesOriented = theIsFacesOriented;
570
571   my2DActor->SetFacesOriented(theIsFacesOriented);
572   my3DActor->SetFacesOriented(theIsFacesOriented);
573
574   myTimeStamp->Modified();
575 }
576
577 bool SMESH_ActorDef::GetFacesOriented()
578 {
579   return myIsFacesOriented;
580 }
581
582
583 void 
584 SMESH_ActorDef::
585 SetControlMode(eControl theMode)
586 {
587   SetControlMode(theMode,true);
588 }
589
590
591 void 
592 SMESH_ActorDef::
593 SetControlMode(eControl theMode,
594                bool theCheckEntityMode)
595 {
596   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();  
597   if( !mgr )
598     return;
599
600   myControlMode = eNone;
601   theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
602
603   my1DActor->GetMapper()->SetScalarVisibility(false);
604   my2DActor->GetMapper()->SetScalarVisibility(false);
605   my3DActor->GetMapper()->SetScalarVisibility(false);
606   myScalarBarActor->SetVisibility(false);
607
608   bool anIsScalarVisible = theMode > eNone;
609
610   if(anIsScalarVisible){
611     SMESH::Controls::FunctorPtr aFunctor;
612     switch(theMode){
613     case eLength:
614     {
615       SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
616       aControl->SetPrecision( myControlsPrecision );
617       aFunctor.reset( aControl );
618       myControlActor = my1DActor;
619       break;
620     }
621     case eLength2D:
622     {
623       aFunctor.reset(new SMESH::Controls::Length2D());
624       myControlActor = my2DActor;
625       break;
626     }
627     case eFreeBorders:
628       aFunctor.reset(new SMESH::Controls::FreeBorders());
629       myControlActor = my1DActor;
630       break;
631     case eFreeEdges:
632       aFunctor.reset(new SMESH::Controls::FreeEdges());
633       myControlActor = my2DActor;
634       break;
635     case eFreeNodes:
636       aFunctor.reset(new SMESH::Controls::FreeNodes());
637       myControlActor = myNodeActor;
638       break;
639     case eFreeFaces:
640       aFunctor.reset(new SMESH::Controls::FreeFaces());
641       myControlActor = my2DActor;
642       break;
643     case eMultiConnection:
644       aFunctor.reset(new SMESH::Controls::MultiConnection());
645       myControlActor = my1DActor;
646       break;
647     case eMultiConnection2D:
648       aFunctor.reset(new SMESH::Controls::MultiConnection2D());
649       myControlActor = my2DActor;
650       break;
651     case eArea:
652     {
653       SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
654       aControl->SetPrecision( myControlsPrecision );
655       aFunctor.reset( aControl );
656       myControlActor = my2DActor;
657       break;
658     }
659     case eTaper:
660     {
661       SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
662       aControl->SetPrecision( myControlsPrecision );
663       aFunctor.reset( aControl );
664       myControlActor = my2DActor;
665       break;
666     }
667     case eAspectRatio:
668     {
669       SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
670       aControl->SetPrecision( myControlsPrecision );
671       aFunctor.reset( aControl );
672       myControlActor = my2DActor;
673       break;
674     }
675     case eAspectRatio3D:
676     {
677       SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
678       aControl->SetPrecision( myControlsPrecision );
679       aFunctor.reset( aControl );
680       myControlActor = my3DActor;
681       break;
682     }
683     case eVolume3D:
684     {
685       SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
686       aControl->SetPrecision( myControlsPrecision );
687       aFunctor.reset( aControl );
688       myControlActor = my3DActor;
689       break;
690     }
691     case eMinimumAngle:
692     {
693       SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
694       aControl->SetPrecision( myControlsPrecision );
695       aFunctor.reset( aControl );
696       myControlActor = my2DActor;
697       break;
698     }
699     case eWarping:
700     {
701       SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
702       aControl->SetPrecision( myControlsPrecision );
703       aFunctor.reset( aControl );
704       myControlActor = my2DActor;
705       break;
706     }
707     case eSkew:
708     {
709       SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
710       aControl->SetPrecision( myControlsPrecision );
711       aFunctor.reset( aControl );
712       myControlActor = my2DActor;
713       break;
714     }
715     default:
716       return;
717     }
718
719     vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
720     vtkIdType aNbCells = aGrid->GetNumberOfCells();
721     if(aNbCells){
722       myControlMode = theMode;
723       switch(myControlMode){
724       case eFreeNodes:
725         myNodeExtActor->SetExtControlMode(aFunctor);
726         break;
727       case eFreeEdges:
728       case eFreeBorders:
729         my1DExtActor->SetExtControlMode(aFunctor);
730         break;
731       case eFreeFaces:
732         my2DExtActor->SetExtControlMode(aFunctor);
733         break;
734       case eLength2D:
735       case eMultiConnection2D:
736         my1DExtActor->SetExtControlMode(aFunctor,myScalarBarActor,myLookupTable);
737         break;
738       default:
739         myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
740       }
741     }
742
743     if(theCheckEntityMode){
744       if(myControlActor == my1DActor)
745         SetEntityMode(eEdges);
746       else if(myControlActor == my2DActor){
747         switch(myControlMode){
748         case eLength2D:
749         case eFreeEdges:
750         case eFreeFaces:
751         case eMultiConnection2D:
752           //SetEntityMode(eEdges);
753           SetEntityMode(eFaces);
754           break;
755         default:
756           SetEntityMode(eFaces);
757         }
758       }else if(myControlActor == my3DActor)
759         SetEntityMode(eVolumes);
760     }
761
762   }else if(theCheckEntityMode){
763     myEntityMode = eAllEntity;
764   }
765
766   SetRepresentation(GetRepresentation());
767
768   myTimeStamp->Modified();
769   Modified();
770 }
771
772
773 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
774   SALOME_Actor::AddToRender(theRenderer);
775
776   theRenderer->AddActor(myNodeActor);
777   theRenderer->AddActor(myBaseActor);
778   
779   theRenderer->AddActor(myNodeExtActor);
780
781   my3DActor->AddToRender(theRenderer);
782   my2DActor->AddToRender(theRenderer);
783   my2DExtActor->AddToRender(theRenderer);
784
785   theRenderer->AddActor(my1DActor);
786   theRenderer->AddActor(my1DExtActor);
787
788   theRenderer->AddActor(myHighlitableActor);
789   
790   theRenderer->AddActor2D(myScalarBarActor);
791
792   myPtsSelectVisiblePoints->SetRenderer(theRenderer);
793   myClsSelectVisiblePoints->SetRenderer(theRenderer);
794
795   theRenderer->AddActor2D(myPointLabels);
796   theRenderer->AddActor2D(myCellsLabels);
797 }
798
799 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
800   SALOME_Actor::RemoveFromRender(theRenderer);
801
802   theRenderer->RemoveActor(myNodeActor);
803   theRenderer->RemoveActor(myBaseActor);
804
805   theRenderer->RemoveActor(myNodeExtActor);
806
807   theRenderer->RemoveActor(myHighlitableActor);
808
809   theRenderer->RemoveActor(my1DActor);
810   theRenderer->RemoveActor(my1DExtActor);
811
812   my2DActor->RemoveFromRender(theRenderer);
813   my2DExtActor->RemoveFromRender(theRenderer);
814   my3DActor->RemoveFromRender(theRenderer);
815
816   theRenderer->RemoveActor(myScalarBarActor);
817   theRenderer->RemoveActor(myPointLabels);
818   theRenderer->RemoveActor(myCellsLabels);
819 }
820
821
822 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, 
823                           const char* theEntry, 
824                           const char* theName,
825                           int theIsClear)
826 {
827   Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
828   setIO(anIO);
829   setName(theName);
830
831   myVisualObj = theVisualObj;
832   myVisualObj->Update(theIsClear);
833
834   myNodeActor->Init(myVisualObj,myImplicitBoolean);
835   myBaseActor->Init(myVisualObj,myImplicitBoolean);
836
837   myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
838
839   myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
840   
841   my1DActor->Init(myVisualObj,myImplicitBoolean);
842   my1DExtActor->Init(myVisualObj,myImplicitBoolean);
843   
844   my2DActor->Init(myVisualObj,myImplicitBoolean);
845   my2DExtActor->Init(myVisualObj,myImplicitBoolean);
846   my3DActor->Init(myVisualObj,myImplicitBoolean);
847   
848   my1DActor->GetMapper()->SetLookupTable(myLookupTable);
849   my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
850
851   my2DActor->GetMapper()->SetLookupTable(myLookupTable);
852   my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
853   my3DActor->GetMapper()->SetLookupTable(myLookupTable);
854     
855   vtkFloatingPointType aFactor, aUnits;
856   my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
857   my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
858   my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
859
860   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
861   if( !mgr )
862     return false;
863
864   //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
865   SetIsShrunkable(true);
866
867   SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
868
869   int aMode = mgr->integerValue( "SMESH", "display_mode" );
870   SetRepresentation(-1);
871   
872   if(aMode == 0){
873     SetRepresentation(eEdge);
874   }else if(aMode == 1){
875     SetRepresentation(eSurface);
876   }else if(aMode == 2){
877     SetRepresentation(ePoint);
878   }
879   
880   if(aMode == 3){
881     SetShrink();
882   }
883
884   if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
885     SetIsDisplayNameActor( true );
886
887   myTimeStamp->Modified();
888   Modified();
889   return true;
890 }
891
892
893 vtkFloatingPointType* SMESH_ActorDef::GetBounds(){
894   return myNodeActor->GetBounds();
895 }
896
897
898 vtkDataSet* SMESH_ActorDef::GetInput(){
899   return GetUnstructuredGrid();
900 }
901
902
903 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
904   Superclass::SetTransform(theTransform);
905
906   myNodeActor->SetTransform(theTransform);
907   myBaseActor->SetTransform(theTransform);
908   
909   myHighlitableActor->SetTransform(theTransform);
910
911   myNodeExtActor->SetTransform(theTransform);
912
913   my1DActor->SetTransform(theTransform);
914   my1DExtActor->SetTransform(theTransform);
915
916   my2DActor->SetTransform(theTransform);
917   my2DExtActor->SetTransform(theTransform);
918   my3DActor->SetTransform(theTransform);
919
920   Modified();
921 }
922
923
924 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
925   vtkLODActor::SetMapper(theMapper);
926 }
927
928
929 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
930   SALOME_Actor::ShallowCopy(prop);
931 }
932
933
934 vtkMapper* SMESH_ActorDef::GetMapper(){
935   return myPickableActor->GetMapper();
936 }
937
938
939 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){ 
940   return myVisualObj->GetUnstructuredGrid();
941 }
942
943
944 bool SMESH_ActorDef::IsInfinitive(){
945   vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
946   aDataSet->Update();
947   myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
948     aDataSet->GetNumberOfCells() == 1 && 
949     aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX;
950   return SALOME_Actor::IsInfinitive();
951 }
952
953
954 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
955   if ( myIsShrinkable == theShrunkable )
956     return;
957   myIsShrinkable = theShrunkable;
958   Modified();
959 }
960
961 vtkFloatingPointType SMESH_ActorDef::GetShrinkFactor(){
962   return myBaseActor->GetShrinkFactor();
963 }
964
965 void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
966   myBaseActor->SetShrinkFactor(theValue);
967
968   my1DActor->SetShrinkFactor(theValue);
969   my1DExtActor->SetShrinkFactor(theValue);
970
971   my2DActor->SetShrinkFactor(theValue);
972   my2DExtActor->SetShrinkFactor(theValue);
973   my3DActor->SetShrinkFactor(theValue);
974
975   Modified();
976 }
977
978 void SMESH_ActorDef::SetShrink(){
979   if(!myIsShrinkable) return;
980
981   myBaseActor->SetShrink();
982
983   my1DActor->SetShrink();
984   my1DExtActor->SetShrink();
985
986   my2DActor->SetShrink();
987   my2DExtActor->SetShrink();
988   my3DActor->SetShrink();
989
990   myIsShrunk = true;
991   Modified();
992 }
993
994 void SMESH_ActorDef::UnShrink(){
995   if(!myIsShrunk) return;
996
997   myBaseActor->UnShrink();
998
999   my1DActor->UnShrink();
1000   my1DExtActor->UnShrink();
1001
1002   my2DActor->UnShrink();
1003   my2DExtActor->UnShrink();
1004   my3DActor->UnShrink();
1005
1006   myIsShrunk = false;
1007   Modified();
1008 }
1009
1010
1011 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1012   return myPickableActor->GetNodeObjId(theVtkID);
1013 }
1014
1015 vtkFloatingPointType* SMESH_ActorDef::GetNodeCoord(int theObjID){
1016   return myPickableActor->GetNodeCoord(theObjID);
1017 }
1018
1019
1020 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1021   return myPickableActor->GetElemObjId(theVtkID);
1022 }
1023
1024 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1025   return myPickableActor->GetElemCell(theObjID);
1026 }
1027
1028
1029 void SMESH_ActorDef::SetVisibility(int theMode){
1030   SetVisibility(theMode,true);
1031 }
1032
1033
1034 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1035   SALOME_Actor::SetVisibility(theMode);
1036
1037   myNodeActor->VisibilityOff();
1038   myBaseActor->VisibilityOff();
1039   
1040   myNodeExtActor->VisibilityOff();
1041
1042   my1DActor->VisibilityOff();
1043   my1DExtActor->VisibilityOff();
1044   
1045   my2DActor->VisibilityOff();
1046   my2DExtActor->VisibilityOff();
1047   my3DActor->VisibilityOff();
1048   
1049   myScalarBarActor->VisibilityOff();
1050   myPointLabels->VisibilityOff();
1051   myCellsLabels->VisibilityOff();
1052   
1053   if(GetVisibility()){
1054     if(theIsUpdateRepersentation)
1055       SetRepresentation(GetRepresentation());
1056     
1057     if(myControlMode != eNone){
1058       switch(myControlMode){
1059       case eFreeNodes:
1060         myNodeExtActor->VisibilityOn();
1061         break;
1062       case eFreeEdges:
1063       case eFreeBorders:
1064         my1DExtActor->VisibilityOn();
1065         break;
1066       case eFreeFaces:
1067         my2DExtActor->VisibilityOn();
1068         break;
1069       case eLength2D:
1070       case eMultiConnection2D:
1071         my1DExtActor->VisibilityOn();
1072       default:
1073         if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1074           myScalarBarActor->VisibilityOn();
1075       }
1076     }
1077
1078     if(myRepresentation != ePoint)
1079       myPickableActor->VisibilityOn();
1080     else {
1081       myNodeActor->VisibilityOn();
1082     }
1083
1084     if(myEntityMode & eEdges){
1085       my1DActor->VisibilityOn();
1086     }
1087     
1088     if(myEntityMode & eFaces){
1089       my2DActor->VisibilityOn();
1090     }
1091     
1092     if(myEntityMode & eVolumes){
1093       my3DActor->VisibilityOn();
1094     }
1095     
1096     if(myIsPointsLabeled){ 
1097       myPointLabels->VisibilityOn();
1098       myNodeActor->VisibilityOn();
1099     }
1100
1101     if(myIsCellsLabeled) 
1102       myCellsLabels->VisibilityOn();
1103   }
1104   UpdateHighlight();
1105   Modified();
1106 }
1107
1108
1109 void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
1110   myEntityState = eAllEntity;
1111
1112   if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)){
1113     myEntityState &= ~eEdges;
1114     theMode &= ~eEdges;
1115   }
1116
1117   if(!myVisualObj->GetNbEntities(SMDSAbs_Face)){
1118     myEntityState &= ~eFaces;
1119     theMode &= ~eFaces;
1120   }
1121
1122   if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)){
1123     myEntityState &= ~eVolumes;
1124     theMode &= ~eVolumes;
1125   }
1126
1127   if(!theMode){
1128     if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1129       theMode |= eEdges;
1130
1131     if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1132       theMode |= eFaces;
1133
1134     if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1135       theMode |= eVolumes;
1136   }
1137
1138   myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1139
1140   myEntityMode = theMode;
1141   VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1142   aFilter = myBaseActor->GetExtractUnstructuredGrid();
1143   aFilter->ClearRegisteredCellsWithType();
1144   aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1145   
1146   if(myEntityMode & eEdges){
1147     if (MYDEBUG) MESSAGE("EDGES");
1148     aFilter->RegisterCellsWithType(VTK_LINE);
1149     aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1150   }
1151
1152   if(myEntityMode & eFaces){
1153     if (MYDEBUG) MESSAGE("FACES");
1154     aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1155     aFilter->RegisterCellsWithType(VTK_POLYGON);
1156     aFilter->RegisterCellsWithType(VTK_QUAD);
1157     aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1158     aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1159   }
1160
1161   if(myEntityMode & eVolumes){
1162     if (MYDEBUG) MESSAGE("VOLUMES");
1163     aFilter->RegisterCellsWithType(VTK_TETRA);
1164     aFilter->RegisterCellsWithType(VTK_VOXEL);
1165     aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1166     aFilter->RegisterCellsWithType(VTK_WEDGE);
1167     aFilter->RegisterCellsWithType(VTK_PYRAMID);
1168     aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1169     aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1170     aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1171     aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1172   }
1173   aFilter->Update();
1174   if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1175   SetVisibility(GetVisibility(),false);
1176 }
1177
1178 void SMESH_ActorDef::SetRepresentation(int theMode){ 
1179   int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1180   int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1181   int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1182   if(theMode < 0){
1183     myRepresentation = eSurface;
1184     if(!aNbFaces && !aNbVolumes && aNbEdges){
1185       myRepresentation = eEdge;
1186     }else if(!aNbFaces && !aNbVolumes && !aNbEdges){
1187       myRepresentation = ePoint;
1188     }
1189   }else{
1190     switch(theMode){
1191     case eEdge:
1192       if(!aNbFaces && !aNbVolumes && !aNbEdges) return;
1193       break;
1194     case eSurface:
1195       if(!aNbFaces && !aNbVolumes) return;
1196       break;
1197     }    
1198     myRepresentation = theMode;
1199   }
1200
1201   if(!GetUnstructuredGrid()->GetNumberOfCells())
1202     myRepresentation = ePoint;
1203
1204   if(myIsShrunk){
1205     if(myRepresentation == ePoint){
1206       UnShrink();
1207       myIsShrunk = true;
1208     }else{
1209       SetShrink();
1210     }      
1211   }
1212
1213   myPickableActor = myBaseActor;
1214   myNodeActor->SetVisibility(false);
1215   myNodeExtActor->SetVisibility(false);
1216   vtkProperty *aProp = NULL, *aBackProp = NULL;
1217   SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1218   switch(myRepresentation){
1219   case ePoint:
1220     myPickableActor = myNodeActor;
1221     myNodeActor->SetVisibility(true);
1222     
1223     aProp = aBackProp = myNodeProp;
1224     aReperesent = SMESH_DeviceActor::ePoint;
1225     break;
1226   case eEdge:
1227     aProp = aBackProp = myEdgeProp;
1228     aReperesent = SMESH_DeviceActor::eInsideframe;
1229     break;
1230   case eSurface:
1231     aProp = mySurfaceProp;
1232     aBackProp = myBackSurfaceProp;
1233     aReperesent = SMESH_DeviceActor::eSurface;
1234     break;
1235   }    
1236
1237   my2DActor->SetProperty(aProp);
1238   my2DActor->SetBackfaceProperty(aBackProp);
1239   my2DActor->SetRepresentation(aReperesent);
1240
1241   my2DExtActor->SetRepresentation(aReperesent);
1242   
1243   my3DActor->SetProperty(aProp);
1244   my3DActor->SetBackfaceProperty(aBackProp);
1245   my3DActor->SetRepresentation(aReperesent);
1246
1247   my1DExtActor->SetVisibility(false);
1248   my2DExtActor->SetVisibility(false);
1249
1250   switch(myControlMode){
1251   case eLength:
1252   case eMultiConnection:
1253     aProp = aBackProp = my1DProp;
1254     if(myRepresentation != ePoint)
1255       aReperesent = SMESH_DeviceActor::eInsideframe;
1256     break;
1257   }
1258   
1259   my1DActor->SetProperty(aProp);
1260   my1DActor->SetBackfaceProperty(aBackProp);
1261   my1DActor->SetRepresentation(aReperesent);
1262
1263   my1DExtActor->SetRepresentation(aReperesent);
1264   
1265   if(myIsPointsVisible)
1266     myPickableActor = myNodeActor;
1267   if(GetPointRepresentation())
1268     myNodeActor->SetVisibility(true);
1269
1270   SetMapper(myPickableActor->GetMapper());
1271
1272   SetVisibility(GetVisibility(),false);
1273
1274   Modified();
1275 }
1276
1277
1278 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1279   if ( myIsPointsVisible == theIsPointsVisible )
1280     return;
1281   myIsPointsVisible = theIsPointsVisible;
1282   SetRepresentation(GetRepresentation());
1283 }
1284
1285 bool SMESH_ActorDef::GetPointRepresentation(){ 
1286   return myIsPointsVisible || myIsPointsLabeled;
1287 }
1288
1289
1290 void SMESH_ActorDef::UpdateHighlight(){
1291   myHighlitableActor->SetVisibility(false);
1292   myHighlitableActor->SetHighlited(false);
1293
1294   if(myIsHighlighted){
1295     myHighlitableActor->SetProperty(myHighlightProp);
1296   }else if(myIsPreselected){
1297     myHighlitableActor->SetProperty(myPreselectProp);
1298   }
1299
1300   bool anIsVisible = GetVisibility();
1301
1302   if(myIsHighlighted || myIsPreselected){
1303     if(GetUnstructuredGrid()->GetNumberOfCells()){
1304       myHighlitableActor->SetHighlited(anIsVisible);
1305       myHighlitableActor->SetVisibility(anIsVisible);
1306       myHighlitableActor->GetExtractUnstructuredGrid()->
1307         SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1308       myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1309     }else if(myRepresentation == ePoint || GetPointRepresentation()){
1310       myHighlitableActor->SetHighlited(anIsVisible);
1311       myHighlitableActor->GetExtractUnstructuredGrid()->
1312         SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1313       myHighlitableActor->SetVisibility(anIsVisible);
1314       myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1315     }
1316   }
1317 }
1318
1319
1320 void SMESH_ActorDef::highlight(bool theHighlight){
1321   if ( myIsHighlighted == theHighlight )
1322     return;
1323   myIsHighlighted = theHighlight;
1324   UpdateHighlight();
1325 }
1326
1327
1328 void SMESH_ActorDef::SetPreSelected(bool thePreselect){ 
1329   if ( myIsPreselected == thePreselect )
1330     return;
1331   myIsPreselected = thePreselect; 
1332   UpdateHighlight();
1333 }
1334
1335
1336 // From vtkFollower
1337 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1338 {
1339   if (myPickableActor->GetIsOpaque())
1340     {
1341     vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1342     this->Render(ren);
1343     return 1;
1344     }
1345   return 0;
1346 }
1347
1348
1349 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1350 {
1351   if (!myPickableActor->GetIsOpaque())
1352     {
1353     vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1354     this->Render(ren);
1355     return 1;
1356     }
1357   return 0;
1358 }
1359
1360
1361 void SMESH_ActorDef::Render(vtkRenderer *ren){
1362   unsigned long aTime = myTimeStamp->GetMTime();
1363   unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1364   unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1365   if(anObjTime > aTime || aClippingTime > aTime)
1366     Update();
1367 }
1368
1369
1370 void SMESH_ActorDef::Update(){
1371   if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1372
1373   if(GetControlMode() != eNone) {
1374     unsigned long aTime = myTimeStamp->GetMTime();
1375     unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1376     if (anObjTime > aTime)
1377       SetControlMode(GetControlMode(),false);
1378   }
1379   if(myIsPointsLabeled){
1380     SetPointsLabeled(myIsPointsLabeled);
1381   }
1382   if(myIsCellsLabeled){
1383     SetCellsLabeled(myIsCellsLabeled);
1384   }
1385   if(myIsFacesOriented){
1386     SetFacesOriented(myIsFacesOriented);
1387   }
1388   SetEntityMode(GetEntityMode());
1389   SetVisibility(GetVisibility());
1390   
1391   myTimeStamp->Modified();
1392   Modified();
1393 }
1394
1395
1396 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1397   SALOME_Actor::ReleaseGraphicsResources(renWin);
1398
1399   myPickableActor->ReleaseGraphicsResources(renWin);
1400 }
1401
1402
1403 static void GetColor(vtkProperty *theProperty, vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1404   vtkFloatingPointType* aColor = theProperty->GetColor();
1405   r = aColor[0];
1406   g = aColor[1];
1407   b = aColor[2];
1408 }
1409
1410
1411 void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
1412   mySurfaceProp->SetOpacity(theValue);
1413   myBackSurfaceProp->SetOpacity(theValue);
1414   myEdgeProp->SetOpacity(theValue);
1415   myNodeProp->SetOpacity(theValue);
1416
1417   my1DProp->SetOpacity(theValue);
1418 }
1419
1420
1421 vtkFloatingPointType SMESH_ActorDef::GetOpacity(){
1422   return mySurfaceProp->GetOpacity();
1423 }
1424
1425
1426 void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1427   mySurfaceProp->SetColor(r,g,b);
1428   myNameActor->SetBackgroundColor(r,g,b);
1429   Modified();
1430 }
1431
1432 void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1433   ::GetColor(mySurfaceProp,r,g,b);
1434   my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1435 }
1436
1437 void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1438   myBackSurfaceProp->SetColor(r,g,b);
1439   Modified();
1440 }
1441
1442 void SMESH_ActorDef::GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1443   ::GetColor(myBackSurfaceProp,r,g,b);
1444 }
1445
1446 void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1447   myEdgeProp->SetColor(r,g,b);
1448   my1DProp->SetColor(r,g,b);
1449   my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1450   Modified();
1451 }
1452
1453 void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1454   ::GetColor(myEdgeProp,r,g,b);
1455 }
1456
1457 void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
1458   myNodeProp->SetColor(r,g,b);
1459   myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1460   Modified();
1461 }
1462
1463 void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
1464   ::GetColor(myNodeProp,r,g,b);
1465 }
1466
1467 void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
1468   myHighlightProp->SetColor(r,g,b);
1469   Modified();
1470 }
1471
1472 void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
1473   ::GetColor(myHighlightProp,r,g,b);
1474 }
1475
1476 void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ 
1477   myPreselectProp->SetColor(r,g,b);
1478   Modified();
1479 }
1480
1481 void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){ 
1482   ::GetColor(myPreselectProp,r,g,b);
1483 }
1484
1485
1486 vtkFloatingPointType SMESH_ActorDef::GetLineWidth(){
1487   return myEdgeProp->GetLineWidth();
1488 }
1489
1490
1491 void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
1492   myEdgeProp->SetLineWidth(theVal);
1493
1494   my1DProp->SetLineWidth(theVal + aLineWidthInc);
1495   my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
1496
1497   Modified();
1498 }
1499
1500
1501 void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){
1502   myNodeProp->SetPointSize(theVal);
1503   myNodeExtProp->SetPointSize(theVal);
1504   myHighlightProp->SetPointSize(theVal);
1505   myPreselectProp->SetPointSize(theVal);
1506
1507   my1DProp->SetPointSize(theVal + aPointSizeInc);
1508   my1DExtProp->SetPointSize(theVal + aPointSizeInc);
1509
1510   Modified();
1511 }
1512
1513 vtkFloatingPointType SMESH_ActorDef::GetNodeSize(){
1514   return myNodeProp->GetPointSize();
1515 }
1516
1517 int SMESH_ActorDef::GetObjDimension( const int theObjId )
1518 {
1519   return myVisualObj->GetElemDimension( theObjId );
1520 }
1521
1522 bool
1523 SMESH_ActorDef::
1524 IsImplicitFunctionUsed() const
1525 {
1526   return myBaseActor->IsImplicitFunctionUsed();
1527 }
1528
1529 void
1530 SMESH_ActorDef::
1531 SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
1532 {
1533   myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1534   myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1535   
1536   myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1537
1538   myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1539   
1540   my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1541   my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1542   
1543   my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1544   my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1545   my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1546 }
1547
1548 vtkIdType 
1549 SMESH_ActorDef::
1550 AddClippingPlane(vtkPlane* thePlane)
1551 {
1552   if(thePlane){
1553     myImplicitBoolean->GetFunction()->AddItem(thePlane);
1554     myCippingPlaneCont.push_back(thePlane);
1555     if(!IsImplicitFunctionUsed())
1556       SetImplicitFunctionUsed(true);
1557   }
1558   return myCippingPlaneCont.size();
1559 }
1560
1561 void
1562 SMESH_ActorDef::
1563 RemoveAllClippingPlanes()
1564 {
1565   myImplicitBoolean->GetFunction()->RemoveAllItems();
1566   myImplicitBoolean->GetFunction()->Modified(); // VTK bug
1567   myCippingPlaneCont.clear();
1568   SetImplicitFunctionUsed(false);
1569 }
1570
1571 vtkIdType
1572 SMESH_ActorDef::
1573 GetNumberOfClippingPlanes()
1574 {
1575   return myCippingPlaneCont.size();
1576 }
1577
1578 vtkPlane* 
1579 SMESH_ActorDef::
1580 GetClippingPlane(vtkIdType theID)
1581 {
1582   if(theID >= myCippingPlaneCont.size())
1583     return NULL;
1584   return myCippingPlaneCont[theID].Get();
1585 }
1586
1587
1588 static void ComputeBoundsParam(vtkDataSet* theDataSet,
1589                                vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3],
1590                                vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj)
1591 {
1592   vtkFloatingPointType aBounds[6];
1593   theDataSet->GetBounds(aBounds);
1594
1595   //Enlarge bounds in order to avoid conflicts of precision
1596   for(int i = 0; i < 6; i += 2){
1597     static double EPS = 1.0E-3;
1598     vtkFloatingPointType aDelta = (aBounds[i+1] - aBounds[i])*EPS;
1599     aBounds[i] -= aDelta;
1600     aBounds[i+1] += aDelta;
1601   }
1602
1603   vtkFloatingPointType aBoundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]},
1604                                {aBounds[1],aBounds[2],aBounds[4]},
1605                                {aBounds[0],aBounds[3],aBounds[4]},
1606                                {aBounds[1],aBounds[3],aBounds[4]},
1607                                {aBounds[0],aBounds[2],aBounds[5]},
1608                                {aBounds[1],aBounds[2],aBounds[5]}, 
1609                                {aBounds[0],aBounds[3],aBounds[5]}, 
1610                                {aBounds[1],aBounds[3],aBounds[5]}};
1611
1612   int aMaxId = 0, aMinId = aMaxId;
1613   theMaxBoundPrj = vtkMath::Dot(theDirection,aBoundPoints[aMaxId]);
1614   theMinBoundPrj = theMaxBoundPrj;
1615   for(int i = 1; i < 8; i++){
1616     vtkFloatingPointType aTmp = vtkMath::Dot(theDirection,aBoundPoints[i]);
1617     if(theMaxBoundPrj < aTmp){
1618       theMaxBoundPrj = aTmp;
1619       aMaxId = i;
1620     }
1621     if(theMinBoundPrj > aTmp){
1622       theMinBoundPrj = aTmp;
1623       aMinId = i;
1624     }
1625   }
1626   vtkFloatingPointType *aMinPnt = aBoundPoints[aMaxId];
1627   theMinPnt[0] = aMinPnt[0];
1628   theMinPnt[1] = aMinPnt[1];
1629   theMinPnt[2] = aMinPnt[2];
1630 }
1631
1632
1633 static void DistanceToPosition(vtkDataSet* theDataSet,
1634                                vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3])
1635 {
1636   vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
1637   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
1638   vtkFloatingPointType aLength = (aMaxBoundPrj-aMinBoundPrj)*theDist;
1639   thePos[0] = aMinPnt[0]-theDirection[0]*aLength;
1640   thePos[1] = aMinPnt[1]-theDirection[1]*aLength;
1641   thePos[2] = aMinPnt[2]-theDirection[2]*aLength;
1642 }
1643
1644
1645 static void PositionToDistance(vtkDataSet* theDataSet, 
1646                                vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist)
1647 {
1648   vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3];
1649   ComputeBoundsParam(theDataSet,theDirection,aMinPnt,aMaxBoundPrj,aMinBoundPrj);
1650   vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos);
1651   theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj);
1652 }
1653
1654
1655 void SMESH_ActorDef::SetPlaneParam(vtkFloatingPointType theDir[3], vtkFloatingPointType theDist, vtkPlane* thePlane)
1656 {
1657   thePlane->SetNormal(theDir);
1658   vtkFloatingPointType anOrigin[3];
1659   ::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin);
1660   thePlane->SetOrigin(anOrigin);
1661 }
1662
1663
1664 void SMESH_ActorDef::GetPlaneParam(vtkFloatingPointType theDir[3], vtkFloatingPointType& theDist, vtkPlane* thePlane)
1665 {
1666   thePlane->GetNormal(theDir);
1667
1668   vtkFloatingPointType anOrigin[3];
1669   thePlane->GetOrigin(anOrigin);
1670   ::PositionToDistance(GetUnstructuredGrid(),theDir,anOrigin,theDist);
1671 }
1672
1673 void SMESH_ActorDef::UpdateScalarBar()
1674 {
1675   SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1676   if( !mgr )
1677     return;
1678
1679   vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
1680
1681   QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
1682   aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1683
1684   aScalarBarTitleProp->SetFontFamilyToArial();
1685
1686   if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
1687   {
1688     QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
1689     if ( f.family() == "Arial" )
1690       aScalarBarTitleProp->SetFontFamilyToArial();
1691     else if ( f.family() == "Courier" )
1692       aScalarBarTitleProp->SetFontFamilyToCourier();
1693     else if ( f.family() == "Times" )
1694       aScalarBarTitleProp->SetFontFamilyToTimes();
1695
1696     if ( f.bold() )
1697       aScalarBarTitleProp->BoldOn();
1698     else
1699       aScalarBarTitleProp->BoldOff();
1700
1701     if ( f.italic() )
1702       aScalarBarTitleProp->ItalicOn();
1703     else
1704      aScalarBarTitleProp->ItalicOff();
1705
1706     if ( f.overline() )
1707       aScalarBarTitleProp->ShadowOn();
1708     else
1709       aScalarBarTitleProp->ShadowOff();
1710   }
1711
1712   myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
1713   aScalarBarTitleProp->Delete();
1714
1715   vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
1716
1717   aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
1718   aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1719
1720   aScalarBarLabelProp->SetFontFamilyToArial();
1721   if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
1722   {
1723     QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
1724     if( f.family() == "Arial" )
1725       aScalarBarLabelProp->SetFontFamilyToArial();
1726     else if( f.family() == "Courier" )
1727       aScalarBarLabelProp->SetFontFamilyToCourier();
1728     else if( f.family() == "Times" )
1729       aScalarBarLabelProp->SetFontFamilyToTimes();
1730
1731     if ( f.bold() )
1732       aScalarBarLabelProp->BoldOn();
1733     else
1734       aScalarBarLabelProp->BoldOff();
1735
1736     if ( f.italic() )
1737       aScalarBarLabelProp->ItalicOn();
1738     else
1739       aScalarBarLabelProp->ItalicOff();
1740
1741     if( f.overline() )
1742       aScalarBarLabelProp->ShadowOn();
1743     else
1744       aScalarBarLabelProp->ShadowOff();
1745   }
1746
1747   myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
1748   aScalarBarLabelProp->Delete();
1749
1750   bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
1751   QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
1752   if( horiz )
1753     myScalarBarActor->SetOrientationToHorizontal();
1754   else
1755     myScalarBarActor->SetOrientationToVertical();
1756
1757
1758   vtkFloatingPointType aXVal = horiz ? 0.20 : 0.01;
1759   if( mgr->hasValue( "SMESH", name + "x" ) )
1760     aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
1761
1762   vtkFloatingPointType aYVal = horiz ? 0.01 : 0.1;
1763   if( mgr->hasValue( "SMESH", name + "y" ) )
1764     aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
1765   myScalarBarActor->SetPosition( aXVal, aYVal );
1766
1767   vtkFloatingPointType aWVal = horiz ? 0.60 : 0.10;
1768   if( mgr->hasValue( "SMESH", name + "width" ) )
1769     aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
1770   myScalarBarActor->SetWidth( aWVal );
1771
1772   vtkFloatingPointType aHVal = horiz ? 0.12 : 0.80;
1773   if( mgr->hasValue( "SMESH", name + "height" ) )
1774     aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
1775   myScalarBarActor->SetHeight( aHVal );
1776
1777   int anIntVal = 5;
1778   if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
1779     anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
1780   myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
1781
1782   anIntVal = 64;
1783   if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
1784     anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
1785   myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
1786   
1787 }