[vtkusers] a problem about a 3D geographical Visualisation code

John Ownsoul mongwarrior at yahoo.com
Mon Oct 22 03:01:45 EDT 2007


Dear Fellows; 


I import x,y,z values from my file and bring them into a vector. But i don't
know what to do then. Could you help me to write the Java code or algorithm?
Or, if it is possible, could you send me the file which contains the
coordinates and resistivity values, and a code which reads the file and
visualize it? 

Here is my code: 


            File file = new File("file.txt"); 

            FileInputStream fis = null; 
            BufferedInputStream bis = null; 
            DataInputStream dis = null; 
            fis = new FileInputStream(file); 
            bis = new BufferedInputStream(fis); 
            dis = new DataInputStream(bis); 
            
            String temp;, 
            
            vtkIdList ids = new vtkIdList(); 
            vtkPoints points = new vtkPoints(); 
            vtkDoubleArray values = new vtkDoubleArray(); 
           values.SetNumberOfTuples(19470);    // i have 1970 points 
            values.SetNumberOfComponents(1); 
            values.SetName("resistivity"); 
            
            double x,y,z,r; 
            int qwe=0;   //qwe is the counter 
            //x,y,z values are the coordinates 
            // r is the resistivity value 
            
            while (dis.available() != 0) 
            { 
            qwe++; 
            temp=dis.readLine(); 
            
            processLine(temp); //this method generates the coordinates and
the resistivity value from the variable "temp" 

            System.out.println("x : " + x + ", y : " + y + ", z : " + z + ",
resist. : " + r ); 
            points.InsertPoint(qwe, x, y, z); 
            values.InsertValue(qwe,r); 
            ids.InsertNextId(qwe); 
            } 
            fis.close(); 
            bis.close(); 
            dis.close(); 

             // i could only write this code. 
-- 
View this message in context: http://www.nabble.com/a-problem-about-a-3D-geographical-Visualisation-code-tf4669019.html#a13337686
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list