Changeset 15287
- Timestamp:
- 06/19/13 16:26:07 (12 years ago)
- Location:
- issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java
r15013 r15287 357 357 thread.start(); 358 358 System.out.println("temperatature = " + target[1]); 359 issmNative.solveISSMModel(target[0],target[1],buff); 359 issmNative.solveISSMModel(target[0],buff); 360 //issmNative.solveISSMModel(target[0],target[1],buff); 360 361 return true; 361 362 } -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMAPP.java
r15013 r15287 25 25 ImageList imageList; 26 26 private static final String PREFERENCE_FIRST_RUN = null; 27 p rivateString extStorageDirectory;27 public static String extStorageDirectory; 28 28 private String issmFolder; 29 29 SharedPreferences settings; … … 49 49 protected Boolean doInBackground(Boolean... target) 50 50 { 51 imageList.decodeAndResizeImageFromURL(); 51 52 imageList.decodeAndResizeImage(); 52 53 //not sure why, but target[0] can be true on install! more to be done. -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageList.java
r15013 r15287 1 1 package gov.nasa.jpl.issm; 2 2 3 import java.io.BufferedOutputStream; 4 import java.io.ByteArrayOutputStream; 5 import java.io.IOException; 6 import java.io.InputStream; 7 import java.net.HttpURLConnection; 8 import java.net.URL; 9 import java.net.URLConnection; 3 10 import java.util.ArrayList; 4 11 5 12 import android.content.Context; 6 13 import android.graphics.Bitmap; 14 import android.graphics.BitmapFactory; 15 import android.util.Log; 7 16 8 17 public class ImageList 9 18 { 10 19 private static ArrayList <Bitmap> imageList; 20 private static ArrayList <Bitmap> imageListFromURL; 11 21 private Context context; 12 22 final int nImage = 17; … … 15 25 { 16 26 imageList = new ArrayList <Bitmap>(); 27 imageListFromURL = new ArrayList <Bitmap>(); 17 28 this.context = context; 29 } 30 //---------------------------------------------------------- 31 public void decodeAndResizeImageFromURL() 32 { 33 URL url; 34 for(int i =0; i <1; i++) 35 { 36 try 37 { 38 url = new URL(ImageListFromUrl.imageUrls[0]); 39 URLConnection connection = url.openConnection(); 40 HttpURLConnection httpConnection = (HttpURLConnection) connection; 41 httpConnection.setRequestMethod("GET"); 42 httpConnection.connect(); 43 44 if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) 45 { 46 imageList.add(ImageResizer.decodeSampledBitmapFromURL(url, 50, 50)); 47 } 48 } catch (IOException e) { 49 Log.e("ImageResizer", "Could not load Bitmap from: " + ImageListFromUrl.imageUrls[i]); 50 } 51 } 18 52 } 19 53 //---------------------------------------------------------- … … 21 55 { 22 56 int resID; 23 for(int i = 0; i < nImage; i++)57 for(int i = 1 ; i < nImage; i++) 24 58 { 25 59 resID=context.getResources().getIdentifier("image"+i, "drawable", context.getPackageName()); … … 32 66 return imageList; 33 67 } 68 //---------------------------------------------------------- 69 public static ArrayList<Bitmap> getImageListFromURL() 70 { 71 return imageListFromURL; 72 } 34 73 } -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageResizer.java
r15013 r15287 1 1 package gov.nasa.jpl.issm; 2 3 import java.io.IOException; 4 import java.net.URL; 2 5 3 6 import android.content.res.Resources; 4 7 import android.graphics.Bitmap; 5 8 import android.graphics.BitmapFactory; 9 import android.util.Log; 6 10 7 11 public class ImageResizer { 12 13 public static Bitmap decodeSampledBitmapFromURL(URL url , int reqWidth, int reqHeight) { 14 15 // First decode with inJustDecodeBounds=true to check dimensions 16 final BitmapFactory.Options options = new BitmapFactory.Options(); 17 options.inJustDecodeBounds = true; 18 try 19 { 20 BitmapFactory.decodeStream(url.openConnection().getInputStream(),null, options); 21 22 // Calculate inSampleSize 23 options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); 24 25 // Decode bitmap with inSampleSize set 26 options.inJustDecodeBounds = false; 27 return BitmapFactory.decodeStream(url.openConnection().getInputStream(), null, options); 28 } 29 catch (IOException e) { 30 Log.e("Error", "Could not load Bitmap from: " + url.toString()); 31 } 32 return null; 33 } 8 34 9 35 public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/IssmJni.java
r14506 r15287 4 4 class IssmJni 5 5 { 6 public native void solveISSMModel(double alpha, DoubleBuffer buff); 6 7 public native void solveISSMModel(double alpha, double temperature, DoubleBuffer buff); 7 8 public native int createISSMModel(String solution_type, String absfile, String relfile); -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/MyGLSurfaceView.java
r14823 r15287 1 1 package gov.nasa.jpl.issm; 2 2 3 import java.io.File; 4 import java.io.FileOutputStream; 5 import java.io.IOException; 6 import java.io.OutputStreamWriter; 3 7 import java.nio.DoubleBuffer; 4 8 import android.content.Context; … … 117 121 } 118 122 123 File file1 = new File(ISSMAPP.extStorageDirectory + "/ISSM/input_files/coordinate.txt"); 124 File file2 = new File(ISSMAPP.extStorageDirectory + "/ISSM/input_files/color.txt"); 125 try { 126 file1.createNewFile(); 127 file2.createNewFile(); 128 FileOutputStream fout1 = new FileOutputStream(file1); 129 OutputStreamWriter write1 = new OutputStreamWriter(fout1); 130 FileOutputStream fout2 = new FileOutputStream(file2); 131 OutputStreamWriter write2 = new OutputStreamWriter(fout2); 132 for(int i = 0; i < size; i ++) 133 { 134 write1.append(f[i][0]+","+f[i][1]+","+f[i][2]+","+f[i][7]+","+f[i][8]+","+f[i][9]+","+f[i][14]+","+f[i][15]+","+f[i][16]+"\n"); 135 write2.append(f[i][3]+","+f[i][4]+","+f[i][5]+","+f[i][10]+","+f[i][11]+","+f[i][12]+","+f[i][17]+","+f[i][18]+","+f[i][19]+"\n"); 136 } 137 write1.close(); 138 write2.close(); 139 } catch (IOException e) { 140 // TODO Auto-generated catch block 141 e.printStackTrace(); 142 } 143 119 144 mRend = new MyGLRenderer(f); 120 145 // Set the Renderer for drawing on the GLSurfaceView
Note:
See TracChangeset
for help on using the changeset viewer.