1 // Copyright (C) 2007-2010 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_ObjectDef.h"
32 #include "SMESH_ControlsDef.hxx"
33 #include "SMDS_UnstructuredGrid.hxx"
34 #include "SMESH_ScalarBarActor.h"
35 #include "VTKViewer_CellCenters.h"
36 #include "VTKViewer_ExtractUnstructuredGrid.h"
37 #include "VTKViewer_FramedTextActor.h"
38 #include "SALOME_InteractiveObject.hxx"
40 #include "SUIT_Session.h"
41 #include "SUIT_ResourceMgr.h"
43 #include <vtkProperty.h>
44 #include <vtkTimeStamp.h>
45 #include <vtkObjectFactory.h>
46 #include <vtkShrinkPolyData.h>
47 #include <vtkMergeFilter.h>
49 #include <vtkMatrix4x4.h>
50 #include <vtkUnstructuredGrid.h>
51 #include <vtkPointData.h>
52 #include <vtkCellData.h>
54 #include <vtkMapper.h>
55 #include <vtkRenderer.h>
58 #include <vtkIdList.h>
59 #include <vtkIntArray.h>
61 #include <vtkActor2D.h>
62 #include <vtkProperty2D.h>
63 #include <vtkPolyData.h>
64 #include <vtkMaskPoints.h>
65 #include <vtkTextProperty.h>
66 #include <vtkLabeledDataMapper.h>
67 #include <vtkSelectVisiblePoints.h>
69 #include <vtkLookupTable.h>
73 #include <vtkImplicitBoolean.h>
74 #include <vtkImplicitFunctionCollection.h>
76 #include <vtkConfigure.h>
77 #if !defined(VTK_XVERSION)
78 #define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
81 #include "utilities.h"
84 static int MYDEBUG = 1;
86 static int MYDEBUG = 1;
89 static int aLineWidthInc = 2;
92 SMESH_ActorDef* SMESH_ActorDef::New(){
93 return new SMESH_ActorDef();
97 SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
102 SMESH_ActorDef* anActor = SMESH_ActorDef::New();
103 if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
108 anActor->UpdateScalarBar();
113 SMESH_ActorDef::SMESH_ActorDef()
115 if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
117 myTimeStamp = vtkTimeStamp::New();
119 myIsPointsVisible = false;
121 myIsShrinkable = false;
124 myIsFacesOriented = false;
126 myControlsPrecision = -1;
127 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
129 if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
130 myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
132 vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
133 vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
135 vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
136 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
138 //Definition 2D and 3D devices of the actor
139 //-----------------------------------------
140 vtkFloatingPointType anRGB[3] = {1,1,1};
141 mySurfaceProp = vtkProperty::New();
142 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
143 mySurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
145 myBackSurfaceProp = vtkProperty::New();
146 SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
147 myBackSurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
149 my2DActor = SMESH_DeviceActor::New();
150 my2DActor->SetUserMatrix(aMatrix);
151 my2DActor->PickableOff();
152 my2DActor->SetProperty(mySurfaceProp);
153 my2DActor->SetBackfaceProperty(myBackSurfaceProp);
154 my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
155 aFilter = my2DActor->GetExtractUnstructuredGrid();
156 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
157 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
158 aFilter->RegisterCellsWithType(VTK_POLYGON);
159 aFilter->RegisterCellsWithType(VTK_QUAD);
160 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
161 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
163 my2DExtProp = vtkProperty::New();
164 my2DExtProp->DeepCopy(mySurfaceProp);
165 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
166 anRGB[0] = 1 - anRGB[0];
167 anRGB[1] = 1 - anRGB[1];
168 anRGB[2] = 1 - anRGB[2];
169 my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
171 my2DExtActor = SMESH_DeviceActor::New();
172 my2DExtActor->SetUserMatrix(aMatrix);
173 my2DExtActor->PickableOff();
174 my2DExtActor->SetProperty(my2DExtProp);
175 my2DExtActor->SetBackfaceProperty(my2DExtProp);
176 my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
177 aFilter = my2DExtActor->GetExtractUnstructuredGrid();
178 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
179 aFilter->RegisterCellsWithType(VTK_POLYGON);
180 aFilter->RegisterCellsWithType(VTK_QUAD);
181 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
182 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
184 my3DActor = SMESH_DeviceActor::New();
185 my3DActor->SetUserMatrix(aMatrix);
186 my3DActor->PickableOff();
187 my3DActor->SetProperty(mySurfaceProp);
188 my3DActor->SetBackfaceProperty(myBackSurfaceProp);
189 my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
190 aFilter = my3DActor->GetExtractUnstructuredGrid();
191 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
192 aFilter->RegisterCellsWithType(VTK_TETRA);
193 aFilter->RegisterCellsWithType(VTK_VOXEL);
194 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
195 aFilter->RegisterCellsWithType(VTK_WEDGE);
196 aFilter->RegisterCellsWithType(VTK_PYRAMID);
197 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
198 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
199 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
200 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
201 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
202 //#ifdef VTK_HAVE_POLYHEDRON
203 MESSAGE("RegisterCellsWithType(VTK_POLYHEDRON)");
204 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
207 //Definition 1D device of the actor
208 //---------------------------------
209 myEdgeProp = vtkProperty::New();
210 myEdgeProp->SetAmbient(1.0);
211 myEdgeProp->SetDiffuse(0.0);
212 myEdgeProp->SetSpecular(0.0);
213 SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
214 myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
215 myEdgeProp->SetLineWidth(aLineWidth);
217 my1DActor = SMESH_DeviceActor::New();
218 my1DActor->SetUserMatrix(aMatrix);
219 my1DActor->PickableOff();
220 my1DActor->SetHighlited(true);
221 my1DActor->SetProperty(myEdgeProp);
222 my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
223 aFilter = my1DActor->GetExtractUnstructuredGrid();
224 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
225 aFilter->RegisterCellsWithType(VTK_LINE);
226 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
228 my1DProp = vtkProperty::New();
229 my1DProp->DeepCopy(myEdgeProp);
230 my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
231 my1DProp->SetPointSize(aElem0DSize);
233 my1DExtProp = vtkProperty::New();
234 my1DExtProp->DeepCopy(myEdgeProp);
235 anRGB[0] = 1 - anRGB[0];
236 anRGB[1] = 1 - anRGB[1];
237 anRGB[2] = 1 - anRGB[2];
238 my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
239 my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
240 my1DExtProp->SetPointSize(aElem0DSize);
242 my1DExtActor = SMESH_DeviceActor::New();
243 my1DExtActor->SetUserMatrix(aMatrix);
244 my1DExtActor->PickableOff();
245 my1DExtActor->SetHighlited(true);
246 my1DExtActor->SetVisibility(false);
247 my1DExtActor->SetProperty(my1DExtProp);
248 my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
249 aFilter = my1DExtActor->GetExtractUnstructuredGrid();
250 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
251 aFilter->RegisterCellsWithType(VTK_LINE);
252 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
255 //Definition 0D device of the actor (0d elements)
256 //-----------------------------------------------
257 my0DProp = vtkProperty::New();
258 SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
259 my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
260 my0DProp->SetPointSize(aElem0DSize);
262 my0DActor = SMESH_DeviceActor::New();
263 my0DActor->SetUserMatrix(aMatrix);
264 my0DActor->SetStoreClippingMapping(true);
265 my0DActor->PickableOff();
266 my0DActor->SetVisibility(false);
267 my0DActor->SetProperty(my0DProp);
268 my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
269 aFilter = my0DActor->GetExtractUnstructuredGrid();
270 //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
271 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
272 aFilter->RegisterCellsWithType(VTK_VERTEX);
274 //my0DExtProp = vtkProperty::New();
275 //my0DExtProp->DeepCopy(my0DProp);
276 //anRGB[0] = 1 - anRGB[0];
277 //anRGB[1] = 1 - anRGB[1];
278 //anRGB[2] = 1 - anRGB[2];
279 //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
280 //my0DExtProp->SetPointSize(aElem0DSize);
282 //my0DExtActor = SMESH_DeviceActor::New();
283 //my0DExtActor->SetUserMatrix(aMatrix);
284 //my0DExtActor->SetStoreClippingMapping(true);
285 //my0DExtActor->PickableOff();
286 //my0DExtActor->SetHighlited(true);
287 //my0DExtActor->SetVisibility(false);
288 //my0DExtActor->SetProperty(my0DExtProp);
289 //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
290 //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
291 ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
292 //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
293 //aFilter->RegisterCellsWithType(VTK_VERTEX);
296 //Definition 0D device of the actor (nodes)
297 //-----------------------------------------
298 myNodeProp = vtkProperty::New();
299 SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
300 myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
302 myNodeActor = SMESH_DeviceActor::New();
303 myNodeActor->SetUserMatrix(aMatrix);
304 myNodeActor->SetStoreClippingMapping(true);
305 myNodeActor->PickableOff();
306 myNodeActor->SetVisibility(false);
307 myNodeActor->SetProperty(myNodeProp);
308 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
309 aFilter = myNodeActor->GetExtractUnstructuredGrid();
310 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
312 myNodeExtProp = vtkProperty::New();
313 myNodeExtProp->DeepCopy(myNodeProp);
314 anRGB[0] = 1 - anRGB[0];
315 anRGB[1] = 1 - anRGB[1];
316 anRGB[2] = 1 - anRGB[2];
317 myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
319 myNodeExtActor = SMESH_DeviceActor::New();
320 myNodeExtActor->SetUserMatrix(aMatrix);
321 myNodeExtActor->SetStoreClippingMapping(true);
322 myNodeExtActor->PickableOff();
323 myNodeExtActor->SetHighlited(true);
324 myNodeExtActor->SetVisibility(false);
325 myNodeExtActor->SetProperty(myNodeExtProp);
326 myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
327 aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
328 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
329 aFilter->RegisterCellsWithType(VTK_VERTEX);
331 //Definition of Pickable and Highlitable engines
332 //----------------------------------------------
334 myBaseActor = SMESH_DeviceActor::New();
335 myBaseActor->SetUserMatrix(aMatrix);
336 myBaseActor->SetStoreGemetryMapping(true);
337 myBaseActor->GetProperty()->SetOpacity(0.0);
339 myPickableActor = myBaseActor;
341 myHighlightProp = vtkProperty::New();
342 myHighlightProp->SetAmbient(1.0);
343 myHighlightProp->SetDiffuse(0.0);
344 myHighlightProp->SetSpecular(0.0);
345 SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
346 myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
347 myHighlightProp->SetPointSize(aElem0DSize); // ??
348 myHighlightProp->SetRepresentation(1);
350 myPreselectProp = vtkProperty::New();
351 myPreselectProp->SetAmbient(1.0);
352 myPreselectProp->SetDiffuse(0.0);
353 myPreselectProp->SetSpecular(0.0);
354 SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
355 myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
356 myPreselectProp->SetPointSize(aElem0DSize); // ??
357 myPreselectProp->SetRepresentation(1);
359 myHighlitableActor = SMESH_DeviceActor::New();
360 myHighlitableActor->SetUserMatrix(aMatrix);
361 myHighlitableActor->PickableOff();
362 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
369 myControlMode = eNone;
370 myControlActor = my2DActor;
372 //Definition of myScalarBarActor
373 //------------------------------
374 myLookupTable = vtkLookupTable::New();
375 //Fix for Bug PAL5195 - SMESH764:
376 //Controls - Aspect Ratio: incorrect colors of the best and worst values
377 myLookupTable->SetHueRange(0.667,0.0);
379 myScalarBarActor = SMESH_ScalarBarActor::New();
380 myScalarBarActor->SetVisibility(false);
381 myScalarBarActor->SetLookupTable(myLookupTable);
384 //Incorrect "Min value" in Scalar Bar in Mesh:
385 // myScalarBarActor->SetLabelFormat("%.4g");
386 // changes was commented because of regression bug IPAL 19981
388 mgr = SUIT_Session::session()->resourceMgr();
392 //Definition of points numbering pipeline
393 //---------------------------------------
394 myPointsNumDataSet = vtkUnstructuredGrid::New();
396 myPtsMaskPoints = vtkMaskPoints::New();
397 myPtsMaskPoints->SetInput(myPointsNumDataSet);
398 myPtsMaskPoints->SetOnRatio(1);
400 myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
401 myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
402 myPtsSelectVisiblePoints->SelectInvisibleOff();
403 myPtsSelectVisiblePoints->SetTolerance(0.1);
405 myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
406 myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
407 #if (VTK_XVERSION < 0x050200)
408 myPtsLabeledDataMapper->SetLabelFormat("%g");
410 myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
412 vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
413 aPtsTextProp->SetFontFamilyToTimes();
414 static int aPointsFontSize = 10;
415 aPtsTextProp->SetFontSize(aPointsFontSize);
416 aPtsTextProp->SetBold(1);
417 aPtsTextProp->SetItalic(0);
418 aPtsTextProp->SetShadow(0);
419 myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
420 aPtsTextProp->Delete();
422 myEntityMode = eAllEntity;
424 myIsPointsLabeled = false;
426 myPointLabels = vtkActor2D::New();
427 myPointLabels->SetMapper(myPtsLabeledDataMapper);
428 myPointLabels->GetProperty()->SetColor(1,1,1);
429 myPointLabels->SetVisibility(myIsPointsLabeled);
432 //Definition of cells numbering pipeline
433 //---------------------------------------
434 myCellsNumDataSet = vtkUnstructuredGrid::New();
436 myCellCenters = VTKViewer_CellCenters::New();
437 myCellCenters->SetInput(myCellsNumDataSet);
439 myClsMaskPoints = vtkMaskPoints::New();
440 myClsMaskPoints->SetInput(myCellCenters->GetOutput());
441 myClsMaskPoints->SetOnRatio(1);
443 myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
444 myClsSelectVisiblePoints->SetInput(myClsMaskPoints->GetOutput());
445 myClsSelectVisiblePoints->SelectInvisibleOff();
446 myClsSelectVisiblePoints->SetTolerance(0.1);
448 myClsLabeledDataMapper = vtkLabeledDataMapper::New();
449 myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
450 #if (VTK_XVERSION < 0x050200)
451 myClsLabeledDataMapper->SetLabelFormat("%g");
453 myClsLabeledDataMapper->SetLabelModeToLabelScalars();
455 vtkTextProperty* aClsTextProp = vtkTextProperty::New();
456 aClsTextProp->SetFontFamilyToTimes();
457 static int aCellsFontSize = 12;
458 aClsTextProp->SetFontSize(aCellsFontSize);
459 aClsTextProp->SetBold(1);
460 aClsTextProp->SetItalic(0);
461 aClsTextProp->SetShadow(0);
462 myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
463 aClsTextProp->Delete();
465 myIsCellsLabeled = false;
467 myCellsLabels = vtkActor2D::New();
468 myCellsLabels->SetMapper(myClsLabeledDataMapper);
469 myCellsLabels->GetProperty()->SetColor(0,1,0);
470 myCellsLabels->SetVisibility(myIsCellsLabeled);
473 myImplicitBoolean = vtkImplicitBoolean::New();
474 myImplicitBoolean->SetOperationTypeToIntersection();
478 //Quadratic 2D elements representation
479 //-----------------------------------------------------------------------------
480 int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
481 if(aQuadratic2DMode == 0){
482 myHighlitableActor->SetQuadraticArcMode(false);
483 my2DActor->SetQuadraticArcMode(false);
484 my1DActor->SetQuadraticArcMode(false);
486 else if(aQuadratic2DMode == 1){
487 myHighlitableActor->SetQuadraticArcMode(true);
488 my2DActor->SetQuadraticArcMode(true);
489 my1DActor->SetQuadraticArcMode(true);
492 int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
493 myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
494 my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
496 // Set colors of the name actor
497 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
498 myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
499 SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
500 myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
504 SMESH_ActorDef::~SMESH_ActorDef()
506 if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
508 // caught by SMESHGUI::ProcessEvents() static method
509 this->InvokeEvent( SMESH::DeleteActorEvent, NULL );
511 myScalarBarActor->Delete();
512 myLookupTable->Delete();
514 mySurfaceProp->Delete();
515 myBackSurfaceProp->Delete();
517 myEdgeProp->Delete();
518 myHighlightProp->Delete();
519 myPreselectProp->Delete();
521 myNodeProp->Delete();
522 myNodeExtProp->Delete();
527 //my0DExtProp->Delete();
528 //my0DExtActor->Delete();
533 my1DExtProp->Delete();
534 my1DExtActor->Delete();
537 my2DExtProp->Delete();
538 my2DExtActor->Delete();
541 myNodeActor->Delete();
542 myBaseActor->Delete();
544 myNodeExtActor->Delete();
546 myHighlitableActor->Delete();
548 //Deleting of points numbering pipeline
549 //---------------------------------------
550 myPointsNumDataSet->Delete();
552 // commented: porting to vtk 5.0
553 // myPtsLabeledDataMapper->RemoveAllInputs();
554 myPtsLabeledDataMapper->Delete();
556 // commented: porting to vtk 5.0
557 // myPtsSelectVisiblePoints->UnRegisterAllOutputs();
558 myPtsSelectVisiblePoints->Delete();
560 // commented: porting to vtk 5.0
561 // myPtsMaskPoints->UnRegisterAllOutputs();
562 myPtsMaskPoints->Delete();
564 myPointLabels->Delete();
567 //Deleting of cells numbering pipeline
568 //---------------------------------------
569 myCellsNumDataSet->Delete();
571 myClsLabeledDataMapper->RemoveAllInputs();
572 myClsLabeledDataMapper->Delete();
574 // commented: porting to vtk 5.0
575 // myClsSelectVisiblePoints->UnRegisterAllOutputs();
576 myClsSelectVisiblePoints->Delete();
578 // commented: porting to vtk 5.0
579 // myClsMaskPoints->UnRegisterAllOutputs();
580 myClsMaskPoints->Delete();
582 // commented: porting to vtk 5.0
583 // myCellCenters->UnRegisterAllOutputs();
584 myCellCenters->Delete();
586 myCellsLabels->Delete();
588 myImplicitBoolean->Delete();
590 myTimeStamp->Delete();
594 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
596 vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
598 myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
600 if ( myIsPointsLabeled )
602 myPointsNumDataSet->ShallowCopy(aGrid);
603 vtkDataSet *aDataSet = myPointsNumDataSet;
605 int aNbElem = aDataSet->GetNumberOfPoints();
607 vtkIntArray *anArray = vtkIntArray::New();
608 anArray->SetNumberOfValues( aNbElem );
610 for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
612 int aSMDSId = myVisualObj->GetNodeObjId( anId );
613 anArray->SetValue( anId, aSMDSId );
616 aDataSet->GetPointData()->SetScalars( anArray );
618 myPtsMaskPoints->SetInput( aDataSet );
619 myPointLabels->SetVisibility( GetVisibility() );
623 myPointLabels->SetVisibility( false );
625 SetRepresentation(GetRepresentation());
626 myTimeStamp->Modified();
630 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
632 vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
633 myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
634 if(myIsCellsLabeled){
635 myCellsNumDataSet->ShallowCopy(aGrid);
636 vtkDataSet *aDataSet = myCellsNumDataSet;
637 int aNbElem = aDataSet->GetNumberOfCells();
638 vtkIntArray *anArray = vtkIntArray::New();
639 anArray->SetNumberOfValues(aNbElem);
640 for(int anId = 0; anId < aNbElem; anId++){
641 int aSMDSId = myVisualObj->GetElemObjId(anId);
642 anArray->SetValue(anId,aSMDSId);
644 aDataSet->GetCellData()->SetScalars(anArray);
645 myCellCenters->SetInput(aDataSet);
646 myCellsLabels->SetVisibility(GetVisibility());
648 myCellsLabels->SetVisibility(false);
650 myTimeStamp->Modified();
654 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
656 myIsFacesOriented = theIsFacesOriented;
658 my2DActor->SetFacesOriented(theIsFacesOriented);
659 my3DActor->SetFacesOriented(theIsFacesOriented);
661 myTimeStamp->Modified();
664 bool SMESH_ActorDef::GetFacesOriented()
666 return myIsFacesOriented;
669 void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType theColor[3])
671 my2DActor->SetFacesOrientationColor( theColor );
672 my3DActor->SetFacesOrientationColor( theColor );
675 void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType theColor[3])
677 my3DActor->GetFacesOrientationColor( theColor );
680 void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale)
682 my2DActor->SetFacesOrientationScale( theScale );
683 my3DActor->SetFacesOrientationScale( theScale );
686 vtkFloatingPointType SMESH_ActorDef::GetFacesOrientationScale()
688 return my3DActor->GetFacesOrientationScale();
691 void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
693 my2DActor->SetFacesOrientation3DVectors( theState );
694 my3DActor->SetFacesOrientation3DVectors( theState );
697 bool SMESH_ActorDef::GetFacesOrientation3DVectors()
699 return my3DActor->GetFacesOrientation3DVectors();
705 SetControlMode(eControl theMode)
707 SetControlMode(theMode,true);
713 SetControlMode(eControl theMode,
714 bool theCheckEntityMode)
716 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
720 myControlMode = eNone;
721 theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
723 my0DActor->GetMapper()->SetScalarVisibility(false);
724 my1DActor->GetMapper()->SetScalarVisibility(false);
725 my2DActor->GetMapper()->SetScalarVisibility(false);
726 my3DActor->GetMapper()->SetScalarVisibility(false);
727 myScalarBarActor->SetVisibility(false);
729 bool anIsScalarVisible = theMode > eNone;
731 if(anIsScalarVisible){
735 SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
736 aControl->SetPrecision( myControlsPrecision );
737 myFunctor.reset( aControl );
738 myControlActor = my1DActor;
743 myFunctor.reset(new SMESH::Controls::Length2D());
744 myControlActor = my2DActor;
748 myFunctor.reset(new SMESH::Controls::FreeBorders());
749 myControlActor = my1DActor;
752 myFunctor.reset(new SMESH::Controls::FreeEdges());
753 myControlActor = my2DActor;
756 myFunctor.reset(new SMESH::Controls::FreeNodes());
757 myControlActor = myNodeActor;
760 myFunctor.reset(new SMESH::Controls::FreeFaces());
761 myControlActor = my2DActor;
763 case eMultiConnection:
764 myFunctor.reset(new SMESH::Controls::MultiConnection());
765 myControlActor = my1DActor;
767 case eMultiConnection2D:
768 myFunctor.reset(new SMESH::Controls::MultiConnection2D());
769 myControlActor = my2DActor;
773 SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
774 aControl->SetPrecision( myControlsPrecision );
775 myFunctor.reset( aControl );
776 myControlActor = my2DActor;
781 SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
782 aControl->SetPrecision( myControlsPrecision );
783 myFunctor.reset( aControl );
784 myControlActor = my2DActor;
789 SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
790 aControl->SetPrecision( myControlsPrecision );
791 myFunctor.reset( aControl );
792 myControlActor = my2DActor;
797 SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
798 aControl->SetPrecision( myControlsPrecision );
799 myFunctor.reset( aControl );
800 myControlActor = my3DActor;
805 SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
806 aControl->SetPrecision( myControlsPrecision );
807 myFunctor.reset( aControl );
808 myControlActor = my3DActor;
811 case eMaxElementLength2D:
813 SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
814 aControl->SetPrecision( myControlsPrecision );
815 myFunctor.reset( aControl );
816 myControlActor = my2DActor;
819 case eMaxElementLength3D:
821 SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
822 aControl->SetPrecision( myControlsPrecision );
823 myFunctor.reset( aControl );
824 myControlActor = my3DActor;
829 SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
830 aControl->SetPrecision( myControlsPrecision );
831 myFunctor.reset( aControl );
832 myControlActor = my2DActor;
837 SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
838 aControl->SetPrecision( myControlsPrecision );
839 myFunctor.reset( aControl );
840 myControlActor = my2DActor;
845 SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
846 aControl->SetPrecision( myControlsPrecision );
847 myFunctor.reset( aControl );
848 myControlActor = my2DActor;
855 vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
856 vtkIdType aNbCells = aGrid->GetNumberOfCells();
858 myControlMode = theMode;
859 switch(myControlMode){
861 myNodeExtActor->SetExtControlMode(myFunctor);
865 my1DExtActor->SetExtControlMode(myFunctor);
868 my2DExtActor->SetExtControlMode(myFunctor);
871 case eMultiConnection2D:
872 my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
875 myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
879 if(theCheckEntityMode){
880 if(myControlActor == my1DActor)
881 SetEntityMode(eEdges);
882 else if(myControlActor == my2DActor){
883 switch(myControlMode){
887 case eMultiConnection2D:
888 //SetEntityMode(eEdges);
889 SetEntityMode(eFaces);
892 SetEntityMode(eFaces);
894 }else if(myControlActor == my3DActor)
895 SetEntityMode(eVolumes);
900 if(theCheckEntityMode)
901 myEntityMode = eAllEntity;
905 SetRepresentation(GetRepresentation());
907 myTimeStamp->Modified();
912 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
913 theRenderer->AddActor(myNodeActor);
914 theRenderer->AddActor(myBaseActor);
916 theRenderer->AddActor(myNodeExtActor);
918 my3DActor->AddToRender(theRenderer);
919 my2DActor->AddToRender(theRenderer);
920 my2DExtActor->AddToRender(theRenderer);
922 theRenderer->AddActor(my1DActor);
923 theRenderer->AddActor(my1DExtActor);
925 theRenderer->AddActor(my0DActor);
926 //theRenderer->AddActor(my0DExtActor);
928 theRenderer->AddActor(myHighlitableActor);
930 theRenderer->AddActor2D(myScalarBarActor);
932 myPtsSelectVisiblePoints->SetRenderer(theRenderer);
933 myClsSelectVisiblePoints->SetRenderer(theRenderer);
935 theRenderer->AddActor2D(myPointLabels);
936 theRenderer->AddActor2D(myCellsLabels);
938 // the superclass' method should be called at the end
939 // (in particular, for correct work of selection)
940 SALOME_Actor::AddToRender(theRenderer);
943 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
944 SALOME_Actor::RemoveFromRender(theRenderer);
946 theRenderer->RemoveActor(myNodeActor);
947 theRenderer->RemoveActor(myBaseActor);
949 theRenderer->RemoveActor(myNodeExtActor);
951 theRenderer->RemoveActor(myHighlitableActor);
953 theRenderer->RemoveActor(my0DActor);
954 //theRenderer->RemoveActor(my0DExtActor);
956 theRenderer->RemoveActor(my1DActor);
957 theRenderer->RemoveActor(my1DExtActor);
959 my2DActor->RemoveFromRender(theRenderer);
960 my2DExtActor->RemoveFromRender(theRenderer);
961 my3DActor->RemoveFromRender(theRenderer);
963 theRenderer->RemoveActor(myScalarBarActor);
964 theRenderer->RemoveActor(myPointLabels);
965 theRenderer->RemoveActor(myCellsLabels);
969 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
970 const char* theEntry,
974 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
978 myVisualObj = theVisualObj;
979 myVisualObj->Update(theIsClear);
981 myNodeActor->Init(myVisualObj,myImplicitBoolean);
982 myBaseActor->Init(myVisualObj,myImplicitBoolean);
984 myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
986 myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
988 my0DActor->Init(myVisualObj,myImplicitBoolean);
989 //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
991 my1DActor->Init(myVisualObj,myImplicitBoolean);
992 my1DExtActor->Init(myVisualObj,myImplicitBoolean);
994 my2DActor->Init(myVisualObj,myImplicitBoolean);
995 my2DExtActor->Init(myVisualObj,myImplicitBoolean);
996 my3DActor->Init(myVisualObj,myImplicitBoolean);
998 my0DActor->GetMapper()->SetLookupTable(myLookupTable);
999 //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1001 my1DActor->GetMapper()->SetLookupTable(myLookupTable);
1002 my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1004 my2DActor->GetMapper()->SetLookupTable(myLookupTable);
1005 my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1006 my3DActor->GetMapper()->SetLookupTable(myLookupTable);
1008 vtkFloatingPointType aFactor, aUnits;
1009 my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
1010 my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
1011 my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
1013 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1017 //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
1018 SetIsShrunkable(true);
1020 SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
1022 int aMode = mgr->integerValue( "SMESH", "display_mode" );
1023 SetRepresentation(-1);
1026 SetRepresentation(eEdge);
1027 }else if(aMode == 1){
1028 SetRepresentation(eSurface);
1029 }else if(aMode == 2){
1030 SetRepresentation(ePoint);
1037 if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1038 SetIsDisplayNameActor( true );
1040 int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
1041 int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
1042 SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
1044 myTimeStamp->Modified();
1050 vtkFloatingPointType* SMESH_ActorDef::GetBounds(){
1051 return myNodeActor->GetBounds();
1055 vtkDataSet* SMESH_ActorDef::GetInput(){
1056 return GetUnstructuredGrid();
1060 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
1061 Superclass::SetTransform(theTransform);
1063 myNodeActor->SetTransform(theTransform);
1064 myBaseActor->SetTransform(theTransform);
1066 myHighlitableActor->SetTransform(theTransform);
1068 myNodeExtActor->SetTransform(theTransform);
1070 my0DActor->SetTransform(theTransform);
1071 //my0DExtActor->SetTransform(theTransform);
1073 my1DActor->SetTransform(theTransform);
1074 my1DExtActor->SetTransform(theTransform);
1076 my2DActor->SetTransform(theTransform);
1077 my2DExtActor->SetTransform(theTransform);
1078 my3DActor->SetTransform(theTransform);
1084 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
1085 vtkLODActor::SetMapper(theMapper);
1089 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
1090 SALOME_Actor::ShallowCopy(prop);
1094 vtkMapper* SMESH_ActorDef::GetMapper(){
1095 return myPickableActor->GetMapper();
1099 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
1100 return myVisualObj->GetUnstructuredGrid();
1104 bool SMESH_ActorDef::IsInfinitive(){
1105 vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
1107 myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
1108 ( aDataSet->GetNumberOfCells() == 1 &&
1109 aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
1110 return SALOME_Actor::IsInfinitive();
1114 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
1115 if ( myIsShrinkable == theShrunkable )
1117 myIsShrinkable = theShrunkable;
1121 vtkFloatingPointType SMESH_ActorDef::GetShrinkFactor(){
1122 return myBaseActor->GetShrinkFactor();
1125 void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
1126 myBaseActor->SetShrinkFactor(theValue);
1128 my1DActor->SetShrinkFactor(theValue);
1129 my1DExtActor->SetShrinkFactor(theValue);
1131 my2DActor->SetShrinkFactor(theValue);
1132 my2DExtActor->SetShrinkFactor(theValue);
1133 my3DActor->SetShrinkFactor(theValue);
1138 void SMESH_ActorDef::SetShrink(){
1139 if(!myIsShrinkable) return;
1141 myBaseActor->SetShrink();
1143 my1DActor->SetShrink();
1144 my1DExtActor->SetShrink();
1146 my2DActor->SetShrink();
1147 my2DExtActor->SetShrink();
1148 my3DActor->SetShrink();
1154 void SMESH_ActorDef::UnShrink(){
1155 if(!myIsShrunk) return;
1157 myBaseActor->UnShrink();
1159 my1DActor->UnShrink();
1160 my1DExtActor->UnShrink();
1162 my2DActor->UnShrink();
1163 my2DExtActor->UnShrink();
1164 my3DActor->UnShrink();
1171 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1172 return myPickableActor->GetNodeObjId(theVtkID);
1175 vtkFloatingPointType* SMESH_ActorDef::GetNodeCoord(int theObjID){
1176 return myPickableActor->GetNodeCoord(theObjID);
1180 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1181 return myPickableActor->GetElemObjId(theVtkID);
1184 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1185 return myPickableActor->GetElemCell(theObjID);
1189 void SMESH_ActorDef::SetVisibility(int theMode){
1190 SetVisibility(theMode,true);
1194 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1195 SALOME_Actor::SetVisibility(theMode);
1197 myNodeActor->VisibilityOff();
1198 myBaseActor->VisibilityOff();
1200 myNodeExtActor->VisibilityOff();
1202 my0DActor->VisibilityOff();
1203 //my0DExtActor->VisibilityOff();
1205 my1DActor->VisibilityOff();
1206 my1DExtActor->VisibilityOff();
1208 my2DActor->VisibilityOff();
1209 my2DExtActor->VisibilityOff();
1210 my3DActor->VisibilityOff();
1212 myScalarBarActor->VisibilityOff();
1213 myPointLabels->VisibilityOff();
1214 myCellsLabels->VisibilityOff();
1216 if(GetVisibility()){
1217 if(theIsUpdateRepersentation)
1218 SetRepresentation(GetRepresentation());
1220 if(myControlMode != eNone){
1221 switch(myControlMode){
1223 myNodeExtActor->VisibilityOn();
1227 my1DExtActor->VisibilityOn();
1230 my2DExtActor->VisibilityOn();
1233 case eMultiConnection2D:
1234 my1DExtActor->VisibilityOn();
1236 if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1237 myScalarBarActor->VisibilityOn();
1241 if(myRepresentation != ePoint)
1242 myPickableActor->VisibilityOn();
1244 myNodeActor->VisibilityOn();
1247 if(myEntityMode & e0DElements){
1248 my0DActor->VisibilityOn();
1251 if(myEntityMode & eEdges && GetRepresentation() != ePoint){
1252 my1DActor->VisibilityOn();
1255 if(myEntityMode & eFaces && GetRepresentation() != ePoint){
1256 my2DActor->VisibilityOn();
1259 if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
1260 my3DActor->VisibilityOn();
1263 if(myIsPointsLabeled){
1264 myPointLabels->VisibilityOn();
1265 myNodeActor->VisibilityOn();
1268 if(myIsCellsLabeled)
1269 myCellsLabels->VisibilityOn();
1276 void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
1278 myEntityState = eAllEntity;
1280 if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
1281 myEntityState &= ~e0DElements;
1282 theMode &= ~e0DElements;
1285 if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
1286 myEntityState &= ~eEdges;
1290 if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
1291 myEntityState &= ~eFaces;
1295 if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
1296 myEntityState &= ~eVolumes;
1297 theMode &= ~eVolumes;
1301 if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
1302 theMode |= e0DElements;
1304 if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1307 if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1310 if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1311 theMode |= eVolumes;
1314 myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1316 myEntityMode = theMode;
1317 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1318 aFilter = myBaseActor->GetExtractUnstructuredGrid();
1319 aFilter->ClearRegisteredCellsWithType();
1320 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1322 VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
1323 aHightFilter->ClearRegisteredCellsWithType();
1324 aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1326 if (myEntityMode & e0DElements) {
1327 if (MYDEBUG) MESSAGE("0D ELEMENTS");
1328 aFilter->RegisterCellsWithType(VTK_VERTEX);
1329 aHightFilter->RegisterCellsWithType(VTK_VERTEX);
1332 if (myEntityMode & eEdges) {
1333 if (MYDEBUG) MESSAGE("EDGES");
1334 aFilter->RegisterCellsWithType(VTK_LINE);
1335 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1337 aHightFilter->RegisterCellsWithType(VTK_LINE);
1338 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1341 if (myEntityMode & eFaces) {
1342 if (MYDEBUG) MESSAGE("FACES");
1343 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1344 aFilter->RegisterCellsWithType(VTK_POLYGON);
1345 aFilter->RegisterCellsWithType(VTK_QUAD);
1346 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1347 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1349 aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
1350 aHightFilter->RegisterCellsWithType(VTK_POLYGON);
1351 aHightFilter->RegisterCellsWithType(VTK_QUAD);
1352 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1353 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1356 if (myEntityMode & eVolumes) {
1357 if (MYDEBUG) MESSAGE("VOLUMES");
1358 aFilter->RegisterCellsWithType(VTK_TETRA);
1359 aFilter->RegisterCellsWithType(VTK_VOXEL);
1360 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1361 aFilter->RegisterCellsWithType(VTK_WEDGE);
1362 aFilter->RegisterCellsWithType(VTK_PYRAMID);
1363 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1364 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1365 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1366 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1367 //#ifdef VTK_HAVE_POLYHEDRON
1368 aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1371 aHightFilter->RegisterCellsWithType(VTK_TETRA);
1372 aHightFilter->RegisterCellsWithType(VTK_VOXEL);
1373 aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1374 aHightFilter->RegisterCellsWithType(VTK_WEDGE);
1375 aHightFilter->RegisterCellsWithType(VTK_PYRAMID);
1376 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1377 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1378 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1379 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1380 aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1381 //#ifdef VTK_HAVE_POLYHEDRON
1382 aHightFilter->RegisterCellsWithType(VTK_POLYHEDRON);
1386 if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1387 SetVisibility(GetVisibility(),false);
1390 void SMESH_ActorDef::SetRepresentation (int theMode)
1392 int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1393 int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1394 int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1397 myRepresentation = eSurface;
1398 if (!aNbFaces && !aNbVolumes && aNbEdges) {
1399 myRepresentation = eEdge;
1400 } else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
1401 myRepresentation = ePoint;
1406 if (!aNbFaces && !aNbVolumes && !aNbEdges) return;
1409 if (!aNbFaces && !aNbVolumes) return;
1412 myRepresentation = theMode;
1415 if (!GetUnstructuredGrid()->GetNumberOfCells())
1416 myRepresentation = ePoint;
1419 if (myRepresentation == ePoint) {
1427 myPickableActor = myBaseActor;
1428 myNodeActor->SetVisibility(false);
1429 myNodeExtActor->SetVisibility(false);
1430 vtkProperty *aProp = NULL, *aBackProp = NULL;
1431 SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1432 SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
1433 switch (myRepresentation) {
1435 myPickableActor = myNodeActor;
1436 myNodeActor->SetVisibility(true);
1437 aQuadraticMode = SMESH_Actor::eLines;
1438 aProp = aBackProp = myNodeProp;
1439 aReperesent = SMESH_DeviceActor::ePoint;
1442 aProp = aBackProp = myEdgeProp;
1443 aReperesent = SMESH_DeviceActor::eInsideframe;
1446 aProp = mySurfaceProp;
1447 aBackProp = myBackSurfaceProp;
1448 aReperesent = SMESH_DeviceActor::eSurface;
1452 my2DActor->SetProperty(aProp);
1453 my2DActor->SetBackfaceProperty(aBackProp);
1454 my2DActor->SetRepresentation(aReperesent);
1456 if(aQuadraticMode == SMESH_Actor::eLines)
1457 my2DActor->SetQuadraticArcMode(false);
1458 else if(aQuadraticMode == SMESH_Actor::eArcs)
1459 my2DActor->SetQuadraticArcMode(true);
1461 my2DExtActor->SetRepresentation(aReperesent);
1463 my3DActor->SetProperty(aProp);
1464 my3DActor->SetBackfaceProperty(aBackProp);
1465 my3DActor->SetRepresentation(aReperesent);
1467 //my0DExtActor->SetVisibility(false);
1468 my1DExtActor->SetVisibility(false);
1469 my2DExtActor->SetVisibility(false);
1472 //my0DActor->SetProperty(aProp);
1473 //my0DActor->SetBackfaceProperty(aBackProp);
1474 my0DActor->SetRepresentation(aReperesent);
1475 //my0DExtActor->SetRepresentation(aReperesent);
1477 switch(myControlMode){
1479 case eMultiConnection:
1480 aProp = aBackProp = my1DProp;
1481 if(myRepresentation != ePoint)
1482 aReperesent = SMESH_DeviceActor::eInsideframe;
1486 if(aQuadraticMode == SMESH_Actor::eLines)
1487 my1DActor->SetQuadraticArcMode(false);
1488 else if(aQuadraticMode == SMESH_Actor::eArcs)
1489 my1DActor->SetQuadraticArcMode(true);
1491 my1DActor->SetProperty(aProp);
1492 my1DActor->SetBackfaceProperty(aBackProp);
1493 my1DActor->SetRepresentation(aReperesent);
1495 my1DExtActor->SetRepresentation(aReperesent);
1497 if(myIsPointsVisible)
1498 myPickableActor = myNodeActor;
1499 if(GetPointRepresentation())
1500 myNodeActor->SetVisibility(true);
1502 SetMapper(myPickableActor->GetMapper());
1504 SetVisibility(GetVisibility(),false);
1510 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1511 if ( myIsPointsVisible == theIsPointsVisible )
1513 myIsPointsVisible = theIsPointsVisible;
1514 SetRepresentation(GetRepresentation());
1517 bool SMESH_ActorDef::GetPointRepresentation(){
1518 return myIsPointsVisible || myIsPointsLabeled;
1522 void SMESH_ActorDef::UpdateHighlight(){
1523 myHighlitableActor->SetVisibility(false);
1524 myHighlitableActor->SetHighlited(false);
1526 if(myIsHighlighted){
1527 myHighlitableActor->SetProperty(myHighlightProp);
1528 }else if(myIsPreselected){
1529 myHighlitableActor->SetProperty(myPreselectProp);
1532 bool anIsVisible = GetVisibility();
1534 if(myIsHighlighted || myIsPreselected){
1535 if(GetUnstructuredGrid()->GetNumberOfCells()){
1536 myHighlitableActor->SetHighlited(anIsVisible);
1537 myHighlitableActor->SetVisibility(anIsVisible);
1538 myHighlitableActor->GetExtractUnstructuredGrid()->
1539 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1540 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1541 }else if(myRepresentation == ePoint || GetPointRepresentation()){
1542 myHighlitableActor->SetHighlited(anIsVisible);
1543 myHighlitableActor->GetExtractUnstructuredGrid()->
1544 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1545 myHighlitableActor->SetVisibility(anIsVisible);
1546 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1548 VTK::MarkerType aMarkerType = GetMarkerType();
1549 if(aMarkerType != VTK::MT_USER)
1550 myHighlitableActor->SetMarkerStd(aMarkerType, GetMarkerScale());
1552 myHighlitableActor->SetMarkerTexture(GetMarkerTexture(), myMarkerTexture);
1558 void SMESH_ActorDef::highlight(bool theHighlight){
1559 if ( myIsHighlighted == theHighlight )
1561 myIsHighlighted = theHighlight;
1566 void SMESH_ActorDef::SetPreSelected(bool thePreselect){
1567 if ( myIsPreselected == thePreselect )
1569 myIsPreselected = thePreselect;
1575 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1577 if (myPickableActor->GetIsOpaque())
1579 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1587 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1589 if (!myPickableActor->GetIsOpaque())
1591 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1599 void SMESH_ActorDef::Render(vtkRenderer *ren){
1600 unsigned long aTime = myTimeStamp->GetMTime();
1601 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1602 unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1603 if(anObjTime > aTime || aClippingTime > aTime)
1608 void SMESH_ActorDef::Update(){
1609 if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1611 if(GetControlMode() != eNone) {
1612 unsigned long aTime = myTimeStamp->GetMTime();
1613 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1614 if (anObjTime > aTime)
1615 SetControlMode(GetControlMode(),false);
1617 if(myIsPointsLabeled){
1618 SetPointsLabeled(myIsPointsLabeled);
1620 if(myIsCellsLabeled){
1621 SetCellsLabeled(myIsCellsLabeled);
1623 if(myIsFacesOriented){
1624 SetFacesOriented(myIsFacesOriented);
1626 SetEntityMode(GetEntityMode());
1627 SetVisibility(GetVisibility());
1629 myTimeStamp->Modified();
1634 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1635 SALOME_Actor::ReleaseGraphicsResources(renWin);
1637 myPickableActor->ReleaseGraphicsResources(renWin);
1641 static void GetColor(vtkProperty *theProperty, vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1642 vtkFloatingPointType* aColor = theProperty->GetColor();
1649 void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
1650 mySurfaceProp->SetOpacity(theValue);
1651 myBackSurfaceProp->SetOpacity(theValue);
1652 myEdgeProp->SetOpacity(theValue);
1653 myNodeProp->SetOpacity(theValue);
1655 my1DProp->SetOpacity(theValue);
1659 vtkFloatingPointType SMESH_ActorDef::GetOpacity(){
1660 return mySurfaceProp->GetOpacity();
1664 void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1665 mySurfaceProp->SetColor(r,g,b);
1666 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1667 if( aGroupObj->GetElementType() == SMDSAbs_Face ||
1668 aGroupObj->GetElementType() == SMDSAbs_Volume )
1669 myNameActor->SetBackgroundColor(r,g,b);
1673 void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1674 ::GetColor(mySurfaceProp,r,g,b);
1675 my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1678 void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1679 myBackSurfaceProp->SetColor(r,g,b);
1683 void SMESH_ActorDef::GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1684 ::GetColor(myBackSurfaceProp,r,g,b);
1687 void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1688 myEdgeProp->SetColor(r,g,b);
1689 my1DProp->SetColor(r,g,b);
1690 my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1691 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1692 if( aGroupObj->GetElementType() == SMDSAbs_Edge )
1693 myNameActor->SetBackgroundColor(r,g,b);
1697 void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1698 ::GetColor(myEdgeProp,r,g,b);
1701 void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1702 myNodeProp->SetColor(r,g,b);
1703 myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1704 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1705 if( aGroupObj->GetElementType() == SMDSAbs_Node )
1706 myNameActor->SetBackgroundColor(r,g,b);
1710 void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1711 ::GetColor(myNodeProp,r,g,b);
1714 void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1715 my0DProp->SetColor(r,g,b);
1716 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1717 if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
1718 myNameActor->SetBackgroundColor(r,g,b);
1722 void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1723 ::GetColor(my0DProp,r,g,b);
1726 void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1727 myHighlightProp->SetColor(r,g,b);
1731 void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1732 ::GetColor(myHighlightProp,r,g,b);
1735 void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1736 myPreselectProp->SetColor(r,g,b);
1740 void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1741 ::GetColor(myPreselectProp,r,g,b);
1745 vtkFloatingPointType SMESH_ActorDef::GetLineWidth(){
1746 return myEdgeProp->GetLineWidth();
1750 void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
1751 myEdgeProp->SetLineWidth(theVal);
1753 my1DProp->SetLineWidth(theVal + aLineWidthInc);
1754 my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
1760 void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
1761 my0DProp->SetPointSize(theVal);
1765 vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
1766 return my0DProp->GetPointSize();
1769 int SMESH_ActorDef::GetObjDimension( const int theObjId )
1771 return myVisualObj->GetElemDimension( theObjId );
1776 IsImplicitFunctionUsed() const
1778 return myBaseActor->IsImplicitFunctionUsed();
1782 SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
1784 myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1785 myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1787 myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1789 myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1791 my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1792 //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1794 my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1795 my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1797 my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1798 my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1799 my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1803 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
1806 myImplicitBoolean->GetFunction()->AddItem(thePlane);
1807 myCippingPlaneCont.push_back(thePlane);
1808 if(!IsImplicitFunctionUsed())
1809 SetImplicitFunctionUsed(true);
1811 return myCippingPlaneCont.size();
1816 RemoveAllClippingPlanes()
1818 myImplicitBoolean->GetFunction()->RemoveAllItems();
1819 myImplicitBoolean->GetFunction()->Modified(); // VTK bug
1820 myCippingPlaneCont.clear();
1821 SetImplicitFunctionUsed(false);
1826 GetNumberOfClippingPlanes()
1828 return myCippingPlaneCont.size();
1833 GetClippingPlane(vtkIdType theID)
1835 if(theID >= myCippingPlaneCont.size())
1837 return myCippingPlaneCont[theID].Get();
1840 void SMESH_ActorDef::UpdateScalarBar()
1842 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1846 vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
1848 QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
1849 aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1851 aScalarBarTitleProp->SetFontFamilyToArial();
1853 if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
1855 QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
1856 if ( f.family() == "Arial" )
1857 aScalarBarTitleProp->SetFontFamilyToArial();
1858 else if ( f.family() == "Courier" )
1859 aScalarBarTitleProp->SetFontFamilyToCourier();
1860 else if ( f.family() == "Times" )
1861 aScalarBarTitleProp->SetFontFamilyToTimes();
1864 aScalarBarTitleProp->BoldOn();
1866 aScalarBarTitleProp->BoldOff();
1869 aScalarBarTitleProp->ItalicOn();
1871 aScalarBarTitleProp->ItalicOff();
1874 aScalarBarTitleProp->ShadowOn();
1876 aScalarBarTitleProp->ShadowOff();
1879 myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
1880 aScalarBarTitleProp->Delete();
1882 vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
1884 aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
1885 aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1887 aScalarBarLabelProp->SetFontFamilyToArial();
1888 if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
1890 QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
1891 if( f.family() == "Arial" )
1892 aScalarBarLabelProp->SetFontFamilyToArial();
1893 else if( f.family() == "Courier" )
1894 aScalarBarLabelProp->SetFontFamilyToCourier();
1895 else if( f.family() == "Times" )
1896 aScalarBarLabelProp->SetFontFamilyToTimes();
1899 aScalarBarLabelProp->BoldOn();
1901 aScalarBarLabelProp->BoldOff();
1904 aScalarBarLabelProp->ItalicOn();
1906 aScalarBarLabelProp->ItalicOff();
1909 aScalarBarLabelProp->ShadowOn();
1911 aScalarBarLabelProp->ShadowOff();
1914 myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
1915 aScalarBarLabelProp->Delete();
1917 bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
1918 QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
1920 myScalarBarActor->SetOrientationToHorizontal();
1922 myScalarBarActor->SetOrientationToVertical();
1925 vtkFloatingPointType aXVal = horiz ? 0.20 : 0.01;
1926 if( mgr->hasValue( "SMESH", name + "x" ) )
1927 aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
1929 vtkFloatingPointType aYVal = horiz ? 0.01 : 0.1;
1930 if( mgr->hasValue( "SMESH", name + "y" ) )
1931 aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
1932 myScalarBarActor->SetPosition( aXVal, aYVal );
1934 vtkFloatingPointType aWVal = horiz ? 0.60 : 0.10;
1935 if( mgr->hasValue( "SMESH", name + "width" ) )
1936 aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
1937 myScalarBarActor->SetWidth( aWVal );
1939 vtkFloatingPointType aHVal = horiz ? 0.12 : 0.80;
1940 if( mgr->hasValue( "SMESH", name + "height" ) )
1941 aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
1942 myScalarBarActor->SetHeight( aHVal );
1945 if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
1946 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
1947 myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
1950 if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
1951 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
1952 myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
1954 bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
1955 myScalarBarActor->SetDistributionVisibility(distributionVisibility);
1957 int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
1958 myScalarBarActor->SetDistributionColoringType(coloringType);
1960 QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
1961 QColor(255, 255, 255));
1963 rgb[0]= distributionColor.red()/255.;
1964 rgb[1]= distributionColor.green()/255.;
1965 rgb[2]= distributionColor.blue()/255.;
1966 myScalarBarActor->SetDistributionColor(rgb);
1971 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
1974 case SMESH_Actor::eLines :
1975 myHighlitableActor->SetQuadraticArcMode(false);
1976 my2DActor->SetQuadraticArcMode(false);
1977 my1DActor->SetQuadraticArcMode(false);
1979 case SMESH_Actor::eArcs :
1980 myHighlitableActor->SetQuadraticArcMode(true);
1981 if(GetRepresentation() != SMESH_Actor::ePoint) {
1982 my2DActor->SetQuadraticArcMode(true);
1983 my1DActor->SetQuadraticArcMode(true);
1992 SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
1994 if(myHighlitableActor->GetQuadraticArcMode())
1995 return SMESH_Actor::eArcs;
1997 return SMESH_Actor::eLines;
2000 void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
2002 SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
2003 myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
2004 myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
2007 void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
2009 SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
2010 myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2011 myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2012 myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor