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 "SMESH_ScalarBarActor.h"
34 #include "VTKViewer_CellCenters.h"
35 #include "VTKViewer_ExtractUnstructuredGrid.h"
36 #include "VTKViewer_FramedTextActor.h"
37 #include "SALOME_InteractiveObject.hxx"
39 #include "SUIT_Session.h"
40 #include "SUIT_ResourceMgr.h"
42 #include <vtkProperty.h>
43 #include <vtkTimeStamp.h>
44 #include <vtkObjectFactory.h>
45 #include <vtkShrinkPolyData.h>
46 #include <vtkMergeFilter.h>
48 #include <vtkMatrix4x4.h>
49 #include <vtkUnstructuredGrid.h>
50 #include <vtkPointData.h>
51 #include <vtkCellData.h>
53 #include <vtkMapper.h>
54 #include <vtkRenderer.h>
57 #include <vtkIdList.h>
58 #include <vtkIntArray.h>
60 #include <vtkActor2D.h>
61 #include <vtkProperty2D.h>
62 #include <vtkPolyData.h>
63 #include <vtkMaskPoints.h>
64 #include <vtkTextProperty.h>
65 #include <vtkLabeledDataMapper.h>
66 #include <vtkSelectVisiblePoints.h>
68 #include <vtkLookupTable.h>
72 #include <vtkImplicitBoolean.h>
73 #include <vtkImplicitFunctionCollection.h>
75 #include <vtkConfigure.h>
76 #if !defined(VTK_XVERSION)
77 #define VTK_XVERSION (VTK_MAJOR_VERSION<<16)+(VTK_MINOR_VERSION<<8)+(VTK_BUILD_VERSION)
80 #include "utilities.h"
83 static int MYDEBUG = 1;
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 = SMESH_ActorDef::New();
102 if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
107 anActor->UpdateScalarBar();
112 SMESH_ActorDef::SMESH_ActorDef()
114 if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
116 myTimeStamp = vtkTimeStamp::New();
118 myIsPointsVisible = false;
120 myIsShrinkable = false;
123 myIsFacesOriented = false;
125 myControlsPrecision = -1;
126 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
128 if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
129 myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
131 vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
132 vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
134 vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
135 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
137 //Definition 2D and 3D devices of the actor
138 //-----------------------------------------
139 vtkFloatingPointType anRGB[3] = {1,1,1};
140 mySurfaceProp = vtkProperty::New();
141 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
142 mySurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
144 myBackSurfaceProp = vtkProperty::New();
145 SMESH::GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) );
146 myBackSurfaceProp->SetColor( anRGB[0], anRGB[1], anRGB[2] );
148 my2DActor = SMESH_DeviceActor::New();
149 my2DActor->SetUserMatrix(aMatrix);
150 my2DActor->PickableOff();
151 my2DActor->SetProperty(mySurfaceProp);
152 my2DActor->SetBackfaceProperty(myBackSurfaceProp);
153 my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
154 aFilter = my2DActor->GetExtractUnstructuredGrid();
155 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
156 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
157 aFilter->RegisterCellsWithType(VTK_POLYGON);
158 aFilter->RegisterCellsWithType(VTK_QUAD);
159 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
160 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
162 my2DExtProp = vtkProperty::New();
163 my2DExtProp->DeepCopy(mySurfaceProp);
164 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
165 anRGB[0] = 1 - anRGB[0];
166 anRGB[1] = 1 - anRGB[1];
167 anRGB[2] = 1 - anRGB[2];
168 my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
170 my2DExtActor = SMESH_DeviceActor::New();
171 my2DExtActor->SetUserMatrix(aMatrix);
172 my2DExtActor->PickableOff();
173 my2DExtActor->SetProperty(my2DExtProp);
174 my2DExtActor->SetBackfaceProperty(my2DExtProp);
175 my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
176 aFilter = my2DExtActor->GetExtractUnstructuredGrid();
177 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
178 aFilter->RegisterCellsWithType(VTK_POLYGON);
179 aFilter->RegisterCellsWithType(VTK_QUAD);
180 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
181 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
183 my3DActor = SMESH_DeviceActor::New();
184 my3DActor->SetUserMatrix(aMatrix);
185 my3DActor->PickableOff();
186 my3DActor->SetProperty(mySurfaceProp);
187 my3DActor->SetBackfaceProperty(myBackSurfaceProp);
188 my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
189 aFilter = my3DActor->GetExtractUnstructuredGrid();
190 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
191 aFilter->RegisterCellsWithType(VTK_TETRA);
192 aFilter->RegisterCellsWithType(VTK_VOXEL);
193 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
194 aFilter->RegisterCellsWithType(VTK_WEDGE);
195 aFilter->RegisterCellsWithType(VTK_PYRAMID);
196 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
197 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
198 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
199 aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
200 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
202 //Definition 1D device of the actor
203 //---------------------------------
204 myEdgeProp = vtkProperty::New();
205 myEdgeProp->SetAmbient(1.0);
206 myEdgeProp->SetDiffuse(0.0);
207 myEdgeProp->SetSpecular(0.0);
208 SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
209 myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
210 myEdgeProp->SetLineWidth(aLineWidth);
212 my1DActor = SMESH_DeviceActor::New();
213 my1DActor->SetUserMatrix(aMatrix);
214 my1DActor->PickableOff();
215 my1DActor->SetHighlited(true);
216 my1DActor->SetProperty(myEdgeProp);
217 my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
218 aFilter = my1DActor->GetExtractUnstructuredGrid();
219 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
220 aFilter->RegisterCellsWithType(VTK_LINE);
221 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
223 my1DProp = vtkProperty::New();
224 my1DProp->DeepCopy(myEdgeProp);
225 my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
226 my1DProp->SetPointSize(aElem0DSize);
228 my1DExtProp = vtkProperty::New();
229 my1DExtProp->DeepCopy(myEdgeProp);
230 anRGB[0] = 1 - anRGB[0];
231 anRGB[1] = 1 - anRGB[1];
232 anRGB[2] = 1 - anRGB[2];
233 my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
234 my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
235 my1DExtProp->SetPointSize(aElem0DSize);
237 my1DExtActor = SMESH_DeviceActor::New();
238 my1DExtActor->SetUserMatrix(aMatrix);
239 my1DExtActor->PickableOff();
240 my1DExtActor->SetHighlited(true);
241 my1DExtActor->SetVisibility(false);
242 my1DExtActor->SetProperty(my1DExtProp);
243 my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
244 aFilter = my1DExtActor->GetExtractUnstructuredGrid();
245 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
246 aFilter->RegisterCellsWithType(VTK_LINE);
247 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
250 //Definition 0D device of the actor (0d elements)
251 //-----------------------------------------------
252 my0DProp = vtkProperty::New();
253 SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
254 my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
255 my0DProp->SetPointSize(aElem0DSize);
257 my0DActor = SMESH_DeviceActor::New();
258 my0DActor->SetUserMatrix(aMatrix);
259 my0DActor->SetStoreClippingMapping(true);
260 my0DActor->PickableOff();
261 my0DActor->SetVisibility(false);
262 my0DActor->SetProperty(my0DProp);
263 my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
264 aFilter = my0DActor->GetExtractUnstructuredGrid();
265 //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
266 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
267 aFilter->RegisterCellsWithType(VTK_VERTEX);
269 //my0DExtProp = vtkProperty::New();
270 //my0DExtProp->DeepCopy(my0DProp);
271 //anRGB[0] = 1 - anRGB[0];
272 //anRGB[1] = 1 - anRGB[1];
273 //anRGB[2] = 1 - anRGB[2];
274 //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
275 //my0DExtProp->SetPointSize(aElem0DSize);
277 //my0DExtActor = SMESH_DeviceActor::New();
278 //my0DExtActor->SetUserMatrix(aMatrix);
279 //my0DExtActor->SetStoreClippingMapping(true);
280 //my0DExtActor->PickableOff();
281 //my0DExtActor->SetHighlited(true);
282 //my0DExtActor->SetVisibility(false);
283 //my0DExtActor->SetProperty(my0DExtProp);
284 //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
285 //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
286 ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
287 //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
288 //aFilter->RegisterCellsWithType(VTK_VERTEX);
291 //Definition 0D device of the actor (nodes)
292 //-----------------------------------------
293 myNodeProp = vtkProperty::New();
294 SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
295 myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
297 myNodeActor = SMESH_DeviceActor::New();
298 myNodeActor->SetUserMatrix(aMatrix);
299 myNodeActor->SetStoreClippingMapping(true);
300 myNodeActor->PickableOff();
301 myNodeActor->SetVisibility(false);
302 myNodeActor->SetProperty(myNodeProp);
303 myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
304 aFilter = myNodeActor->GetExtractUnstructuredGrid();
305 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
307 myNodeExtProp = vtkProperty::New();
308 myNodeExtProp->DeepCopy(myNodeProp);
309 anRGB[0] = 1 - anRGB[0];
310 anRGB[1] = 1 - anRGB[1];
311 anRGB[2] = 1 - anRGB[2];
312 myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
314 myNodeExtActor = SMESH_DeviceActor::New();
315 myNodeExtActor->SetUserMatrix(aMatrix);
316 myNodeExtActor->SetStoreClippingMapping(true);
317 myNodeExtActor->PickableOff();
318 myNodeExtActor->SetHighlited(true);
319 myNodeExtActor->SetVisibility(false);
320 myNodeExtActor->SetProperty(myNodeExtProp);
321 myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
322 aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
323 aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
324 aFilter->RegisterCellsWithType(VTK_VERTEX);
326 //Definition of Pickable and Highlitable engines
327 //----------------------------------------------
329 myBaseActor = SMESH_DeviceActor::New();
330 myBaseActor->SetUserMatrix(aMatrix);
331 myBaseActor->SetStoreGemetryMapping(true);
332 myBaseActor->GetProperty()->SetOpacity(0.0);
334 myPickableActor = myBaseActor;
336 myHighlightProp = vtkProperty::New();
337 myHighlightProp->SetAmbient(1.0);
338 myHighlightProp->SetDiffuse(0.0);
339 myHighlightProp->SetSpecular(0.0);
340 SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
341 myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
342 myHighlightProp->SetPointSize(aElem0DSize); // ??
343 myHighlightProp->SetRepresentation(1);
345 myPreselectProp = vtkProperty::New();
346 myPreselectProp->SetAmbient(1.0);
347 myPreselectProp->SetDiffuse(0.0);
348 myPreselectProp->SetSpecular(0.0);
349 SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
350 myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
351 myPreselectProp->SetPointSize(aElem0DSize); // ??
352 myPreselectProp->SetRepresentation(1);
354 myHighlitableActor = SMESH_DeviceActor::New();
355 myHighlitableActor->SetUserMatrix(aMatrix);
356 myHighlitableActor->PickableOff();
357 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
364 myControlMode = eNone;
365 myControlActor = my2DActor;
367 //Definition of myScalarBarActor
368 //------------------------------
369 myLookupTable = vtkLookupTable::New();
370 //Fix for Bug PAL5195 - SMESH764:
371 //Controls - Aspect Ratio: incorrect colors of the best and worst values
372 myLookupTable->SetHueRange(0.667,0.0);
374 myScalarBarActor = SMESH_ScalarBarActor::New();
375 myScalarBarActor->SetVisibility(false);
376 myScalarBarActor->SetLookupTable(myLookupTable);
379 //Incorrect "Min value" in Scalar Bar in Mesh:
380 // myScalarBarActor->SetLabelFormat("%.4g");
381 // changes was commented because of regression bug IPAL 19981
383 mgr = SUIT_Session::session()->resourceMgr();
387 //Definition of points numbering pipeline
388 //---------------------------------------
389 myPointsNumDataSet = vtkUnstructuredGrid::New();
391 myPtsMaskPoints = vtkMaskPoints::New();
392 myPtsMaskPoints->SetInput(myPointsNumDataSet);
393 myPtsMaskPoints->SetOnRatio(1);
395 myPtsSelectVisiblePoints = vtkSelectVisiblePoints::New();
396 myPtsSelectVisiblePoints->SetInput(myPtsMaskPoints->GetOutput());
397 myPtsSelectVisiblePoints->SelectInvisibleOff();
398 myPtsSelectVisiblePoints->SetTolerance(0.1);
400 myPtsLabeledDataMapper = vtkLabeledDataMapper::New();
401 myPtsLabeledDataMapper->SetInput(myPtsSelectVisiblePoints->GetOutput());
402 #if (VTK_XVERSION < 0x050200)
403 myPtsLabeledDataMapper->SetLabelFormat("%g");
405 myPtsLabeledDataMapper->SetLabelModeToLabelScalars();
407 vtkTextProperty* aPtsTextProp = vtkTextProperty::New();
408 aPtsTextProp->SetFontFamilyToTimes();
409 static int aPointsFontSize = 10;
410 aPtsTextProp->SetFontSize(aPointsFontSize);
411 aPtsTextProp->SetBold(1);
412 aPtsTextProp->SetItalic(0);
413 aPtsTextProp->SetShadow(0);
414 myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
415 aPtsTextProp->Delete();
417 myEntityMode = eAllEntity;
419 myIsPointsLabeled = false;
421 myPointLabels = vtkActor2D::New();
422 myPointLabels->SetMapper(myPtsLabeledDataMapper);
423 myPointLabels->GetProperty()->SetColor(1,1,1);
424 myPointLabels->SetVisibility(myIsPointsLabeled);
427 //Definition of cells numbering pipeline
428 //---------------------------------------
429 myCellsNumDataSet = vtkUnstructuredGrid::New();
431 myCellCenters = VTKViewer_CellCenters::New();
432 myCellCenters->SetInput(myCellsNumDataSet);
434 myClsMaskPoints = vtkMaskPoints::New();
435 myClsMaskPoints->SetInput(myCellCenters->GetOutput());
436 myClsMaskPoints->SetOnRatio(1);
438 myClsSelectVisiblePoints = vtkSelectVisiblePoints::New();
439 myClsSelectVisiblePoints->SetInput(myClsMaskPoints->GetOutput());
440 myClsSelectVisiblePoints->SelectInvisibleOff();
441 myClsSelectVisiblePoints->SetTolerance(0.1);
443 myClsLabeledDataMapper = vtkLabeledDataMapper::New();
444 myClsLabeledDataMapper->SetInput(myClsSelectVisiblePoints->GetOutput());
445 #if (VTK_XVERSION < 0x050200)
446 myClsLabeledDataMapper->SetLabelFormat("%g");
448 myClsLabeledDataMapper->SetLabelModeToLabelScalars();
450 vtkTextProperty* aClsTextProp = vtkTextProperty::New();
451 aClsTextProp->SetFontFamilyToTimes();
452 static int aCellsFontSize = 12;
453 aClsTextProp->SetFontSize(aCellsFontSize);
454 aClsTextProp->SetBold(1);
455 aClsTextProp->SetItalic(0);
456 aClsTextProp->SetShadow(0);
457 myClsLabeledDataMapper->SetLabelTextProperty(aClsTextProp);
458 aClsTextProp->Delete();
460 myIsCellsLabeled = false;
462 myCellsLabels = vtkActor2D::New();
463 myCellsLabels->SetMapper(myClsLabeledDataMapper);
464 myCellsLabels->GetProperty()->SetColor(0,1,0);
465 myCellsLabels->SetVisibility(myIsCellsLabeled);
468 myImplicitBoolean = vtkImplicitBoolean::New();
469 myImplicitBoolean->SetOperationTypeToIntersection();
473 //Quadratic 2D elements representation
474 //-----------------------------------------------------------------------------
475 int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
476 if(aQuadratic2DMode == 0){
477 myHighlitableActor->SetQuadraticArcMode(false);
478 my2DActor->SetQuadraticArcMode(false);
479 my1DActor->SetQuadraticArcMode(false);
481 else if(aQuadratic2DMode == 1){
482 myHighlitableActor->SetQuadraticArcMode(true);
483 my2DActor->SetQuadraticArcMode(true);
484 my1DActor->SetQuadraticArcMode(true);
487 int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
488 myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
489 my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
491 // Set colors of the name actor
492 SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
493 myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
494 SMESH::GetColor( "SMESH", "group_name_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
495 myNameActor->SetForegroundColor(anRGB[0], anRGB[1], anRGB[2]);
499 SMESH_ActorDef::~SMESH_ActorDef()
501 if(MYDEBUG) MESSAGE("~SMESH_ActorDef - "<<this);
503 // caught by SMESHGUI::ProcessEvents() static method
504 this->InvokeEvent( SMESH::DeleteActorEvent, NULL );
506 myScalarBarActor->Delete();
507 myLookupTable->Delete();
509 mySurfaceProp->Delete();
510 myBackSurfaceProp->Delete();
512 myEdgeProp->Delete();
513 myHighlightProp->Delete();
514 myPreselectProp->Delete();
516 myNodeProp->Delete();
517 myNodeExtProp->Delete();
522 //my0DExtProp->Delete();
523 //my0DExtActor->Delete();
528 my1DExtProp->Delete();
529 my1DExtActor->Delete();
532 my2DExtProp->Delete();
533 my2DExtActor->Delete();
536 myNodeActor->Delete();
537 myBaseActor->Delete();
539 myNodeExtActor->Delete();
541 myHighlitableActor->Delete();
543 //Deleting of points numbering pipeline
544 //---------------------------------------
545 myPointsNumDataSet->Delete();
547 // commented: porting to vtk 5.0
548 // myPtsLabeledDataMapper->RemoveAllInputs();
549 myPtsLabeledDataMapper->Delete();
551 // commented: porting to vtk 5.0
552 // myPtsSelectVisiblePoints->UnRegisterAllOutputs();
553 myPtsSelectVisiblePoints->Delete();
555 // commented: porting to vtk 5.0
556 // myPtsMaskPoints->UnRegisterAllOutputs();
557 myPtsMaskPoints->Delete();
559 myPointLabels->Delete();
562 //Deleting of cells numbering pipeline
563 //---------------------------------------
564 myCellsNumDataSet->Delete();
566 myClsLabeledDataMapper->RemoveAllInputs();
567 myClsLabeledDataMapper->Delete();
569 // commented: porting to vtk 5.0
570 // myClsSelectVisiblePoints->UnRegisterAllOutputs();
571 myClsSelectVisiblePoints->Delete();
573 // commented: porting to vtk 5.0
574 // myClsMaskPoints->UnRegisterAllOutputs();
575 myClsMaskPoints->Delete();
577 // commented: porting to vtk 5.0
578 // myCellCenters->UnRegisterAllOutputs();
579 myCellCenters->Delete();
581 myCellsLabels->Delete();
583 myImplicitBoolean->Delete();
585 myTimeStamp->Delete();
589 void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
591 vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
593 myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
595 if ( myIsPointsLabeled )
597 myPointsNumDataSet->ShallowCopy(aGrid);
598 vtkDataSet *aDataSet = myPointsNumDataSet;
600 int aNbElem = aDataSet->GetNumberOfPoints();
602 vtkIntArray *anArray = vtkIntArray::New();
603 anArray->SetNumberOfValues( aNbElem );
605 for ( vtkIdType anId = 0; anId < aNbElem; anId++ )
607 int aSMDSId = myVisualObj->GetNodeObjId( anId );
608 anArray->SetValue( anId, aSMDSId );
611 aDataSet->GetPointData()->SetScalars( anArray );
613 myPtsMaskPoints->SetInput( aDataSet );
614 myPointLabels->SetVisibility( GetVisibility() );
618 myPointLabels->SetVisibility( false );
620 SetRepresentation(GetRepresentation());
621 myTimeStamp->Modified();
625 void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled)
627 vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
628 myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
629 if(myIsCellsLabeled){
630 myCellsNumDataSet->ShallowCopy(aGrid);
631 vtkDataSet *aDataSet = myCellsNumDataSet;
632 int aNbElem = aDataSet->GetNumberOfCells();
633 vtkIntArray *anArray = vtkIntArray::New();
634 anArray->SetNumberOfValues(aNbElem);
635 for(int anId = 0; anId < aNbElem; anId++){
636 int aSMDSId = myVisualObj->GetElemObjId(anId);
637 anArray->SetValue(anId,aSMDSId);
639 aDataSet->GetCellData()->SetScalars(anArray);
640 myCellCenters->SetInput(aDataSet);
641 myCellsLabels->SetVisibility(GetVisibility());
643 myCellsLabels->SetVisibility(false);
645 myTimeStamp->Modified();
649 void SMESH_ActorDef::SetFacesOriented(bool theIsFacesOriented)
651 myIsFacesOriented = theIsFacesOriented;
653 my2DActor->SetFacesOriented(theIsFacesOriented);
654 my3DActor->SetFacesOriented(theIsFacesOriented);
656 myTimeStamp->Modified();
659 bool SMESH_ActorDef::GetFacesOriented()
661 return myIsFacesOriented;
664 void SMESH_ActorDef::SetFacesOrientationColor(vtkFloatingPointType theColor[3])
666 my2DActor->SetFacesOrientationColor( theColor );
667 my3DActor->SetFacesOrientationColor( theColor );
670 void SMESH_ActorDef::GetFacesOrientationColor(vtkFloatingPointType theColor[3])
672 my3DActor->GetFacesOrientationColor( theColor );
675 void SMESH_ActorDef::SetFacesOrientationScale(vtkFloatingPointType theScale)
677 my2DActor->SetFacesOrientationScale( theScale );
678 my3DActor->SetFacesOrientationScale( theScale );
681 vtkFloatingPointType SMESH_ActorDef::GetFacesOrientationScale()
683 return my3DActor->GetFacesOrientationScale();
686 void SMESH_ActorDef::SetFacesOrientation3DVectors(bool theState)
688 my2DActor->SetFacesOrientation3DVectors( theState );
689 my3DActor->SetFacesOrientation3DVectors( theState );
692 bool SMESH_ActorDef::GetFacesOrientation3DVectors()
694 return my3DActor->GetFacesOrientation3DVectors();
700 SetControlMode(eControl theMode)
702 SetControlMode(theMode,true);
708 SetControlMode(eControl theMode,
709 bool theCheckEntityMode)
711 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
715 myControlMode = eNone;
716 theCheckEntityMode &= mgr->booleanValue( "SMESH", "display_entity", false );
718 my0DActor->GetMapper()->SetScalarVisibility(false);
719 my1DActor->GetMapper()->SetScalarVisibility(false);
720 my2DActor->GetMapper()->SetScalarVisibility(false);
721 my3DActor->GetMapper()->SetScalarVisibility(false);
722 myScalarBarActor->SetVisibility(false);
724 bool anIsScalarVisible = theMode > eNone;
726 if(anIsScalarVisible){
730 SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
731 aControl->SetPrecision( myControlsPrecision );
732 myFunctor.reset( aControl );
733 myControlActor = my1DActor;
738 myFunctor.reset(new SMESH::Controls::Length2D());
739 myControlActor = my2DActor;
743 myFunctor.reset(new SMESH::Controls::FreeBorders());
744 myControlActor = my1DActor;
747 myFunctor.reset(new SMESH::Controls::FreeEdges());
748 myControlActor = my2DActor;
751 myFunctor.reset(new SMESH::Controls::FreeNodes());
752 myControlActor = myNodeActor;
755 myFunctor.reset(new SMESH::Controls::FreeFaces());
756 myControlActor = my2DActor;
758 case eMultiConnection:
759 myFunctor.reset(new SMESH::Controls::MultiConnection());
760 myControlActor = my1DActor;
762 case eMultiConnection2D:
763 myFunctor.reset(new SMESH::Controls::MultiConnection2D());
764 myControlActor = my2DActor;
768 SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
769 aControl->SetPrecision( myControlsPrecision );
770 myFunctor.reset( aControl );
771 myControlActor = my2DActor;
776 SMESH::Controls::Taper* aControl = new SMESH::Controls::Taper();
777 aControl->SetPrecision( myControlsPrecision );
778 myFunctor.reset( aControl );
779 myControlActor = my2DActor;
784 SMESH::Controls::AspectRatio* aControl = new SMESH::Controls::AspectRatio();
785 aControl->SetPrecision( myControlsPrecision );
786 myFunctor.reset( aControl );
787 myControlActor = my2DActor;
792 SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
793 aControl->SetPrecision( myControlsPrecision );
794 myFunctor.reset( aControl );
795 myControlActor = my3DActor;
800 SMESH::Controls::Volume* aControl = new SMESH::Controls::Volume();
801 aControl->SetPrecision( myControlsPrecision );
802 myFunctor.reset( aControl );
803 myControlActor = my3DActor;
806 case eMaxElementLength2D:
808 SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
809 aControl->SetPrecision( myControlsPrecision );
810 myFunctor.reset( aControl );
811 myControlActor = my2DActor;
814 case eMaxElementLength3D:
816 SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
817 aControl->SetPrecision( myControlsPrecision );
818 myFunctor.reset( aControl );
819 myControlActor = my3DActor;
824 SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
825 aControl->SetPrecision( myControlsPrecision );
826 myFunctor.reset( aControl );
827 myControlActor = my2DActor;
832 SMESH::Controls::Warping* aControl = new SMESH::Controls::Warping();
833 aControl->SetPrecision( myControlsPrecision );
834 myFunctor.reset( aControl );
835 myControlActor = my2DActor;
840 SMESH::Controls::Skew* aControl = new SMESH::Controls::Skew();
841 aControl->SetPrecision( myControlsPrecision );
842 myFunctor.reset( aControl );
843 myControlActor = my2DActor;
850 vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
851 vtkIdType aNbCells = aGrid->GetNumberOfCells();
853 myControlMode = theMode;
854 switch(myControlMode){
856 myNodeExtActor->SetExtControlMode(myFunctor);
860 my1DExtActor->SetExtControlMode(myFunctor);
863 my2DExtActor->SetExtControlMode(myFunctor);
866 case eMultiConnection2D:
867 my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
870 myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
874 if(theCheckEntityMode){
875 if(myControlActor == my1DActor)
876 SetEntityMode(eEdges);
877 else if(myControlActor == my2DActor){
878 switch(myControlMode){
882 case eMultiConnection2D:
883 //SetEntityMode(eEdges);
884 SetEntityMode(eFaces);
887 SetEntityMode(eFaces);
889 }else if(myControlActor == my3DActor)
890 SetEntityMode(eVolumes);
895 if(theCheckEntityMode)
896 myEntityMode = eAllEntity;
900 SetRepresentation(GetRepresentation());
902 myTimeStamp->Modified();
907 void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
908 theRenderer->AddActor(myNodeActor);
909 theRenderer->AddActor(myBaseActor);
911 theRenderer->AddActor(myNodeExtActor);
913 my3DActor->AddToRender(theRenderer);
914 my2DActor->AddToRender(theRenderer);
915 my2DExtActor->AddToRender(theRenderer);
917 theRenderer->AddActor(my1DActor);
918 theRenderer->AddActor(my1DExtActor);
920 theRenderer->AddActor(my0DActor);
921 //theRenderer->AddActor(my0DExtActor);
923 theRenderer->AddActor(myHighlitableActor);
925 theRenderer->AddActor2D(myScalarBarActor);
927 myPtsSelectVisiblePoints->SetRenderer(theRenderer);
928 myClsSelectVisiblePoints->SetRenderer(theRenderer);
930 theRenderer->AddActor2D(myPointLabels);
931 theRenderer->AddActor2D(myCellsLabels);
933 // the superclass' method should be called at the end
934 // (in particular, for correct work of selection)
935 SALOME_Actor::AddToRender(theRenderer);
938 void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
939 SALOME_Actor::RemoveFromRender(theRenderer);
941 theRenderer->RemoveActor(myNodeActor);
942 theRenderer->RemoveActor(myBaseActor);
944 theRenderer->RemoveActor(myNodeExtActor);
946 theRenderer->RemoveActor(myHighlitableActor);
948 theRenderer->RemoveActor(my0DActor);
949 //theRenderer->RemoveActor(my0DExtActor);
951 theRenderer->RemoveActor(my1DActor);
952 theRenderer->RemoveActor(my1DExtActor);
954 my2DActor->RemoveFromRender(theRenderer);
955 my2DExtActor->RemoveFromRender(theRenderer);
956 my3DActor->RemoveFromRender(theRenderer);
958 theRenderer->RemoveActor(myScalarBarActor);
959 theRenderer->RemoveActor(myPointLabels);
960 theRenderer->RemoveActor(myCellsLabels);
964 bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
965 const char* theEntry,
969 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
973 myVisualObj = theVisualObj;
974 myVisualObj->Update(theIsClear);
976 myNodeActor->Init(myVisualObj,myImplicitBoolean);
977 myBaseActor->Init(myVisualObj,myImplicitBoolean);
979 myHighlitableActor->Init(myVisualObj,myImplicitBoolean);
981 myNodeExtActor->Init(myVisualObj,myImplicitBoolean);
983 my0DActor->Init(myVisualObj,myImplicitBoolean);
984 //my0DExtActor->Init(myVisualObj,myImplicitBoolean);
986 my1DActor->Init(myVisualObj,myImplicitBoolean);
987 my1DExtActor->Init(myVisualObj,myImplicitBoolean);
989 my2DActor->Init(myVisualObj,myImplicitBoolean);
990 my2DExtActor->Init(myVisualObj,myImplicitBoolean);
991 my3DActor->Init(myVisualObj,myImplicitBoolean);
993 my0DActor->GetMapper()->SetLookupTable(myLookupTable);
994 //my0DExtActor->GetMapper()->SetLookupTable(myLookupTable);
996 my1DActor->GetMapper()->SetLookupTable(myLookupTable);
997 my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
999 my2DActor->GetMapper()->SetLookupTable(myLookupTable);
1000 my2DExtActor->GetMapper()->SetLookupTable(myLookupTable);
1001 my3DActor->GetMapper()->SetLookupTable(myLookupTable);
1003 vtkFloatingPointType aFactor, aUnits;
1004 my2DActor->GetPolygonOffsetParameters(aFactor,aUnits);
1005 my2DActor->SetPolygonOffsetParameters(aFactor,aUnits*0.75);
1006 my2DExtActor->SetPolygonOffsetParameters(aFactor,aUnits*0.5);
1008 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1012 //SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
1013 SetIsShrunkable(true);
1015 SetShrinkFactor( SMESH::GetFloat( "SMESH:shrink_coeff", 75 ) / 100. );
1017 int aMode = mgr->integerValue( "SMESH", "display_mode" );
1018 SetRepresentation(-1);
1021 SetRepresentation(eEdge);
1022 }else if(aMode == 1){
1023 SetRepresentation(eSurface);
1024 }else if(aMode == 2){
1025 SetRepresentation(ePoint);
1032 if( dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1033 SetIsDisplayNameActor( true );
1035 int aMarkerType = mgr->integerValue( "SMESH", "type_of_marker", 1 ); // dot
1036 int aMarkerScale = mgr->integerValue( "SMESH", "marker_scale", 9 ); // 5 pixels
1037 SetMarkerStd( (VTK::MarkerType)aMarkerType, (VTK::MarkerScale)aMarkerScale );
1039 myTimeStamp->Modified();
1045 vtkFloatingPointType* SMESH_ActorDef::GetBounds(){
1046 return myNodeActor->GetBounds();
1050 vtkDataSet* SMESH_ActorDef::GetInput(){
1051 return GetUnstructuredGrid();
1055 void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){
1056 Superclass::SetTransform(theTransform);
1058 myNodeActor->SetTransform(theTransform);
1059 myBaseActor->SetTransform(theTransform);
1061 myHighlitableActor->SetTransform(theTransform);
1063 myNodeExtActor->SetTransform(theTransform);
1065 my0DActor->SetTransform(theTransform);
1066 //my0DExtActor->SetTransform(theTransform);
1068 my1DActor->SetTransform(theTransform);
1069 my1DExtActor->SetTransform(theTransform);
1071 my2DActor->SetTransform(theTransform);
1072 my2DExtActor->SetTransform(theTransform);
1073 my3DActor->SetTransform(theTransform);
1079 void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
1080 vtkLODActor::SetMapper(theMapper);
1084 void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
1085 SALOME_Actor::ShallowCopy(prop);
1089 vtkMapper* SMESH_ActorDef::GetMapper(){
1090 return myPickableActor->GetMapper();
1094 vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
1095 return myVisualObj->GetUnstructuredGrid();
1099 bool SMESH_ActorDef::IsInfinitive(){
1100 vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
1102 myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
1103 ( aDataSet->GetNumberOfCells() == 1 &&
1104 aDataSet->GetCell(0)->GetCellType() == VTK_VERTEX );
1105 return SALOME_Actor::IsInfinitive();
1109 void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
1110 if ( myIsShrinkable == theShrunkable )
1112 myIsShrinkable = theShrunkable;
1116 vtkFloatingPointType SMESH_ActorDef::GetShrinkFactor(){
1117 return myBaseActor->GetShrinkFactor();
1120 void SMESH_ActorDef::SetShrinkFactor(vtkFloatingPointType theValue){
1121 myBaseActor->SetShrinkFactor(theValue);
1123 my1DActor->SetShrinkFactor(theValue);
1124 my1DExtActor->SetShrinkFactor(theValue);
1126 my2DActor->SetShrinkFactor(theValue);
1127 my2DExtActor->SetShrinkFactor(theValue);
1128 my3DActor->SetShrinkFactor(theValue);
1133 void SMESH_ActorDef::SetShrink(){
1134 if(!myIsShrinkable) return;
1136 myBaseActor->SetShrink();
1138 my1DActor->SetShrink();
1139 my1DExtActor->SetShrink();
1141 my2DActor->SetShrink();
1142 my2DExtActor->SetShrink();
1143 my3DActor->SetShrink();
1149 void SMESH_ActorDef::UnShrink(){
1150 if(!myIsShrunk) return;
1152 myBaseActor->UnShrink();
1154 my1DActor->UnShrink();
1155 my1DExtActor->UnShrink();
1157 my2DActor->UnShrink();
1158 my2DExtActor->UnShrink();
1159 my3DActor->UnShrink();
1166 int SMESH_ActorDef::GetNodeObjId(int theVtkID){
1167 return myPickableActor->GetNodeObjId(theVtkID);
1170 vtkFloatingPointType* SMESH_ActorDef::GetNodeCoord(int theObjID){
1171 return myPickableActor->GetNodeCoord(theObjID);
1175 int SMESH_ActorDef::GetElemObjId(int theVtkID){
1176 return myPickableActor->GetElemObjId(theVtkID);
1179 vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
1180 return myPickableActor->GetElemCell(theObjID);
1184 void SMESH_ActorDef::SetVisibility(int theMode){
1185 SetVisibility(theMode,true);
1189 void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
1190 SALOME_Actor::SetVisibility(theMode);
1192 myNodeActor->VisibilityOff();
1193 myBaseActor->VisibilityOff();
1195 myNodeExtActor->VisibilityOff();
1197 my0DActor->VisibilityOff();
1198 //my0DExtActor->VisibilityOff();
1200 my1DActor->VisibilityOff();
1201 my1DExtActor->VisibilityOff();
1203 my2DActor->VisibilityOff();
1204 my2DExtActor->VisibilityOff();
1205 my3DActor->VisibilityOff();
1207 myScalarBarActor->VisibilityOff();
1208 myPointLabels->VisibilityOff();
1209 myCellsLabels->VisibilityOff();
1211 if(GetVisibility()){
1212 if(theIsUpdateRepersentation)
1213 SetRepresentation(GetRepresentation());
1215 if(myControlMode != eNone){
1216 switch(myControlMode){
1218 myNodeExtActor->VisibilityOn();
1222 my1DExtActor->VisibilityOn();
1225 my2DExtActor->VisibilityOn();
1228 case eMultiConnection2D:
1229 my1DExtActor->VisibilityOn();
1231 if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
1232 myScalarBarActor->VisibilityOn();
1236 if(myRepresentation != ePoint)
1237 myPickableActor->VisibilityOn();
1239 myNodeActor->VisibilityOn();
1242 if(myEntityMode & e0DElements){
1243 my0DActor->VisibilityOn();
1246 if(myEntityMode & eEdges && GetRepresentation() != ePoint){
1247 my1DActor->VisibilityOn();
1250 if(myEntityMode & eFaces && GetRepresentation() != ePoint){
1251 my2DActor->VisibilityOn();
1254 if(myEntityMode & eVolumes && GetRepresentation() != ePoint){
1255 my3DActor->VisibilityOn();
1258 if(myIsPointsLabeled){
1259 myPointLabels->VisibilityOn();
1260 myNodeActor->VisibilityOn();
1263 if(myIsCellsLabeled)
1264 myCellsLabels->VisibilityOn();
1271 void SMESH_ActorDef::SetEntityMode(unsigned int theMode)
1273 myEntityState = eAllEntity;
1275 if(!myVisualObj->GetNbEntities(SMDSAbs_0DElement)) {
1276 myEntityState &= ~e0DElements;
1277 theMode &= ~e0DElements;
1280 if(!myVisualObj->GetNbEntities(SMDSAbs_Edge)) {
1281 myEntityState &= ~eEdges;
1285 if(!myVisualObj->GetNbEntities(SMDSAbs_Face)) {
1286 myEntityState &= ~eFaces;
1290 if(!myVisualObj->GetNbEntities(SMDSAbs_Volume)) {
1291 myEntityState &= ~eVolumes;
1292 theMode &= ~eVolumes;
1296 if(myVisualObj->GetNbEntities(SMDSAbs_0DElement))
1297 theMode |= e0DElements;
1299 if(myVisualObj->GetNbEntities(SMDSAbs_Edge))
1302 if(myVisualObj->GetNbEntities(SMDSAbs_Face))
1305 if(myVisualObj->GetNbEntities(SMDSAbs_Volume))
1306 theMode |= eVolumes;
1309 myBaseActor->myGeomFilter->SetInside(myEntityMode != myEntityState);
1311 myEntityMode = theMode;
1312 VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
1313 aFilter = myBaseActor->GetExtractUnstructuredGrid();
1314 aFilter->ClearRegisteredCellsWithType();
1315 aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1317 VTKViewer_ExtractUnstructuredGrid* aHightFilter = myHighlitableActor->GetExtractUnstructuredGrid();
1318 aHightFilter->ClearRegisteredCellsWithType();
1319 aHightFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
1321 if (myEntityMode & e0DElements) {
1322 if (MYDEBUG) MESSAGE("0D ELEMENTS");
1323 aFilter->RegisterCellsWithType(VTK_VERTEX);
1324 aHightFilter->RegisterCellsWithType(VTK_VERTEX);
1327 if (myEntityMode & eEdges) {
1328 if (MYDEBUG) MESSAGE("EDGES");
1329 aFilter->RegisterCellsWithType(VTK_LINE);
1330 aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1332 aHightFilter->RegisterCellsWithType(VTK_LINE);
1333 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
1336 if (myEntityMode & eFaces) {
1337 if (MYDEBUG) MESSAGE("FACES");
1338 aFilter->RegisterCellsWithType(VTK_TRIANGLE);
1339 aFilter->RegisterCellsWithType(VTK_POLYGON);
1340 aFilter->RegisterCellsWithType(VTK_QUAD);
1341 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1342 aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1344 aHightFilter->RegisterCellsWithType(VTK_TRIANGLE);
1345 aHightFilter->RegisterCellsWithType(VTK_POLYGON);
1346 aHightFilter->RegisterCellsWithType(VTK_QUAD);
1347 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
1348 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
1351 if (myEntityMode & eVolumes) {
1352 if (MYDEBUG) MESSAGE("VOLUMES");
1353 aFilter->RegisterCellsWithType(VTK_TETRA);
1354 aFilter->RegisterCellsWithType(VTK_VOXEL);
1355 aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1356 aFilter->RegisterCellsWithType(VTK_WEDGE);
1357 aFilter->RegisterCellsWithType(VTK_PYRAMID);
1358 aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1359 aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1360 aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1361 aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1363 aHightFilter->RegisterCellsWithType(VTK_TETRA);
1364 aHightFilter->RegisterCellsWithType(VTK_VOXEL);
1365 aHightFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
1366 aHightFilter->RegisterCellsWithType(VTK_WEDGE);
1367 aHightFilter->RegisterCellsWithType(VTK_PYRAMID);
1368 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
1369 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
1370 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
1371 aHightFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
1372 aHightFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
1375 if (MYDEBUG) MESSAGE(aFilter->GetOutput()->GetNumberOfCells());
1376 SetVisibility(GetVisibility(),false);
1379 void SMESH_ActorDef::SetRepresentation (int theMode)
1381 int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
1382 int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
1383 int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
1386 myRepresentation = eSurface;
1387 if (!aNbFaces && !aNbVolumes && aNbEdges) {
1388 myRepresentation = eEdge;
1389 } else if (!aNbFaces && !aNbVolumes && !aNbEdges) {
1390 myRepresentation = ePoint;
1395 if (!aNbFaces && !aNbVolumes && !aNbEdges) return;
1398 if (!aNbFaces && !aNbVolumes) return;
1401 myRepresentation = theMode;
1404 if (!GetUnstructuredGrid()->GetNumberOfCells())
1405 myRepresentation = ePoint;
1408 if (myRepresentation == ePoint) {
1416 myPickableActor = myBaseActor;
1417 myNodeActor->SetVisibility(false);
1418 myNodeExtActor->SetVisibility(false);
1419 vtkProperty *aProp = NULL, *aBackProp = NULL;
1420 SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
1421 SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
1422 switch (myRepresentation) {
1424 myPickableActor = myNodeActor;
1425 myNodeActor->SetVisibility(true);
1426 aQuadraticMode = SMESH_Actor::eLines;
1427 aProp = aBackProp = myNodeProp;
1428 aReperesent = SMESH_DeviceActor::ePoint;
1431 aProp = aBackProp = myEdgeProp;
1432 aReperesent = SMESH_DeviceActor::eInsideframe;
1435 aProp = mySurfaceProp;
1436 aBackProp = myBackSurfaceProp;
1437 aReperesent = SMESH_DeviceActor::eSurface;
1441 my2DActor->SetProperty(aProp);
1442 my2DActor->SetBackfaceProperty(aBackProp);
1443 my2DActor->SetRepresentation(aReperesent);
1445 if(aQuadraticMode == SMESH_Actor::eLines)
1446 my2DActor->SetQuadraticArcMode(false);
1447 else if(aQuadraticMode == SMESH_Actor::eArcs)
1448 my2DActor->SetQuadraticArcMode(true);
1450 my2DExtActor->SetRepresentation(aReperesent);
1452 my3DActor->SetProperty(aProp);
1453 my3DActor->SetBackfaceProperty(aBackProp);
1454 my3DActor->SetRepresentation(aReperesent);
1456 //my0DExtActor->SetVisibility(false);
1457 my1DExtActor->SetVisibility(false);
1458 my2DExtActor->SetVisibility(false);
1461 //my0DActor->SetProperty(aProp);
1462 //my0DActor->SetBackfaceProperty(aBackProp);
1463 my0DActor->SetRepresentation(aReperesent);
1464 //my0DExtActor->SetRepresentation(aReperesent);
1466 switch(myControlMode){
1468 case eMultiConnection:
1469 aProp = aBackProp = my1DProp;
1470 if(myRepresentation != ePoint)
1471 aReperesent = SMESH_DeviceActor::eInsideframe;
1475 if(aQuadraticMode == SMESH_Actor::eLines)
1476 my1DActor->SetQuadraticArcMode(false);
1477 else if(aQuadraticMode == SMESH_Actor::eArcs)
1478 my1DActor->SetQuadraticArcMode(true);
1480 my1DActor->SetProperty(aProp);
1481 my1DActor->SetBackfaceProperty(aBackProp);
1482 my1DActor->SetRepresentation(aReperesent);
1484 my1DExtActor->SetRepresentation(aReperesent);
1486 if(myIsPointsVisible)
1487 myPickableActor = myNodeActor;
1488 if(GetPointRepresentation())
1489 myNodeActor->SetVisibility(true);
1491 SetMapper(myPickableActor->GetMapper());
1493 SetVisibility(GetVisibility(),false);
1499 void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
1500 if ( myIsPointsVisible == theIsPointsVisible )
1502 myIsPointsVisible = theIsPointsVisible;
1503 SetRepresentation(GetRepresentation());
1506 bool SMESH_ActorDef::GetPointRepresentation(){
1507 return myIsPointsVisible || myIsPointsLabeled;
1511 void SMESH_ActorDef::UpdateHighlight(){
1512 myHighlitableActor->SetVisibility(false);
1513 myHighlitableActor->SetHighlited(false);
1515 if(myIsHighlighted){
1516 myHighlitableActor->SetProperty(myHighlightProp);
1517 }else if(myIsPreselected){
1518 myHighlitableActor->SetProperty(myPreselectProp);
1521 bool anIsVisible = GetVisibility();
1523 if(myIsHighlighted || myIsPreselected){
1524 if(GetUnstructuredGrid()->GetNumberOfCells()){
1525 myHighlitableActor->SetHighlited(anIsVisible);
1526 myHighlitableActor->SetVisibility(anIsVisible);
1527 myHighlitableActor->GetExtractUnstructuredGrid()->
1528 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::eCells);
1529 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
1530 }else if(myRepresentation == ePoint || GetPointRepresentation()){
1531 myHighlitableActor->SetHighlited(anIsVisible);
1532 myHighlitableActor->GetExtractUnstructuredGrid()->
1533 SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
1534 myHighlitableActor->SetVisibility(anIsVisible);
1535 myHighlitableActor->SetRepresentation(SMESH_DeviceActor::ePoint);
1537 VTK::MarkerType aMarkerType = GetMarkerType();
1538 if(aMarkerType != VTK::MT_USER)
1539 myHighlitableActor->SetMarkerStd(aMarkerType, GetMarkerScale());
1541 myHighlitableActor->SetMarkerTexture(GetMarkerTexture(), myMarkerTexture);
1547 void SMESH_ActorDef::highlight(bool theHighlight){
1548 if ( myIsHighlighted == theHighlight )
1550 myIsHighlighted = theHighlight;
1555 void SMESH_ActorDef::SetPreSelected(bool thePreselect){
1556 if ( myIsPreselected == thePreselect )
1558 myIsPreselected = thePreselect;
1564 int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
1566 if (myPickableActor->GetIsOpaque())
1568 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1576 int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
1578 if (!myPickableActor->GetIsOpaque())
1580 vtkRenderer *ren = static_cast<vtkRenderer *>(vp);
1588 void SMESH_ActorDef::Render(vtkRenderer *ren){
1589 unsigned long aTime = myTimeStamp->GetMTime();
1590 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1591 unsigned long aClippingTime = myImplicitBoolean->GetMTime();
1592 if(anObjTime > aTime || aClippingTime > aTime)
1597 void SMESH_ActorDef::Update(){
1598 if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
1600 if(GetControlMode() != eNone) {
1601 unsigned long aTime = myTimeStamp->GetMTime();
1602 unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
1603 if (anObjTime > aTime)
1604 SetControlMode(GetControlMode(),false);
1606 if(myIsPointsLabeled){
1607 SetPointsLabeled(myIsPointsLabeled);
1609 if(myIsCellsLabeled){
1610 SetCellsLabeled(myIsCellsLabeled);
1612 if(myIsFacesOriented){
1613 SetFacesOriented(myIsFacesOriented);
1615 SetEntityMode(GetEntityMode());
1616 SetVisibility(GetVisibility());
1618 myTimeStamp->Modified();
1623 void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
1624 SALOME_Actor::ReleaseGraphicsResources(renWin);
1626 myPickableActor->ReleaseGraphicsResources(renWin);
1630 static void GetColor(vtkProperty *theProperty, vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1631 vtkFloatingPointType* aColor = theProperty->GetColor();
1638 void SMESH_ActorDef::SetOpacity(vtkFloatingPointType theValue){
1639 mySurfaceProp->SetOpacity(theValue);
1640 myBackSurfaceProp->SetOpacity(theValue);
1641 myEdgeProp->SetOpacity(theValue);
1642 myNodeProp->SetOpacity(theValue);
1644 my1DProp->SetOpacity(theValue);
1648 vtkFloatingPointType SMESH_ActorDef::GetOpacity(){
1649 return mySurfaceProp->GetOpacity();
1653 void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1654 mySurfaceProp->SetColor(r,g,b);
1655 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1656 if( aGroupObj->GetElementType() == SMDSAbs_Face ||
1657 aGroupObj->GetElementType() == SMDSAbs_Volume )
1658 myNameActor->SetBackgroundColor(r,g,b);
1662 void SMESH_ActorDef::GetSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1663 ::GetColor(mySurfaceProp,r,g,b);
1664 my2DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1667 void SMESH_ActorDef::SetBackSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1668 myBackSurfaceProp->SetColor(r,g,b);
1672 void SMESH_ActorDef::GetBackSufaceColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1673 ::GetColor(myBackSurfaceProp,r,g,b);
1676 void SMESH_ActorDef::SetEdgeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1677 myEdgeProp->SetColor(r,g,b);
1678 my1DProp->SetColor(r,g,b);
1679 my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1680 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1681 if( aGroupObj->GetElementType() == SMDSAbs_Edge )
1682 myNameActor->SetBackgroundColor(r,g,b);
1686 void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1687 ::GetColor(myEdgeProp,r,g,b);
1690 void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1691 myNodeProp->SetColor(r,g,b);
1692 myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b);
1693 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1694 if( aGroupObj->GetElementType() == SMDSAbs_Node )
1695 myNameActor->SetBackgroundColor(r,g,b);
1699 void SMESH_ActorDef::GetNodeColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1700 ::GetColor(myNodeProp,r,g,b);
1703 void SMESH_ActorDef::Set0DColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1704 my0DProp->SetColor(r,g,b);
1705 if( SMESH_GroupObj* aGroupObj = dynamic_cast<SMESH_GroupObj*>( myVisualObj.get() ) )
1706 if( aGroupObj->GetElementType() == SMDSAbs_0DElement )
1707 myNameActor->SetBackgroundColor(r,g,b);
1711 void SMESH_ActorDef::Get0DColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1712 ::GetColor(my0DProp,r,g,b);
1715 void SMESH_ActorDef::SetHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1716 myHighlightProp->SetColor(r,g,b);
1720 void SMESH_ActorDef::GetHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1721 ::GetColor(myHighlightProp,r,g,b);
1724 void SMESH_ActorDef::SetPreHighlightColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){
1725 myPreselectProp->SetColor(r,g,b);
1729 void SMESH_ActorDef::GetPreHighlightColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b){
1730 ::GetColor(myPreselectProp,r,g,b);
1734 vtkFloatingPointType SMESH_ActorDef::GetLineWidth(){
1735 return myEdgeProp->GetLineWidth();
1739 void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){
1740 myEdgeProp->SetLineWidth(theVal);
1742 my1DProp->SetLineWidth(theVal + aLineWidthInc);
1743 my1DExtProp->SetLineWidth(theVal + aLineWidthInc);
1749 void SMESH_ActorDef::Set0DSize(vtkFloatingPointType theVal){
1750 my0DProp->SetPointSize(theVal);
1754 vtkFloatingPointType SMESH_ActorDef::Get0DSize(){
1755 return my0DProp->GetPointSize();
1758 int SMESH_ActorDef::GetObjDimension( const int theObjId )
1760 return myVisualObj->GetElemDimension( theObjId );
1765 IsImplicitFunctionUsed() const
1767 return myBaseActor->IsImplicitFunctionUsed();
1771 SMESH_ActorDef::SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed)
1773 myNodeActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1774 myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1776 myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1778 myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1780 my0DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1781 //my0DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1783 my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1784 my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1786 my2DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1787 my2DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1788 my3DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed);
1792 SMESH_ActorDef::AddClippingPlane(vtkPlane* thePlane)
1795 myImplicitBoolean->GetFunction()->AddItem(thePlane);
1796 myCippingPlaneCont.push_back(thePlane);
1797 if(!IsImplicitFunctionUsed())
1798 SetImplicitFunctionUsed(true);
1800 return myCippingPlaneCont.size();
1805 RemoveAllClippingPlanes()
1807 myImplicitBoolean->GetFunction()->RemoveAllItems();
1808 myImplicitBoolean->GetFunction()->Modified(); // VTK bug
1809 myCippingPlaneCont.clear();
1810 SetImplicitFunctionUsed(false);
1815 GetNumberOfClippingPlanes()
1817 return myCippingPlaneCont.size();
1822 GetClippingPlane(vtkIdType theID)
1824 if(theID >= myCippingPlaneCont.size())
1826 return myCippingPlaneCont[theID].Get();
1829 void SMESH_ActorDef::UpdateScalarBar()
1831 SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
1835 vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
1837 QColor aTColor = mgr->colorValue( "SMESH", "scalar_bar_title_color", QColor( 255, 255, 255 ) );
1838 aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1840 aScalarBarTitleProp->SetFontFamilyToArial();
1842 if ( mgr->hasValue( "SMESH", "scalar_bar_title_font" ) )
1844 QFont f = mgr->fontValue( "SMESH", "scalar_bar_title_font" );
1845 if ( f.family() == "Arial" )
1846 aScalarBarTitleProp->SetFontFamilyToArial();
1847 else if ( f.family() == "Courier" )
1848 aScalarBarTitleProp->SetFontFamilyToCourier();
1849 else if ( f.family() == "Times" )
1850 aScalarBarTitleProp->SetFontFamilyToTimes();
1853 aScalarBarTitleProp->BoldOn();
1855 aScalarBarTitleProp->BoldOff();
1858 aScalarBarTitleProp->ItalicOn();
1860 aScalarBarTitleProp->ItalicOff();
1863 aScalarBarTitleProp->ShadowOn();
1865 aScalarBarTitleProp->ShadowOff();
1868 myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
1869 aScalarBarTitleProp->Delete();
1871 vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
1873 aTColor = mgr->colorValue( "SMESH", "scalar_bar_label_color", QColor( 255, 255, 255 ) );
1874 aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
1876 aScalarBarLabelProp->SetFontFamilyToArial();
1877 if( mgr->hasValue( "SMESH", "scalar_bar_label_font" ) )
1879 QFont f = mgr->fontValue( "SMESH", "scalar_bar_label_font" );
1880 if( f.family() == "Arial" )
1881 aScalarBarLabelProp->SetFontFamilyToArial();
1882 else if( f.family() == "Courier" )
1883 aScalarBarLabelProp->SetFontFamilyToCourier();
1884 else if( f.family() == "Times" )
1885 aScalarBarLabelProp->SetFontFamilyToTimes();
1888 aScalarBarLabelProp->BoldOn();
1890 aScalarBarLabelProp->BoldOff();
1893 aScalarBarLabelProp->ItalicOn();
1895 aScalarBarLabelProp->ItalicOff();
1898 aScalarBarLabelProp->ShadowOn();
1900 aScalarBarLabelProp->ShadowOff();
1903 myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
1904 aScalarBarLabelProp->Delete();
1906 bool horiz = ( mgr->integerValue( "SMESH", "scalar_bar_orientation" ) == 1 );
1907 QString name = QString( "scalar_bar_%1_" ).arg( horiz ? "horizontal" : "vertical" );
1909 myScalarBarActor->SetOrientationToHorizontal();
1911 myScalarBarActor->SetOrientationToVertical();
1914 vtkFloatingPointType aXVal = horiz ? 0.20 : 0.01;
1915 if( mgr->hasValue( "SMESH", name + "x" ) )
1916 aXVal = mgr->doubleValue( "SMESH", name + "x", aXVal );
1918 vtkFloatingPointType aYVal = horiz ? 0.01 : 0.1;
1919 if( mgr->hasValue( "SMESH", name + "y" ) )
1920 aYVal = mgr->doubleValue( "SMESH", name + "y", aYVal );
1921 myScalarBarActor->SetPosition( aXVal, aYVal );
1923 vtkFloatingPointType aWVal = horiz ? 0.60 : 0.10;
1924 if( mgr->hasValue( "SMESH", name + "width" ) )
1925 aWVal = mgr->doubleValue( "SMESH", name + "width", aWVal );
1926 myScalarBarActor->SetWidth( aWVal );
1928 vtkFloatingPointType aHVal = horiz ? 0.12 : 0.80;
1929 if( mgr->hasValue( "SMESH", name + "height" ) )
1930 aHVal = mgr->doubleValue( "SMESH", name + "height", aHVal );
1931 myScalarBarActor->SetHeight( aHVal );
1934 if( mgr->hasValue( "SMESH", "scalar_bar_num_labels" ) )
1935 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_labels", anIntVal );
1936 myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
1939 if( mgr->hasValue( "SMESH", "scalar_bar_num_colors" ) )
1940 anIntVal = mgr->integerValue( "SMESH", "scalar_bar_num_colors", anIntVal );
1941 myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
1943 bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
1944 myScalarBarActor->SetDistributionVisibility(distributionVisibility);
1946 int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
1947 myScalarBarActor->SetDistributionColoringType(coloringType);
1949 QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
1950 QColor(255, 255, 255));
1952 rgb[0]= distributionColor.red()/255.;
1953 rgb[1]= distributionColor.green()/255.;
1954 rgb[2]= distributionColor.blue()/255.;
1955 myScalarBarActor->SetDistributionColor(rgb);
1960 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
1963 case SMESH_Actor::eLines :
1964 myHighlitableActor->SetQuadraticArcMode(false);
1965 my2DActor->SetQuadraticArcMode(false);
1966 my1DActor->SetQuadraticArcMode(false);
1968 case SMESH_Actor::eArcs :
1969 myHighlitableActor->SetQuadraticArcMode(true);
1970 if(GetRepresentation() != SMESH_Actor::ePoint) {
1971 my2DActor->SetQuadraticArcMode(true);
1972 my1DActor->SetQuadraticArcMode(true);
1981 SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
1983 if(myHighlitableActor->GetQuadraticArcMode())
1984 return SMESH_Actor::eArcs;
1986 return SMESH_Actor::eLines;
1989 void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
1991 SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
1992 myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
1993 myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
1996 void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
1998 SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
1999 myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2000 myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
2001 myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor