+ if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
+ myBaseActor = SMESH_DeviceActor::New();
+
+ myTimeStamp = vtkTimeStamp::New();
+
+ myIsPointsVisible = false;
+
+ myIsShrinkable = false;
+ myIsShrunk = false;
+
+ myIsFacesOriented = false;
+
+ myControlsPrecision = -1;
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+
+ if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
+ myControlsPrecision = mgr->integerValue( "SMESH", "controls_precision", -1);
+
+ vtkFloatingPointType aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
+ vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
+
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+ VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
+
+ //Definition 2D and 3D devices of the actor
+ //-----------------------------------------
+ vtkFloatingPointType anRGB[3] = {1,1,1};
+ mySurfaceProp = vtkProperty::New();
+ QColor ffc, bfc;
+ int delta;
+ SMESH::GetColor( "SMESH", "fill_color", ffc, delta, "0,170,255|-100" ) ;
+ mySurfaceProp->SetColor( ffc.red() / 255. , ffc.green() / 255. , ffc.blue() / 255. );
+ myDeltaBrightness = delta;
+
+ myBackSurfaceProp = vtkProperty::New();
+ bfc = Qtx::mainColorToSecondary(ffc, delta);
+ myBackSurfaceProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
+
+ my2DActor = SMESH_CellLabelActor::New();
+ my2DActor->SetStoreGemetryMapping(true);
+ my2DActor->SetUserMatrix(aMatrix);
+ my2DActor->PickableOff();
+ my2DActor->SetProperty(mySurfaceProp);
+ my2DActor->SetBackfaceProperty(myBackSurfaceProp);
+ my2DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my2DActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_POLYGON);
+ aFilter->RegisterCellsWithType(VTK_QUAD);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
+
+ my2DExtProp = vtkProperty::New();
+ my2DExtProp->DeepCopy(mySurfaceProp);
+ SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
+ anRGB[0] = 1 - anRGB[0];
+ anRGB[1] = 1 - anRGB[1];
+ anRGB[2] = 1 - anRGB[2];
+ my2DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ my2DExtActor = SMESH_DeviceActor::New();
+ my2DExtActor->SetUserMatrix(aMatrix);
+ my2DExtActor->PickableOff();
+ my2DExtActor->SetProperty(my2DExtProp);
+ my2DExtActor->SetBackfaceProperty(my2DExtProp);
+ my2DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
+ aFilter = my2DExtActor->GetExtractUnstructuredGrid();
+ aFilter->RegisterCellsWithType(VTK_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_POLYGON);
+ aFilter->RegisterCellsWithType(VTK_QUAD);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TRIANGLE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_QUAD);
+
+ my3DActor = SMESH_CellLabelActor::New();
+ my3DActor->SetStoreGemetryMapping(true);
+ my3DActor->SetUserMatrix(aMatrix);
+ my3DActor->PickableOff();
+ my3DActor->SetProperty(mySurfaceProp);
+ my3DActor->SetBackfaceProperty(myBackSurfaceProp);
+ my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my3DActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_TETRA);
+ aFilter->RegisterCellsWithType(VTK_VOXEL);
+ aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_WEDGE);
+ aFilter->RegisterCellsWithType(VTK_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
+//#ifdef VTK_HAVE_POLYHEDRON
+ MESSAGE("RegisterCellsWithType(VTK_POLYHEDRON)");
+ aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
+//#endif
+
+ my3DExtActor = SMESH_DeviceActor::New();
+ my3DExtActor->SetUserMatrix(aMatrix);
+ my3DExtActor->PickableOff();
+ my3DExtActor->SetProperty(my2DExtProp);
+ my3DExtActor->SetBackfaceProperty(my2DExtProp);
+ my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my3DExtActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_TETRA);
+ aFilter->RegisterCellsWithType(VTK_VOXEL);
+ aFilter->RegisterCellsWithType(VTK_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_WEDGE);
+ aFilter->RegisterCellsWithType(VTK_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_WEDGE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_PYRAMID);
+ aFilter->RegisterCellsWithType(VTK_CONVEX_POINT_SET);
+ aFilter->RegisterCellsWithType(VTK_POLYHEDRON);
+
+ //Definition 1D device of the actor
+ //---------------------------------
+ myEdgeProp = vtkProperty::New();
+ myEdgeProp->SetAmbient(1.0);
+ myEdgeProp->SetDiffuse(0.0);
+ myEdgeProp->SetSpecular(0.0);
+ SMESH::GetColor( "SMESH", "wireframe_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
+ myEdgeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myEdgeProp->SetLineWidth(aLineWidth);
+
+ my1DActor = SMESH_CellLabelActor::New();
+ my1DActor->SetStoreGemetryMapping(true);
+ my1DActor->SetUserMatrix(aMatrix);
+ my1DActor->PickableOff();
+ my1DActor->SetHighlited(true);
+ my1DActor->SetProperty(myEdgeProp);
+ my1DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my1DActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_LINE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
+
+ my1DProp = vtkProperty::New();
+ my1DProp->DeepCopy(myEdgeProp);
+ my1DProp->SetLineWidth(aLineWidth + aLineWidthInc);
+ my1DProp->SetPointSize(aElem0DSize);
+
+ my1DExtProp = vtkProperty::New();
+ my1DExtProp->DeepCopy(myEdgeProp);
+ anRGB[0] = 1 - anRGB[0];
+ anRGB[1] = 1 - anRGB[1];
+ anRGB[2] = 1 - anRGB[2];
+ my1DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ my1DExtProp->SetLineWidth(aLineWidth + aLineWidthInc);
+ my1DExtProp->SetPointSize(aElem0DSize);
+
+ my1DExtActor = SMESH_DeviceActor::New();
+ my1DExtActor->SetUserMatrix(aMatrix);
+ my1DExtActor->PickableOff();
+ my1DExtActor->SetHighlited(true);
+ my1DExtActor->SetVisibility(false);
+ my1DExtActor->SetProperty(my1DExtProp);
+ my1DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
+ aFilter = my1DExtActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_LINE);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_EDGE);
+
+
+ //Definition 0D device of the actor (0d elements)
+ //-----------------------------------------------
+ my0DProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "elem0d_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 0 ) );
+ my0DProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ my0DProp->SetPointSize(aElem0DSize);
+
+ my0DActor = SMESH_CellLabelActor::New();
+ my0DActor->SetUserMatrix(aMatrix);
+ my0DActor->SetStoreGemetryMapping(true);
+ my0DActor->PickableOff();
+ my0DActor->SetVisibility(false);
+ my0DActor->SetProperty(my0DProp);
+ my0DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = my0DActor->GetExtractUnstructuredGrid();
+ //aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_VERTEX);
+
+ //my0DExtProp = vtkProperty::New();
+ //my0DExtProp->DeepCopy(my0DProp);
+ //anRGB[0] = 1 - anRGB[0];
+ //anRGB[1] = 1 - anRGB[1];
+ //anRGB[2] = 1 - anRGB[2];
+ //my0DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ //my0DExtProp->SetPointSize(aElem0DSize);
+ //
+ //my0DExtActor = SMESH_DeviceActor::New();
+ //my0DExtActor->SetUserMatrix(aMatrix);
+ //my0DExtActor->SetStoreClippingMapping(true);
+ //my0DExtActor->PickableOff();
+ //my0DExtActor->SetHighlited(true);
+ //my0DExtActor->SetVisibility(false);
+ //my0DExtActor->SetProperty(my0DExtProp);
+ //my0DExtActor->SetRepresentation(SMESH_DeviceActor::eInsideframe);
+ //aFilter = my0DExtActor->GetExtractUnstructuredGrid();
+ ////aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ //aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ //aFilter->RegisterCellsWithType(VTK_VERTEX);
+
+
+ //Definition 0D device of the actor (nodes)
+ //-----------------------------------------
+ myNodeProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "node_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 0 ) );
+ myNodeProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ myNodeActor = SMESH_NodeLabelActor::New();
+ myNodeActor->SetUserMatrix(aMatrix);
+ myNodeActor->SetStoreClippingMapping(true);
+ myNodeActor->PickableOff();
+ myNodeActor->SetVisibility(false);
+ myNodeActor->SetProperty(myNodeProp);
+ myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint);
+ aFilter = myNodeActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+
+ myNodeExtProp = vtkProperty::New();
+ myNodeExtProp->DeepCopy(myNodeProp);
+ anRGB[0] = 1 - anRGB[0];
+ anRGB[1] = 1 - anRGB[1];
+ anRGB[2] = 1 - anRGB[2];
+ myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ myNodeExtActor = SMESH_DeviceActor::New();
+ myNodeExtActor->SetUserMatrix(aMatrix);
+ myNodeExtActor->SetStoreClippingMapping(true);
+ myNodeExtActor->PickableOff();
+ myNodeExtActor->SetHighlited(true);
+ myNodeExtActor->SetVisibility(false);
+ myNodeExtActor->SetProperty(myNodeExtProp);
+ myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint);
+ aFilter = myNodeExtActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints);
+ aFilter->RegisterCellsWithType(VTK_VERTEX);
+
+ //Definition of Pickable and Highlitable engines
+ //----------------------------------------------
+
+ myBaseActor->SetUserMatrix(aMatrix);
+ myBaseActor->SetStoreGemetryMapping(true);
+ myBaseActor->GetProperty()->SetOpacity(0.0);
+ myPickableActor = myBaseActor;
+
+ myHighlightProp = vtkProperty::New();
+ myHighlightProp->SetAmbient(1.0);
+ myHighlightProp->SetDiffuse(0.0);
+ myHighlightProp->SetSpecular(0.0);
+ SMESH::GetColor( "SMESH", "selection_object_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 255, 255 ) );
+ myHighlightProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myHighlightProp->SetPointSize(aElem0DSize); // ??
+ myHighlightProp->SetRepresentation(1);
+
+ myOutLineProp = vtkProperty::New();
+ myOutLineProp->SetAmbient(1.0);
+ myOutLineProp->SetDiffuse(0.0);
+ myOutLineProp->SetSpecular(0.0);
+ SMESH::GetColor( "SMESH", "outline_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 70, 0 ) );
+ myOutLineProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myOutLineProp->SetPointSize(aElem0DSize); // ??
+ myOutLineProp->SetRepresentation(1);
+
+ myPreselectProp = vtkProperty::New();
+ myPreselectProp->SetAmbient(1.0);
+ myPreselectProp->SetDiffuse(0.0);
+ myPreselectProp->SetSpecular(0.0);
+ SMESH::GetColor( "SMESH", "highlight_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 255, 255 ) );
+ myPreselectProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myPreselectProp->SetPointSize(aElem0DSize); // ??
+ myPreselectProp->SetRepresentation(1);
+
+ myHighlitableActor = SMESH_DeviceActor::New();
+ myHighlitableActor->SetUserMatrix(aMatrix);
+ myHighlitableActor->PickableOff();
+ myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
+
+ aMatrix->Delete();