1 // Copyright (C) 2007-2013 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.
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 <vtkImplicitBoolean.h>
79 #include <vtkImplicitFunctionCollection.h>
81 #include <vtkConfigure.h>
82 #if !defined(VTK_XVERSION)
83 #define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
86 #include "utilities.h"
89 static int MYDEBUG = 1;
91 static int MYDEBUG = 1;
94 static int aLineWidthInc = 2;
97 SMESH_ActorDef* SMESH_ActorDef::New(){
98 return new SMESH_ActorDef();
102 SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
103 const char* theEntry,
107 SMESH_ActorDef* anActor = NULL;
108 if(theVisualObj->IsValid() ) {
109 anActor = SMESH_ActorDef::New();
110 if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
115 anActor->UpdateScalarBar();
121 SMESH_ActorDef::SMESH_ActorDef()
123 if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
124 myBaseActor = SMESH_DeviceActor::New();
126 myTimeStamp = vtkTimeStamp::New();
128 myIsPointsVisible = false;
129 myIsEntityModeCache = false;
131 myHighlightActor = SMESH_SVTKActor::New();
132 myHighlightActor->Delete(); // vtkSmartPointer!
133 myHighlightActor->Initialize();
135 myPreHighlightActor = SMESH_SVTKActor::New();
136 myPreHighlightActor->Delete();
137 myPreHighlightActor->Initialize();
139 myIsShrinkable = false;
142 myIsFacesOriented = false;
144 myControlsPrecision = -1;
145 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
147 if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
148 myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
150 vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
151 vtkFloatingPointType aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
152 vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
153 vtkFloatingPointType aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
155 SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
157 bool anItalicNd = false;
158 bool aShadowNd = false;
160 if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
161 QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
162 if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
163 else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
164 else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
166 anItalicNd = f.italic();
167 aShadowNd = f.overline();
168 aSizeNd = f.pointSize();
170 vtkFloatingPointType anRGBNd[3] = {1,1,1};
171 SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
173 SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
175 bool anItalicEl = false;
176 bool aShadowEl = false;
178 if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
179 QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
180 if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
181 else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
182 else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
184 anItalicEl = f.italic();
185 aShadowEl = f.overline();
186 aSizeEl = f.pointSize();
188 vtkFloatingPointType anRGBEl[3] = {0,1,0};
189 SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
191 vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
192 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
194 //Definition 2D and 3D devices of the actor
195 //-----------------------------------------
196 vtkFloatingPointType anRGB[3] = {1,1,1};
197 mySurfaceProp = vtkProperty::New();
200 SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
201 mySurfaceProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
202 myDeltaBrightness = delta;
204 myBackSurfaceProp = vtkProperty::New();
205 bfc = Qtx::mainColorToSecondary(ffc, delta);
206 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
208 myNormalVProp = vtkProperty::New();
209 SMESH::GetColor( "SMESH", "volume_color", ffc, delta, "255,0,170|-100" );
210 myNormalVProp->SetColor( ffc.redF(), ffc.greenF(), ffc.blueF() );
211 myDeltaVBrightness = delta;
213 myReversedVProp = vtkProperty::New();
214 bfc = Qtx::mainColorToSecondary(ffc, delta);
215 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
217 my2DActor = SMESH_CellLabelActor::New();
218 my2DActor->SetStoreGemetryMapping(true);
219 my2DActor->SetUserMatrix(aMatrix);
220 my2DActor->PickableOff();
221 my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
222 my2DActor->SetProperty(mySurfaceProp);
223 my2DActor->SetBackfaceProperty(myBackSurfaceProp);
224 my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
225 aFilter = my2DActor->GetExtractUnstructuredGrid();
226 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
227 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
228 aFilter->RegisterCellsWithType(VTK_POLYGON);
229 aFilter->RegisterCellsWithType(VTK_QUAD);
230 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
231 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
232 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
234 my2DExtProp = vtkProperty::New();
235 my2DExtProp->DeepCopy(mySurfaceProp);
236 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
237 anRGB[0] = 1 - anRGB[0];
238 anRGB[1] = 1 - anRGB[1];
239 anRGB[2] = 1 - anRGB[2];
240 my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
242 my2DExtActor = SMESH_DeviceActor::New();
243 my2DExtActor->SetUserMatrix(aMatrix);
244 my2DExtActor->PickableOff();
245 my2DExtActor->SetProperty(my2DExtProp);
246 my2DExtActor->SetBackfaceProperty(my2DExtProp);
247 my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
248 aFilter = my2DExtActor->GetExtractUnstructuredGrid();
249 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
250 aFilter->RegisterCellsWithType(VTK_POLYGON);
251 aFilter->RegisterCellsWithType(VTK_QUAD);
252 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
253 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
254 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
256 my3DActor = SMESH_CellLabelActor::New();
257 my3DActor->SetStoreGemetryMapping(true);
258 my3DActor->SetUserMatrix(aMatrix);
259 my3DActor->PickableOff();
260 my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
261 my3DActor->SetProperty(myNormalVProp);
262 my3DActor->SetBackfaceProperty(myReversedVProp);
263 my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
264 my3DActor->SetCoincident3DAllowed(true);
265 aFilter = my3DActor->GetExtractUnstructuredGrid();
266 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
267 aFilter->RegisterCellsWithType(VTK_TETRA);
268 aFilter->RegisterCellsWithType(VTK_VOXEL);
269 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
270 aFilter->RegisterCellsWithType(VTK_WEDGE);
271 aFilter->RegisterCellsWithType(VTK_PYRAMID);
272 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
273 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
274 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
275 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
276 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
277 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
278 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
279 //#ifdef VTK_HAVE_POLYHEDRON
280 MESSAGE("RegisterCellsWithType(VTK_POLYHEDRON)");
281 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
284 my3DExtProp = vtkProperty::New();
285 my3DExtProp->DeepCopy(myNormalVProp);
286 SMESH::GetColor( "SMESH", "volume_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 170 ) );
287 anRGB[0] = 1 - anRGB[0];
288 anRGB[1] = 1 - anRGB[1];
289 anRGB[2] = 1 - anRGB[2];
290 my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
292 my3DExtActor = SMESH_DeviceActor::New();
293 my3DExtActor->SetUserMatrix(aMatrix);
294 my3DExtActor->PickableOff();
295 my3DExtActor->SetProperty(my3DExtProp);
296 my3DExtActor->SetBackfaceProperty(my3DExtProp);
297 my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
298 my3DExtActor->SetCoincident3DAllowed(true);
299 aFilter = my3DExtActor->GetExtractUnstructuredGrid();
300 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
301 aFilter->RegisterCellsWithType(VTK_TETRA);
302 aFilter->RegisterCellsWithType(VTK_VOXEL);
303 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
304 aFilter->RegisterCellsWithType(VTK_WEDGE);
305 aFilter->RegisterCellsWithType(VTK_PYRAMID);
306 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
307 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
308 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
309 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
310 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
311 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
312 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
313 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
315 //Definition 1D device of the actor
316 //---------------------------------
317 myEdgeProp = vtkProperty::New();
318 myEdgeProp->SetAmbient(1.0);
319 myEdgeProp->SetDiffuse(0.0);
320 myEdgeProp->SetSpecular(0.0);
321 SMESH::GetColor( "SMESH", "wireframe_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
322 myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
323 myEdgeProp->SetLineWidth(aLineWidth);
325 my1DActor = SMESH_CellLabelActor::New();
326 my1DActor->SetStoreGemetryMapping(true);
327 my1DActor->SetUserMatrix(aMatrix);
328 my1DActor->PickableOff();
329 my1DActor->SetHighlited(true);
330 my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
331 my1DActor->SetProperty(myEdgeProp);
332 my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
333 aFilter = my1DActor->GetExtractUnstructuredGrid();
334 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
335 aFilter->RegisterCellsWithType(VTK_LINE);
336 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
338 my1DProp = vtkProperty::New();
339 my1DProp->DeepCopy(myEdgeProp);
340 my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
341 my1DProp->SetPointSize(aElem0DSize);
343 my1DExtProp = vtkProperty::New();
344 my1DExtProp->DeepCopy(myEdgeProp);
345 anRGB[0] = 1 - anRGB[0];
346 anRGB[1] = 1 - anRGB[1];
347 anRGB[2] = 1 - anRGB[2];
348 my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
349 my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
350 my1DExtProp->SetPointSize(aElem0DSize);
352 my1DExtActor = SMESH_DeviceActor::New();
353 my1DExtActor->SetUserMatrix(aMatrix);
354 my1DExtActor->PickableOff();
355 my1DExtActor->SetHighlited(true);
356 my1DExtActor->SetVisibility(false);
357 my1DExtActor->SetProperty(my1DExtProp);
358 my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
359 aFilter = my1DExtActor->GetExtractUnstructuredGrid();
360 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
361 aFilter->RegisterCellsWithType(VTK_LINE);
362 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
365 //Definition 0D device of the actor (0d elements)
366 //-----------------------------------------------
367 my0DProp = vtkProperty::New();
368 SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
369 my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
370 my0DProp->SetPointSize(aElem0DSize);
372 my0DActor = SMESH_CellLabelActor::New();
373 my0DActor->SetUserMatrix(aMatrix);
374 my0DActor->SetStoreGemetryMapping(true);
375 my0DActor->PickableOff();
376 my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
377 my0DActor->SetVisibility(false);
378 my0DActor->SetProperty(my0DProp);
379 my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
380 aFilter = my0DActor->GetExtractUnstructuredGrid();
381 //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
382 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
383 aFilter->RegisterCellsWithType(VTK_VERTEX);
385 //Definition 0D device of the actor (ball elements)
386 //-----------------------------------------------
387 myBallProp = vtkProperty::New();
388 SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
389 myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
390 myBallProp->SetPointSize(aBallElemSize);
392 myBallActor = SMESH_CellLabelActor::New();
393 myBallActor->SetUserMatrix(aMatrix);
394 myBallActor->SetStoreGemetryMapping(true);
395 myBallActor->PickableOff();
396 myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
397 myBallActor->SetVisibility(false);
398 myBallActor->SetProperty(myBallProp);
399 myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
400 aFilter = myBallActor->GetExtractUnstructuredGrid();
401 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
402 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
404 //my0DExtProp = vtkProperty::New();
405 //my0DExtProp->DeepCopy(my0DProp);
406 //anRGB[0] = 1 - anRGB[0];
407 //anRGB[1] = 1 - anRGB[1];
408 //anRGB[2] = 1 - anRGB[2];
409 //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
410 //my0DExtProp->SetPointSize(aElem0DSize);
412 //my0DExtActor = SMESH_DeviceActor::New();
413 //my0DExtActor->SetUserMatrix(aMatrix);
414 //my0DExtActor->SetStoreClippingMapping(true);
415 //my0DExtActor->PickableOff();
416 //my0DExtActor->SetHighlited(true);
417 //my0DExtActor->SetVisibility(false);
418 //my0DExtActor->SetProperty(my0DExtProp);
419 //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
420 //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
421 ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
422 //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
423 //aFilter->RegisterCellsWithType(VTK_VERTEX);
426 //Definition 0D device of the actor (nodes)
427 //-----------------------------------------
428 myNodeProp = vtkProperty::New();
429 SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
430 myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
432 myNodeActor = SMESH_NodeLabelActor::New();
433 myNodeActor->SetUserMatrix(aMatrix);
434 myNodeActor->SetStoreClippingMapping(true);
435 myNodeActor->PickableOff();
436 myNodeActor->SetVisibility(false);
437 myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
438 myNodeActor->SetProperty(myNodeProp);
439 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
440 aFilter = myNodeActor->GetExtractUnstructuredGrid();
441 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
443 myNodeExtProp = vtkProperty::New();
444 myNodeExtProp->DeepCopy(myNodeProp);
445 anRGB[0] = 1 - anRGB[0];
446 anRGB[1] = 1 - anRGB[1];
447 anRGB[2] = 1 - anRGB[2];
448 myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
450 myNodeExtActor = SMESH_DeviceActor::New();
451 myNodeExtActor->SetUserMatrix(aMatrix);
452 myNodeExtActor->SetStoreClippingMapping(true);
453 myNodeExtActor->PickableOff();
454 myNodeExtActor->SetHighlited(true);
455 myNodeExtActor->SetVisibility(false);
456 myNodeExtActor->SetProperty(myNodeExtProp);
457 myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
458 aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
459 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
460 aFilter->RegisterCellsWithType(VTK_VERTEX);
462 //Definition of Pickable and Highlitable engines
463 //----------------------------------------------
465 myBaseActor->SetUserMatrix(aMatrix);
466 myBaseActor->SetStoreGemetryMapping(true);
467 myBaseActor->GetProperty()->SetOpacity(0.0);
468 myPickableActor = myBaseActor;
470 myHighlightProp = vtkProperty::New();
471 myHighlightProp->SetAmbient(1.0);
472 myHighlightProp->SetDiffuse(0.0);
473 myHighlightProp->SetSpecular(0.0);
474 SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
475 myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
476 myHighlightProp->SetPointSize(aElem0DSize); // ??
477 myHighlightProp->SetLineWidth(aLineWidth);
478 myHighlightProp->SetRepresentation(1);
480 myBallHighlightProp = vtkProperty::New();
481 myBallHighlightProp->DeepCopy(myHighlightProp);
482 myBallHighlightProp->SetPointSize(aBallElemSize);
485 myOutLineProp = vtkProperty::New();
486 myOutLineProp->SetAmbient(1.0);
487 myOutLineProp->SetDiffuse(0.0);
488 myOutLineProp->SetSpecular(0.0);
489 SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
490 myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
491 myOutLineProp->SetLineWidth(aOutlineWidth);
492 myOutLineProp->SetRepresentation(1);
494 myPreselectProp = vtkProperty::New();
495 myPreselectProp->SetAmbient(1.0);
496 myPreselectProp->SetDiffuse(0.0);
497 myPreselectProp->SetSpecular(0.0);
498 SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
499 myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
500 myPreselectProp->SetPointSize(aElem0DSize); // ??
501 myPreselectProp->SetLineWidth(aLineWidth);
502 myPreselectProp->SetRepresentation(1);
504 myBallPreselectProp = vtkProperty::New();
505 myBallPreselectProp->DeepCopy(myPreselectProp);
506 myBallPreselectProp->SetPointSize(aBallElemSize);
508 myHighlitableActor = SMESH_DeviceActor::New();
509 myHighlitableActor->SetUserMatrix(aMatrix);
510 myHighlitableActor->PickableOff();
511 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
512 myHighlitableActor->SetCoincident3DAllowed(true);
519 myControlMode = eNone;
520 myControlActor = my2DActor;
522 //Definition of myScalarBarActor
523 //------------------------------
524 myLookupTable = vtkLookupTable::New();
525 //Fix for Bug PAL5195 - SMESH764:
526 //Controls - Aspect Ratio: incorrect colors of the best and worst values
527 myLookupTable->SetHueRange(0.667,0.0);
529 myScalarBarActor = SMESH_ScalarBarActor::New();
530 myScalarBarActor->SetVisibility(false);
531 myScalarBarActor->SetLookupTable(myLookupTable);
534 //Incorrect "Min value" in Scalar Bar in Mesh:
535 // myScalarBarActor->SetLabelFormat("%.4g");
536 // changes was commented because of regression bug IPAL 19981
538 mgr = SUIT_Session::session()->resourceMgr();
542 myEntityMode = eAllEntity;
543 myEntityModeCache = eAllEntity;
546 myImplicitBoolean = vtkImplicitBoolean::New();
547 myImplicitBoolean->SetOperationTypeToIntersection();
549 //Quadratic 2D elements representation
550 //-----------------------------------------------------------------------------
551 int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
552 if(aQuadratic2DMode == 0){
553 myHighlitableActor->SetQuadraticArcMode(false);
554 my2DActor->SetQuadraticArcMode(false);
555 my1DActor->SetQuadraticArcMode(false);
557 else if(aQuadratic2DMode == 1){
558 myHighlitableActor->SetQuadraticArcMode(true);
559 my2DActor->SetQuadraticArcMode(true);
560 my1DActor->SetQuadraticArcMode(true);
563 int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
564 myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
565 my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
567 // Set colors of the name actor
568 SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
569 myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
570 SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
571 myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
573 #ifndef DISABLE_PLOT2DVIEWER
577 SetBallSize(aBallElemSize);
578 Set0DSize(aElem0DSize);
582 SMESH_ActorDef::~SMESH_ActorDef()
584 if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
586 // Please keep the order same as one in the header file
588 myTimeStamp->Delete();
590 myScalarBarActor->Delete();
591 myLookupTable->Delete();
593 mySurfaceProp->Delete();
594 myBackSurfaceProp->Delete();
595 myNormalVProp->Delete();
596 myReversedVProp->Delete();
597 myEdgeProp->Delete();
598 myNodeProp->Delete();
600 myNodeActor->Delete();
601 myBaseActor->Delete();
602 //myPickableActor->Delete(); myPickableActor == myBaseActor
604 myHighlightProp->Delete();
605 myOutLineProp->Delete();
606 myPreselectProp->Delete();
608 myBallHighlightProp->Delete();
609 myBallPreselectProp->Delete();
611 myHighlitableActor->Delete();
613 my2DExtProp->Delete();
614 my3DExtProp->Delete();
616 my2DExtActor->Delete();
618 my3DExtActor->Delete();
619 // myControlActor->Delete(); myControlActor == my2DActor
621 myNodeExtProp->Delete();
622 myNodeExtActor->Delete();
626 my1DExtProp->Delete();
627 my1DExtActor->Delete();
631 myBallProp->Delete();
632 myBallActor->Delete();
633 //my0DExtProp->Delete();
634 //my0DExtActor->Delete();
636 myImplicitBoolean->Delete();
638 #ifndef DISABLE_PLOT2DVIEWER
640 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
641 delete my2dHistogram;
646 void SMESH_ActorDef::Delete()
648 // This is just to guarantee that the DeleteActorEvent (which was previously invoked
649 // from the actor's destructor) will be thrown before removing the actor's observers,
650 // that is done inside the Superclass::Delete() method but before the destructor itself
651 // (see the issue 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash).
652 // The event is caught by SMESHGUI::ProcessEvents() static method.
653 this->InvokeEvent( SMESH::DeleteActorEvent, NULL );
655 Superclass::Delete();
658 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
661 myNodeActor->SetPointsLabeled(theIsPointsLabeled);
662 SetRepresentation(GetRepresentation());
663 myTimeStamp->Modified();
667 void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize,
668 bool theBold, bool theItalic, bool theShadow,
669 vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
672 myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
673 SetRepresentation( GetRepresentation() );
674 myTimeStamp->Modified();
678 void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize,
679 bool theBold, bool theItalic, bool theShadow,
680 vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b )
683 my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
684 SetRepresentation( GetRepresentation() );
685 myTimeStamp->Modified();
688 my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
689 SetRepresentation( GetRepresentation() );
690 myTimeStamp->Modified();
693 my1DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
694 SetRepresentation( GetRepresentation() );
695 myTimeStamp->Modified();
698 my0DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
699 SetRepresentation( GetRepresentation() );
700 myTimeStamp->Modified();
703 myBallActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
704 SetRepresentation( GetRepresentation() );
705 myTimeStamp->Modified();
709 bool SMESH_ActorDef::GetPointsLabeled() {
710 return myNodeActor && myNodeActor->GetPointsLabeled();
713 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
716 my3DActor->SetCellsLabeled(theIsCellsLabeled);
719 my2DActor->SetCellsLabeled(theIsCellsLabeled);
722 my1DActor->SetCellsLabeled(theIsCellsLabeled);
725 my0DActor->SetCellsLabeled(theIsCellsLabeled);
728 myBallActor->SetCellsLabeled(theIsCellsLabeled);
730 myTimeStamp->Modified();
734 bool SMESH_ActorDef::GetCellsLabeled() {
737 result = result || my3DActor->GetCellsLabeled();
740 result = result || my2DActor->GetCellsLabeled();
743 result = result || my1DActor->GetCellsLabeled();
746 result = result || my0DActor->GetCellsLabeled();
749 result = result || myBallActor->GetCellsLabeled();
755 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
757 myIsFacesOriented = theIsFacesOriented;
759 my2DActor->SetFacesOriented(theIsFacesOriented);
760 my3DActor->SetFacesOriented(theIsFacesOriented);
762 myTimeStamp->Modified();
765 bool SMESH_ActorDef::GetFacesOriented()
767 return myIsFacesOriented;
770 void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
772 my2DActor->SetFacesOrientationColor( r, g, b );
773 my3DActor->SetFacesOrientationColor( r, g, b );
776 void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
778 my3DActor->GetFacesOrientationColor( r, g, b );
781 void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale)
783 my2DActor->SetFacesOrientationScale( theScale );
784 my3DActor->SetFacesOrientationScale( theScale );
787 vtkFloatingPointType SMESH_ActorDef::GetFacesOrientationScale()
789 return my3DActor->GetFacesOrientationScale();
792 void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
794 my2DActor->SetFacesOrientation3DVectors( theState );
795 my3DActor->SetFacesOrientation3DVectors( theState );
798 bool SMESH_ActorDef::GetFacesOrientation3DVectors()
800 return my3DActor->GetFacesOrientation3DVectors();
806 SetControlMode(eControl theMode)
808 SetControlMode(theMode,true);
814 SetControlMode(eControl theMode,
815 bool theCheckEntityMode)
817 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
818 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
819 lookupTable->SetScale(VTK_SCALE_LINEAR);
821 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
825 myControlMode = eNone;
826 theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
828 my0DActor->GetMapper()->SetScalarVisibility(false);
829 my1DActor->GetMapper()->SetScalarVisibility(false);
830 my2DActor->GetMapper()->SetScalarVisibility(false);
831 my3DActor->GetMapper()->SetScalarVisibility(false);
832 myBallActor->GetMapper()->SetScalarVisibility(false);
833 myScalarBarActor->SetVisibility(false);
835 bool anIsScalarVisible = theMode > eNone;
837 if(anIsScalarVisible) {
841 SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
842 aControl->SetPrecision( myControlsPrecision );
843 myFunctor.reset( aControl );
844 myControlActor = my1DActor;
849 myFunctor.reset(new SMESH::Controls::Length2D());
850 myControlActor = my2DActor;
854 myFunctor.reset(new SMESH::Controls::FreeBorders());
855 myControlActor = my1DActor;
858 myFunctor.reset(new SMESH::Controls::FreeEdges());
859 myControlActor = my2DActor;
862 myFunctor.reset(new SMESH::Controls::FreeNodes());
863 myControlActor = myNodeActor;
866 myFunctor.reset(new SMESH::Controls::FreeFaces());
867 myControlActor = my2DActor;
869 case eCoincidentNodes:
871 SMESH::Controls::CoincidentNodes* cn = new SMESH::Controls::CoincidentNodes();
872 double tol = mgr->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 );
873 cn->SetTolerance( tol );
875 myControlActor = myNodeActor;
878 case eCoincidentElems1D:
879 myFunctor.reset(new SMESH::Controls::CoincidentElements1D());
880 myControlActor = my1DActor;
882 case eCoincidentElems2D:
883 myFunctor.reset(new SMESH::Controls::CoincidentElements2D());
884 myControlActor = my2DActor;
886 case eCoincidentElems3D:
887 myFunctor.reset(new SMESH::Controls::CoincidentElements3D());
888 myControlActor = my3DActor;
890 case eBareBorderFace:
891 myFunctor.reset(new SMESH::Controls::BareBorderFace());
892 myControlActor = my2DActor;
894 case eOverConstrainedFace:
895 myFunctor.reset(new SMESH::Controls::OverConstrainedFace());
896 myControlActor = my2DActor;
898 case eMultiConnection:
899 myFunctor.reset(new SMESH::Controls::MultiConnection());
900 myControlActor = my1DActor;
902 case eMultiConnection2D:
903 myFunctor.reset(new SMESH::Controls::MultiConnection2D());
904 myControlActor = my2DActor;
908 SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
909 aControl->SetPrecision( myControlsPrecision );
910 myFunctor.reset( aControl );
911 myControlActor = my2DActor;
916 SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
917 aControl->SetPrecision( myControlsPrecision );
918 myFunctor.reset( aControl );
919 myControlActor = my2DActor;
924 SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
925 aControl->SetPrecision( myControlsPrecision );
926 myFunctor.reset( aControl );
927 myControlActor = my2DActor;
932 SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
933 aControl->SetPrecision( myControlsPrecision );
934 myFunctor.reset( aControl );
935 myControlActor = my3DActor;
940 SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
941 aControl->SetPrecision( myControlsPrecision );
942 myFunctor.reset( aControl );
943 myControlActor = my3DActor;
946 case eMaxElementLength2D:
948 SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
949 aControl->SetPrecision( myControlsPrecision );
950 myFunctor.reset( aControl );
951 myControlActor = my2DActor;
954 case eMaxElementLength3D:
956 SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
957 aControl->SetPrecision( myControlsPrecision );
958 myFunctor.reset( aControl );
959 myControlActor = my3DActor;
962 case eBareBorderVolume:
964 myFunctor.reset(new SMESH::Controls::BareBorderVolume());
965 myControlActor = my3DActor;
968 case eOverConstrainedVolume:
970 myFunctor.reset(new SMESH::Controls::OverConstrainedVolume());
971 myControlActor = my3DActor;
976 SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
977 aControl->SetPrecision( myControlsPrecision );
978 myFunctor.reset( aControl );
979 myControlActor = my2DActor;
984 SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
985 aControl->SetPrecision( myControlsPrecision );
986 myFunctor.reset( aControl );
987 myControlActor = my2DActor;
992 SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
993 aControl->SetPrecision( myControlsPrecision );
994 myFunctor.reset( aControl );
995 myControlActor = my2DActor;
1002 vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
1003 vtkIdType aNbCells = aGrid->GetNumberOfCells();
1005 myControlMode = theMode;
1006 switch(myControlMode){
1008 case eCoincidentNodes:
1009 myNodeExtActor->SetExtControlMode(myFunctor);
1013 case eCoincidentElems1D:
1014 my1DExtActor->SetExtControlMode(myFunctor);
1017 case eBareBorderFace:
1018 case eOverConstrainedFace:
1019 case eCoincidentElems2D:
1020 my2DExtActor->SetExtControlMode(myFunctor);
1022 case eBareBorderVolume:
1023 case eOverConstrainedVolume:
1024 case eCoincidentElems3D:
1025 my3DExtActor->SetExtControlMode(myFunctor);
1028 case eMultiConnection2D:
1029 my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
1030 UpdateDistribution();
1033 myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
1034 UpdateDistribution();
1038 if(theCheckEntityMode) {
1039 if(myControlActor == my1DActor) {
1040 if (!myIsEntityModeCache){
1041 myEntityModeCache = GetEntityMode();
1042 myIsEntityModeCache=true;
1044 SetEntityMode(eEdges);
1046 else if(myControlActor == my2DActor) {
1047 switch(myControlMode) {
1051 case eMultiConnection2D:
1052 if (!myIsEntityModeCache){
1053 myEntityModeCache = GetEntityMode();
1054 myIsEntityModeCache=true;
1056 SetEntityMode(eFaces);
1059 if (!myIsEntityModeCache){
1060 myEntityModeCache = GetEntityMode();
1061 myIsEntityModeCache=true;
1063 SetEntityMode(eFaces);
1065 }else if(myControlActor == my3DActor) {
1066 if (!myIsEntityModeCache){
1067 myEntityModeCache = GetEntityMode();
1068 myIsEntityModeCache=true;
1070 SetEntityMode(eVolumes);
1076 if(theCheckEntityMode){
1077 myEntityMode = myEntityModeCache;
1078 myIsEntityModeCache = false;
1083 SetRepresentation(GetRepresentation());
1085 myTimeStamp->Modified();
1088 lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
1089 double * range = lookupTable->GetRange();
1091 if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07)
1092 lookupTable->SetScale(VTK_SCALE_LOG10);
1098 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
1100 //myHighlightActor->AddToRender(theRenderer);
1102 theRenderer->AddActor(myBaseActor);
1103 theRenderer->AddActor(myNodeExtActor);
1104 theRenderer->AddActor(my1DExtActor);
1106 my3DActor ->AddToRender(theRenderer);
1107 my3DExtActor->AddToRender(theRenderer);
1108 my2DActor ->AddToRender(theRenderer);
1109 my2DExtActor->AddToRender(theRenderer);
1110 myNodeActor ->AddToRender(theRenderer);
1111 my1DActor ->AddToRender(theRenderer);
1112 my0DActor ->AddToRender(theRenderer);
1113 myBallActor ->AddToRender(theRenderer);
1114 //theRenderer->AddActor(my0DExtActor);
1116 theRenderer->AddActor(myHighlitableActor);
1118 theRenderer->AddActor2D(myScalarBarActor);
1120 // the superclass' method should be called at the end
1121 // (in particular, for correct work of selection)
1122 SALOME_Actor::AddToRender(theRenderer);
1125 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
1126 SALOME_Actor::RemoveFromRender(theRenderer);
1128 theRenderer->RemoveActor(myBaseActor);
1130 theRenderer->RemoveActor(myNodeExtActor);
1132 theRenderer->RemoveActor(myHighlitableActor);
1134 //theRenderer->RemoveActor(my0DExtActor);
1136 theRenderer->RemoveActor(my1DExtActor);
1138 my2DActor->RemoveFromRender(theRenderer);
1139 my2DExtActor->RemoveFromRender(theRenderer);
1140 my3DActor->RemoveFromRender(theRenderer);
1141 my3DExtActor->RemoveFromRender(theRenderer);
1142 myNodeActor->RemoveFromRender(theRenderer);
1143 my0DActor->RemoveFromRender(theRenderer);
1144 myBallActor->RemoveFromRender(theRenderer);
1145 my1DActor->RemoveFromRender(theRenderer);
1147 theRenderer->RemoveActor(myScalarBarActor);
1151 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
1152 const char* theEntry,
1153 const char* theName,
1156 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
1160 myVisualObj = theVisualObj;
1161 myVisualObj->Update(theIsClear);
1163 myNodeActor->Init(myVisualObj,myImplicitBoolean);
1164 myBaseActor->Init(myVisualObj,myImplicitBoolean);
1166 myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
1168 myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
1170 my0DActor->Init(myVisualObj,myImplicitBoolean);
1171 myBallActor->Init(myVisualObj,myImplicitBoolean);
1172 //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
1174 my1DActor->Init(myVisualObj,myImplicitBoolean);
1175 my1DExtActor->Init(myVisualObj,myImplicitBoolean);
1177 my2DActor->Init(myVisualObj,myImplicitBoolean);
1178 my2DExtActor->Init(myVisualObj,myImplicitBoolean);
1179 my3DActor->Init(myVisualObj,myImplicitBoolean);
1180 my3DExtActor->Init(myVisualObj,myImplicitBoolean);
1182 my0DActor->GetMapper()->SetLookupTable(myLookupTable);
1183 myBallActor->GetMapper()->SetLookupTable(myLookupTable);
1184 //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1186 my1DActor->GetMapper()->SetLookupTable(myLookupTable);
1187 my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1189 my2DActor->GetMapper()->SetLookupTable(myLookupTable);
1190 my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1191 my3DActor->GetMapper()->SetLookupTable(myLookupTable);
1192 my3DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1194 vtkFloatingPointType aFactor, aUnits;
1195 my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
1196 my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
1197 my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
1198 my3DActor->SetPolygonOffsetParameters(2*aFactor,aUnits);
1200 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1204 //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
1205 SetIsShrunkable(true);
1207 SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
1209 int aMode = mgr->integerValue( "SMESH", "display_mode" );
1210 SetRepresentation(-1);
1213 SetRepresentation(eEdge);
1214 }else if(aMode == 1){
1215 SetRepresentation(eSurface);
1216 }else if(aMode == 2){
1217 SetRepresentation(ePoint);
1224 if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1225 SetIsDisplayNameActor( true );
1227 int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
1228 int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
1229 SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
1231 myTimeStamp->Modified();
1237 vtkFloatingPointType* SMESH_ActorDef::GetBounds(){
1238 return myNodeActor->GetBounds();
1242 vtkDataSet* SMESH_ActorDef::GetInput(){
1243 return GetUnstructuredGrid();
1247 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
1248 Superclass::SetTransform(theTransform);
1250 myNodeActor->SetTransform(theTransform);
1251 myBaseActor->SetTransform(theTransform);
1253 myHighlitableActor->SetTransform(theTransform);
1255 myNodeExtActor->SetTransform(theTransform);
1257 my0DActor->SetTransform(theTransform);
1258 myBallActor->SetTransform(theTransform);
1259 //my0DExtActor->SetTransform(theTransform);
1261 my1DActor->SetTransform(theTransform);
1262 my1DExtActor->SetTransform(theTransform);
1264 my2DActor->SetTransform(theTransform);
1265 my2DExtActor->SetTransform(theTransform);
1266 my3DActor->SetTransform(theTransform);
1267 my3DExtActor->SetTransform(theTransform);
1273 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
1274 vtkLODActor::SetMapper(theMapper);
1278 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
1279 SALOME_Actor::ShallowCopy(prop);
1283 vtkMapper* SMESH_ActorDef::GetMapper(){
1284 return myPickableActor->GetMapper();
1288 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
1289 return myVisualObj->GetUnstructuredGrid();
1293 bool SMESH_ActorDef::IsInfinitive(){
1294 vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
1296 myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
1297 ( aDataSet->GetNumberOfCells() == 1 &&
1298 aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
1299 return SALOME_Actor::IsInfinitive();
1303 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
1304 if ( myIsShrinkable == theShrunkable )
1306 myIsShrinkable = theShrunkable;
1310 vtkFloatingPointType SMESH_ActorDef::GetShrinkFactor(){
1311 return myBaseActor->GetShrinkFactor();
1314 void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
1315 myBaseActor->SetShrinkFactor(theValue);
1317 my1DActor->SetShrinkFactor(theValue);
1318 my1DExtActor->SetShrinkFactor(theValue);
1320 my2DActor->SetShrinkFactor(theValue);
1321 my2DExtActor->SetShrinkFactor(theValue);
1322 my3DActor->SetShrinkFactor(theValue);
1323 my3DExtActor->SetShrinkFactor(theValue);
1324 my3DExtActor->SetShrinkFactor(theValue);
1325 myHighlitableActor->SetShrinkFactor(theValue);
1330 void SMESH_ActorDef::SetShrink(){
1331 if(!myIsShrinkable) return;
1333 myBaseActor->SetShrink();
1335 my1DActor->SetShrink();
1336 my1DExtActor->SetShrink();
1338 my2DActor->SetShrink();
1339 my2DExtActor->SetShrink();
1340 my3DActor->SetShrink();
1341 my3DExtActor->SetShrink();
1342 myHighlitableActor->SetShrink();
1348 void SMESH_ActorDef::UnShrink(){
1349 if(!myIsShrunk) return;
1351 myBaseActor->UnShrink();
1353 my1DActor->UnShrink();
1354 my1DExtActor->UnShrink();
1356 my2DActor->UnShrink();
1357 my2DExtActor->UnShrink();
1358 my3DActor->UnShrink();
1359 my3DExtActor->UnShrink();
1360 myHighlitableActor->UnShrink();
1367 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1368 return myPickableActor->GetNodeObjId(theVtkID);
1371 vtkFloatingPointType* SMESH_ActorDef::GetNodeCoord(int theObjID){
1372 return myPickableActor->GetNodeCoord(theObjID);
1376 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1377 return myPickableActor->GetElemObjId(theVtkID);
1380 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1381 return myPickableActor->GetElemCell(theObjID);
1385 void SMESH_ActorDef::SetVisibility(int theMode){
1386 SetVisibility(theMode,true);
1390 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1391 SALOME_Actor::SetVisibility(theMode);
1393 myNodeActor->VisibilityOff();
1394 myBaseActor->VisibilityOff();
1396 myNodeExtActor->VisibilityOff();
1398 my0DActor->VisibilityOff();
1399 myBallActor->VisibilityOff();
1400 //my0DExtActor->VisibilityOff();
1402 my1DActor->VisibilityOff();
1403 my1DExtActor->VisibilityOff();
1405 my2DActor->VisibilityOff();
1406 my2DExtActor->VisibilityOff();
1407 my3DActor->VisibilityOff();
1408 my3DExtActor->VisibilityOff();
1410 myScalarBarActor->VisibilityOff();
1412 if(GetVisibility()){
1413 if(theIsUpdateRepersentation)
1414 SetRepresentation(GetRepresentation());
1416 if(myControlMode != eNone){
1417 switch(myControlMode){
1419 case eCoincidentNodes:
1420 myNodeExtActor->VisibilityOn();
1424 case eCoincidentElems1D:
1425 my1DExtActor->VisibilityOn();
1428 case eBareBorderFace:
1429 case eOverConstrainedFace:
1430 case eCoincidentElems2D:
1431 my2DExtActor->VisibilityOn();
1433 case eBareBorderVolume:
1434 case eOverConstrainedVolume:
1435 case eCoincidentElems3D:
1436 my3DExtActor->VisibilityOn();
1439 case eMultiConnection2D:
1440 my1DExtActor->VisibilityOn();
1442 if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1443 myScalarBarActor->VisibilityOn();
1447 if(myRepresentation != ePoint)
1448 myPickableActor->VisibilityOn();
1450 myNodeActor->VisibilityOn();
1453 if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
1454 my0DActor->VisibilityOn();
1456 if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
1457 myBallActor->VisibilityOn();
1460 if(myEntityMode & eEdges && GetRepresentation() != ePoint){
1461 my1DActor->VisibilityOn();
1464 if(myEntityMode & eFaces && GetRepresentation() != ePoint){
1465 my2DActor->VisibilityOn();
1468 if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
1469 my3DActor->VisibilityOn();
1472 if(myNodeActor->GetPointsLabeled()){
1473 myNodeActor->VisibilityOn();
1477 my0DActor->UpdateLabels();
1480 myBallActor->UpdateLabels();
1483 my1DActor->UpdateLabels();
1486 my2DActor->UpdateLabels();
1489 my3DActor->UpdateLabels();
1491 #ifndef DISABLE_PLOT2DVIEWER
1493 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
1500 void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
1502 myEntityState = eAllEntity;
1504 if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
1505 myEntityState &= ~e0DElements;
1506 theMode &= ~e0DElements;
1509 if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) {
1510 myEntityState &= ~eBallElem;
1511 theMode &= ~eBallElem;
1514 if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
1515 myEntityState &= ~eEdges;
1519 if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
1520 myEntityState &= ~eFaces;
1524 if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
1525 myEntityState &= ~eVolumes;
1526 theMode &= ~eVolumes;
1530 if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
1531 theMode |= e0DElements;
1533 if(myVisualObj->GetNbEntities(SMDSAbs_Ball))
1534 theMode |= eBallElem;
1536 if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1539 if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1542 if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1543 theMode |= eVolumes;
1546 myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1548 myEntityMode = theMode;
1549 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1550 aFilter = myBaseActor->GetExtractUnstructuredGrid();
1551 aFilter->ClearRegisteredCellsWithType();
1552 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1554 VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
1555 aHightFilter->ClearRegisteredCellsWithType();
1556 aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1558 if (myEntityMode & e0DElements) {
1559 if (MYDEBUG) MESSAGE("0D ELEMENTS");
1560 aFilter->RegisterCellsWithType(VTK_VERTEX);
1561 aHightFilter->RegisterCellsWithType(VTK_VERTEX);
1564 if (myEntityMode & eBallElem) {
1565 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
1566 aHightFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
1569 if (myEntityMode & eEdges) {
1570 if (MYDEBUG) MESSAGE("EDGES");
1571 aFilter->RegisterCellsWithType(VTK_LINE);
1572 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1574 aHightFilter->RegisterCellsWithType(VTK_LINE);
1575 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1578 if (myEntityMode & eFaces) {
1579 if (MYDEBUG) MESSAGE("FACES");
1580 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1581 aFilter->RegisterCellsWithType(VTK_POLYGON);
1582 aFilter->RegisterCellsWithType(VTK_QUAD);
1583 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1584 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1585 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1587 aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
1588 aHightFilter->RegisterCellsWithType(VTK_POLYGON);
1589 aHightFilter->RegisterCellsWithType(VTK_QUAD);
1590 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1591 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1592 aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1595 if (myEntityMode & eVolumes) {
1596 if (MYDEBUG) MESSAGE("VOLUMES");
1597 aFilter->RegisterCellsWithType(VTK_TETRA);
1598 aFilter->RegisterCellsWithType(VTK_VOXEL);
1599 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1600 aFilter->RegisterCellsWithType(VTK_WEDGE);
1601 aFilter->RegisterCellsWithType(VTK_PYRAMID);
1602 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1603 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1604 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1605 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1606 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1607 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1608 //#ifdef VTK_HAVE_POLYHEDRON
1609 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1612 aHightFilter->RegisterCellsWithType(VTK_TETRA);
1613 aHightFilter->RegisterCellsWithType(VTK_VOXEL);
1614 aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1615 aHightFilter->RegisterCellsWithType(VTK_WEDGE);
1616 aHightFilter->RegisterCellsWithType(VTK_PYRAMID);
1617 aHightFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1618 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1619 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1620 aHightFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1621 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1622 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1623 aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1624 //#ifdef VTK_HAVE_POLYHEDRON
1625 aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1629 if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1630 SetVisibility(GetVisibility(),false);
1633 void SMESH_ActorDef::SetRepresentation (int theMode)
1635 int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1636 int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1637 int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1638 int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement);
1639 int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball);
1642 myRepresentation = eSurface;
1643 if (!aNbFaces && !aNbVolumes && aNbEdges) {
1644 myRepresentation = eEdge;
1645 } else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
1646 myRepresentation = ePoint;
1651 if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNb0Ds && !aNbBalls) return;
1654 if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
1657 myRepresentation = theMode;
1660 if (!GetUnstructuredGrid()->GetNumberOfCells())
1661 myRepresentation = ePoint;
1664 if (myRepresentation == ePoint) {
1672 myPickableActor = myBaseActor;
1673 myNodeActor->SetVisibility(false);
1674 myNodeExtActor->SetVisibility(false);
1675 vtkProperty *aProp = NULL, *aBackProp = NULL;
1676 vtkProperty *aPropVN = NULL, *aPropVR = NULL;
1677 SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1678 SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
1679 switch (myRepresentation) {
1681 myPickableActor = myNodeActor;
1682 myNodeActor->SetVisibility(true);
1683 aQuadraticMode = SMESH_Actor::eLines;
1684 aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
1685 aReperesent = SMESH_DeviceActor::ePoint;
1688 aProp = aBackProp = aPropVN = aPropVR = myEdgeProp;
1689 aReperesent = SMESH_DeviceActor::eInsideframe;
1692 aProp = mySurfaceProp;
1693 aBackProp = myBackSurfaceProp;
1694 aPropVN = myNormalVProp;
1695 aPropVR = myReversedVProp;
1696 aReperesent = SMESH_DeviceActor::eSurface;
1700 my2DActor->SetProperty(aProp);
1701 my2DActor->SetBackfaceProperty(aBackProp);
1702 my2DActor->SetRepresentation(aReperesent);
1704 if(aQuadraticMode == SMESH_Actor::eLines)
1705 my2DActor->SetQuadraticArcMode(false);
1706 else if(aQuadraticMode == SMESH_Actor::eArcs)
1707 my2DActor->SetQuadraticArcMode(true);
1709 my2DExtActor->SetRepresentation(aReperesent);
1711 my3DActor->SetProperty(aPropVN);
1712 my3DActor->SetBackfaceProperty(aPropVR);
1713 my3DActor->SetRepresentation(aReperesent);
1715 //my0DExtActor->SetVisibility(false);
1716 my1DExtActor->SetVisibility(false);
1717 my2DExtActor->SetVisibility(false);
1718 my3DExtActor->SetVisibility(false);
1721 //my0DActor->SetProperty(aProp);
1722 //my0DActor->SetBackfaceProperty(aBackProp);
1723 my0DActor->SetRepresentation(aReperesent);
1724 myBallActor->SetRepresentation(aReperesent);
1725 //my0DExtActor->SetRepresentation(aReperesent);
1727 switch(myControlMode){
1729 case eMultiConnection:
1730 aProp = aBackProp = my1DProp;
1731 if(myRepresentation != ePoint)
1732 aReperesent = SMESH_DeviceActor::eInsideframe;
1736 if(aQuadraticMode == SMESH_Actor::eLines)
1737 my1DActor->SetQuadraticArcMode(false);
1738 else if(aQuadraticMode == SMESH_Actor::eArcs)
1739 my1DActor->SetQuadraticArcMode(true);
1741 my1DActor->SetProperty(aProp);
1742 my1DActor->SetBackfaceProperty(aBackProp);
1743 my1DActor->SetRepresentation(aReperesent);
1745 my1DExtActor->SetRepresentation(aReperesent);
1747 if(myIsPointsVisible)
1748 myPickableActor = myNodeActor;
1749 if(GetPointRepresentation())
1750 myNodeActor->SetVisibility(true);
1752 SetMapper(myPickableActor->GetMapper());
1754 SetVisibility(GetVisibility(),false);
1760 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1761 if ( myIsPointsVisible == theIsPointsVisible )
1763 myIsPointsVisible = theIsPointsVisible;
1764 SetRepresentation(GetRepresentation());
1767 bool SMESH_ActorDef::GetPointRepresentation(){
1768 return myIsPointsVisible || myNodeActor->GetPointsLabeled();
1772 void SMESH_ActorDef::UpdateHighlight(){
1773 myHighlitableActor->SetHighlited(false);
1774 myHighlitableActor->SetVisibility(false);
1776 bool anIsVisible = GetVisibility();
1778 switch(myRepresentation){
1779 case SMESH_DeviceActor::eSurface:
1780 case SMESH_DeviceActor::eWireframe:
1782 if(myIsHighlighted) {
1783 myHighlitableActor->SetProperty(myHighlightProp);
1784 myBallActor->SetProperty(myBallHighlightProp);
1785 }else if(myIsPreselected){
1786 myHighlitableActor->SetProperty(myPreselectProp);
1787 myBallActor->SetProperty(myBallPreselectProp);
1788 } else if(anIsVisible){
1789 myBallActor->SetProperty(myBallProp);
1790 (myRepresentation == eSurface) ?
1791 myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
1793 if(GetUnstructuredGrid()->GetNumberOfCells()) {
1794 myHighlitableActor->SetHighlited(anIsVisible);
1795 myHighlitableActor->GetExtractUnstructuredGrid()->
1796 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1797 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1799 myHighlitableActor->SetVisibility(anIsVisible);
1802 case SMESH_DeviceActor::ePoint:
1804 if(myIsHighlighted) {
1805 myNodeActor->SetProperty(myHighlightProp);
1806 }else if(myIsPreselected) {
1807 myNodeActor->SetProperty(myPreselectProp);
1808 } else if(anIsVisible) {
1809 myNodeActor->SetProperty(myNodeProp);
1811 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1812 myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1819 void SMESH_ActorDef::highlight(bool theHighlight){
1820 if ( myIsHighlighted == theHighlight )
1822 myIsHighlighted = theHighlight;
1827 void SMESH_ActorDef::SetPreSelected(bool thePreselect){
1828 if ( myIsPreselected == thePreselect )
1830 myIsPreselected = thePreselect;
1836 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1838 if (myPickableActor->GetIsOpaque())
1840 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1848 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1850 if (!myPickableActor->GetIsOpaque())
1852 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1860 void SMESH_ActorDef::Render(vtkRenderer *ren){
1861 unsigned long aTime = myTimeStamp->GetMTime();
1862 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1863 unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1864 if(anObjTime > aTime || aClippingTime > aTime)
1869 void SMESH_ActorDef::Update(){
1870 if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1872 if(GetControlMode() != eNone) {
1873 unsigned long aTime = myTimeStamp->GetMTime();
1874 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1875 if (anObjTime > aTime)
1876 SetControlMode(GetControlMode(),false);
1880 myNodeActor->UpdateLabels();
1883 my0DActor->UpdateLabels();
1886 myBallActor->UpdateLabels();
1889 my1DActor->UpdateLabels();
1892 my2DActor->UpdateLabels();
1895 my3DActor->UpdateLabels();
1897 if(myIsFacesOriented){
1898 SetFacesOriented(myIsFacesOriented);
1901 if(myVisualObj->GetEntitiesFlag()) {
1902 myEntityMode |= myVisualObj->GetEntitiesState();
1905 SetEntityMode(GetEntityMode());
1906 SetVisibility(GetVisibility());
1908 myTimeStamp->Modified();
1913 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1914 SALOME_Actor::ReleaseGraphicsResources(renWin);
1916 myPickableActor->ReleaseGraphicsResources(renWin);
1920 static void GetColor(vtkProperty *theProperty, vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1921 vtkFloatingPointType* aColor = theProperty->GetColor();
1928 void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
1929 mySurfaceProp->SetOpacity(theValue);
1930 myBackSurfaceProp->SetOpacity(theValue);
1931 myNormalVProp->SetOpacity(theValue);
1932 myReversedVProp->SetOpacity(theValue);
1933 myEdgeProp->SetOpacity(theValue);
1934 myOutLineProp->SetOpacity(theValue);
1935 myNodeProp->SetOpacity(theValue);
1937 my1DProp->SetOpacity(theValue);
1938 my0DProp->SetOpacity(theValue);
1939 myBallProp->SetOpacity(theValue);
1943 vtkFloatingPointType SMESH_ActorDef::GetOpacity(){
1944 return mySurfaceProp->GetOpacity();
1948 void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){
1949 mySurfaceProp->SetColor(r,g,b);
1950 my2DExtProp->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_Face )
1953 myNameActor->SetBackgroundColor(r,g,b);
1955 myDeltaBrightness = delta;
1956 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1957 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1961 void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){
1962 ::GetColor(mySurfaceProp,r,g,b);
1963 delta = myDeltaBrightness;
1966 void SMESH_ActorDef::SetVolumeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b, int delta){
1967 myNormalVProp->SetColor(r,g,b);
1968 my3DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1969 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1970 if( aGroupObj->GetElementType() == SMDSAbs_Volume )
1971 myNameActor->SetBackgroundColor(r,g,b);
1973 myDeltaVBrightness = delta;
1974 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1975 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1979 void SMESH_ActorDef::GetVolumeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b, int& delta){
1980 ::GetColor(myNormalVProp,r,g,b);
1981 delta = myDeltaVBrightness;
1984 void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1985 myEdgeProp->SetColor(r,g,b);
1986 my1DProp->SetColor(r,g,b);
1987 my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1988 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1989 if( aGroupObj->GetElementType() == SMDSAbs_Edge )
1990 myNameActor->SetBackgroundColor(r,g,b);
1994 void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1995 ::GetColor(myEdgeProp,r,g,b);
1998 void SMESH_ActorDef::SetOutlineColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1999 myOutLineProp->SetColor(r,g,b);
2003 void SMESH_ActorDef::GetOutlineColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2004 ::GetColor(myOutLineProp,r,g,b);
2008 void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
2009 myNodeProp->SetColor(r,g,b);
2010 myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
2011 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2012 if( aGroupObj->GetElementType() == SMDSAbs_Node )
2013 myNameActor->SetBackgroundColor(r,g,b);
2017 void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2018 ::GetColor(myNodeProp,r,g,b);
2021 void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
2022 my0DProp->SetColor(r,g,b);
2023 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2024 if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
2025 myNameActor->SetBackgroundColor(r,g,b);
2029 void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2030 ::GetColor(my0DProp,r,g,b);
2033 void SMESH_ActorDef::SetBallColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
2034 myBallProp->SetColor(r,g,b);
2035 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2036 if( aGroupObj->GetElementType() == SMDSAbs_Ball )
2037 myNameActor->SetBackgroundColor(r,g,b);
2041 void SMESH_ActorDef::GetBallColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2042 ::GetColor(myBallProp,r,g,b);
2045 void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
2046 myHighlightProp->SetColor(r,g,b);
2047 myBallHighlightProp->SetColor(r,g,b);
2051 void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2052 ::GetColor(myHighlightProp,r,g,b);
2055 void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
2056 myPreselectProp->SetColor(r,g,b);
2057 myBallPreselectProp->SetColor(r,g,b);
2061 void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
2062 ::GetColor(myPreselectProp,r,g,b);
2066 vtkFloatingPointType SMESH_ActorDef::GetLineWidth(){
2067 return myEdgeProp->GetLineWidth();
2071 void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
2072 myEdgeProp->SetLineWidth(theVal);
2074 my1DProp->SetLineWidth(theVal + aLineWidthInc);
2075 my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
2076 my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
2077 my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
2078 myOutLineProp->SetLineWidth(theVal);
2079 myHighlightProp->SetLineWidth(theVal);
2080 myPreselectProp->SetLineWidth(theVal);
2084 vtkFloatingPointType SMESH_ActorDef::GetOutlineWidth()
2086 return myOutLineProp->GetLineWidth();
2089 void SMESH_ActorDef::SetOutlineWidth(vtkFloatingPointType theVal)
2091 myOutLineProp->SetLineWidth(theVal);
2095 void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
2096 my0DProp->SetPointSize(theVal);
2097 myHighlightProp->SetPointSize(theVal);
2098 myPreselectProp->SetPointSize(theVal);
2100 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2101 aCustom->Set0DSize(theVal);
2103 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2104 aCustom->Set0DSize(theVal);
2110 vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
2111 return my0DProp->GetPointSize();
2114 void SMESH_ActorDef::SetBallSize(vtkFloatingPointType theVal){
2115 myBallProp->SetPointSize(theVal);
2116 myBallHighlightProp->SetPointSize(theVal);
2117 myBallPreselectProp->SetPointSize(theVal);
2118 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2119 aCustom->SetBallSize(theVal);
2121 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2122 aCustom->SetBallSize(theVal);
2128 vtkFloatingPointType SMESH_ActorDef::GetBallSize(){
2129 return myBallProp->GetPointSize();
2132 int SMESH_ActorDef::GetObjDimension( const int theObjId )
2134 return myVisualObj->GetElemDimension( theObjId );
2139 IsImplicitFunctionUsed() const
2141 return myBaseActor->IsImplicitFunctionUsed();
2145 SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
2147 myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2148 myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2150 myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2152 myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2154 my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2155 myBallActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2156 //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2158 my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2159 my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2161 my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2162 my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2163 my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2164 my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2168 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
2171 myImplicitBoolean->GetFunction()->AddItem(thePlane);
2172 myCippingPlaneCont.push_back(thePlane);
2173 if(!IsImplicitFunctionUsed())
2174 SetImplicitFunctionUsed(true);
2175 myNodeActor->UpdateLabels();
2177 return myCippingPlaneCont.size();
2182 RemoveAllClippingPlanes()
2184 myImplicitBoolean->GetFunction()->RemoveAllItems();
2185 myImplicitBoolean->GetFunction()->Modified(); // VTK bug
2186 myCippingPlaneCont.clear();
2187 SetImplicitFunctionUsed(false);
2188 myNodeActor->UpdateLabels();
2193 GetNumberOfClippingPlanes()
2195 return myCippingPlaneCont.size();
2200 GetClippingPlane(vtkIdType theID)
2202 if(theID >= myCippingPlaneCont.size())
2204 return myCippingPlaneCont[theID].Get();
2207 void SMESH_ActorDef::UpdateScalarBar()
2209 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
2213 vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
2215 QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
2216 aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2218 aScalarBarTitleProp->SetFontFamilyToArial();
2220 if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
2222 QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
2223 if ( f.family() == "Arial" )
2224 aScalarBarTitleProp->SetFontFamilyToArial();
2225 else if ( f.family() == "Courier" )
2226 aScalarBarTitleProp->SetFontFamilyToCourier();
2227 else if ( f.family() == "Times" )
2228 aScalarBarTitleProp->SetFontFamilyToTimes();
2231 aScalarBarTitleProp->BoldOn();
2233 aScalarBarTitleProp->BoldOff();
2236 aScalarBarTitleProp->ItalicOn();
2238 aScalarBarTitleProp->ItalicOff();
2241 aScalarBarTitleProp->ShadowOn();
2243 aScalarBarTitleProp->ShadowOff();
2246 myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
2247 aScalarBarTitleProp->Delete();
2249 vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
2251 aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
2252 aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2254 aScalarBarLabelProp->SetFontFamilyToArial();
2255 if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
2257 QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
2258 if( f.family() == "Arial" )
2259 aScalarBarLabelProp->SetFontFamilyToArial();
2260 else if( f.family() == "Courier" )
2261 aScalarBarLabelProp->SetFontFamilyToCourier();
2262 else if( f.family() == "Times" )
2263 aScalarBarLabelProp->SetFontFamilyToTimes();
2266 aScalarBarLabelProp->BoldOn();
2268 aScalarBarLabelProp->BoldOff();
2271 aScalarBarLabelProp->ItalicOn();
2273 aScalarBarLabelProp->ItalicOff();
2276 aScalarBarLabelProp->ShadowOn();
2278 aScalarBarLabelProp->ShadowOff();
2281 myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
2282 aScalarBarLabelProp->Delete();
2284 bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
2285 QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
2287 myScalarBarActor->SetOrientationToHorizontal();
2289 myScalarBarActor->SetOrientationToVertical();
2292 vtkFloatingPointType aXVal = horiz ? 0.20 : 0.01;
2293 if( mgr->hasValue( "SMESH", name + "x" ) )
2294 aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
2296 vtkFloatingPointType aYVal = horiz ? 0.01 : 0.1;
2297 if( mgr->hasValue( "SMESH", name + "y" ) )
2298 aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
2299 myScalarBarActor->SetPosition( aXVal, aYVal );
2301 vtkFloatingPointType aWVal = horiz ? 0.60 : 0.10;
2302 if( mgr->hasValue( "SMESH", name + "width" ) )
2303 aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
2304 myScalarBarActor->SetWidth( aWVal );
2306 vtkFloatingPointType aHVal = horiz ? 0.12 : 0.80;
2307 if( mgr->hasValue( "SMESH", name + "height" ) )
2308 aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
2309 myScalarBarActor->SetHeight( aHVal );
2312 if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
2313 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
2314 myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
2317 if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
2318 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
2319 myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
2321 bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
2322 myScalarBarActor->SetDistributionVisibility(distributionVisibility);
2324 int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
2325 myScalarBarActor->SetDistributionColoringType(coloringType);
2327 QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
2328 QColor(255, 255, 255));
2330 rgb[0]= distributionColor.red()/255.;
2331 rgb[1]= distributionColor.green()/255.;
2332 rgb[2]= distributionColor.blue()/255.;
2333 myScalarBarActor->SetDistributionColor(rgb);
2338 void SMESH_ActorDef::UpdateDistribution()
2340 if(SMESH::Controls::NumericalFunctor* fun =
2341 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2343 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2344 std::vector<int> nbEvents;
2345 std::vector<double> funValues;
2346 SMESH_VisualObjDef::TEntityList elems;
2347 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2348 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2349 std::vector<int> elemIds;
2350 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2351 elemIds.push_back( (*e)->GetID());
2352 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2353 double * range = lookupTable->GetRange();
2354 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2355 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2356 myScalarBarActor->SetDistribution(nbEvents);
2360 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
2363 case SMESH_Actor::eLines :
2364 myHighlitableActor->SetQuadraticArcMode(false);
2365 my2DActor->SetQuadraticArcMode(false);
2366 my1DActor->SetQuadraticArcMode(false);
2368 case SMESH_Actor::eArcs :
2369 myHighlitableActor->SetQuadraticArcMode(true);
2370 if(GetRepresentation() != SMESH_Actor::ePoint) {
2371 my2DActor->SetQuadraticArcMode(true);
2372 my1DActor->SetQuadraticArcMode(true);
2381 SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
2383 if(myHighlitableActor->GetQuadraticArcMode())
2384 return SMESH_Actor::eArcs;
2386 return SMESH_Actor::eLines;
2389 void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
2391 SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
2392 myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
2393 myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
2396 void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
2398 SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
2399 myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2400 myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2401 myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
2404 #ifndef DISABLE_PLOT2DVIEWER
2405 SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
2408 my2dHistogram->clearAllPoints();
2410 if(SMESH::Controls::NumericalFunctor* fun =
2411 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2414 if(!my2dHistogram) {
2415 my2dHistogram = new SPlot2d_Histogram();
2416 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
2417 my2dHistogram->setIO(anIO);
2420 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2421 std::vector<int> nbEvents;
2422 std::vector<double> funValues;
2423 SMESH_VisualObjDef::TEntityList elems;
2424 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2425 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2426 std::vector<int> elemIds;
2428 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2429 elemIds.push_back( (*e)->GetID());
2431 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2432 double * range = lookupTable->GetRange();
2433 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2434 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2436 for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
2437 my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
2439 if(funValues.size() >= 2)
2440 my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
2444 //Color of the histogram
2445 if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
2446 my2dHistogram->setAutoAssign(true);
2449 myScalarBarActor->GetDistributionColor(rgb);
2450 QColor aColor = QColor( (int)( rgb[0]*255 ), (int)( rgb[1]*255 ), (int)( rgb[2]*255 ) );
2451 my2dHistogram->setColor(aColor);
2455 return my2dHistogram;