1 // Copyright (C) 2007-2016 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 = 0;
88 static int aLineWidthInc = 2;
91 SMESH_ActorDef* SMESH_ActorDef::New(){
92 return new SMESH_ActorDef();
96 SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
101 SMESH_ActorDef* anActor = NULL;
102 if(theVisualObj->IsValid() ) {
103 anActor = SMESH_ActorDef::New();
104 if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
109 anActor->UpdateScalarBar();
115 SMESH_ActorDef::SMESH_ActorDef()
117 if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
118 myBaseActor = SMESH_DeviceActor::New();
120 myTimeStamp = vtkTimeStamp::New();
122 myIsPointsVisible = false;
123 myIsEntityModeCache = false;
125 myHighlightActor = SMESH_SVTKActor::New();
126 myHighlightActor->Delete(); // vtkSmartPointer!
127 myHighlightActor->Initialize();
129 myPreHighlightActor = SMESH_SVTKActor::New();
130 myPreHighlightActor->Delete();
131 myPreHighlightActor->Initialize();
133 myIsShrinkable = false;
136 myIsFacesOriented = false;
138 myControlsPrecision = -1;
139 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
141 if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
142 myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
144 double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
145 double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
146 double aBallElemScale = SMESH::GetFloat("SMESH:ball_elem_scale",1.0);
147 double aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
148 double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
150 SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
152 bool anItalicNd = false;
153 bool aShadowNd = false;
155 if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
156 QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
157 if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
158 else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
159 else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
161 anItalicNd = f.italic();
162 aShadowNd = f.overline();
163 aSizeNd = f.pointSize();
165 double anRGBNd[3] = {1,1,1};
166 SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
168 SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
170 bool anItalicEl = false;
171 bool aShadowEl = false;
173 if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
174 QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
175 if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
176 else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
177 else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
179 anItalicEl = f.italic();
180 aShadowEl = f.overline();
181 aSizeEl = f.pointSize();
183 double anRGBEl[3] = {0,1,0};
184 SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
186 vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
187 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
189 //Definition 2D and 3D devices of the actor
190 //-----------------------------------------
191 double anRGB[3] = {1,1,1};
192 mySurfaceProp = vtkProperty::New();
195 SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
196 mySurfaceProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
197 myDeltaBrightness = delta;
199 myBackSurfaceProp = vtkProperty::New();
200 bfc = Qtx::mainColorToSecondary(ffc, delta);
201 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
203 myNormalVProp = vtkProperty::New();
204 SMESH::GetColor( "SMESH", "volume_color", ffc, delta, "255,0,170|-100" );
205 myNormalVProp->SetColor( ffc.redF(), ffc.greenF(), ffc.blueF() );
206 myDeltaVBrightness = delta;
208 myReversedVProp = vtkProperty::New();
209 bfc = Qtx::mainColorToSecondary(ffc, delta);
210 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
212 my2DActor = SMESH_CellLabelActor::New();
213 my2DActor->SetStoreGemetryMapping(true);
214 my2DActor->SetUserMatrix(aMatrix);
215 my2DActor->PickableOff();
216 my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
217 my2DActor->SetProperty(mySurfaceProp);
218 my2DActor->SetBackfaceProperty(myBackSurfaceProp);
219 my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
220 aFilter = my2DActor->GetExtractUnstructuredGrid();
221 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
222 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
223 aFilter->RegisterCellsWithType(VTK_QUAD);
224 aFilter->RegisterCellsWithType(VTK_POLYGON);
225 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
226 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
227 aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON);
228 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
229 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
231 my2DExtProp = vtkProperty::New();
232 my2DExtProp->DeepCopy(mySurfaceProp);
233 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
234 anRGB[0] = 1 - anRGB[0];
235 anRGB[1] = 1 - anRGB[1];
236 anRGB[2] = 1 - anRGB[2];
237 my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
239 my2DExtActor = SMESH_DeviceActor::New();
240 my2DExtActor->SetUserMatrix(aMatrix);
241 my2DExtActor->PickableOff();
242 my2DExtActor->SetProperty(my2DExtProp);
243 my2DExtActor->SetBackfaceProperty(my2DExtProp);
244 my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
245 aFilter = my2DExtActor->GetExtractUnstructuredGrid();
246 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
247 aFilter->RegisterCellsWithType(VTK_QUAD);
248 aFilter->RegisterCellsWithType(VTK_POLYGON);
249 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
250 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
251 aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON);
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 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
280 my3DExtProp = vtkProperty::New();
281 my3DExtProp->DeepCopy(myNormalVProp);
282 SMESH::GetColor( "SMESH", "volume_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 170 ) );
283 anRGB[0] = 1 - anRGB[0];
284 anRGB[1] = 1 - anRGB[1];
285 anRGB[2] = 1 - anRGB[2];
286 my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
288 my3DExtActor = SMESH_DeviceActor::New();
289 my3DExtActor->SetUserMatrix(aMatrix);
290 my3DExtActor->PickableOff();
291 my3DExtActor->SetProperty(my3DExtProp);
292 my3DExtActor->SetBackfaceProperty(my3DExtProp);
293 my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
294 my3DExtActor->SetCoincident3DAllowed(true);
295 aFilter = my3DExtActor->GetExtractUnstructuredGrid();
296 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
297 aFilter->RegisterCellsWithType(VTK_TETRA);
298 aFilter->RegisterCellsWithType(VTK_VOXEL);
299 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
300 aFilter->RegisterCellsWithType(VTK_WEDGE);
301 aFilter->RegisterCellsWithType(VTK_PYRAMID);
302 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
303 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
304 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
305 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
306 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
307 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
308 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
309 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
311 //Definition 1D device of the actor
312 //---------------------------------
313 myEdgeProp = vtkProperty::New();
314 myEdgeProp->SetAmbient(1.0);
315 myEdgeProp->SetDiffuse(0.0);
316 myEdgeProp->SetSpecular(0.0);
317 SMESH::GetColor( "SMESH", "wireframe_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
318 myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
319 myEdgeProp->SetLineWidth(aLineWidth);
321 my1DActor = SMESH_CellLabelActor::New();
322 my1DActor->SetStoreGemetryMapping(true);
323 my1DActor->SetUserMatrix(aMatrix);
324 my1DActor->PickableOff();
325 my1DActor->SetHighlited(true);
326 my1DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
327 my1DActor->SetProperty(myEdgeProp);
328 my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
329 aFilter = my1DActor->GetExtractUnstructuredGrid();
330 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
331 aFilter->RegisterCellsWithType(VTK_LINE);
332 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
334 my1DProp = vtkProperty::New();
335 my1DProp->DeepCopy(myEdgeProp);
336 my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
337 my1DProp->SetPointSize(aElem0DSize);
339 my1DExtProp = vtkProperty::New();
340 my1DExtProp->DeepCopy(myEdgeProp);
341 anRGB[0] = 1 - anRGB[0];
342 anRGB[1] = 1 - anRGB[1];
343 anRGB[2] = 1 - anRGB[2];
344 my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
345 my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
346 my1DExtProp->SetPointSize(aElem0DSize);
348 my1DExtActor = SMESH_DeviceActor::New();
349 my1DExtActor->SetUserMatrix(aMatrix);
350 my1DExtActor->PickableOff();
351 my1DExtActor->SetHighlited(true);
352 my1DExtActor->SetVisibility(false);
353 my1DExtActor->SetProperty(my1DExtProp);
354 my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
355 aFilter = my1DExtActor->GetExtractUnstructuredGrid();
356 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
357 aFilter->RegisterCellsWithType(VTK_LINE);
358 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
361 //Definition 0D device of the actor (0d elements)
362 //-----------------------------------------------
363 my0DProp = vtkProperty::New();
364 SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
365 my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
366 my0DProp->SetPointSize(aElem0DSize);
368 my0DActor = SMESH_CellLabelActor::New();
369 my0DActor->SetUserMatrix(aMatrix);
370 my0DActor->SetStoreGemetryMapping(true);
371 my0DActor->PickableOff();
372 my0DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
373 my0DActor->SetVisibility(false);
374 my0DActor->SetProperty(my0DProp);
375 my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
376 aFilter = my0DActor->GetExtractUnstructuredGrid();
377 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
378 aFilter->RegisterCellsWithType(VTK_VERTEX);
380 //Definition 0D device of the actor (ball elements)
381 //-----------------------------------------------
382 myBallProp = vtkProperty::New();
383 SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
384 myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
385 myBallProp->SetPointSize(aBallElemSize);
387 myBallActor = SMESH_CellLabelActor::New();
388 myBallActor->SetUserMatrix(aMatrix);
389 myBallActor->SetStoreGemetryMapping(true);
390 myBallActor->PickableOff();
391 myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
392 myBallActor->SetVisibility(false);
393 myBallActor->SetProperty(myBallProp);
394 myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
395 myBallActor->SetBallEnabled(true);
396 aFilter = myBallActor->GetExtractUnstructuredGrid();
397 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
398 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
400 //my0DExtProp = vtkProperty::New();
401 //my0DExtProp->DeepCopy(my0DProp);
402 //anRGB[0] = 1 - anRGB[0];
403 //anRGB[1] = 1 - anRGB[1];
404 //anRGB[2] = 1 - anRGB[2];
405 //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
406 //my0DExtProp->SetPointSize(aElem0DSize);
408 //my0DExtActor = SMESH_DeviceActor::New();
409 //my0DExtActor->SetUserMatrix(aMatrix);
410 //my0DExtActor->SetStoreClippingMapping(true);
411 //my0DExtActor->PickableOff();
412 //my0DExtActor->SetHighlited(true);
413 //my0DExtActor->SetVisibility(false);
414 //my0DExtActor->SetProperty(my0DExtProp);
415 //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
416 //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
417 ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
418 //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
419 //aFilter->RegisterCellsWithType(VTK_VERTEX);
422 //Definition 0D device of the actor (nodes)
423 //-----------------------------------------
424 myNodeProp = vtkProperty::New();
425 SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
426 myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
428 myNodeActor = SMESH_NodeLabelActor::New();
429 myNodeActor->SetUserMatrix(aMatrix);
430 myNodeActor->SetStoreClippingMapping(true);
431 myNodeActor->PickableOff();
432 myNodeActor->SetVisibility(false);
433 myNodeActor->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
434 myNodeActor->SetProperty(myNodeProp);
435 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
436 aFilter = myNodeActor->GetExtractUnstructuredGrid();
437 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
439 myNodeExtProp = vtkProperty::New();
440 myNodeExtProp->DeepCopy(myNodeProp);
441 anRGB[0] = 1 - anRGB[0];
442 anRGB[1] = 1 - anRGB[1];
443 anRGB[2] = 1 - anRGB[2];
444 myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
446 myNodeExtActor = SMESH_DeviceActor::New();
447 myNodeExtActor->SetUserMatrix(aMatrix);
448 myNodeExtActor->SetStoreClippingMapping(true);
449 myNodeExtActor->PickableOff();
450 myNodeExtActor->SetHighlited(true);
451 myNodeExtActor->SetVisibility(false);
452 myNodeExtActor->SetProperty(myNodeExtProp);
453 myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
454 aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
455 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
456 aFilter->RegisterCellsWithType(VTK_VERTEX);
458 //Definition of Pickable and Highlitable engines
459 //----------------------------------------------
461 myBaseActor->SetUserMatrix(aMatrix);
462 myBaseActor->SetStoreGemetryMapping(true);
463 myBaseActor->GetProperty()->SetOpacity(0.0);
464 myPickableActor = myBaseActor;
466 myHighlightProp = vtkProperty::New();
467 myHighlightProp->SetAmbient(1.0);
468 myHighlightProp->SetDiffuse(0.0);
469 myHighlightProp->SetSpecular(0.0);
470 SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
471 myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
472 myHighlightProp->SetPointSize(aElem0DSize); // ??
473 myHighlightProp->SetLineWidth(aLineWidth);
474 myHighlightProp->SetRepresentation(1);
476 myOutLineProp = vtkProperty::New();
477 myOutLineProp->SetAmbient(1.0);
478 myOutLineProp->SetDiffuse(0.0);
479 myOutLineProp->SetSpecular(0.0);
480 SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
481 myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
482 myOutLineProp->SetLineWidth(aOutlineWidth);
483 myOutLineProp->SetRepresentation(1);
485 myPreselectProp = vtkProperty::New();
486 myPreselectProp->SetAmbient(1.0);
487 myPreselectProp->SetDiffuse(0.0);
488 myPreselectProp->SetSpecular(0.0);
489 SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
490 myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
491 myPreselectProp->SetPointSize(aElem0DSize); // ??
492 myPreselectProp->SetLineWidth(aLineWidth);
493 myPreselectProp->SetRepresentation(1);
495 myHighlitableActor = SMESH_DeviceActor::New();
496 myHighlitableActor->SetUserMatrix(aMatrix);
497 myHighlitableActor->PickableOff();
498 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
499 myHighlitableActor->SetCoincident3DAllowed(true);
506 myControlMode = eNone;
507 myControlActor = my2DActor;
509 //Definition of myScalarBarActor
510 //------------------------------
511 myLookupTable = vtkLookupTable::New();
512 //Fix for Bug PAL5195 - SMESH764:
513 //Controls - Aspect Ratio: incorrect colors of the best and worst values
514 myLookupTable->SetHueRange(0.667,0.0);
516 myScalarBarActor = SMESH_ScalarBarActor::New();
517 myScalarBarActor->SetVisibility(false);
518 myScalarBarActor->SetLookupTable(myLookupTable);
521 //Incorrect "Min value" in Scalar Bar in Mesh:
522 // myScalarBarActor->SetLabelFormat("%.4g");
523 // changes was commented because of regression bug IPAL 19981
525 mgr = SUIT_Session::session()->resourceMgr();
529 myEntityMode = eAllEntity;
530 myEntityModeCache = eAllEntity;
533 myImplicitBoolean = vtkImplicitBoolean::New();
534 myImplicitBoolean->SetOperationTypeToIntersection();
536 myPlaneCollection = vtkPlaneCollection::New();
538 //Quadratic 2D elements representation
539 //-----------------------------------------------------------------------------
540 int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
541 if(aQuadratic2DMode == 0){
542 myHighlitableActor->SetQuadraticArcMode(false);
543 my2DActor->SetQuadraticArcMode(false);
544 my1DActor->SetQuadraticArcMode(false);
546 else if(aQuadratic2DMode == 1){
547 myHighlitableActor->SetQuadraticArcMode(true);
548 my2DActor->SetQuadraticArcMode(true);
549 my1DActor->SetQuadraticArcMode(true);
552 int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
553 myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
554 my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
556 // Set colors of the name actor
557 SMESH::GetColor( "SMESH", "default_grp_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
558 myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
559 SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
560 myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
562 #ifndef DISABLE_PLOT2DVIEWER
566 SetBallSize(aBallElemSize);
567 SetBallScale(aBallElemScale);
568 Set0DSize(aElem0DSize);
572 SMESH_ActorDef::~SMESH_ActorDef()
574 if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
576 // Please keep the order same as one in the header file
578 myTimeStamp->Delete();
580 myScalarBarActor->Delete();
581 myLookupTable->Delete();
583 mySurfaceProp->Delete();
584 myBackSurfaceProp->Delete();
585 myNormalVProp->Delete();
586 myReversedVProp->Delete();
587 myEdgeProp->Delete();
588 myNodeProp->Delete();
590 myNodeActor->Delete();
591 myBaseActor->Delete();
592 //myPickableActor->Delete(); myPickableActor == myBaseActor
594 myHighlightProp->Delete();
595 myOutLineProp->Delete();
596 myPreselectProp->Delete();
598 myHighlitableActor->Delete();
600 my2DExtProp->Delete();
601 my3DExtProp->Delete();
603 my2DExtActor->Delete();
605 my3DExtActor->Delete();
606 // myControlActor->Delete(); myControlActor == my2DActor
608 myNodeExtProp->Delete();
609 myNodeExtActor->Delete();
613 my1DExtProp->Delete();
614 my1DExtActor->Delete();
618 myBallProp->Delete();
619 myBallActor->Delete();
620 //my0DExtProp->Delete();
621 //my0DExtActor->Delete();
623 myImplicitBoolean->Delete();
624 myPlaneCollection->Delete();
626 #ifndef DISABLE_PLOT2DVIEWER
628 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
629 delete my2dHistogram;
634 void SMESH_ActorDef::Delete()
636 // This is just to guarantee that the DeleteActorEvent (which was previously invoked
637 // from the actor's destructor) will be thrown before removing the actor's observers,
638 // that is done inside the Superclass::Delete() method but before the destructor itself
639 // (see the issue 0021562: EDF SMESH: clipping and delete mesh clipped leads to crash).
640 // The event is caught by SMESHGUI::ProcessEvents() static method.
641 this->InvokeEvent( SMESH::DeleteActorEvent, NULL );
643 Superclass::Delete();
646 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
649 myNodeActor->SetPointsLabeled(theIsPointsLabeled);
650 SetRepresentation(GetRepresentation());
651 myTimeStamp->Modified();
655 void SMESH_ActorDef::SetPointsFontProperties( SMESH::LabelFont theFamily, int theSize,
656 bool theBold, bool theItalic, bool theShadow,
657 double r, double g, double b )
660 myNodeActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
661 SetRepresentation( GetRepresentation() );
662 myTimeStamp->Modified();
666 void SMESH_ActorDef::SetCellsFontProperties( SMESH::LabelFont theFamily, int theSize,
667 bool theBold, bool theItalic, bool theShadow,
668 double r, double g, double b )
671 my3DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
674 my2DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
675 SetRepresentation( GetRepresentation() );
676 myTimeStamp->Modified();
679 my1DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
680 SetRepresentation( GetRepresentation() );
681 myTimeStamp->Modified();
684 my0DActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
685 SetRepresentation( GetRepresentation() );
686 myTimeStamp->Modified();
689 myBallActor->SetFontProperties( theFamily, theSize, theBold, theItalic, theShadow, r, g, b );
690 SetRepresentation( GetRepresentation() );
691 myTimeStamp->Modified();
695 bool SMESH_ActorDef::GetPointsLabeled() {
696 return myNodeActor && myNodeActor->GetPointsLabeled();
699 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
702 my3DActor->SetCellsLabeled(theIsCellsLabeled);
705 my2DActor->SetCellsLabeled(theIsCellsLabeled);
708 my1DActor->SetCellsLabeled(theIsCellsLabeled);
711 my0DActor->SetCellsLabeled(theIsCellsLabeled);
714 myBallActor->SetCellsLabeled(theIsCellsLabeled);
716 myTimeStamp->Modified();
720 bool SMESH_ActorDef::GetCellsLabeled() {
723 result = result || my3DActor->GetCellsLabeled();
726 result = result || my2DActor->GetCellsLabeled();
729 result = result || my1DActor->GetCellsLabeled();
732 result = result || my0DActor->GetCellsLabeled();
735 result = result || myBallActor->GetCellsLabeled();
741 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
743 myIsFacesOriented = theIsFacesOriented;
745 my2DActor->SetFacesOriented(theIsFacesOriented);
746 my3DActor->SetFacesOriented(theIsFacesOriented);
748 myTimeStamp->Modified();
751 bool SMESH_ActorDef::GetFacesOriented()
753 return myIsFacesOriented;
756 void SMESH_ActorDef::SetFacesOrientationColor(double r,double g,double b)
758 my2DActor->SetFacesOrientationColor( r, g, b );
759 my3DActor->SetFacesOrientationColor( r, g, b );
762 void SMESH_ActorDef::GetFacesOrientationColor(double& r,double& g,double& b)
764 my3DActor->GetFacesOrientationColor( r, g, b );
767 void SMESH_ActorDef::SetFacesOrientationScale(double theScale)
769 my2DActor->SetFacesOrientationScale( theScale );
770 my3DActor->SetFacesOrientationScale( theScale );
773 double SMESH_ActorDef::GetFacesOrientationScale()
775 return my3DActor->GetFacesOrientationScale();
778 void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
780 my2DActor->SetFacesOrientation3DVectors( theState );
781 my3DActor->SetFacesOrientation3DVectors( theState );
784 bool SMESH_ActorDef::GetFacesOrientation3DVectors()
786 return my3DActor->GetFacesOrientation3DVectors();
792 SetControlMode(eControl theMode)
794 SetControlMode(theMode,true);
800 SetControlMode( eControl theMode, bool theCheckEntityMode )
802 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
803 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
804 lookupTable->SetScale(VTK_SCALE_LINEAR);
806 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
810 myControlMode = eNone;
811 theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
813 my0DActor->GetMapper()->SetScalarVisibility(false);
814 my1DActor->GetMapper()->SetScalarVisibility(false);
815 my2DActor->GetMapper()->SetScalarVisibility(false);
816 my3DActor->GetMapper()->SetScalarVisibility(false);
817 myBallActor->GetMapper()->SetScalarVisibility(false);
818 myScalarBarActor->SetVisibility(false);
820 bool anIsScalarVisible = theMode > eNone;
822 if(anIsScalarVisible) {
826 SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
827 aControl->SetPrecision( myControlsPrecision );
828 myFunctor.reset( aControl );
829 myControlActor = my1DActor;
834 myFunctor.reset(new SMESH::Controls::Length2D());
835 myControlActor = my2DActor;
839 myFunctor.reset(new SMESH::Controls::FreeBorders());
840 myControlActor = my1DActor;
843 myFunctor.reset(new SMESH::Controls::FreeEdges());
844 myControlActor = my2DActor;
847 myFunctor.reset(new SMESH::Controls::FreeNodes());
848 myControlActor = myNodeActor;
851 myFunctor.reset(new SMESH::Controls::FreeFaces());
852 myControlActor = my2DActor;
854 case eCoincidentNodes:
856 SMESH::Controls::CoincidentNodes* cn = new SMESH::Controls::CoincidentNodes();
857 double tol = mgr->doubleValue( "SMESH", "equal_nodes_tolerance", 1e-7 );
858 cn->SetTolerance( tol );
860 myControlActor = myNodeActor;
863 case eCoincidentElems1D:
864 myFunctor.reset(new SMESH::Controls::CoincidentElements1D());
865 myControlActor = my1DActor;
867 case eCoincidentElems2D:
868 myFunctor.reset(new SMESH::Controls::CoincidentElements2D());
869 myControlActor = my2DActor;
871 case eCoincidentElems3D:
872 myFunctor.reset(new SMESH::Controls::CoincidentElements3D());
873 myControlActor = my3DActor;
875 case eBareBorderFace:
876 myFunctor.reset(new SMESH::Controls::BareBorderFace());
877 myControlActor = my2DActor;
879 case eOverConstrainedFace:
880 myFunctor.reset(new SMESH::Controls::OverConstrainedFace());
881 myControlActor = my2DActor;
883 case eMultiConnection:
884 myFunctor.reset(new SMESH::Controls::MultiConnection());
885 myControlActor = my1DActor;
887 case eMultiConnection2D:
888 myFunctor.reset(new SMESH::Controls::MultiConnection2D());
889 myControlActor = my2DActor;
893 SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
894 aControl->SetPrecision( myControlsPrecision );
895 myFunctor.reset( aControl );
896 myControlActor = my2DActor;
901 SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
902 aControl->SetPrecision( myControlsPrecision );
903 myFunctor.reset( aControl );
904 myControlActor = my2DActor;
909 SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
910 aControl->SetPrecision( myControlsPrecision );
911 myFunctor.reset( aControl );
912 myControlActor = my2DActor;
917 SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
918 aControl->SetPrecision( myControlsPrecision );
919 myFunctor.reset( aControl );
920 myControlActor = my3DActor;
925 SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
926 aControl->SetPrecision( myControlsPrecision );
927 myFunctor.reset( aControl );
928 myControlActor = my3DActor;
931 case eMaxElementLength2D:
933 SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
934 aControl->SetPrecision( myControlsPrecision );
935 myFunctor.reset( aControl );
936 myControlActor = my2DActor;
939 case eMaxElementLength3D:
941 SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
942 aControl->SetPrecision( myControlsPrecision );
943 myFunctor.reset( aControl );
944 myControlActor = my3DActor;
947 case eBareBorderVolume:
949 myFunctor.reset(new SMESH::Controls::BareBorderVolume());
950 myControlActor = my3DActor;
953 case eOverConstrainedVolume:
955 myFunctor.reset(new SMESH::Controls::OverConstrainedVolume());
956 myControlActor = my3DActor;
961 SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
962 aControl->SetPrecision( myControlsPrecision );
963 myFunctor.reset( aControl );
964 myControlActor = my2DActor;
969 SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
970 aControl->SetPrecision( myControlsPrecision );
971 myFunctor.reset( aControl );
972 myControlActor = my2DActor;
977 SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
978 aControl->SetPrecision( myControlsPrecision );
979 myFunctor.reset( aControl );
980 myControlActor = my2DActor;
987 vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
988 vtkIdType aNbCells = aGrid->GetNumberOfCells();
990 myControlMode = theMode;
991 switch(myControlMode){
993 case eCoincidentNodes:
994 myNodeExtActor->SetExtControlMode(myFunctor);
998 case eCoincidentElems1D:
999 my1DExtActor->SetExtControlMode(myFunctor);
1002 case eBareBorderFace:
1003 case eOverConstrainedFace:
1004 case eCoincidentElems2D:
1005 my2DExtActor->SetExtControlMode(myFunctor);
1007 case eBareBorderVolume:
1008 case eOverConstrainedVolume:
1009 case eCoincidentElems3D:
1010 my3DExtActor->SetExtControlMode(myFunctor);
1013 case eMultiConnection2D:
1014 my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
1015 UpdateDistribution();
1018 myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
1019 UpdateDistribution();
1023 if(theCheckEntityMode) {
1024 if(myControlActor == my1DActor) {
1025 if (!myIsEntityModeCache){
1026 myEntityModeCache = GetEntityMode();
1027 myIsEntityModeCache=true;
1029 SetEntityMode(eEdges);
1031 else if(myControlActor == my2DActor) {
1032 switch(myControlMode) {
1036 case eMultiConnection2D:
1037 if (!myIsEntityModeCache){
1038 myEntityModeCache = GetEntityMode();
1039 myIsEntityModeCache=true;
1041 SetEntityMode(eFaces);
1044 if (!myIsEntityModeCache){
1045 myEntityModeCache = GetEntityMode();
1046 myIsEntityModeCache=true;
1048 SetEntityMode(eFaces);
1050 }else if(myControlActor == my3DActor) {
1051 if (!myIsEntityModeCache){
1052 myEntityModeCache = GetEntityMode();
1053 myIsEntityModeCache=true;
1055 SetEntityMode(eVolumes);
1061 if(theCheckEntityMode){
1062 myEntityMode = myEntityModeCache;
1063 myIsEntityModeCache = false;
1068 SetRepresentation(GetRepresentation());
1070 myTimeStamp->Modified();
1073 lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
1074 double * range = lookupTable->GetRange();
1076 if (isLogarithmic && range[0] > 1e-07 && range[1] > 1e-07)
1077 lookupTable->SetScale(VTK_SCALE_LOG10);
1083 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
1085 theRenderer->AddActor(myBaseActor);
1086 theRenderer->AddActor(myNodeExtActor);
1087 theRenderer->AddActor(my1DExtActor);
1089 my3DActor ->AddToRender(theRenderer);
1090 my3DExtActor->AddToRender(theRenderer);
1091 my2DActor ->AddToRender(theRenderer);
1092 my2DExtActor->AddToRender(theRenderer);
1093 myNodeActor ->AddToRender(theRenderer);
1094 my1DActor ->AddToRender(theRenderer);
1095 my0DActor ->AddToRender(theRenderer);
1096 myBallActor ->AddToRender(theRenderer);
1098 theRenderer->AddActor(myHighlitableActor);
1100 theRenderer->AddActor2D(myScalarBarActor);
1102 // the superclass' method should be called at the end
1103 // (in particular, for correct work of selection)
1104 SALOME_Actor::AddToRender(theRenderer);
1107 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
1108 SALOME_Actor::RemoveFromRender(theRenderer);
1110 theRenderer->RemoveActor(myBaseActor);
1112 theRenderer->RemoveActor(myNodeExtActor);
1114 theRenderer->RemoveActor(myHighlitableActor);
1116 //theRenderer->RemoveActor(my0DExtActor);
1118 theRenderer->RemoveActor(my1DExtActor);
1120 my2DActor->RemoveFromRender(theRenderer);
1121 my2DExtActor->RemoveFromRender(theRenderer);
1122 my3DActor->RemoveFromRender(theRenderer);
1123 my3DExtActor->RemoveFromRender(theRenderer);
1124 myNodeActor->RemoveFromRender(theRenderer);
1125 my0DActor->RemoveFromRender(theRenderer);
1126 myBallActor->RemoveFromRender(theRenderer);
1127 my1DActor->RemoveFromRender(theRenderer);
1129 theRenderer->RemoveActor(myScalarBarActor);
1133 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
1134 const char* theEntry,
1135 const char* theName,
1138 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
1142 myVisualObj = theVisualObj;
1143 myVisualObj->Update(theIsClear);
1145 SMESH_SVTKActor::SafeDownCast(myHighlightActor)->SetVisualObject(myVisualObj);
1146 SMESH_SVTKActor::SafeDownCast(myPreHighlightActor)->SetVisualObject(myVisualObj);
1148 myNodeActor->Init(myVisualObj,myImplicitBoolean);
1149 myBaseActor->Init(myVisualObj,myImplicitBoolean);
1151 myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
1153 myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
1155 my0DActor->Init(myVisualObj,myImplicitBoolean);
1156 myBallActor->Init(myVisualObj,myImplicitBoolean);
1157 //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
1159 my1DActor->Init(myVisualObj,myImplicitBoolean);
1160 my1DExtActor->Init(myVisualObj,myImplicitBoolean);
1162 my2DActor->Init(myVisualObj,myImplicitBoolean);
1163 my2DExtActor->Init(myVisualObj,myImplicitBoolean);
1164 my3DActor->Init(myVisualObj,myImplicitBoolean);
1165 my3DExtActor->Init(myVisualObj,myImplicitBoolean);
1167 my0DActor->GetMapper()->SetLookupTable(myLookupTable);
1168 myBallActor->GetMapper()->SetLookupTable(myLookupTable);
1169 //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1171 my1DActor->GetMapper()->SetLookupTable(myLookupTable);
1172 my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1174 my2DActor->GetMapper()->SetLookupTable(myLookupTable);
1175 my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1176 my3DActor->GetMapper()->SetLookupTable(myLookupTable);
1177 my3DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1179 double aFactor, aUnits;
1180 my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
1181 my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
1182 my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
1183 my3DActor->SetPolygonOffsetParameters(2*aFactor,aUnits);
1185 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1189 //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
1190 SetIsShrunkable(true);
1192 SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
1194 int aMode = mgr->integerValue( "SMESH", "display_mode" );
1195 SetRepresentation(-1);
1198 SetRepresentation(eEdge);
1199 }else if(aMode == 1){
1200 SetRepresentation(eSurface);
1201 }else if(aMode == 2){
1202 SetRepresentation(ePoint);
1209 if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1210 SetIsDisplayNameActor( true );
1212 int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
1213 int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
1214 SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
1216 myTimeStamp->Modified();
1222 double* SMESH_ActorDef::GetBounds(){
1223 return myNodeActor->GetBounds();
1227 vtkDataSet* SMESH_ActorDef::GetInput(){
1228 return GetUnstructuredGrid();
1232 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
1233 Superclass::SetTransform(theTransform);
1235 myNodeActor->SetTransform(theTransform);
1236 myBaseActor->SetTransform(theTransform);
1238 myHighlitableActor->SetTransform(theTransform);
1240 myNodeExtActor->SetTransform(theTransform);
1242 my0DActor->SetTransform(theTransform);
1243 myBallActor->SetTransform(theTransform);
1244 //my0DExtActor->SetTransform(theTransform);
1246 my1DActor->SetTransform(theTransform);
1247 my1DExtActor->SetTransform(theTransform);
1249 my2DActor->SetTransform(theTransform);
1250 my2DExtActor->SetTransform(theTransform);
1251 my3DActor->SetTransform(theTransform);
1252 my3DExtActor->SetTransform(theTransform);
1258 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
1259 vtkLODActor::SetMapper(theMapper);
1263 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
1264 SALOME_Actor::ShallowCopy(prop);
1268 vtkMapper* SMESH_ActorDef::GetMapper(){
1269 return myPickableActor->GetMapper();
1273 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
1274 return myVisualObj->GetUnstructuredGrid();
1278 bool SMESH_ActorDef::IsInfinitive(){
1279 vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
1280 myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
1281 ( aDataSet->GetNumberOfCells() == 1 &&
1282 aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
1283 return SALOME_Actor::IsInfinitive();
1287 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
1288 if ( myIsShrinkable == theShrunkable )
1290 myIsShrinkable = theShrunkable;
1294 double SMESH_ActorDef::GetShrinkFactor(){
1295 return myBaseActor->GetShrinkFactor();
1298 void SMESH_ActorDef::SetShrinkFactor(double theValue){
1299 myBaseActor->SetShrinkFactor(theValue);
1301 my1DActor->SetShrinkFactor(theValue);
1302 my1DExtActor->SetShrinkFactor(theValue);
1304 my2DActor->SetShrinkFactor(theValue);
1305 my2DExtActor->SetShrinkFactor(theValue);
1306 my3DActor->SetShrinkFactor(theValue);
1307 my3DExtActor->SetShrinkFactor(theValue);
1308 my3DExtActor->SetShrinkFactor(theValue);
1309 myHighlitableActor->SetShrinkFactor(theValue);
1314 void SMESH_ActorDef::SetShrink() {
1315 if(!myIsShrinkable) return;
1317 myBaseActor->SetShrink();
1319 my1DActor->SetShrink();
1320 my1DExtActor->SetShrink();
1322 my2DActor->SetShrink();
1323 my2DExtActor->SetShrink();
1324 my3DActor->SetShrink();
1325 my3DExtActor->SetShrink();
1326 myHighlitableActor->SetShrink();
1332 void SMESH_ActorDef::UnShrink(){
1333 if(!myIsShrunk) return;
1335 myBaseActor->UnShrink();
1337 my1DActor->UnShrink();
1338 my1DExtActor->UnShrink();
1340 my2DActor->UnShrink();
1341 my2DExtActor->UnShrink();
1342 my3DActor->UnShrink();
1343 my3DExtActor->UnShrink();
1344 myHighlitableActor->UnShrink();
1351 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1352 return myPickableActor->GetNodeObjId(theVtkID);
1355 double* SMESH_ActorDef::GetNodeCoord(int theObjID){
1356 return myPickableActor->GetNodeCoord(theObjID);
1360 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1361 return myPickableActor->GetElemObjId(theVtkID);
1364 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1365 return myPickableActor->GetElemCell(theObjID);
1369 void SMESH_ActorDef::SetVisibility(int theMode){
1370 SetVisibility(theMode,true);
1374 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1375 SALOME_Actor::SetVisibility(theMode);
1377 myNodeActor->VisibilityOff();
1378 myBaseActor->VisibilityOff();
1380 myNodeExtActor->VisibilityOff();
1382 my0DActor->VisibilityOff();
1383 myBallActor->VisibilityOff();
1384 //my0DExtActor->VisibilityOff();
1386 my1DActor->VisibilityOff();
1387 my1DExtActor->VisibilityOff();
1389 my2DActor->VisibilityOff();
1390 my2DExtActor->VisibilityOff();
1391 my3DActor->VisibilityOff();
1392 my3DExtActor->VisibilityOff();
1394 myScalarBarActor->VisibilityOff();
1396 if(GetVisibility()){
1397 if(theIsUpdateRepersentation)
1398 SetRepresentation(GetRepresentation());
1400 if(myControlMode != eNone){
1401 switch(myControlMode){
1403 case eCoincidentNodes:
1404 myNodeExtActor->VisibilityOn();
1408 case eCoincidentElems1D:
1409 my1DExtActor->VisibilityOn();
1412 case eBareBorderFace:
1413 case eOverConstrainedFace:
1414 case eCoincidentElems2D:
1415 my2DExtActor->VisibilityOn();
1417 case eBareBorderVolume:
1418 case eOverConstrainedVolume:
1419 case eCoincidentElems3D:
1420 my3DExtActor->VisibilityOn();
1423 case eMultiConnection2D:
1424 my1DExtActor->VisibilityOn();
1426 if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1427 myScalarBarActor->VisibilityOn();
1431 if(myRepresentation != ePoint)
1432 myPickableActor->VisibilityOn();
1434 myNodeActor->VisibilityOn();
1437 if(myEntityMode & e0DElements && GetRepresentation() != ePoint ){
1438 my0DActor->VisibilityOn();
1440 if(myEntityMode & eBallElem && GetRepresentation() != ePoint ){
1441 myBallActor->VisibilityOn();
1444 if(myEntityMode & eEdges && GetRepresentation() != ePoint){
1445 my1DActor->VisibilityOn();
1448 if(myEntityMode & eFaces && GetRepresentation() != ePoint){
1449 my2DActor->VisibilityOn();
1452 if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
1453 my3DActor->VisibilityOn();
1456 if(myNodeActor->GetPointsLabeled()){
1457 myNodeActor->VisibilityOn();
1461 my0DActor->UpdateLabels();
1464 myBallActor->UpdateLabels();
1467 my1DActor->UpdateLabels();
1470 my2DActor->UpdateLabels();
1473 my3DActor->UpdateLabels();
1475 #ifndef DISABLE_PLOT2DVIEWER
1477 SMESH::ProcessIn2DViewers(this,SMESH::RemoveFrom2dViewer);
1484 void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
1486 myEntityState = eAllEntity;
1488 if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
1489 myEntityState &= ~e0DElements;
1490 theMode &= ~e0DElements;
1493 if(!myVisualObj->GetNbEntities(SMDSAbs_Ball)) {
1494 myEntityState &= ~eBallElem;
1495 theMode &= ~eBallElem;
1498 if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
1499 myEntityState &= ~eEdges;
1503 if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
1504 myEntityState &= ~eFaces;
1508 if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
1509 myEntityState &= ~eVolumes;
1510 theMode &= ~eVolumes;
1514 if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
1515 theMode |= e0DElements;
1517 if(myVisualObj->GetNbEntities(SMDSAbs_Ball))
1518 theMode |= eBallElem;
1520 if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1523 if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1526 if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1527 theMode |= eVolumes;
1530 myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1532 myEntityMode = theMode;
1533 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1534 aFilter = myBaseActor->GetExtractUnstructuredGrid();
1535 aFilter->ClearRegisteredCellsWithType();
1536 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1538 VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
1539 aHightFilter->ClearRegisteredCellsWithType();
1540 aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1542 if (myEntityMode & e0DElements) {
1543 if (MYDEBUG) MESSAGE("0D ELEMENTS");
1544 aFilter->RegisterCellsWithType(VTK_VERTEX);
1545 aHightFilter->RegisterCellsWithType(VTK_VERTEX);
1548 if (myEntityMode & eBallElem) {
1549 aFilter->RegisterCellsWithType(VTK_POLY_VERTEX);
1552 if (myEntityMode & eEdges) {
1553 if (MYDEBUG) MESSAGE("EDGES");
1554 aFilter->RegisterCellsWithType(VTK_LINE);
1555 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1557 aHightFilter->RegisterCellsWithType(VTK_LINE);
1558 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1561 if (myEntityMode & eFaces) {
1562 if (MYDEBUG) MESSAGE("FACES");
1563 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1564 aFilter->RegisterCellsWithType(VTK_QUAD);
1565 aFilter->RegisterCellsWithType(VTK_POLYGON);
1566 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1567 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1568 aFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON);
1569 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1570 aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
1572 aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
1573 aHightFilter->RegisterCellsWithType(VTK_QUAD);
1574 aHightFilter->RegisterCellsWithType(VTK_POLYGON);
1575 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1576 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1577 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_POLYGON);
1578 aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
1579 aHightFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
1582 if (myEntityMode & eVolumes) {
1583 if (MYDEBUG) MESSAGE("VOLUMES");
1584 aFilter->RegisterCellsWithType(VTK_TETRA);
1585 aFilter->RegisterCellsWithType(VTK_VOXEL);
1586 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1587 aFilter->RegisterCellsWithType(VTK_WEDGE);
1588 aFilter->RegisterCellsWithType(VTK_PYRAMID);
1589 aFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1590 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1591 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1592 aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1593 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1594 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1595 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1596 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1598 aHightFilter->RegisterCellsWithType(VTK_TETRA);
1599 aHightFilter->RegisterCellsWithType(VTK_VOXEL);
1600 aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1601 aHightFilter->RegisterCellsWithType(VTK_WEDGE);
1602 aHightFilter->RegisterCellsWithType(VTK_PYRAMID);
1603 aHightFilter->RegisterCellsWithType(VTK_HEXAGONAL_PRISM);
1604 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1605 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1606 aHightFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_HEXAHEDRON);
1607 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1608 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1609 aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1610 aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1613 if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1614 SetVisibility(GetVisibility(),false);
1617 void SMESH_ActorDef::SetRepresentation (int theMode)
1619 int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1620 int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1621 int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1622 int aNb0Ds = myVisualObj->GetNbEntities(SMDSAbs_0DElement);
1623 int aNbBalls = myVisualObj->GetNbEntities(SMDSAbs_Ball);
1626 myRepresentation = eSurface;
1627 if (!aNbFaces && !aNbVolumes && !aNbBalls && aNbEdges) {
1628 myRepresentation = eEdge;
1629 } else if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNbBalls) {
1630 myRepresentation = ePoint;
1635 if (!aNbFaces && !aNbVolumes && !aNbEdges && !aNb0Ds && !aNbBalls) return;
1638 if (!aNbFaces && !aNbVolumes && !aNb0Ds && !aNbBalls) return;
1641 myRepresentation = theMode;
1644 if (!GetUnstructuredGrid()->GetNumberOfCells())
1645 myRepresentation = ePoint;
1648 if (myRepresentation == ePoint) {
1656 myPickableActor = myBaseActor;
1657 myNodeActor->SetVisibility(false);
1658 myNodeExtActor->SetVisibility(false);
1659 vtkProperty *aProp = NULL, *aBackProp = NULL;
1660 vtkProperty *aPropVN = NULL, *aPropVR = NULL;
1661 SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1662 SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
1663 switch (myRepresentation) {
1665 myPickableActor = myNodeActor;
1666 myNodeActor->SetVisibility(true);
1667 aQuadraticMode = SMESH_Actor::eLines;
1668 aProp = aBackProp = aPropVN = aPropVR = myNodeProp;
1669 aReperesent = SMESH_DeviceActor::ePoint;
1672 aProp = aBackProp = aPropVN = aPropVR = myEdgeProp;
1673 aReperesent = SMESH_DeviceActor::eInsideframe;
1676 aProp = mySurfaceProp;
1677 aBackProp = myBackSurfaceProp;
1678 aPropVN = myNormalVProp;
1679 aPropVR = myReversedVProp;
1680 aReperesent = SMESH_DeviceActor::eSurface;
1684 my2DActor->SetProperty(aProp);
1685 my2DActor->SetBackfaceProperty(aBackProp);
1686 my2DActor->SetRepresentation(aReperesent);
1688 if(aQuadraticMode == SMESH_Actor::eLines)
1689 my2DActor->SetQuadraticArcMode(false);
1690 else if(aQuadraticMode == SMESH_Actor::eArcs)
1691 my2DActor->SetQuadraticArcMode(true);
1693 my2DExtActor->SetRepresentation(aReperesent);
1695 my3DActor->SetProperty(aPropVN);
1696 my3DActor->SetBackfaceProperty(aPropVR);
1697 my3DActor->SetRepresentation(aReperesent);
1700 my1DExtActor->SetVisibility(false);
1701 my2DExtActor->SetVisibility(false);
1702 my3DExtActor->SetVisibility(false);
1704 my0DActor->SetRepresentation(aReperesent);
1705 myBallActor->SetRepresentation(aReperesent);
1707 switch ( myControlMode ) {
1709 case eMultiConnection:
1710 aProp = aBackProp = my1DProp;
1711 if(myRepresentation != ePoint)
1712 aReperesent = SMESH_DeviceActor::eInsideframe;
1717 if(aQuadraticMode == SMESH_Actor::eLines)
1718 my1DActor->SetQuadraticArcMode(false);
1719 else if(aQuadraticMode == SMESH_Actor::eArcs)
1720 my1DActor->SetQuadraticArcMode(true);
1722 my1DActor->SetProperty(aProp);
1723 my1DActor->SetBackfaceProperty(aBackProp);
1724 my1DActor->SetRepresentation(aReperesent);
1726 my1DExtActor->SetRepresentation(aReperesent);
1728 if(myIsPointsVisible)
1729 myPickableActor = myNodeActor;
1730 if(GetPointRepresentation())
1731 myNodeActor->SetVisibility(true);
1733 SetMapper(myPickableActor->GetMapper());
1735 SetVisibility(GetVisibility(),false);
1741 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1742 if ( myIsPointsVisible == theIsPointsVisible )
1744 myIsPointsVisible = theIsPointsVisible;
1745 SetRepresentation(GetRepresentation());
1748 bool SMESH_ActorDef::GetPointRepresentation(){
1749 return myIsPointsVisible || myNodeActor->GetPointsLabeled();
1753 void SMESH_ActorDef::UpdateHighlight(){
1754 myHighlitableActor->SetHighlited(false);
1755 myHighlitableActor->SetVisibility(false);
1756 bool anIsVisible = GetVisibility();
1758 switch(myRepresentation){
1759 case SMESH_DeviceActor::eSurface:
1760 case SMESH_DeviceActor::eWireframe:
1762 if(myIsHighlighted) {
1763 myHighlitableActor->SetProperty(myHighlightProp);
1764 }else if(myIsPreselected){
1765 myHighlitableActor->SetProperty(myPreselectProp);
1766 } else if(anIsVisible){
1767 (myRepresentation == eSurface) ?
1768 myHighlitableActor->SetProperty(myOutLineProp) : myHighlitableActor->SetProperty(myEdgeProp);
1770 if(GetUnstructuredGrid()->GetNumberOfCells()) {
1771 myHighlitableActor->SetHighlited(anIsVisible);
1772 myHighlitableActor->GetExtractUnstructuredGrid()->
1773 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1774 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1776 myHighlitableActor->SetVisibility(anIsVisible);
1779 case SMESH_DeviceActor::ePoint:
1781 if(myIsHighlighted) {
1782 myNodeActor->SetProperty(myHighlightProp);
1783 }else if(myIsPreselected) {
1784 myNodeActor->SetProperty(myPreselectProp);
1785 } else if(anIsVisible) {
1786 myNodeActor->SetProperty(myNodeProp);
1788 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1789 myNodeActor->GetExtractUnstructuredGrid()->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1796 void SMESH_ActorDef::highlight(bool theHighlight){
1797 if ( myIsHighlighted == theHighlight )
1799 myIsHighlighted = theHighlight;
1804 void SMESH_ActorDef::SetPreSelected(bool thePreselect){
1805 if ( myIsPreselected == thePreselect )
1807 myIsPreselected = thePreselect;
1813 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1815 if (myPickableActor->GetIsOpaque())
1817 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1825 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1827 if (!myPickableActor->GetIsOpaque())
1829 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1837 void SMESH_ActorDef::Render(vtkRenderer *ren){
1838 unsigned long aTime = myTimeStamp->GetMTime();
1839 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1840 unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1841 if(anObjTime > aTime || aClippingTime > aTime)
1846 void SMESH_ActorDef::Update(){
1847 if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1849 if(GetControlMode() != eNone) {
1850 unsigned long aTime = myTimeStamp->GetMTime();
1851 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1852 if (anObjTime > aTime)
1853 SetControlMode(GetControlMode(),false);
1857 myNodeActor->UpdateLabels();
1860 my0DActor->UpdateLabels();
1863 myBallActor->UpdateLabels();
1866 my1DActor->UpdateLabels();
1869 my2DActor->UpdateLabels();
1872 my3DActor->UpdateLabels();
1874 if(myIsFacesOriented){
1875 SetFacesOriented(myIsFacesOriented);
1878 if(myVisualObj->GetEntitiesFlag()) {
1879 myEntityMode |= myVisualObj->GetEntitiesState();
1882 SetEntityMode(GetEntityMode());
1883 SetVisibility(GetVisibility());
1885 myTimeStamp->Modified();
1890 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1891 SALOME_Actor::ReleaseGraphicsResources(renWin);
1893 myPickableActor->ReleaseGraphicsResources(renWin);
1897 static void GetColor(vtkProperty *theProperty, double& r,double& g,double& b){
1898 double* aColor = theProperty->GetColor();
1905 void SMESH_ActorDef::SetOpacity(double theValue){
1906 mySurfaceProp->SetOpacity(theValue);
1907 myBackSurfaceProp->SetOpacity(theValue);
1908 myNormalVProp->SetOpacity(theValue);
1909 myReversedVProp->SetOpacity(theValue);
1910 myEdgeProp->SetOpacity(theValue);
1911 myOutLineProp->SetOpacity(theValue);
1912 myNodeProp->SetOpacity(theValue);
1914 my1DProp->SetOpacity(theValue);
1915 my0DProp->SetOpacity(theValue);
1916 myBallProp->SetOpacity(theValue);
1920 double SMESH_ActorDef::GetOpacity(){
1921 return mySurfaceProp->GetOpacity();
1925 void SMESH_ActorDef::SetSufaceColor(double r,double g,double b, int delta){
1926 mySurfaceProp->SetColor(r,g,b);
1927 my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1928 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1929 if( aGroupObj->GetElementType() == SMDSAbs_Face )
1930 myNameActor->SetBackgroundColor(r,g,b);
1932 myDeltaBrightness = delta;
1933 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1934 myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1938 void SMESH_ActorDef::GetSufaceColor(double& r,double& g,double& b, int& delta){
1939 ::GetColor(mySurfaceProp,r,g,b);
1940 delta = myDeltaBrightness;
1943 void SMESH_ActorDef::SetVolumeColor(double r,double g,double b, int delta){
1944 myNormalVProp->SetColor(r,g,b);
1945 my3DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1946 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1947 if( aGroupObj->GetElementType() == SMDSAbs_Volume )
1948 myNameActor->SetBackgroundColor(r,g,b);
1950 myDeltaVBrightness = delta;
1951 QColor bfc = Qtx::mainColorToSecondary(QColor(int(r*255),int(g*255),int(b*255)), delta);
1952 myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
1956 void SMESH_ActorDef::GetVolumeColor(double& r,double& g,double& b, int& delta){
1957 ::GetColor(myNormalVProp,r,g,b);
1958 delta = myDeltaVBrightness;
1961 void SMESH_ActorDef::SetEdgeColor(double r,double g,double b){
1962 myEdgeProp->SetColor(r,g,b);
1963 my1DProp->SetColor(r,g,b);
1964 my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1965 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1966 if( aGroupObj->GetElementType() == SMDSAbs_Edge )
1967 myNameActor->SetBackgroundColor(r,g,b);
1971 void SMESH_ActorDef::GetEdgeColor(double& r,double& g,double& b){
1972 ::GetColor(myEdgeProp,r,g,b);
1975 void SMESH_ActorDef::SetOutlineColor(double r,double g,double b){
1976 myOutLineProp->SetColor(r,g,b);
1980 void SMESH_ActorDef::GetOutlineColor(double& r,double& g,double& b){
1981 ::GetColor(myOutLineProp,r,g,b);
1985 void SMESH_ActorDef::SetNodeColor(double r,double g,double b){
1986 myNodeProp->SetColor(r,g,b);
1987 myNodeExtProp->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_Node )
1990 myNameActor->SetBackgroundColor(r,g,b);
1994 void SMESH_ActorDef::GetNodeColor(double& r,double& g,double& b){
1995 ::GetColor(myNodeProp,r,g,b);
1998 void SMESH_ActorDef::Set0DColor(double r,double g,double b){
1999 my0DProp->SetColor(r,g,b);
2000 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2001 if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
2002 myNameActor->SetBackgroundColor(r,g,b);
2006 void SMESH_ActorDef::Get0DColor(double& r,double& g,double& b){
2007 ::GetColor(my0DProp,r,g,b);
2010 void SMESH_ActorDef::SetBallColor(double r,double g,double b){
2011 myBallProp->SetColor(r,g,b);
2012 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
2013 if( aGroupObj->GetElementType() == SMDSAbs_Ball )
2014 myNameActor->SetBackgroundColor(r,g,b);
2018 void SMESH_ActorDef::GetBallColor(double& r,double& g,double& b){
2019 ::GetColor(myBallProp,r,g,b);
2022 void SMESH_ActorDef::SetHighlightColor(double r,double g,double b){
2023 myHighlightProp->SetColor(r,g,b);
2027 void SMESH_ActorDef::GetHighlightColor(double& r,double& g,double& b){
2028 ::GetColor(myHighlightProp,r,g,b);
2031 void SMESH_ActorDef::SetPreHighlightColor(double r,double g,double b){
2032 myPreselectProp->SetColor(r,g,b);
2036 void SMESH_ActorDef::GetPreHighlightColor(double& r,double& g,double& b){
2037 ::GetColor(myPreselectProp,r,g,b);
2041 double SMESH_ActorDef::GetLineWidth(){
2042 return myEdgeProp->GetLineWidth();
2046 void SMESH_ActorDef::SetLineWidth(double theVal){
2047 myEdgeProp->SetLineWidth(theVal);
2049 my1DProp->SetLineWidth(theVal + aLineWidthInc);
2050 my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
2051 my2DExtProp->SetLineWidth(theVal + aLineWidthInc);
2052 my3DExtProp->SetLineWidth(theVal + aLineWidthInc);
2053 myOutLineProp->SetLineWidth(theVal);
2054 myHighlightProp->SetLineWidth(theVal);
2055 myPreselectProp->SetLineWidth(theVal);
2059 double SMESH_ActorDef::GetOutlineWidth()
2061 return myOutLineProp->GetLineWidth();
2064 void SMESH_ActorDef::SetOutlineWidth(double theVal)
2066 myOutLineProp->SetLineWidth(theVal);
2070 void SMESH_ActorDef::Set0DSize(double theVal){
2071 my0DProp->SetPointSize(theVal);
2072 myHighlightProp->SetPointSize(theVal);
2073 myPreselectProp->SetPointSize(theVal);
2075 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2076 aCustom->Set0DSize(theVal);
2078 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2079 aCustom->Set0DSize(theVal);
2085 double SMESH_ActorDef::Get0DSize(){
2086 return my0DProp->GetPointSize();
2089 void SMESH_ActorDef::SetBallSize(double theVal){
2090 myBallProp->SetPointSize(theVal);
2092 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2093 aCustom->SetBallSize(theVal);
2095 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2096 aCustom->SetBallSize(theVal);
2102 double SMESH_ActorDef::GetBallSize(){
2103 return myBallProp->GetPointSize();
2106 double SMESH_ActorDef::GetBallScale()
2108 return myBallActor->GetBallScale();
2111 void SMESH_ActorDef::SetBallScale( double theVal )
2113 myBallActor->SetBallScale( theVal );
2114 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myHighlightActor )) {
2115 aCustom->SetBallScale(theVal);
2117 if(SMESH_SVTKActor* aCustom = SMESH_SVTKActor::SafeDownCast( myPreHighlightActor )) {
2118 aCustom->SetBallScale(theVal);
2124 int SMESH_ActorDef::GetObjDimension( const int theObjId )
2126 return myVisualObj->GetElemDimension( theObjId );
2131 IsImplicitFunctionUsed() const
2133 return myBaseActor->IsImplicitFunctionUsed();
2137 SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
2139 myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2140 myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2142 myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2144 myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2146 my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2147 myBallActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2148 //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2150 my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2151 my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2153 my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2154 my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2155 my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2156 my3DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
2160 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
2163 myImplicitBoolean->GetFunction()->AddItem(thePlane);
2164 myCippingPlaneCont.push_back(thePlane);
2165 if(!IsImplicitFunctionUsed())
2166 SetImplicitFunctionUsed(true);
2167 myNodeActor->UpdateLabels();
2169 return myCippingPlaneCont.size();
2173 SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
2176 myPlaneCollection->AddItem( thePlane );
2180 SMESH_ActorDef::SetOpenGLClippingPlane()
2182 // before use this method you must add clipping planes using method
2183 // SMESH_ActorDef::AddOpenGLClippingPlane(vtkPlane* thePlane)
2184 if( !myPlaneCollection->GetNumberOfItems() )
2187 // It is necessary to set plane collection for each mapper of actor
2188 // and update current inputs of mapper
2189 myNodeActor->SetPlaneCollection( myPlaneCollection );
2190 myNodeActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2192 myBaseActor->SetPlaneCollection( myPlaneCollection );
2193 myBaseActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2195 myHighlitableActor->SetPlaneCollection( myPlaneCollection );
2196 myHighlitableActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2198 my1DActor->SetPlaneCollection( myPlaneCollection );
2199 my1DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2201 my2DActor->SetPlaneCollection( myPlaneCollection );
2202 my2DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2204 myNodeExtActor->SetPlaneCollection( myPlaneCollection );
2205 myNodeExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2207 my0DActor->SetPlaneCollection( myPlaneCollection );
2208 my0DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2210 myBallActor->SetPlaneCollection( myPlaneCollection );
2211 myBallActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2213 my1DExtActor->SetPlaneCollection( myPlaneCollection );
2214 my1DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2216 my2DExtActor->SetPlaneCollection( myPlaneCollection );
2217 my2DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2219 my3DActor->SetPlaneCollection( myPlaneCollection );
2220 my3DActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2222 my3DExtActor->SetPlaneCollection( myPlaneCollection );
2223 my3DExtActor->SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid());
2233 RemoveAllClippingPlanes()
2235 myPlaneCollection->RemoveAllItems();
2236 myImplicitBoolean->GetFunction()->RemoveAllItems();
2237 myImplicitBoolean->GetFunction()->Modified(); // VTK bug
2238 myCippingPlaneCont.clear();
2239 SetImplicitFunctionUsed(false);
2240 myNodeActor->UpdateLabels();
2245 GetNumberOfClippingPlanes()
2247 return myCippingPlaneCont.size();
2252 GetClippingPlane(vtkIdType theID)
2254 if ( theID >= (vtkIdType)myCippingPlaneCont.size() )
2256 return myCippingPlaneCont[theID].Get();
2259 void SMESH_ActorDef::UpdateScalarBar()
2261 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
2265 vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
2267 QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
2268 aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2270 aScalarBarTitleProp->SetFontFamilyToArial();
2272 if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
2274 QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
2275 if ( f.family() == "Arial" )
2276 aScalarBarTitleProp->SetFontFamilyToArial();
2277 else if ( f.family() == "Courier" )
2278 aScalarBarTitleProp->SetFontFamilyToCourier();
2279 else if ( f.family() == "Times" )
2280 aScalarBarTitleProp->SetFontFamilyToTimes();
2283 aScalarBarTitleProp->BoldOn();
2285 aScalarBarTitleProp->BoldOff();
2288 aScalarBarTitleProp->ItalicOn();
2290 aScalarBarTitleProp->ItalicOff();
2293 aScalarBarTitleProp->ShadowOn();
2295 aScalarBarTitleProp->ShadowOff();
2298 myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
2299 aScalarBarTitleProp->Delete();
2301 vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
2303 aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
2304 aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
2306 aScalarBarLabelProp->SetFontFamilyToArial();
2307 if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
2309 QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
2310 if( f.family() == "Arial" )
2311 aScalarBarLabelProp->SetFontFamilyToArial();
2312 else if( f.family() == "Courier" )
2313 aScalarBarLabelProp->SetFontFamilyToCourier();
2314 else if( f.family() == "Times" )
2315 aScalarBarLabelProp->SetFontFamilyToTimes();
2318 aScalarBarLabelProp->BoldOn();
2320 aScalarBarLabelProp->BoldOff();
2323 aScalarBarLabelProp->ItalicOn();
2325 aScalarBarLabelProp->ItalicOff();
2328 aScalarBarLabelProp->ShadowOn();
2330 aScalarBarLabelProp->ShadowOff();
2333 myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
2334 aScalarBarLabelProp->Delete();
2336 bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
2337 QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
2339 myScalarBarActor->SetOrientationToHorizontal();
2341 myScalarBarActor->SetOrientationToVertical();
2344 double aXVal = horiz ? 0.20 : 0.01;
2345 if( mgr->hasValue( "SMESH", name + "x" ) )
2346 aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
2348 double aYVal = horiz ? 0.01 : 0.1;
2349 if( mgr->hasValue( "SMESH", name + "y" ) )
2350 aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
2351 myScalarBarActor->SetPosition( aXVal, aYVal );
2353 double aWVal = horiz ? 0.60 : 0.10;
2354 if( mgr->hasValue( "SMESH", name + "width" ) )
2355 aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
2356 myScalarBarActor->SetWidth( aWVal );
2358 double aHVal = horiz ? 0.12 : 0.80;
2359 if( mgr->hasValue( "SMESH", name + "height" ) )
2360 aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
2361 myScalarBarActor->SetHeight( aHVal );
2364 if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
2365 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
2366 myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
2369 if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
2370 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
2371 myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
2373 bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
2374 myScalarBarActor->SetDistributionVisibility(distributionVisibility);
2376 int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
2377 myScalarBarActor->SetDistributionColoringType(coloringType);
2379 QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
2380 QColor(255, 255, 255));
2382 rgb[0]= distributionColor.red()/255.;
2383 rgb[1]= distributionColor.green()/255.;
2384 rgb[2]= distributionColor.blue()/255.;
2385 myScalarBarActor->SetDistributionColor(rgb);
2390 void SMESH_ActorDef::UpdateDistribution()
2392 if(SMESH::Controls::NumericalFunctor* fun =
2393 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2395 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2396 std::vector<int> nbEvents;
2397 std::vector<double> funValues;
2398 SMESH_VisualObjDef::TEntityList elems;
2399 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2400 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2401 std::vector<int> elemIds;
2402 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2403 elemIds.push_back( (*e)->GetID());
2404 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2405 double * range = lookupTable->GetRange();
2406 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2407 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2408 myScalarBarActor->SetDistribution(nbEvents);
2412 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
2415 case SMESH_Actor::eLines :
2416 myHighlitableActor->SetQuadraticArcMode(false);
2417 my2DActor->SetQuadraticArcMode(false);
2418 my1DActor->SetQuadraticArcMode(false);
2420 case SMESH_Actor::eArcs :
2421 myHighlitableActor->SetQuadraticArcMode(true);
2422 if(GetRepresentation() != SMESH_Actor::ePoint) {
2423 my2DActor->SetQuadraticArcMode(true);
2424 my1DActor->SetQuadraticArcMode(true);
2433 SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
2435 if(myHighlitableActor->GetQuadraticArcMode())
2436 return SMESH_Actor::eArcs;
2438 return SMESH_Actor::eLines;
2441 void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
2443 SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
2444 myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
2445 myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
2448 void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
2450 SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
2451 myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2452 myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2453 myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
2456 #ifndef DISABLE_PLOT2DVIEWER
2457 SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram() {
2460 my2dHistogram->clearAllPoints();
2462 if(SMESH::Controls::NumericalFunctor* fun =
2463 dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
2466 if(!my2dHistogram) {
2467 my2dHistogram = new SPlot2d_Histogram();
2468 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
2469 my2dHistogram->setIO(anIO);
2472 int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
2473 std::vector<int> nbEvents;
2474 std::vector<double> funValues;
2475 SMESH_VisualObjDef::TEntityList elems;
2476 if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
2477 dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
2478 std::vector<int> elemIds;
2480 for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
2481 elemIds.push_back( (*e)->GetID());
2483 vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
2484 double * range = lookupTable->GetRange();
2485 bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
2486 fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
2488 for ( size_t i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
2489 my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
2491 if(funValues.size() >= 2)
2492 my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
2496 //Color of the histogram
2497 if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
2498 my2dHistogram->setAutoAssign(true);
2501 myScalarBarActor->GetDistributionColor(rgb);
2502 QColor aColor = QColor( (int)( rgb[0]*255 ), (int)( rgb[1]*255 ), (int)( rgb[2]*255 ) );
2503 my2dHistogram->setColor(aColor);
2507 return my2dHistogram;