+ if(MYDEBUG) MESSAGE("SMESH_ActorDef - "<<this);
+ myBaseActor = SMESH_DeviceActor::New();
+
+ myTimeStamp = vtkTimeStamp::New();
+
+ myIsPointsVisible = false;
+ myIsEntityModeCache = false;
+
+ myHighlightActor = SMESH_SVTKActor::New();
+ myHighlightActor->Delete(); // vtkSmartPointer!
+ myHighlightActor->Initialize();
+
+ myPreHighlightActor = SMESH_SVTKActor::New();
+ myPreHighlightActor->Delete();
+ myPreHighlightActor->Initialize();
+
+ 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);
+
+ double aElem0DSize = SMESH::GetFloat("SMESH:elem0d_size",5);
+ double aBallElemSize = SMESH::GetFloat("SMESH:ball_elem_size",10);
+ double aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
+ double aOutlineWidth = SMESH::GetFloat("SMESH:outline_width",1);
+
+ SMESH::LabelFont aFamilyNd = SMESH::FntTimes;
+ bool aBoldNd = true;
+ bool anItalicNd = false;
+ bool aShadowNd = false;
+ int aSizeNd = 10;
+ if ( mgr->hasValue( "SMESH", "numbering_node_font" ) ) {
+ QFont f = mgr->fontValue( "SMESH", "numbering_node_font" );
+ if ( f.family() == "Arial" ) aFamilyNd = SMESH::FntArial;
+ else if ( f.family() == "Courier" ) aFamilyNd = SMESH::FntCourier;
+ else if ( f.family() == "Times" ) aFamilyNd = SMESH::FntTimes;
+ aBoldNd = f.bold();
+ anItalicNd = f.italic();
+ aShadowNd = f.overline();
+ aSizeNd = f.pointSize();
+ }
+ double anRGBNd[3] = {1,1,1};
+ SMESH::GetColor( "SMESH", "numbering_node_color", anRGBNd[0], anRGBNd[1], anRGBNd[2], QColor( 255, 255, 255 ) );
+
+ SMESH::LabelFont aFamilyEl = SMESH::FntTimes;
+ bool aBoldEl = true;
+ bool anItalicEl = false;
+ bool aShadowEl = false;
+ int aSizeEl = 12;
+ if ( mgr->hasValue( "SMESH", "numbering_elem_font" ) ) {
+ QFont f = mgr->fontValue( "SMESH", "numbering_elem_font" );
+ if ( f.family() == "Arial" ) aFamilyEl = SMESH::FntArial;
+ else if ( f.family() == "Courier" ) aFamilyEl = SMESH::FntCourier;
+ else if ( f.family() == "Times" ) aFamilyEl = SMESH::FntTimes;
+ aBoldEl = f.bold();
+ anItalicEl = f.italic();
+ aShadowEl = f.overline();
+ aSizeEl = f.pointSize();
+ }
+ double anRGBEl[3] = {0,1,0};
+ SMESH::GetColor( "SMESH", "numbering_elem_color", anRGBEl[0], anRGBEl[1], anRGBEl[2], QColor( 0, 255, 0 ) );
+
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+ VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
+
+ //Definition 2D and 3D devices of the actor
+ //-----------------------------------------
+ double 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. );
+
+ myNormalVProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "volume_color", ffc, delta, "255,0,170|-100" );
+ myNormalVProp->SetColor( ffc.redF(), ffc.greenF(), ffc.blueF() );
+ myDeltaVBrightness = delta;
+
+ myReversedVProp = vtkProperty::New();
+ bfc = Qtx::mainColorToSecondary(ffc, delta);
+ myReversedVProp->SetColor( bfc.red() / 255. , bfc.green() / 255. , bfc.blue() / 255. );
+
+ my2DActor = SMESH_CellLabelActor::New();
+ my2DActor->SetStoreGemetryMapping(true);
+ my2DActor->SetUserMatrix(aMatrix);
+ my2DActor->PickableOff();
+ my2DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ 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);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
+
+ 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);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_QUAD);
+ aFilter->RegisterCellsWithType(VTK_BIQUADRATIC_TRIANGLE);
+
+ my3DActor = SMESH_CellLabelActor::New();
+ my3DActor->SetStoreGemetryMapping(true);
+ my3DActor->SetUserMatrix(aMatrix);
+ my3DActor->PickableOff();
+ my3DActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ my3DActor->SetProperty(myNormalVProp);
+ my3DActor->SetBackfaceProperty(myReversedVProp);
+ my3DActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ my3DActor->SetCoincident3DAllowed(true);
+ 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_HEXAGONAL_PRISM);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_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
+
+ my3DExtProp = vtkProperty::New();
+ my3DExtProp->DeepCopy(myNormalVProp);
+ SMESH::GetColor( "SMESH", "volume_color", anRGB[0], anRGB[1], anRGB[2], QColor( 255, 0, 170 ) );
+ anRGB[0] = 1 - anRGB[0];
+ anRGB[1] = 1 - anRGB[1];
+ anRGB[2] = 1 - anRGB[2];
+ my3DExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+
+ my3DExtActor = SMESH_DeviceActor::New();
+ my3DExtActor->SetUserMatrix(aMatrix);
+ my3DExtActor->PickableOff();
+ my3DExtActor->SetProperty(my3DExtProp);
+ my3DExtActor->SetBackfaceProperty(my3DExtProp);
+ my3DExtActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ my3DExtActor->SetCoincident3DAllowed(true);
+ 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_HEXAGONAL_PRISM);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_TETRA);
+ aFilter->RegisterCellsWithType(VTK_QUADRATIC_HEXAHEDRON);
+ aFilter->RegisterCellsWithType(VTK_TRIQUADRATIC_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->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ 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->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ 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);
+
+ //Definition 0D device of the actor (ball elements)
+ //-----------------------------------------------
+ myBallProp = vtkProperty::New();
+ SMESH::GetColor( "SMESH", "ball_elem_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 85, 255 ) );
+ myBallProp->SetColor(anRGB[0],anRGB[1],anRGB[2]);
+ myBallProp->SetPointSize(aBallElemSize);
+
+ myBallActor = SMESH_CellLabelActor::New();
+ myBallActor->SetUserMatrix(aMatrix);
+ myBallActor->SetStoreGemetryMapping(true);
+ myBallActor->PickableOff();
+ myBallActor->SetFontProperties( aFamilyEl, aSizeEl, aBoldEl, anItalicEl, aShadowEl, anRGBEl[0], anRGBEl[1], anRGBEl[2] );
+ myBallActor->SetVisibility(false);
+ myBallActor->SetProperty(myBallProp);
+ myBallActor->SetRepresentation(SMESH_DeviceActor::eSurface);
+ aFilter = myBallActor->GetExtractUnstructuredGrid();
+ aFilter->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
+ aFilter->RegisterCellsWithType(VTK_POLY_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->SetFontProperties( aFamilyNd, aSizeNd, aBoldNd, anItalicNd, aShadowNd, anRGBNd[0], anRGBNd[1], anRGBNd[2] );
+ 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->SetLineWidth(aLineWidth);
+ myHighlightProp->SetRepresentation(1);
+
+ myBallHighlightProp = vtkProperty::New();
+ myBallHighlightProp->DeepCopy(myHighlightProp);
+ myBallHighlightProp->SetPointSize(aBallElemSize);
+
+
+ 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->SetLineWidth(aOutlineWidth);
+ 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->SetLineWidth(aLineWidth);
+ myPreselectProp->SetRepresentation(1);
+
+ myBallPreselectProp = vtkProperty::New();
+ myBallPreselectProp->DeepCopy(myPreselectProp);
+ myBallPreselectProp->SetPointSize(aBallElemSize);
+
+ myHighlitableActor = SMESH_DeviceActor::New();
+ myHighlitableActor->SetUserMatrix(aMatrix);
+ myHighlitableActor->PickableOff();
+ myHighlitableActor->SetRepresentation(SMESH_DeviceActor::eWireframe);
+ myHighlitableActor->SetCoincident3DAllowed(true);
+
+ aMatrix->Delete();
+
+ myName = "";
+ myIO = NULL;