]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merging from the BR_V5_DEV branch.
authornds <nds@opencascade.com>
Mon, 6 Oct 2008 10:14:23 +0000 (10:14 +0000)
committernds <nds@opencascade.com>
Mon, 6 Oct 2008 10:14:23 +0000 (10:14 +0000)
src/VTKViewer/VTKViewer_GeometryFilter.cxx
src/VTKViewer/VTKViewer_Trihedron.cxx

index 5d2590de63e9f337ee114d020decbc90bd4c1333..3d6182e96292a3728780c2d937093f38bd210fa9 100755 (executable)
@@ -474,6 +474,7 @@ VTKViewer_GeometryFilter
         case VTK_QUADRATIC_QUAD:
         case VTK_QUADRATIC_TETRA:
         case VTK_QUADRATIC_HEXAHEDRON:
+        case VTK_QUADRATIC_WEDGE:
          if(!myIsWireframeMode){
            input->GetCell(cellId,cell);
            vtkIdList *pts = vtkIdList::New();  
@@ -650,6 +651,82 @@ VTKViewer_GeometryFilter
 
              break;
            }
+            case VTK_QUADRATIC_WEDGE: {
+              aCellType = VTK_POLYGON;
+             numFacePts = 6;
+              //---------------------------------------------------------------
+              //Face 1
+             aNewPts[0] = pts[0];
+             aNewPts[1] = pts[6];
+             aNewPts[2] = pts[1];
+             aNewPts[3] = pts[7];
+             aNewPts[4] = pts[2];
+             aNewPts[5] = pts[8];
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping)
+               myVTK2ObjIds.push_back(cellId);
+              outputCD->CopyData(cd,cellId,newCellId);
+              
+              //---------------------------------------------------------------
+              //Face 2
+              aNewPts[0] = pts[3];
+             aNewPts[1] = pts[9];
+             aNewPts[2] = pts[4];
+             aNewPts[3] = pts[10];
+             aNewPts[4] = pts[5];
+             aNewPts[5] = pts[11];
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping)
+               myVTK2ObjIds.push_back(cellId);
+              outputCD->CopyData(cd,cellId,newCellId);
+              
+              //---------------------------------------------------------------
+              //Face 3
+              numFacePts = 8;
+              aNewPts[0] = pts[0];
+             aNewPts[1] = pts[8];
+             aNewPts[2] = pts[2];
+             aNewPts[3] = pts[14];
+             aNewPts[4] = pts[5];
+             aNewPts[5] = pts[11];
+             aNewPts[6] = pts[3];
+             aNewPts[7] = pts[12];
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping)
+               myVTK2ObjIds.push_back(cellId);
+              outputCD->CopyData(cd,cellId,newCellId);
+
+              //---------------------------------------------------------------
+              //Face 4
+              aNewPts[0] = pts[1];
+             aNewPts[1] = pts[13];
+             aNewPts[2] = pts[4];
+             aNewPts[3] = pts[10];
+             aNewPts[4] = pts[5];
+             aNewPts[5] = pts[14];
+             aNewPts[6] = pts[2];
+             aNewPts[7] = pts[7];
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping)
+               myVTK2ObjIds.push_back(cellId);
+              outputCD->CopyData(cd,cellId,newCellId);
+
+              //---------------------------------------------------------------
+              //Face 5
+              aNewPts[0] = pts[0];
+             aNewPts[1] = pts[12];
+             aNewPts[2] = pts[3];
+             aNewPts[3] = pts[9];
+             aNewPts[4] = pts[4];
+             aNewPts[5] = pts[13];
+              aNewPts[6] = pts[1];
+              aNewPts[7] = pts[6];
+              newCellId = output->InsertNextCell(aCellType,numFacePts,aNewPts);
+             if(myStoreMapping)
+               myVTK2ObjIds.push_back(cellId);
+              outputCD->CopyData(cd,cellId,newCellId);
+              break;
+            }
            case VTK_QUADRATIC_HEXAHEDRON: {
              aCellType = VTK_POLYGON;
              numFacePts = 8;
@@ -772,7 +849,7 @@ VTKViewer_GeometryFilter
     delete [] cellVis;
     }
 
-  return 0;
+  return 1;
 }
 
 
index f50d67b30b862bc967e3ef2efcb92107dde0b9a8..7781f1b579707eb3b3e34350e8c34652968ece92 100755 (executable)
@@ -80,8 +80,12 @@ void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer)
     vtkFloatingPointType aLength = aDataSet->GetLength();
     vtkFloatingPointType aPrecision = 1.0E-3;
     vtkFloatingPointType anOldScale = GetScale()[0];
-    vtkFloatingPointType aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1]));
-    if(fabs(aScale - anOldScale)/aScale > aPrecision){
+    vtkFloatingPointType aScale;
+    if (aSize[1] > aSize[0])
+      aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1]));
+    else
+      aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[1])/vtkFloatingPointType(aSize[0]));
+    if(aScale != 0.0&& fabs(aScale - anOldScale)/aScale > aPrecision){
       SetScale(aScale);
     }
   }