]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d.vtk/src/org/simantics/g3d/vtk/shape/MeshActor.java
White space clean-up
[simantics/3d.git] / org.simantics.g3d.vtk / src / org / simantics / g3d / vtk / shape / MeshActor.java
index c52e021ebf9ade2a718e1fed3785b0d592679d16..43aaadb1fcef491344eda62f03f0a874db8d6e5e 100644 (file)
@@ -35,53 +35,53 @@ public class MeshActor extends vtkActor {
                polyData.Allocate(mesh.getIndices().size()/3, mesh.getIndices().size()/3);
                
                vtkTriangle triangle = new vtkTriangle();
-        vtkIdList list = triangle.GetPointIds();
-        for (int i = 0; i < mesh.getIndices().size(); i+=3) {
-               list.SetId(0, mesh.getIndices().get(i));
-               list.SetId(1, mesh.getIndices().get(i+1));
-               list.SetId(2, mesh.getIndices().get(i+2));
-               polyData.InsertNextCell(triangle.GetCellType(), list);
-        }
-        list.Delete();
-        triangle.Delete();
-        
-        
-        vtkPoints points = new vtkPoints();
-        for (int i = 0; i < mesh.getVertices().size(); i++) {
-               Tuple3d p = mesh.getVertices().get(i);
-               points.InsertPoint(i, p.x, p.y, p.z);
-        }
-        
-        polyData.SetPoints(points);
-        points.Delete();
-        
-        if (mesh.getNormals() != null) {
-               vtkFloatArray normals = new vtkFloatArray();
-               normals.SetNumberOfComponents(3);
-               normals.SetNumberOfTuples(mesh.getNormals().size());
-               for (int i = 0; i < mesh.getNormals().size(); i++) {
-               Tuple3d p = mesh.getNormals().get(i);
-               normals.InsertTuple3(i, p.x, p.y, p.z);
-            }
-               vtkPointData pointData = polyData.GetPointData();
-               pointData.SetNormals(normals);
-               normals.Delete();
-               pointData.Delete();
-        }
-        if (mesh.getColors() != null) {
-               vtkUnsignedCharArray colors = new vtkUnsignedCharArray();
-               colors.SetName("Colors");
-               colors.SetNumberOfComponents(3);
-               colors.SetNumberOfTuples(mesh.getColors().size());
-               for (int i = 0; i < mesh.getColors().size(); i++) {
-                       Color4d c = mesh.getColors().get(i);
-                       colors.InsertTuple3(i, 255.0* c.x, 255.0 * c.y, 255.0 * c.z);
-               }
-               polyData.GetPointData().AddArray(colors);
-               colors.Delete();
-               
-        }
-        return polyData;
+               vtkIdList list = triangle.GetPointIds();
+               for (int i = 0; i < mesh.getIndices().size(); i+=3) {
+                       list.SetId(0, mesh.getIndices().get(i));
+                       list.SetId(1, mesh.getIndices().get(i+1));
+                       list.SetId(2, mesh.getIndices().get(i+2));
+                       polyData.InsertNextCell(triangle.GetCellType(), list);
+               }
+               list.Delete();
+               triangle.Delete();
+               
+               
+               vtkPoints points = new vtkPoints();
+               for (int i = 0; i < mesh.getVertices().size(); i++) {
+                       Tuple3d p = mesh.getVertices().get(i);
+                       points.InsertPoint(i, p.x, p.y, p.z);
+               }
+               
+               polyData.SetPoints(points);
+               points.Delete();
+               
+               if (mesh.getNormals() != null) {
+                       vtkFloatArray normals = new vtkFloatArray();
+                       normals.SetNumberOfComponents(3);
+                       normals.SetNumberOfTuples(mesh.getNormals().size());
+                       for (int i = 0; i < mesh.getNormals().size(); i++) {
+                               Tuple3d p = mesh.getNormals().get(i);
+                               normals.InsertTuple3(i, p.x, p.y, p.z);
+                       }
+                       vtkPointData pointData = polyData.GetPointData();
+                       pointData.SetNormals(normals);
+                       normals.Delete();
+                       pointData.Delete();
+               }
+               if (mesh.getColors() != null) {
+                       vtkUnsignedCharArray colors = new vtkUnsignedCharArray();
+                       colors.SetName("Colors");
+                       colors.SetNumberOfComponents(3);
+                       colors.SetNumberOfTuples(mesh.getColors().size());
+                       for (int i = 0; i < mesh.getColors().size(); i++) {
+                               Color4d c = mesh.getColors().get(i);
+                               colors.InsertTuple3(i, 255.0* c.x, 255.0 * c.y, 255.0 * c.z);
+                       }
+                       polyData.GetPointData().AddArray(colors);
+                       colors.Delete();
+                       
+               }
+               return polyData;
        }
        
        public void setMesh(Mesh mesh) {
@@ -89,29 +89,29 @@ public class MeshActor extends vtkActor {
                vtkPolyDataMapper mapper = new vtkPolyDataMapper();
                vtkPolyData polyData = createPolyData(mesh);
                
-       
-        if (mesh.getNormals() == null) {
-               vtkPolyDataNormals normals = new vtkPolyDataNormals();
-               normals.SetInputData(polyData);
-               normals.ComputePointNormalsOn();
-               mapper.SetInputConnection(normals.GetOutputPort());
-               normals.GetOutputPort().Delete();
-               normals.Delete();
-        } else {
-               mapper.SetInputData(polyData);
-        }
-        
-        if (mesh.getColors() != null) {
-                mapper.ScalarVisibilityOn();
-                mapper.SetScalarModeToUsePointFieldData();
-                mapper.SelectColorArray("Colors");
-        }
-        
-        SetMapper(mapper);
-        mapper.Delete();
-        polyData.GetPointData().Delete();
-        polyData.Delete();
-        
+               
+               if (mesh.getNormals() == null) {
+                       vtkPolyDataNormals normals = new vtkPolyDataNormals();
+                       normals.SetInputData(polyData);
+                       normals.ComputePointNormalsOn();
+                       mapper.SetInputConnection(normals.GetOutputPort());
+                       normals.GetOutputPort().Delete();
+                       normals.Delete();
+               } else {
+                       mapper.SetInputData(polyData);
+               }
+               
+               if (mesh.getColors() != null) {
+                       mapper.ScalarVisibilityOn();
+                       mapper.SetScalarModeToUsePointFieldData();
+                       mapper.SelectColorArray("Colors");
+               }
+               
+               SetMapper(mapper);
+               mapper.Delete();
+               polyData.GetPointData().Delete();
+               polyData.Delete();
+               
        }
        
        @Override