- switch (theCommandID)
- {
- case 6001: //Length Edges
- {
- type = tr( "SMESH_CONTROL_LENGTH_EDGES");
- meshMapper = (vtkDataSetMapper*)MeshActor->EdgeDevice->GetMapper();
- vtkUnstructuredGrid* grid = (vtkUnstructuredGrid*)meshMapper->GetInput();
- MESSAGE ( " init minimum length " << grid->GetNumberOfCells() )
- for (int i=0; i<grid->GetNumberOfCells(); i++ ) {
- vtkCell* cell = grid->GetCell(i);
- float len = SMESHGUI_ComputeScalarValue::LengthEdges(cell);
- if (len == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,len);
- scalars->InsertTuple1(i,len);
- }
- }
- if (ValidateScalars && (MeshActor->getDisplayMode()!=0))
- ChangeRepresentation( MeshActor, 1 );// limitation; in Wireframe, colored edges are not visible
- break;
- }
- case 6011: // Area Elements
- {
- type = tr( "SMESH_CONTROL_AREA_ELEMENTS");
- for (int i=0; i< MeshActor->GetMapper()->GetInput()->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->GetMapper()->GetInput()->GetCell(i);
- float area = SMESHGUI_ComputeScalarValue::AreaElements(cell);
- if (area == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,area);
- scalars->InsertTuple1(i,area);
- }
- }
- if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
- ChangeRepresentation( MeshActor, 1 );
- break;
- }
- case 6012: // Taper
- {
- type = tr( "SMESH_CONTROL_TAPER_ELEMENTS");
- for (int i=0; i< MeshActor->DataSource->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->DataSource->GetCell(i);
- float taper = SMESHGUI_ComputeScalarValue::Taper(cell);
- if (taper == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,taper);
- scalars->InsertTuple1(i,taper);
- }
- }
- break;
- }
- case 6013: // Aspect ratio
- {
- type = tr( "SMESH_CONTROL_ASPECTRATIO_ELEMENTS");
- for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->DataSource->GetCell(i);
- float aspect = SMESHGUI_ComputeScalarValue::AspectRatio(cell);
- if (aspect == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,aspect);
- scalars->InsertTuple1(i,aspect);
- }
- }
- if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
- ChangeRepresentation( MeshActor, 1 );
- break;
- }
- case 6014: // Minimum angle
- {
- type = tr( "SMESH_CONTROL_MINIMUMANGLE_ELEMENTS");
- for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->DataSource->GetCell(i);
- float angle = SMESHGUI_ComputeScalarValue::MinimumAngle(cell);
- if (angle == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,angle);
- scalars->InsertTuple1(i,angle);
- }
- }
- if (ValidateScalars && (MeshActor->getDisplayMode()!=1))
- ChangeRepresentation( MeshActor, 1 );
- break;
- }
- case 6015: // Warp
- {
- type = tr( "SMESH_CONTROL_WARP_ELEMENTS");
- for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->DataSource->GetCell(i);
- float Warp = SMESHGUI_ComputeScalarValue::Warp(cell);
- if (Warp == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,Warp);
- scalars->InsertTuple1(i,Warp);
- }
- }
- break;
- }
- case 6016: // Skew
- {
- type = tr( "SMESH_CONTROL_SKEW_ELEMENTS");
- for (int i=0; i<MeshActor->DataSource->GetNumberOfCells(); i++ ) {
- vtkCell* cell = MeshActor->DataSource->GetCell(i);
- float angle = SMESHGUI_ComputeScalarValue::Skew(cell);
- if (angle == 0) continue;
- else {
- ValidateScalars = true;
-// mpv porting vtk 4.2.2
-// scalars->InsertScalar(i,angle);
- scalars->InsertTuple1(i,angle);
- }
- }
- break;
- }
- }
-
- if ( !ValidateScalars ) {
- QApplication::restoreOverrideCursor();
- return;