Changeset 15287


Ignore:
Timestamp:
06/19/13 16:26:07 (12 years ago)
Author:
ltnguyen
Message:

final modification for android project, freezing project and start ISSM web-base application

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  
    357357                        thread.start();
    358358                        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);
    360361                        return true;
    361362                }
  • issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSMAPP.java

    r15013 r15287  
    2525        ImageList imageList;
    2626        private static final String PREFERENCE_FIRST_RUN = null;
    27         private String extStorageDirectory;
     27        public static String extStorageDirectory;
    2828        private String issmFolder;
    2929        SharedPreferences settings;
     
    4949                        protected Boolean doInBackground(Boolean... target)
    5050                        {
     51                                imageList.decodeAndResizeImageFromURL();
    5152                                imageList.decodeAndResizeImage();
    5253                                //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  
    11package gov.nasa.jpl.issm;
    22
     3import java.io.BufferedOutputStream;
     4import java.io.ByteArrayOutputStream;
     5import java.io.IOException;
     6import java.io.InputStream;
     7import java.net.HttpURLConnection;
     8import java.net.URL;
     9import java.net.URLConnection;
    310import java.util.ArrayList;
    411
    512import android.content.Context;
    613import android.graphics.Bitmap;
     14import android.graphics.BitmapFactory;
     15import android.util.Log;
    716
    817public class ImageList
    918{
    1019        private static ArrayList <Bitmap> imageList;
     20        private static ArrayList <Bitmap> imageListFromURL;
    1121        private Context context;
    1222        final int nImage = 17;
     
    1525        {
    1626                imageList = new ArrayList <Bitmap>();
     27                imageListFromURL = new ArrayList <Bitmap>();
    1728                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                }
    1852        }
    1953//----------------------------------------------------------
     
    2155        {
    2256                int resID;
    23                 for(int i = 0 ; i < nImage; i++)
     57                for(int i = 1 ; i < nImage; i++)
    2458                {
    2559                        resID=context.getResources().getIdentifier("image"+i, "drawable", context.getPackageName());
     
    3266                return imageList;
    3367        }
     68//----------------------------------------------------------
     69                public static ArrayList<Bitmap> getImageListFromURL()
     70                {
     71                        return imageListFromURL;
     72                }       
    3473}
  • issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ImageResizer.java

    r15013 r15287  
    11package gov.nasa.jpl.issm;
     2
     3import java.io.IOException;
     4import java.net.URL;
    25
    36import android.content.res.Resources;
    47import android.graphics.Bitmap;
    58import android.graphics.BitmapFactory;
     9import android.util.Log;
    610
    711public 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    }
    834       
    935        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  
    44class IssmJni
    55{
     6        public native void solveISSMModel(double alpha, DoubleBuffer buff);
    67        public native void solveISSMModel(double alpha, double temperature, DoubleBuffer buff);
    78        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  
    11package gov.nasa.jpl.issm;
    22
     3import java.io.File;
     4import java.io.FileOutputStream;
     5import java.io.IOException;
     6import java.io.OutputStreamWriter;
    37import java.nio.DoubleBuffer;
    48import android.content.Context;
     
    117121                }
    118122                               
     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               
    119144        mRend = new MyGLRenderer(f);
    120145        // Set the Renderer for drawing on the GLSurfaceView
Note: See TracChangeset for help on using the changeset viewer.