1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH OBJECT : interactive object for SMESH visualization
24 // File : SMESH_Actor.cxx
25 // Author : Nicolas REJNERI
28 #include "SMESH_ActorDef.h"
29 #include "SMESH_ActorUtils.h"
30 #include "SMESH_DeviceActor.h"
31 #include "SMESH_NodeLabelActor.h"
32 #include "SMESH_CellLabelActor.h"
33 #include "SMESH_ObjectDef.h"
34 #include "SMESH_ControlsDef.hxx"
35 #include "SMDS_UnstructuredGrid.hxx"
36 #include "SMESH_ScalarBarActor.h"
37 #include "VTKViewer_ExtractUnstructuredGrid.h"
38 #include "VTKViewer_FramedTextActor.h"
39 #include "SALOME_InteractiveObject.hxx"
40 #include "SMESH_SVTKActor.h"
42 #include "SUIT_Session.h"
43 #include "SUIT_ResourceMgr.h"
47 #ifndef DISABLE_PLOT2DVIEWER
48 #include <SPlot2d_Histogram.h>
51 #include <vtkProperty.h>
52 #include <vtkTimeStamp.h>
53 #include <vtkObjectFactory.h>
54 #include <vtkShrinkPolyData.h>
55 #include <vtkMergeFilter.h>
57 #include <vtkMatrix4x4.h>
58 #include <vtkUnstructuredGrid.h>
59 #include <vtkPointData.h>
60 #include <vtkCellData.h>
62 #include <vtkMapper.h>
63 #include <vtkRenderer.h>
66 #include <vtkIdList.h>
67 #include <vtkIntArray.h>
69 #include <vtkActor2D.h>
70 #include <vtkProperty2D.h>
71 #include <vtkPolyData.h>
72 #include <vtkTextProperty.h>
74 #include <vtkLookupTable.h>
78 #include <vtkPlaneCollection.h>
79 #include <vtkImplicitBoolean.h>
80 #include <vtkImplicitFunctionCollection.h>
82 #include "utilities.h"
85 static int MYDEBUG = 1;
87 static int MYDEBUG = 1;
90 static int aLineWidthInc = 2;
93 SMESH_ActorDef* SMESH_ActorDef::New(){
94 return new SMESH_ActorDef();
98 SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
103 SMESH_ActorDef* anActor = NULL;
104 if(theVisualObj->IsValid() ) {
105 anActor = SMESH_ActorDef::New();
106 if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
111 anActor->UpdateScalarBar();
117 SMESH_ActorDef::SMESH_ActorDef()
119 if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
120 myBaseActor = SMESH_DeviceActor::New();
122 myTimeStamp = vtkTimeStamp::New();
124 myIsPointsVisible = false;
125 myIsEntityModeCache = false;
127 myHighlightActor = SMESH_SVTKActor::New();
128 myHighlightActor->Delete(); // vtkSmartPointer!
129 myHighlightActor->Initialize();
131 myPreHighlightActor = SMESH_SVTKActor::New();
132 myPreHighlightActor->Delete();
133 myPreHighlightActor->Initialize();
135 myIsShrinkable = false;
138 myIsFacesOriented = false;
140 myControlsPrecision = -1;
141 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
143 if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
144 myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
146 double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
147 double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
148 double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0);
149 double aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
150 double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
152 SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
154 bool anItalicNd = false;
155 bool aShadowNd = false;
157 if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
158 QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
159 if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
160 else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
161 else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
163 anItalicNd = f.italic();
164 aShadowNd = f.overline();
165 aSizeNd = f.pointSize();
167 double anRGBNd[3] = {1,1,1};
168 SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
170 SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
172 bool anItalicEl = false;
173 bool aShadowEl = false;
175 if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
176 QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
177 if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
178 else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
179 else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
181 anItalicEl = f.italic();
182 aShadowEl = f.overline();
183 aSizeEl = f.pointSize();
185 double anRGBEl[3] = {0,1,0};
186 SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
188 vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
189 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
191 //Definition 2D and 3D devices of the actor
192 //-----------------------------------------
193 double anRGB[3] = {1,1,1};
194 mySurfaceProp = vtkProperty::New();
197 SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
198 mySurfaceProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
199 myDeltaBrightness = delta;
201 myBackSurfaceProp = vtkProperty::New();
202 bfc = Qtx::mainColorToSecondary(ffc, delta);
203 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
205 myNormalVProp = vtkProperty::New();
206 SMESH::GetColor( "SMESH", "volume_color", ffc, delta, "255,0,170|-100" );
207 myNormalVProp->SetColor( ffc.redF(), ffc.greenF(), ffc.blueF() );
208 myDeltaVBrightness = delta;
210 myReversedVProp = vtkProperty::New();
211 bfc = Qtx::mainColorToSecondary(ffc, delta);
212 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
214 my2DActor = SMESH_CellLabelActor::New();
215 my2DActor->SetStoreGemetryMapping(true);
216 my2DActor->SetUserMatrix(aMatrix);
217 my2DActor->PickableOff();
218 my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
219 my2DActor->SetProperty(mySurfaceProp);
220 my2DActor->SetBackfaceProperty(myBackSurfaceProp);
221 my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
222 aFilter = my2DActor->GetExtractUnstructuredGrid();
223 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
224 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
225 aFilter->RegisterCellsWithType(VTK_POLYGON);
226 aFilter->RegisterCellsWithType(VTK_QUAD);
227 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
228 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
229 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
230 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
232 my2DExtProp = vtkProperty::New();
233 my2DExtProp->DeepCopy(mySurfaceProp);
234 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
235 anRGB[0] = 1 - anRGB[0];
236 anRGB[1] = 1 - anRGB[1];
237 anRGB[2] = 1 - anRGB[2];
238 my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
240 my2DExtActor = SMESH_DeviceActor::New();
241 my2DExtActor->SetUserMatrix(aMatrix);
242 my2DExtActor->PickableOff();
243 my2DExtActor->SetProperty(my2DExtProp);
244 my2DExtActor->SetBackfaceProperty(my2DExtProp);
245 my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
246 aFilter = my2DExtActor->GetExtractUnstructuredGrid();
247 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
248 aFilter->RegisterCellsWithType(VTK_POLYGON);
249 aFilter->RegisterCellsWithType(VTK_QUAD);
250 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
251 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
252 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
253 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
255 my3DActor = SMESH_CellLabelActor::New();
256 my3DActor->SetStoreGemetryMapping(true);
257 my3DActor->SetUserMatrix(aMatrix);
258 my3DActor->PickableOff();
259 my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
260 my3DActor->SetProperty(myNormalVProp);
261 my3DActor->SetBackfaceProperty(myReversedVProp);
262 my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
263 my3DActor->SetCoincident3DAllowed(true);
264 aFilter = my3DActor->GetExtractUnstructuredGrid();
265 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
266 aFilter->RegisterCellsWithType(VTK_TETRA);
267 aFilter->RegisterCellsWithType(VTK_VOXEL);
268 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
269 aFilter->RegisterCellsWithType(VTK_WEDGE);
270 aFilter->RegisterCellsWithType(VTK_PYRAMID);
271 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
272 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
273 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
274 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
275 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
276 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
277 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
278 //#ifdef VTK_HAVE_POLYHEDRON
279 MESSAGE("RegisterCellsWithType(VTK_POLYHEDRON)");
280 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
283 my3DExtProp = vtkProperty::New();
284 my3DExtProp->DeepCopy(myNormalVProp);
285 SMESH::GetColor( "SMESH", "volume_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 170 ) );
286 anRGB[0] = 1 - anRGB[0];
287 anRGB[1] = 1 - anRGB[1];
288 anRGB[2] = 1 - anRGB[2];
289 my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
291 my3DExtActor = SMESH_DeviceActor::New();
292 my3DExtActor->SetUserMatrix(aMatrix);
293 my3DExtActor->PickableOff();
294 my3DExtActor->SetProperty(my3DExtProp);
295 my3DExtActor->SetBackfaceProperty(my3DExtProp);
296 my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
297 my3DExtActor->SetCoincident3DAllowed(true);
298 aFilter = my3DExtActor->GetExtractUnstructuredGrid();
299 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
300 aFilter->RegisterCellsWithType(VTK_TETRA);
301 aFilter->RegisterCellsWithType(VTK_VOXEL);
302 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
303 aFilter->RegisterCellsWithType(VTK_WEDGE);
304 aFilter->RegisterCellsWithType(VTK_PYRAMID);
305 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
306 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
307 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
308 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
309 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
310 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
311 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
312 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
314 //Definition 1D device of the actor
315 //---------------------------------
316 myEdgeProp = vtkProperty::New();
317 myEdgeProp->SetAmbient(1.0);
318 myEdgeProp->SetDiffuse(0.0);
319 myEdgeProp->SetSpecular(0.0);
320 SMESH::GetColor( "SMESH", "wireframe_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
321 myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
322 myEdgeProp->SetLineWidth(aLineWidth);
324 my1DActor = SMESH_CellLabelActor::New();
325 my1DActor->SetStoreGemetryMapping(true);
326 my1DActor->SetUserMatrix(aMatrix);
327 my1DActor->PickableOff();
328 my1DActor->SetHighlited(true);
329 my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
330 my1DActor->SetProperty(myEdgeProp);
331 my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
332 aFilter = my1DActor->GetExtractUnstructuredGrid();
333 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
334 aFilter->RegisterCellsWithType(VTK_LINE);
335 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
337 my1DProp = vtkProperty::New();
338 my1DProp->DeepCopy(myEdgeProp);
339 my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
340 my1DProp->SetPointSize(aElem0DSize);
342 my1DExtProp = vtkProperty::New();
343 my1DExtProp->DeepCopy(myEdgeProp);
344 anRGB[0] = 1 - anRGB[0];
345 anRGB[1] = 1 - anRGB[1];
346 anRGB[2] = 1 - anRGB[2];
347 my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
348 my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
349 my1DExtProp->SetPointSize(aElem0DSize);
351 my1DExtActor = SMESH_DeviceActor::New();
352 my1DExtActor->SetUserMatrix(aMatrix);
353 my1DExtActor->PickableOff();
354 my1DExtActor->SetHighlited(true);
355 my1DExtActor->SetVisibility(false);
356 my1DExtActor->SetProperty(my1DExtProp);
357 my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
358 aFilter = my1DExtActor->GetExtractUnstructuredGrid();
359 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
360 aFilter->RegisterCellsWithType(VTK_LINE);
361 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
364 //Definition 0D device of the actor (0d elements)
365 //-----------------------------------------------
366 my0DProp = vtkProperty::New();
367 SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
368 my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
369 my0DProp->SetPointSize(aElem0DSize);
371 my0DActor = SMESH_CellLabelActor::New();
372 my0DActor->SetUserMatrix(aMatrix);
373 my0DActor->SetStoreGemetryMapping(true);
374 my0DActor->PickableOff();
375 my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
376 my0DActor->SetVisibility(false);
377 my0DActor->SetProperty(my0DProp);
378 my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
379 aFilter = my0DActor->GetExtractUnstructuredGrid();
380 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
381 aFilter->RegisterCellsWithType(VTK_VERTEX);
383 //Definition 0D device of the actor (ball elements)
384 //-----------------------------------------------
385 myBallProp = vtkProperty::New();
386 SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
387 myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
388 myBallProp->SetPointSize(aBallElemSize);
390 myBallActor = SMESH_CellLabelActor::New();
391 myBallActor->SetUserMatrix(aMatrix);
392 myBallActor->SetStoreGemetryMapping(true);
393 myBallActor->PickableOff();
394 myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
395 myBallActor->SetVisibility(false);
396 myBallActor->SetProperty(myBallProp);
397 myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
398 myBallActor->SetBallEnabled(true);
399 aFilter = myBallActor->GetExtractUnstructuredGrid();
400 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
401 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
403 //my0DExtProp = vtkProperty::New();
404 //my0DExtProp->DeepCopy(my0DProp);
405 //anRGB[0] = 1 - anRGB[0];
406 //anRGB[1] = 1 - anRGB[1];
407 //anRGB[2] = 1 - anRGB[2];
408 //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
409 //my0DExtProp->SetPointSize(aElem0DSize);
411 //my0DExtActor = SMESH_DeviceActor::New();
412 //my0DExtActor->SetUserMatrix(aMatrix);
413 //my0DExtActor->SetStoreClippingMapping(true);
414 //my0DExtActor->PickableOff();
415 //my0DExtActor->SetHighlited(true);
416 //my0DExtActor->SetVisibility(false);
417 //my0DExtActor->SetProperty(my0DExtProp);
418 //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
419 //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
420 ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
421 //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
422 //aFilter->RegisterCellsWithType(VTK_VERTEX);
425 //Definition 0D device of the actor (nodes)
426 //-----------------------------------------
427 myNodeProp = vtkProperty::New();
428 SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
429 myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
431 myNodeActor = SMESH_NodeLabelActor::New();
432 myNodeActor->SetUserMatrix(aMatrix);
433 myNodeActor->SetStoreClippingMapping(true);
434 myNodeActor->PickableOff();
435 myNodeActor->SetVisibility(false);
436 myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
437 myNodeActor->SetProperty(myNodeProp);
438 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
439 aFilter = myNodeActor->GetExtractUnstructuredGrid();
440 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
442 myNodeExtProp = vtkProperty::New();
443 myNodeExtProp->DeepCopy(myNodeProp);
444 anRGB[0] = 1 - anRGB[0];
445 anRGB[1] = 1 - anRGB[1];
446 anRGB[2] = 1 - anRGB[2];
447 myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
449 myNodeExtActor = SMESH_DeviceActor::New();
450 myNodeExtActor->SetUserMatrix(aMatrix);
451 myNodeExtActor->SetStoreClippingMapping(true);
452 myNodeExtActor->PickableOff();
453 myNodeExtActor->SetHighlited(true);
454 myNodeExtActor->SetVisibility(false);
455 myNodeExtActor->SetProperty(myNodeExtProp);
456 myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
457 aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
458 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
459 aFilter->RegisterCellsWithType(VTK_VERTEX);
461 //Definition of Pickable and Highlitable engines
462 //----------------------------------------------
464 myBaseActor->SetUserMatrix(aMatrix);
465 myBaseActor->SetStoreGemetryMapping(true);
466 myBaseActor->GetProperty()->SetOpacity(0.0);
467 myPickableActor = myBaseActor;
469 myHighlightProp = vtkProperty::New();
470 myHighlightProp->SetAmbient(1.0);
471 myHighlightProp->SetDiffuse(0.0);
472 myHighlightProp->SetSpecular(0.0);
473 SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
474 myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
475 myHighlightProp->SetPointSize(aElem0DSize); // ??
476 myHighlightProp->SetLineWidth(aLineWidth);
477 myHighlightProp->SetRepresentation(1);
479 myOutLineProp = vtkProperty::New();
480 myOutLineProp->SetAmbient(1.0);
481 myOutLineProp->SetDiffuse(0.0);
482 myOutLineProp->SetSpecular(0.0);
483 SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
484 myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
485 myOutLineProp->SetLineWidth(aOutlineWidth);
486 myOutLineProp->SetRepresentation(1);
488 myPreselectProp = vtkProperty::New();
489 myPreselectProp->SetAmbient(1.0);
490 myPreselectProp->SetDiffuse(0.0);
491 myPreselectProp->SetSpecular(0.0);
492 SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
493 myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
494 myPreselectProp->SetPointSize(aElem0DSize); // ??
495 myPreselectProp->SetLineWidth(aLineWidth);
496 myPreselectProp->SetRepresentation(1);
498 myHighlitableActor = SMESH_DeviceActor::New();
499 myHighlitableActor->SetUserMatrix(aMatrix);
500 myHighlitableActor->PickableOff();
501 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
502 myHighlitableActor->SetCoincident3DAllowed(true);
509 myControlMode = eNone;
510 myControlActor = my2DActor;
512 //Definition of myScalarBarActor
513 //------------------------------
514 myLookupTable = vtkLookupTable::New();
515 //Fix for Bug PAL5195 - SMESH764:
516 //Controls - Aspect Ratio: incorrect colors of the best and worst values
517 myLookupTable->SetHueRange(0.667,0.0);
519 myScalarBarActor = SMESH_ScalarBarActor::New();
520 myScalarBarActor->SetVisibility(false);
521 myScalarBarActor->SetLookupTable(myLookupTable);
524 //Incorrect "Min value" in Scalar Bar in Mesh:
525 // myScalarBarActor->SetLabelFormat("%.4g");
526 // changes was commented because of regression bug IPAL 19981
528 mgr = SUIT_Session::session()->resourceMgr();
532 myEntityMode = eAllEntity;
533 myEntityModeCache = eAllEntity;
536 myImplicitBoolean = vtkImplicitBoolean::New();
537 myImplicitBoolean->SetOperationTypeToIntersection();
539 myPlaneCollection = vtkPlaneCollection::New();
541 //Quadratic 2D elements representation
542 //-----------------------------------------------------------------------------
543 int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
544 if(aQuadratic2DMode == 0){
545 myHighlitableActor->SetQuadraticArcMode(false);
546 my2DActor->SetQuadraticArcMode(false);
547 my1DActor->SetQuadraticArcMode(false);
549 else if(aQuadratic2DMode == 1){
550 myHighlitableActor->SetQuadraticArcMode(true);
551 my2DActor->SetQuadraticArcMode(true);
552 my1DActor->SetQuadraticArcMode(true);
555 int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
556 myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
557 my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
559 // Set colors of the name actor
560 SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
561 myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
562 SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
563 myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
565 #ifndef DISABLE_PLOT2DVIEWER
569 SetBallSize(aBallElemSize);
570 SetBallScale(aBallElemScale);
571 Set0DSize(aElem0DSize);
575 SMESH_ActorDef::~SMESH_ActorDef()
577 if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
579 // Please keep the order same as one in the header file
581 myTimeStamp->Delete();
583 myScalarBarActor->Delete();
584 myLookupTable->Delete();
586 mySurfaceProp->Delete();
587 myBackSurfaceProp->Delete();
588 myNormalVProp->Delete();
589 myReversedVProp->Delete();
590 myEdgeProp->Delete();
591 myNodeProp->Delete();
593 myNodeActor->Delete();
594 myBaseActor->Delete();
595 //myPickableActor->Delete(); myPickableActor == myBaseActor
597 myHighlightProp->Delete();
598 myOutLineProp->Delete();
599 myPreselectProp->Delete();
601 myHighlitableActor->Delete();
603 my2DExtProp->Delete();
604 my3DExtProp->Delete();
606 my2DExtActor->Delete();
608 my3DExtActor->Delete();
609 // myControlActor->Delete(); myControlActor == my2DActor
611 myNodeExtProp->Delete();
612 myNodeExtActor->Delete();
616 my1DExtProp->Delete();
617 my1DExtActor->Delete();
621 myBallProp->Delete();
622 myBallActor->Delete();
623 //my0DExtProp->Delete();
624 //my0DExtActor->Delete();
626 myImplicitBoolean->Delete();
627 myPlaneCollection->Delete();
629 #ifndef DISABLE_PLOT2DVIEWER
631 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
632 delete my2dHistogram;
637 void SMESH_ActorDef::Delete()
639 // This is just to guarantee that the DeleteActorEvent (which was previously invoked
640 // from the actor's destructor) will be thrown before removing the actor's observers,
641 // that is done inside the Superclass::Delete() method but before the destructor itself
642 // (see the issue 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash).
643 // The event is caught by SMESHGUI::ProcessEvents() static method.
644 this->InvokeEvent( SMESH::DeleteActorEvent, NULL );
646 Superclass::Delete();
649 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
652 myNodeActor->SetPointsLabeled(theIsPointsLabeled);
653 SetRepresentation(GetRepresentation());
654 myTimeStamp->Modified();
658 void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize,
659 bool theBold, bool theItalic, bool theShadow,
660 double r, double g, double b )
663 myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
664 SetRepresentation( GetRepresentation() );
665 myTimeStamp->Modified();
669 void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize,
670 bool theBold, bool theItalic, bool theShadow,
671 double r, double g, double b )
674 my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
677 my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
678 SetRepresentation( GetRepresentation() );
679 myTimeStamp->Modified();
682 my1DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
683 SetRepresentation( GetRepresentation() );
684 myTimeStamp->Modified();
687 my0DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
688 SetRepresentation( GetRepresentation() );
689 myTimeStamp->Modified();
692 myBallActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
693 SetRepresentation( GetRepresentation() );
694 myTimeStamp->Modified();
698 bool SMESH_ActorDef::GetPointsLabeled() {
699 return myNodeActor && myNodeActor->GetPointsLabeled();
702 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
705 my3DActor->SetCellsLabeled(theIsCellsLabeled);
708 my2DActor->SetCellsLabeled(theIsCellsLabeled);
711 my1DActor->SetCellsLabeled(theIsCellsLabeled);
714 my0DActor->SetCellsLabeled(theIsCellsLabeled);
717 myBallActor->SetCellsLabeled(theIsCellsLabeled);
719 myTimeStamp->Modified();
723 bool SMESH_ActorDef::GetCellsLabeled() {
726 result = result || my3DActor->GetCellsLabeled();
729 result = result || my2DActor->GetCellsLabeled();
732 result = result || my1DActor->GetCellsLabeled();
735 result = result || my0DActor->GetCellsLabeled();
738 result = result || myBallActor->GetCellsLabeled();
744 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
746 myIsFacesOriented = theIsFacesOriented;
748 my2DActor->SetFacesOriented(theIsFacesOriented);
749 my3DActor->SetFacesOriented(theIsFacesOriented);
751 myTimeStamp->Modified();
754 bool SMESH_ActorDef::GetFacesOriented()
756 return myIsFacesOriented;
759 void SMESH_ActorDef::SetFacesOrientationColor(double r,double g,double b)
761 my2DActor->SetFacesOrientationColor( r, g, b );
762 my3DActor->SetFacesOrientationColor( r, g, b );
765 void SMESH_ActorDef::GetFacesOrientationColor(double& r,double& g,double& b)
767 my3DActor->GetFacesOrientationColor( r, g, b );
770 void SMESH_ActorDef::SetFacesOrientationScale(double theScale)
772 my2DActor->SetFacesOrientationScale( theScale );
773 my3DActor->SetFacesOrientationScale( theScale );
776 double SMESH_ActorDef::GetFacesOrientationScale()
778 return my3DActor->GetFacesOrientationScale();
781 void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
783 my2DActor->SetFacesOrientation3DVectors( theState );
784 my3DActor->SetFacesOrientation3DVectors( theState );
787 bool SMESH_ActorDef::GetFacesOrientation3DVectors()
789 return my3DActor->GetFacesOrientation3DVectors();
795 SetControlMode(eControl theMode)
797 SetControlMode(theMode,true);
803 SetControlMode(eControl theMode,
804 bool theCheckEntityMode)
806 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
807 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
808 lookupTable->SetScale(VTK_SCALE_LINEAR);
810 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
814 myControlMode = eNone;
815 theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
817 my0DActor->GetMapper()->SetScalarVisibility(false);
818 my1DActor->GetMapper()->SetScalarVisibility(false);
819 my2DActor->GetMapper()->SetScalarVisibility(false);
820 my3DActor->GetMapper()->SetScalarVisibility(false);
821 myBallActor->GetMapper()->SetScalarVisibility(false);
822 myScalarBarActor->SetVisibility(false);
824 bool anIsScalarVisible = theMode > eNone;
826 if(anIsScalarVisible) {
830 SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
831 aControl->SetPrecision( myControlsPrecision );
832 myFunctor.reset( aControl );
833 myControlActor = my1DActor;
838 myFunctor.reset(new SMESH::Controls::Length2D());
839 myControlActor = my2DActor;
843 myFunctor.reset(new SMESH::Controls::FreeBorders());
844 myControlActor = my1DActor;
847 myFunctor.reset(new SMESH::Controls::FreeEdges());
848 myControlActor = my2DActor;
851 myFunctor.reset(new SMESH::Controls::FreeNodes());
852 myControlActor = myNodeActor;
855 myFunctor.reset(new SMESH::Controls::FreeFaces());
856 myControlActor = my2DActor;
858 case eCoincidentNodes:
860 SMESH::Controls::CoincidentNodes* cn = new SMESH::Controls::CoincidentNodes();
861 double tol = mgr->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 );
862 cn->SetTolerance( tol );
864 myControlActor = myNodeActor;
867 case eCoincidentElems1D:
868 myFunctor.reset(new SMESH::Controls::CoincidentElements1D());
869 myControlActor = my1DActor;
871 case eCoincidentElems2D:
872 myFunctor.reset(new SMESH::Controls::CoincidentElements2D());
873 myControlActor = my2DActor;
875 case eCoincidentElems3D:
876 myFunctor.reset(new SMESH::Controls::CoincidentElements3D());
877 myControlActor = my3DActor;
879 case eBareBorderFace:
880 myFunctor.reset(new SMESH::Controls::BareBorderFace());
881 myControlActor = my2DActor;
883 case eOverConstrainedFace:
884 myFunctor.reset(new SMESH::Controls::OverConstrainedFace());
885 myControlActor = my2DActor;
887 case eMultiConnection:
888 myFunctor.reset(new SMESH::Controls::MultiConnection());
889 myControlActor = my1DActor;
891 case eMultiConnection2D:
892 myFunctor.reset(new SMESH::Controls::MultiConnection2D());
893 myControlActor = my2DActor;
897 SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
898 aControl->SetPrecision( myControlsPrecision );
899 myFunctor.reset( aControl );
900 myControlActor = my2DActor;
905 SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
906 aControl->SetPrecision( myControlsPrecision );
907 myFunctor.reset( aControl );
908 myControlActor = my2DActor;
913 SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
914 aControl->SetPrecision( myControlsPrecision );
915 myFunctor.reset( aControl );
916 myControlActor = my2DActor;
921 SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
922 aControl->SetPrecision( myControlsPrecision );
923 myFunctor.reset( aControl );
924 myControlActor = my3DActor;
929 SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
930 aControl->SetPrecision( myControlsPrecision );
931 myFunctor.reset( aControl );
932 myControlActor = my3DActor;
935 case eMaxElementLength2D:
937 SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
938 aControl->SetPrecision( myControlsPrecision );
939 myFunctor.reset( aControl );
940 myControlActor = my2DActor;
943 case eMaxElementLength3D:
945 SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
946 aControl->SetPrecision( myControlsPrecision );
947 myFunctor.reset( aControl );
948 myControlActor = my3DActor;
951 case eBareBorderVolume:
953 myFunctor.reset(new SMESH::Controls::BareBorderVolume());
954 myControlActor = my3DActor;
957 case eOverConstrainedVolume:
959 myFunctor.reset(new SMESH::Controls::OverConstrainedVolume());
960 myControlActor = my3DActor;
965 SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
966 aControl->SetPrecision( myControlsPrecision );
967 myFunctor.reset( aControl );
968 myControlActor = my2DActor;
973 SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
974 aControl->SetPrecision( myControlsPrecision );
975 myFunctor.reset( aControl );
976 myControlActor = my2DActor;
981 SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
982 aControl->SetPrecision( myControlsPrecision );
983 myFunctor.reset( aControl );
984 myControlActor = my2DActor;
991 vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
992 vtkIdType aNbCells = aGrid->GetNumberOfCells();
994 myControlMode = theMode;
995 switch(myControlMode){
997 case eCoincidentNodes:
998 myNodeExtActor->SetExtControlMode(myFunctor);
1002 case eCoincidentElems1D:
1003 my1DExtActor->SetExtControlMode(myFunctor);
1006 case eBareBorderFace:
1007 case eOverConstrainedFace:
1008 case eCoincidentElems2D:
1009 my2DExtActor->SetExtControlMode(myFunctor);
1011 case eBareBorderVolume:
1012 case eOverConstrainedVolume:
1013 case eCoincidentElems3D:
1014 my3DExtActor->SetExtControlMode(myFunctor);
1017 case eMultiConnection2D:
1018 my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
1019 UpdateDistribution();
1022 myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
1023 UpdateDistribution();
1027 if(theCheckEntityMode) {
1028 if(myControlActor == my1DActor) {
1029 if (!myIsEntityModeCache){
1030 myEntityModeCache = GetEntityMode();
1031 myIsEntityModeCache=true;
1033 SetEntityMode(eEdges);
1035 else if(myControlActor == my2DActor) {
1036 switch(myControlMode) {
1040 case eMultiConnection2D:
1041 if (!myIsEntityModeCache){
1042 myEntityModeCache = GetEntityMode();
1043 myIsEntityModeCache=true;
1045 SetEntityMode(eFaces);
1048 if (!myIsEntityModeCache){
1049 myEntityModeCache = GetEntityMode();
1050 myIsEntityModeCache=true;
1052 SetEntityMode(eFaces);
1054 }else if(myControlActor == my3DActor) {
1055 if (!myIsEntityModeCache){
1056 myEntityModeCache = GetEntityMode();
1057 myIsEntityModeCache=true;
1059 SetEntityMode(eVolumes);
1065 if(theCheckEntityMode){
1066 myEntityMode = myEntityModeCache;
1067 myIsEntityModeCache = false;
1072 SetRepresentation(GetRepresentation());
1074 myTimeStamp->Modified();
1077 lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
1078 double * range = lookupTable->GetRange();
1080 if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07)
1081 lookupTable->SetScale(VTK_SCALE_LOG10);
1087 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
1089 theRenderer->AddActor(myBaseActor);
1090 theRenderer->AddActor(myNodeExtActor);
1091 theRenderer->AddActor(my1DExtActor);
1093 my3DActor ->AddToRender(theRenderer);
1094 my3DExtActor->AddToRender(theRenderer);
1095 my2DActor ->AddToRender(theRenderer);
1096 my2DExtActor->AddToRender(theRenderer);
1097 myNodeActor ->AddToRender(theRenderer);
1098 my1DActor ->AddToRender(theRenderer);
1099 my0DActor ->AddToRender(theRenderer);
1100 myBallActor ->AddToRender(theRenderer);
1102 theRenderer->AddActor(myHighlitableActor);
1104 theRenderer->AddActor2D(myScalarBarActor);
1106 // the superclass' method should be called at the end
1107 // (in particular, for correct work of selection)
1108 SALOME_Actor::AddToRender(theRenderer);
1111 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
1112 SALOME_Actor::RemoveFromRender(theRenderer);
1114 theRenderer->RemoveActor(myBaseActor);
1116 theRenderer->RemoveActor(myNodeExtActor);
1118 theRenderer->RemoveActor(myHighlitableActor);
1120 //theRenderer->RemoveActor(my0DExtActor);
1122 theRenderer->RemoveActor(my1DExtActor);
1124 my2DActor->RemoveFromRender(theRenderer);
1125 my2DExtActor->RemoveFromRender(theRenderer);
1126 my3DActor->RemoveFromRender(theRenderer);
1127 my3DExtActor->RemoveFromRender(theRenderer);
1128 myNodeActor->RemoveFromRender(theRenderer);
1129 my0DActor->RemoveFromRender(theRenderer);
1130 myBallActor->RemoveFromRender(theRenderer);
1131 my1DActor->RemoveFromRender(theRenderer);
1133 theRenderer->RemoveActor(myScalarBarActor);
1137 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
1138 const char* theEntry,
1139 const char* theName,
1142 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
1146 myVisualObj = theVisualObj;
1147 myVisualObj->Update(theIsClear);
1149 SMESH_SVTKActor::SafeDownCast(myHighlightActor)->SetVisualObject(myVisualObj);
1150 SMESH_SVTKActor::SafeDownCast(myPreHighlightActor)->SetVisualObject(myVisualObj);
1152 myNodeActor->Init(myVisualObj,myImplicitBoolean);
1153 myBaseActor->Init(myVisualObj,myImplicitBoolean);
1155 myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
1157 myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
1159 my0DActor->Init(myVisualObj,myImplicitBoolean);
1160 myBallActor->Init(myVisualObj,myImplicitBoolean);
1161 //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
1163 my1DActor->Init(myVisualObj,myImplicitBoolean);
1164 my1DExtActor->Init(myVisualObj,myImplicitBoolean);
1166 my2DActor->Init(myVisualObj,myImplicitBoolean);
1167 my2DExtActor->Init(myVisualObj,myImplicitBoolean);
1168 my3DActor->Init(myVisualObj,myImplicitBoolean);
1169 my3DExtActor->Init(myVisualObj,myImplicitBoolean);
1171 my0DActor->GetMapper()->SetLookupTable(myLookupTable);
1172 myBallActor->GetMapper()->SetLookupTable(myLookupTable);
1173 //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1175 my1DActor->GetMapper()->SetLookupTable(myLookupTable);
1176 my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1178 my2DActor->GetMapper()->SetLookupTable(myLookupTable);
1179 my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1180 my3DActor->GetMapper()->SetLookupTable(myLookupTable);
1181 my3DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1183 double aFactor, aUnits;
1184 my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
1185 my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
1186 my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
1187 my3DActor->SetPolygonOffsetParameters(2*aFactor,aUnits);
1189 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1193 //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
1194 SetIsShrunkable(true);
1196 SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
1198 int aMode = mgr->integerValue( "SMESH", "display_mode" );
1199 SetRepresentation(-1);
1202 SetRepresentation(eEdge);
1203 }else if(aMode == 1){
1204 SetRepresentation(eSurface);
1205 }else if(aMode == 2){
1206 SetRepresentation(ePoint);
1213 if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1214 SetIsDisplayNameActor( true );
1216 int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
1217 int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
1218 SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
1220 myTimeStamp->Modified();
1226 double* SMESH_ActorDef::GetBounds(){
1227 return myNodeActor->GetBounds();
1231 vtkDataSet* SMESH_ActorDef::GetInput(){
1232 return GetUnstructuredGrid();
1236 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
1237 Superclass::SetTransform(theTransform);
1239 myNodeActor->SetTransform(theTransform);
1240 myBaseActor->SetTransform(theTransform);
1242 myHighlitableActor->SetTransform(theTransform);
1244 myNodeExtActor->SetTransform(theTransform);
1246 my0DActor->SetTransform(theTransform);
1247 myBallActor->SetTransform(theTransform);
1248 //my0DExtActor->SetTransform(theTransform);
1250 my1DActor->SetTransform(theTransform);
1251 my1DExtActor->SetTransform(theTransform);
1253 my2DActor->SetTransform(theTransform);
1254 my2DExtActor->SetTransform(theTransform);
1255 my3DActor->SetTransform(theTransform);
1256 my3DExtActor->SetTransform(theTransform);
1262 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
1263 vtkLODActor::SetMapper(theMapper);
1267 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
1268 SALOME_Actor::ShallowCopy(prop);
1272 vtkMapper* SMESH_ActorDef::GetMapper(){
1273 return myPickableActor->GetMapper();
1277 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
1278 return myVisualObj->GetUnstructuredGrid();
1282 bool SMESH_ActorDef::IsInfinitive(){
1283 vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
1284 myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
1285 ( aDataSet->GetNumberOfCells() == 1 &&
1286 aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
1287 return SALOME_Actor::IsInfinitive();
1291 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
1292 if ( myIsShrinkable == theShrunkable )
1294 myIsShrinkable = theShrunkable;
1298 double SMESH_ActorDef::GetShrinkFactor(){
1299 return myBaseActor->GetShrinkFactor();
1302 void SMESH_ActorDef::SetShrinkFactor(double theValue){
1303 myBaseActor->SetShrinkFactor(theValue);
1305 my1DActor->SetShrinkFactor(theValue);
1306 my1DExtActor->SetShrinkFactor(theValue);
1308 my2DActor->SetShrinkFactor(theValue);
1309 my2DExtActor->SetShrinkFactor(theValue);
1310 my3DActor->SetShrinkFactor(theValue);
1311 my3DExtActor->SetShrinkFactor(theValue);
1312 my3DExtActor->SetShrinkFactor(theValue);
1313 myHighlitableActor->SetShrinkFactor(theValue);
1318 void SMESH_ActorDef::SetShrink() {
1319 if(!myIsShrinkable) return;
1321 myBaseActor->SetShrink();
1323 my1DActor->SetShrink();
1324 my1DExtActor->SetShrink();
1326 my2DActor->SetShrink();
1327 my2DExtActor->SetShrink();
1328 my3DActor->SetShrink();
1329 my3DExtActor->SetShrink();
1330 myHighlitableActor->SetShrink();
1336 void SMESH_ActorDef::UnShrink(){
1337 if(!myIsShrunk) return;
1339 myBaseActor->UnShrink();
1341 my1DActor->UnShrink();
1342 my1DExtActor->UnShrink();
1344 my2DActor->UnShrink();
1345 my2DExtActor->UnShrink();
1346 my3DActor->UnShrink();
1347 my3DExtActor->UnShrink();
1348 myHighlitableActor->UnShrink();
1355 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1356 return myPickableActor->GetNodeObjId(theVtkID);
1359 double* SMESH_ActorDef::GetNodeCoord(int theObjID){
1360 return myPickableActor->GetNodeCoord(theObjID);
1364 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1365 return myPickableActor->GetElemObjId(theVtkID);
1368 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1369 return myPickableActor->GetElemCell(theObjID);
1373 void SMESH_ActorDef::SetVisibility(int theMode){
1374 SetVisibility(theMode,true);
1378 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1379 SALOME_Actor::SetVisibility(theMode);
1381 myNodeActor->VisibilityOff();
1382 myBaseActor->VisibilityOff();
1384 myNodeExtActor->VisibilityOff();
1386 my0DActor->VisibilityOff();
1387 myBallActor->VisibilityOff();
1388 //my0DExtActor->VisibilityOff();
1390 my1DActor->VisibilityOff();
1391 my1DExtActor->VisibilityOff();
1393 my2DActor->VisibilityOff();
1394 my2DExtActor->VisibilityOff();
1395 my3DActor->VisibilityOff();
1396 my3DExtActor->VisibilityOff();
1398 myScalarBarActor->VisibilityOff();
1400 if(GetVisibility()){
1401 if(theIsUpdateRepersentation)
1402 SetRepresentation(GetRepresentation());
1404 if(myControlMode != eNone){
1405 switch(myControlMode){
1407 case eCoincidentNodes:
1408 myNodeExtActor->VisibilityOn();
1412 case eCoincidentElems1D:
1413 my1DExtActor->VisibilityOn();
1416 case eBareBorderFace:
1417 case eOverConstrainedFace:
1418 case eCoincidentElems2D:
1419 my2DExtActor->VisibilityOn();
1421 case eBareBorderVolume:
1422 case eOverConstrainedVolume:
1423 case eCoincidentElems3D:
1424 my3DExtActor->VisibilityOn();
1427 case eMultiConnection2D:
1428 my1DExtActor->VisibilityOn();
1430 if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1431 myScalarBarActor->VisibilityOn();
1435 if(myRepresentation != ePoint)
1436 myPickableActor->VisibilityOn();
1438 myNodeActor->VisibilityOn();
1441 if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
1442 my0DActor->VisibilityOn();
1444 if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
1445 myBallActor->VisibilityOn();
1448 if(myEntityMode & eEdges && GetRepresentation() != ePoint){
1449 my1DActor->VisibilityOn();
1452 if(myEntityMode & eFaces && GetRepresentation() != ePoint){
1453 my2DActor->VisibilityOn();
1456 if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
1457 my3DActor->VisibilityOn();
1460 if(myNodeActor->GetPointsLabeled()){
1461 myNodeActor->VisibilityOn();
1465 my0DActor->UpdateLabels();
1468 myBallActor->UpdateLabels();
1471 my1DActor->UpdateLabels();
1474 my2DActor->UpdateLabels();
1477 my3DActor->UpdateLabels();
1479 #ifndef DISABLE_PLOT2DVIEWER
1481 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
1488 void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
1490 myEntityState = eAllEntity;
1492 if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
1493 myEntityState &= ~e0DElements;
1494 theMode &= ~e0DElements;
1497 if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) {
1498 myEntityState &= ~eBallElem;
1499 theMode &= ~eBallElem;
1502 if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
1503 myEntityState &= ~eEdges;
1507 if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
1508 myEntityState &= ~eFaces;
1512 if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
1513 myEntityState &= ~eVolumes;
1514 theMode &= ~eVolumes;
1518 if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
1519 theMode |= e0DElements;
1521 if(myVisualObj->GetNbEntities(SMDSAbs_Ball))
1522 theMode |= eBallElem;
1524 if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1527 if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1530 if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1531 theMode |= eVolumes;
1534 myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1536 myEntityMode = theMode;
1537 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1538 aFilter = myBaseActor->GetExtractUnstructuredGrid();
1539 aFilter->ClearRegisteredCellsWithType();
1540 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1542 VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
1543 aHightFilter->ClearRegisteredCellsWithType();
1544 aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1546 if (myEntityMode & e0DElements) {
1547 if (MYDEBUG) MESSAGE("0D ELEMENTS");
1548 aFilter->RegisterCellsWithType(VTK_VERTEX);
1549 aHightFilter->RegisterCellsWithType(VTK_VERTEX);
1552 if (myEntityMode & eBallElem) {
1553 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
1556 if (myEntityMode & eEdges) {
1557 if (MYDEBUG) MESSAGE("EDGES");
1558 aFilter->RegisterCellsWithType(VTK_LINE);
1559 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1561 aHightFilter->RegisterCellsWithType(VTK_LINE);
1562 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1565 if (myEntityMode & eFaces) {
1566 if (MYDEBUG) MESSAGE("FACES");
1567 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1568 aFilter->RegisterCellsWithType(VTK_POLYGON);
1569 aFilter->RegisterCellsWithType(VTK_QUAD);
1570 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1571 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1572 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1573 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
1575 aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
1576 aHightFilter->RegisterCellsWithType(VTK_POLYGON);
1577 aHightFilter->RegisterCellsWithType(VTK_QUAD);
1578 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1579 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1580 aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1581 aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
1584 if (myEntityMode & eVolumes) {
1585 if (MYDEBUG) MESSAGE("VOLUMES");
1586 aFilter->RegisterCellsWithType(VTK_TETRA);
1587 aFilter->RegisterCellsWithType(VTK_VOXEL);
1588 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1589 aFilter->RegisterCellsWithType(VTK_WEDGE);
1590 aFilter->RegisterCellsWithType(VTK_PYRAMID);
1591 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1592 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1593 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1594 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1595 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1596 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1597 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1598 //#ifdef VTK_HAVE_POLYHEDRON
1599 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1602 aHightFilter->RegisterCellsWithType(VTK_TETRA);
1603 aHightFilter->RegisterCellsWithType(VTK_VOXEL);
1604 aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1605 aHightFilter->RegisterCellsWithType(VTK_WEDGE);
1606 aHightFilter->RegisterCellsWithType(VTK_PYRAMID);
1607 aHightFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1608 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1609 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1610 aHightFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1611 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1612 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1613 aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1614 //#ifdef VTK_HAVE_POLYHEDRON
1615 aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1619 if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1620 SetVisibility(GetVisibility(),false);
1623 void SMESH_ActorDef::SetRepresentation (int theMode)
1625 int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1626 int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1627 int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1628 int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement);
1629 int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball);
1632 myRepresentation = eSurface;
1633 if (!aNbFaces && !aNbVolumes && !aNbBalls && aNbEdges) {
1634 myRepresentation = eEdge;
1635 } else if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNbBalls) {
1636 myRepresentation = ePoint;
1641 if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNb0Ds && !aNbBalls) return;
1644 if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
1647 myRepresentation = theMode;
1650 if (!GetUnstructuredGrid()->GetNumberOfCells())
1651 myRepresentation = ePoint;
1654 if (myRepresentation == ePoint) {
1662 myPickableActor = myBaseActor;
1663 myNodeActor->SetVisibility(false);
1664 myNodeExtActor->SetVisibility(false);
1665 vtkProperty *aProp = NULL, *aBackProp = NULL;
1666 vtkProperty *aPropVN = NULL, *aPropVR = NULL;
1667 SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1668 SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
1669 switch (myRepresentation) {
1671 myPickableActor = myNodeActor;
1672 myNodeActor->SetVisibility(true);
1673 aQuadraticMode = SMESH_Actor::eLines;
1674 aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
1675 aReperesent = SMESH_DeviceActor::ePoint;
1678 aProp = aBackProp = aPropVN = aPropVR = myEdgeProp;
1679 aReperesent = SMESH_DeviceActor::eInsideframe;
1682 aProp = mySurfaceProp;
1683 aBackProp = myBackSurfaceProp;
1684 aPropVN = myNormalVProp;
1685 aPropVR = myReversedVProp;
1686 aReperesent = SMESH_DeviceActor::eSurface;
1690 my2DActor->SetProperty(aProp);
1691 my2DActor->SetBackfaceProperty(aBackProp);
1692 my2DActor->SetRepresentation(aReperesent);
1694 if(aQuadraticMode == SMESH_Actor::eLines)
1695 my2DActor->SetQuadraticArcMode(false);
1696 else if(aQuadraticMode == SMESH_Actor::eArcs)
1697 my2DActor->SetQuadraticArcMode(true);
1699 my2DExtActor->SetRepresentation(aReperesent);
1701 my3DActor->SetProperty(aPropVN);
1702 my3DActor->SetBackfaceProperty(aPropVR);
1703 my3DActor->SetRepresentation(aReperesent);
1706 my1DExtActor->SetVisibility(false);
1707 my2DExtActor->SetVisibility(false);
1708 my3DExtActor->SetVisibility(false);
1710 my0DActor->SetRepresentation(aReperesent);
1711 myBallActor->SetRepresentation(aReperesent);
1713 switch(myControlMode){
1715 case eMultiConnection:
1716 aProp = aBackProp = my1DProp;
1717 if(myRepresentation != ePoint)
1718 aReperesent = SMESH_DeviceActor::eInsideframe;
1722 if(aQuadraticMode == SMESH_Actor::eLines)
1723 my1DActor->SetQuadraticArcMode(false);
1724 else if(aQuadraticMode == SMESH_Actor::eArcs)
1725 my1DActor->SetQuadraticArcMode(true);
1727 my1DActor->SetProperty(aProp);
1728 my1DActor->SetBackfaceProperty(aBackProp);
1729 my1DActor->SetRepresentation(aReperesent);
1731 my1DExtActor->SetRepresentation(aReperesent);
1733 if(myIsPointsVisible)
1734 myPickableActor = myNodeActor;
1735 if(GetPointRepresentation())
1736 myNodeActor->SetVisibility(true);
1738 SetMapper(myPickableActor->GetMapper());
1740 SetVisibility(GetVisibility(),false);
1746 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1747 if ( myIsPointsVisible == theIsPointsVisible )
1749 myIsPointsVisible = theIsPointsVisible;
1750 SetRepresentation(GetRepresentation());
1753 bool SMESH_ActorDef::GetPointRepresentation(){
1754 return myIsPointsVisible || myNodeActor->GetPointsLabeled();
1758 void SMESH_ActorDef::UpdateHighlight(){
1759 myHighlitableActor->SetHighlited(false);
1760 myHighlitableActor->SetVisibility(false);
1761 bool anIsVisible = GetVisibility();
1763 switch(myRepresentation){
1764 case SMESH_DeviceActor::eSurface:
1765 case SMESH_DeviceActor::eWireframe:
1767 if(myIsHighlighted) {
1768 myHighlitableActor->SetProperty(myHighlightProp);
1769 }else if(myIsPreselected){
1770 myHighlitableActor->SetProperty(myPreselectProp);
1771 } else if(anIsVisible){
1772 (myRepresentation == eSurface) ?
1773 myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
1775 if(GetUnstructuredGrid()->GetNumberOfCells()) {
1776 myHighlitableActor->SetHighlited(anIsVisible);
1777 myHighlitableActor->GetExtractUnstructuredGrid()->
1778 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1779 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1781 myHighlitableActor->SetVisibility(anIsVisible);
1784 case SMESH_DeviceActor::ePoint:
1786 if(myIsHighlighted) {
1787 myNodeActor->SetProperty(myHighlightProp);
1788 }else if(myIsPreselected) {
1789 myNodeActor->SetProperty(myPreselectProp);
1790 } else if(anIsVisible) {
1791 myNodeActor->SetProperty(myNodeProp);
1793 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1794 myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1801 void SMESH_ActorDef::highlight(bool theHighlight){
1802 if ( myIsHighlighted == theHighlight )
1804 myIsHighlighted = theHighlight;
1809 void SMESH_ActorDef::SetPreSelected(bool thePreselect){
1810 if ( myIsPreselected == thePreselect )
1812 myIsPreselected = thePreselect;
1818 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1820 if (myPickableActor->GetIsOpaque())
1822 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1830 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1832 if (!myPickableActor->GetIsOpaque())
1834 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1842 void SMESH_ActorDef::Render(vtkRenderer *ren){
1843 unsigned long aTime = myTimeStamp->GetMTime();
1844 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1845 unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1846 if(anObjTime > aTime || aClippingTime > aTime)
1851 void SMESH_ActorDef::Update(){
1852 if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1854 if(GetControlMode() != eNone) {
1855 unsigned long aTime = myTimeStamp->GetMTime();
1856 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1857 if (anObjTime > aTime)
1858 SetControlMode(GetControlMode(),false);
1862 myNodeActor->UpdateLabels();
1865 my0DActor->UpdateLabels();
1868 myBallActor->UpdateLabels();
1871 my1DActor->UpdateLabels();
1874 my2DActor->UpdateLabels();
1877 my3DActor->UpdateLabels();
1879 if(myIsFacesOriented){
1880 SetFacesOriented(myIsFacesOriented);
1883 if(myVisualObj->GetEntitiesFlag()) {
1884 myEntityMode |= myVisualObj->GetEntitiesState();
1887 SetEntityMode(GetEntityMode());
1888 SetVisibility(GetVisibility());
1890 myTimeStamp->Modified();
1895 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1896 SALOME_Actor::ReleaseGraphicsResources(renWin);
1898 myPickableActor->ReleaseGraphicsResources(renWin);
1902 static void GetColor(vtkProperty *theProperty, double& r,double& g,double& b){
1903 double* aColor = theProperty->GetColor();
1910 void SMESH_ActorDef::SetOpacity(double theValue){
1911 mySurfaceProp->SetOpacity(theValue);
1912 myBackSurfaceProp->SetOpacity(theValue);
1913 myNormalVProp->SetOpacity(theValue);
1914 myReversedVProp->SetOpacity(theValue);
1915 myEdgeProp->SetOpacity(theValue);
1916 myOutLineProp->SetOpacity(theValue);
1917 myNodeProp->SetOpacity(theValue);
1919 my1DProp->SetOpacity(theValue);
1920 my0DProp->SetOpacity(theValue);
1921 myBallProp->SetOpacity(theValue);
1925 double SMESH_ActorDef::GetOpacity(){
1926 return mySurfaceProp->GetOpacity();
1930 void SMESH_ActorDef::SetSufaceColor(double r,double g,double b, int delta){
1931 mySurfaceProp->SetColor(r,g,b);
1932 my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1933 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1934 if( aGroupObj->GetElementType() == SMDSAbs_Face )
1935 myNameActor->SetBackgroundColor(r,g,b);
1937 myDeltaBrightness = delta;
1938 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1939 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1943 void SMESH_ActorDef::GetSufaceColor(double& r,double& g,double& b, int& delta){
1944 ::GetColor(mySurfaceProp,r,g,b);
1945 delta = myDeltaBrightness;
1948 void SMESH_ActorDef::SetVolumeColor(double r,double g,double b, int delta){
1949 myNormalVProp->SetColor(r,g,b);
1950 my3DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1951 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1952 if( aGroupObj->GetElementType() == SMDSAbs_Volume )
1953 myNameActor->SetBackgroundColor(r,g,b);
1955 myDeltaVBrightness = delta;
1956 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1957 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1961 void SMESH_ActorDef::GetVolumeColor(double& r,double& g,double& b, int& delta){
1962 ::GetColor(myNormalVProp,r,g,b);
1963 delta = myDeltaVBrightness;
1966 void SMESH_ActorDef::SetEdgeColor(double r,double g,double b){
1967 myEdgeProp->SetColor(r,g,b);
1968 my1DProp->SetColor(r,g,b);
1969 my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1970 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1971 if( aGroupObj->GetElementType() == SMDSAbs_Edge )
1972 myNameActor->SetBackgroundColor(r,g,b);
1976 void SMESH_ActorDef::GetEdgeColor(double& r,double& g,double& b){
1977 ::GetColor(myEdgeProp,r,g,b);
1980 void SMESH_ActorDef::SetOutlineColor(double r,double g,double b){
1981 myOutLineProp->SetColor(r,g,b);
1985 void SMESH_ActorDef::GetOutlineColor(double& r,double& g,double& b){
1986 ::GetColor(myOutLineProp,r,g,b);
1990 void SMESH_ActorDef::SetNodeColor(double r,double g,double b){
1991 myNodeProp->SetColor(r,g,b);
1992 myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1993 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1994 if( aGroupObj->GetElementType() == SMDSAbs_Node )
1995 myNameActor->SetBackgroundColor(r,g,b);
1999 void SMESH_ActorDef::GetNodeColor(double& r,double& g,double& b){
2000 ::GetColor(myNodeProp,r,g,b);
2003 void SMESH_ActorDef::Set0DColor(double r,double g,double b){
2004 my0DProp->SetColor(r,g,b);
2005 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2006 if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
2007 myNameActor->SetBackgroundColor(r,g,b);
2011 void SMESH_ActorDef::Get0DColor(double& r,double& g,double& b){
2012 ::GetColor(my0DProp,r,g,b);
2015 void SMESH_ActorDef::SetBallColor(double r,double g,double b){
2016 myBallProp->SetColor(r,g,b);
2017 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2018 if( aGroupObj->GetElementType() == SMDSAbs_Ball )
2019 myNameActor->SetBackgroundColor(r,g,b);
2023 void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b){
2024 ::GetColor(myBallProp,r,g,b);
2027 void SMESH_ActorDef::SetHighlightColor(double r,double g,double b){
2028 myHighlightProp->SetColor(r,g,b);
2032 void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b){
2033 ::GetColor(myHighlightProp,r,g,b);
2036 void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b){
2037 myPreselectProp->SetColor(r,g,b);
2041 void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b){
2042 ::GetColor(myPreselectProp,r,g,b);
2046 double SMESH_ActorDef::GetLineWidth(){
2047 return myEdgeProp->GetLineWidth();
2051 void SMESH_ActorDef::SetLineWidth(double theVal){
2052 myEdgeProp->SetLineWidth(theVal);
2054 my1DProp->SetLineWidth(theVal + aLineWidthInc);
2055 my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
2056 my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
2057 my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
2058 myOutLineProp->SetLineWidth(theVal);
2059 myHighlightProp->SetLineWidth(theVal);
2060 myPreselectProp->SetLineWidth(theVal);
2064 double SMESH_ActorDef::GetOutlineWidth()
2066 return myOutLineProp->GetLineWidth();
2069 void SMESH_ActorDef::SetOutlineWidth(double theVal)
2071 myOutLineProp->SetLineWidth(theVal);
2075 void SMESH_ActorDef::Set0DSize(double theVal){
2076 my0DProp->SetPointSize(theVal);
2077 myHighlightProp->SetPointSize(theVal);
2078 myPreselectProp->SetPointSize(theVal);
2080 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2081 aCustom->Set0DSize(theVal);
2083 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2084 aCustom->Set0DSize(theVal);
2090 double SMESH_ActorDef::Get0DSize(){
2091 return my0DProp->GetPointSize();
2094 void SMESH_ActorDef::SetBallSize(double theVal){
2095 myBallProp->SetPointSize(theVal);
2097 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2098 aCustom->SetBallSize(theVal);
2100 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2101 aCustom->SetBallSize(theVal);
2107 double SMESH_ActorDef::GetBallSize(){
2108 return myBallProp->GetPointSize();
2111 double SMESH_ActorDef::GetBallScale()
2113 return myBallActor->GetBallScale();
2116 void SMESH_ActorDef::SetBallScale( double theVal )
2118 myBallActor->SetBallScale( theVal );
2121 int SMESH_ActorDef::GetObjDimension( const int theObjId )
2123 return myVisualObj->GetElemDimension( theObjId );
2128 IsImplicitFunctionUsed() const
2130 return myBaseActor->IsImplicitFunctionUsed();
2134 SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
2136 myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2137 myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2139 myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2141 myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2143 my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2144 myBallActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2145 //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2147 my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2148 my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2150 my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2151 my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2152 my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2153 my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2157 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
2160 myImplicitBoolean->GetFunction()->AddItem(thePlane);
2161 myCippingPlaneCont.push_back(thePlane);
2162 if(!IsImplicitFunctionUsed())
2163 SetImplicitFunctionUsed(true);
2164 myNodeActor->UpdateLabels();
2166 return myCippingPlaneCont.size();
2170 SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
2173 myPlaneCollection->AddItem( thePlane );
2177 SMESH_ActorDef::SetOpenGLClippingPlane()
2179 // before use this method you must add clipping planes using method
2180 // SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
2181 if( !myPlaneCollection->GetNumberOfItems() )
2184 // It is necessary to set plane collection for each mapper of actor
2185 // and update current inputs of mapper
2186 myNodeActor->SetPlaneCollection( myPlaneCollection );
2187 myNodeActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2189 myBaseActor->SetPlaneCollection( myPlaneCollection );
2190 myBaseActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2192 myHighlitableActor->SetPlaneCollection( myPlaneCollection );
2193 myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2195 my1DActor->SetPlaneCollection( myPlaneCollection );
2196 my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2198 my2DActor->SetPlaneCollection( myPlaneCollection );
2199 my2DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2201 myNodeExtActor->SetPlaneCollection( myPlaneCollection );
2202 myNodeExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2204 my0DActor->SetPlaneCollection( myPlaneCollection );
2205 my0DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2207 myBallActor->SetPlaneCollection( myPlaneCollection );
2208 myBallActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2210 my1DExtActor->SetPlaneCollection( myPlaneCollection );
2211 my1DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2213 my2DExtActor->SetPlaneCollection( myPlaneCollection );
2214 my2DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2216 my3DActor->SetPlaneCollection( myPlaneCollection );
2217 my3DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2219 my3DExtActor->SetPlaneCollection( myPlaneCollection );
2220 my3DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2230 RemoveAllClippingPlanes()
2232 myPlaneCollection->RemoveAllItems();
2233 myImplicitBoolean->GetFunction()->RemoveAllItems();
2234 myImplicitBoolean->GetFunction()->Modified(); // VTK bug
2235 myCippingPlaneCont.clear();
2236 SetImplicitFunctionUsed(false);
2237 myNodeActor->UpdateLabels();
2242 GetNumberOfClippingPlanes()
2244 return myCippingPlaneCont.size();
2249 GetClippingPlane(vtkIdType theID)
2251 if(theID >= myCippingPlaneCont.size())
2253 return myCippingPlaneCont[theID].Get();
2256 void SMESH_ActorDef::UpdateScalarBar()
2258 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
2262 vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
2264 QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
2265 aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2267 aScalarBarTitleProp->SetFontFamilyToArial();
2269 if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
2271 QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
2272 if ( f.family() == "Arial" )
2273 aScalarBarTitleProp->SetFontFamilyToArial();
2274 else if ( f.family() == "Courier" )
2275 aScalarBarTitleProp->SetFontFamilyToCourier();
2276 else if ( f.family() == "Times" )
2277 aScalarBarTitleProp->SetFontFamilyToTimes();
2280 aScalarBarTitleProp->BoldOn();
2282 aScalarBarTitleProp->BoldOff();
2285 aScalarBarTitleProp->ItalicOn();
2287 aScalarBarTitleProp->ItalicOff();
2290 aScalarBarTitleProp->ShadowOn();
2292 aScalarBarTitleProp->ShadowOff();
2295 myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
2296 aScalarBarTitleProp->Delete();
2298 vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
2300 aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
2301 aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2303 aScalarBarLabelProp->SetFontFamilyToArial();
2304 if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
2306 QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
2307 if( f.family() == "Arial" )
2308 aScalarBarLabelProp->SetFontFamilyToArial();
2309 else if( f.family() == "Courier" )
2310 aScalarBarLabelProp->SetFontFamilyToCourier();
2311 else if( f.family() == "Times" )
2312 aScalarBarLabelProp->SetFontFamilyToTimes();
2315 aScalarBarLabelProp->BoldOn();
2317 aScalarBarLabelProp->BoldOff();
2320 aScalarBarLabelProp->ItalicOn();
2322 aScalarBarLabelProp->ItalicOff();
2325 aScalarBarLabelProp->ShadowOn();
2327 aScalarBarLabelProp->ShadowOff();
2330 myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
2331 aScalarBarLabelProp->Delete();
2333 bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
2334 QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
2336 myScalarBarActor->SetOrientationToHorizontal();
2338 myScalarBarActor->SetOrientationToVertical();
2341 double aXVal = horiz ? 0.20 : 0.01;
2342 if( mgr->hasValue( "SMESH", name + "x" ) )
2343 aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
2345 double aYVal = horiz ? 0.01 : 0.1;
2346 if( mgr->hasValue( "SMESH", name + "y" ) )
2347 aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
2348 myScalarBarActor->SetPosition( aXVal, aYVal );
2350 double aWVal = horiz ? 0.60 : 0.10;
2351 if( mgr->hasValue( "SMESH", name + "width" ) )
2352 aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
2353 myScalarBarActor->SetWidth( aWVal );
2355 double aHVal = horiz ? 0.12 : 0.80;
2356 if( mgr->hasValue( "SMESH", name + "height" ) )
2357 aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
2358 myScalarBarActor->SetHeight( aHVal );
2361 if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
2362 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
2363 myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
2366 if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
2367 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
2368 myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
2370 bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
2371 myScalarBarActor->SetDistributionVisibility(distributionVisibility);
2373 int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
2374 myScalarBarActor->SetDistributionColoringType(coloringType);
2376 QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
2377 QColor(255, 255, 255));
2379 rgb[0]= distributionColor.red()/255.;
2380 rgb[1]= distributionColor.green()/255.;
2381 rgb[2]= distributionColor.blue()/255.;
2382 myScalarBarActor->SetDistributionColor(rgb);
2387 void SMESH_ActorDef::UpdateDistribution()
2389 if(SMESH::Controls::NumericalFunctor* fun =
2390 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2392 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2393 std::vector<int> nbEvents;
2394 std::vector<double> funValues;
2395 SMESH_VisualObjDef::TEntityList elems;
2396 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2397 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2398 std::vector<int> elemIds;
2399 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2400 elemIds.push_back( (*e)->GetID());
2401 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2402 double * range = lookupTable->GetRange();
2403 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2404 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2405 myScalarBarActor->SetDistribution(nbEvents);
2409 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
2412 case SMESH_Actor::eLines :
2413 myHighlitableActor->SetQuadraticArcMode(false);
2414 my2DActor->SetQuadraticArcMode(false);
2415 my1DActor->SetQuadraticArcMode(false);
2417 case SMESH_Actor::eArcs :
2418 myHighlitableActor->SetQuadraticArcMode(true);
2419 if(GetRepresentation() != SMESH_Actor::ePoint) {
2420 my2DActor->SetQuadraticArcMode(true);
2421 my1DActor->SetQuadraticArcMode(true);
2430 SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
2432 if(myHighlitableActor->GetQuadraticArcMode())
2433 return SMESH_Actor::eArcs;
2435 return SMESH_Actor::eLines;
2438 void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
2440 SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
2441 myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
2442 myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
2445 void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
2447 SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
2448 myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2449 myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2450 myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
2453 #ifndef DISABLE_PLOT2DVIEWER
2454 SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
2457 my2dHistogram->clearAllPoints();
2459 if(SMESH::Controls::NumericalFunctor* fun =
2460 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2463 if(!my2dHistogram) {
2464 my2dHistogram = new SPlot2d_Histogram();
2465 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
2466 my2dHistogram->setIO(anIO);
2469 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2470 std::vector<int> nbEvents;
2471 std::vector<double> funValues;
2472 SMESH_VisualObjDef::TEntityList elems;
2473 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2474 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2475 std::vector<int> elemIds;
2477 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2478 elemIds.push_back( (*e)->GetID());
2480 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2481 double * range = lookupTable->GetRange();
2482 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2483 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2485 for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
2486 my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
2488 if(funValues.size() >= 2)
2489 my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
2493 //Color of the histogram
2494 if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
2495 my2dHistogram->setAutoAssign(true);
2498 myScalarBarActor->GetDistributionColor(rgb);
2499 QColor aColor = QColor( (int)( rgb[0]*255 ), (int)( rgb[1]*255 ), (int)( rgb[2]*255 ) );
2500 my2dHistogram->setColor(aColor);
2504 return my2dHistogram;