Changeset 14710
- Timestamp:
- 04/22/13 21:34:06 (12 years ago)
- Location:
- issm/trunk-jpl/src/mobile/android/ISSM_APP
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/mobile/android/ISSM_APP/bin/AndroidManifest.xml
r14547 r14710 5 5 android:installLocation="preferExternal" > 6 6 <uses-sdk 7 android:minSdkVersion="1 0"7 android:minSdkVersion="11" 8 8 android:targetSdkVersion="15" /> 9 9 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> -
issm/trunk-jpl/src/mobile/android/ISSM_APP/res/layout/issmcore.xml
r14694 r14710 36 36 android:background="@drawable/back_button"/> --> 37 37 38 <gov.nasa.jpl.issm.ColorBar 39 android:id="@+id/colorbar" 40 android:layout_width="wrap_content" 41 android:layout_height="wrap_content" 42 android:layout_alignTop="@+id/spinner" /> 38 43 <Spinner 39 44 android:id="@+id/spinner" 40 45 android:layout_width="wrap_content" 41 46 android:layout_height="wrap_content" 42 android:layout_alignBottom="@+id/back"43 47 android:layout_marginBottom="5dp" 44 48 android:layout_toRightOf="@+id/play" -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ColorBar.java
r14472 r14710 1 1 package gov.nasa.jpl.issm; 2 3 import java.text.DecimalFormat; 2 4 3 5 import android.content.Context; … … 5 7 import android.graphics.Color; 6 8 import android.graphics.Paint; 9 import android.util.AttributeSet; 7 10 import android.view.MotionEvent; 8 11 import android.view.View; … … 15 18 private int width = 30; 16 19 private int start_x = 10; 17 private int start_y = 30;20 private int start_y = 10; 18 21 private int end_y = 0; 19 22 boolean touch; 20 23 final int MAX_SCALING =255; 21 24 double [][] colorBuffer; 22 public ColorBar(Context context) 25 private String vmax; 26 private String vmin; 27 private String vmid; 28 private boolean drawInformation = false; 29 public ColorBar(Context context, AttributeSet attrs) 23 30 { 24 super(context );31 super(context,attrs); 25 32 setWillNotDraw(false); 26 33 paint.setStrokeWidth(5); … … 29 36 touch = false; 30 37 } 31 //---------------------------------------------------------------- 38 //---------------------------------------------------------------- 39 //change the color map 40 public void setVelocity(double vmax, double vmin) 41 { 42 this.vmin = vmin+""; 43 String max = vmax+""; 44 String mid = ((vmax+vmin)/2) + ""; 45 this.vmax = max.substring(0,3) + max.substring(max.length()-3, max.length()); 46 this.vmid = mid.substring(0,3) + mid.substring(mid.length()-3, mid.length()); 47 drawInformation = true; 48 } 49 //----------------------------------------------------------------- 32 50 //change the color map 33 51 public void setColorMap(ColorMap colorMap) … … 41 59 int r,g,b; 42 60 int y = start_y; 43 for(int i = 0; i < 64; i++)61 for(int i = 63; i >= 0; i-- ) 44 62 { 45 63 r = Math.round((float)colorBuffer[i][0]*MAX_SCALING); … … 47 65 b = Math.round((float)colorBuffer[i][2]*MAX_SCALING); 48 66 paint.setColor(Color.argb(MAX_SCALING, r, g, b)); 49 canvas.drawLine( start_x, y, start_x+width, y, paint);67 canvas.drawLine(y, start_x,y, start_x+width, paint); 50 68 51 if( i == 60) canvas.drawText("_0.0", start_x+width, y, textpaint);52 if(i == 48) canvas.drawText("_0.2", start_x+width, y, textpaint);53 if(i == 36) canvas.drawText("_0.4", start_x+width, y, textpaint);54 if(i == 24) canvas.drawText("_0.6", start_x+width, y, textpaint);55 if(i == 12) canvas.drawText("_0.8", start_x+width, y, textpaint);56 if(i == 0) canvas.drawText("_1.0", start_x+width, y, textpaint);57 58 y+= 5;69 if(drawInformation) 70 { 71 if(i == 63) canvas.drawText(vmin,y, start_x+width+20, textpaint); 72 if(i == 38) canvas.drawText(vmid,y, start_x+width+20, textpaint); 73 if(i == 8) canvas.drawText(vmax,y, start_x+width+20, textpaint); 74 if(i == 0) canvas.drawText("V(m/yr)",y+10, start_x+width, textpaint); 75 } 76 y+=3; 59 77 } 60 61 78 end_y = y; 62 79 } 63 //---------------------------------------------------------------- 64 / /allow user to move color bar around80 //---------------------------------------------------------------- 81 /*allow user to move color bar around 65 82 @Override 66 83 public boolean onTouchEvent (MotionEvent event) … … 89 106 } 90 107 return true; 91 } 108 }*/ 92 109 //---------------------------------------------------------------- 93 110 } 94 111 //////////////////////////////////////////////////////////////////////////// 112 class Velocity 113 { 114 private double vmax; 115 private double vmin; 116 public void setVmax(double vmax) {this.vmax = vmax;} 117 public void setVmin(double vmin) {this.vmin = vmin;} 118 public double getVmax() {return vmax;} 119 public double getVmin() {return vmin;} 120 } -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/ISSM.java
r14703 r14710 51 51 private ProgressDialog dialog; 52 52 private ColorBar colorBar; 53 private Velocity velocity; 53 54 private SliderMenu sliders; 54 55 private ImageView defaultMap; … … 92 93 defaultMap = (ImageView) findViewById(R.id.defaultMap); 93 94 dialog = new ProgressDialog(this); 94 95 colorBar = (ColorBar) findViewById(R.id.colorbar); 95 96 //load up the ISSM library and create double buffer in java 96 97 //which later on will be pass for native for allocation. 97 98 issmNative = new IssmJni(); 99 velocity = new Velocity(); 98 100 99 101 //set default color map to be HSV 100 102 this.colorMap = new ColorMap(); 101 103 //create colorBar 102 colorBar = new ColorBar(this);103 104 colorBar.setColorMap(colorMap); 104 105 spinner.setOnItemSelectedListener(new OnItemSelectedListener() … … 112 113 String color = (String) spinner.getItemAtPosition(item); 113 114 colorMap.setColor(color); 115 colorBar.setColorMap(colorMap); 116 colorBar.invalidate(); 114 117 drawFigure(); 115 118 } … … 242 245 { 243 246 frame.removeView(mGLView); 244 mGLView = new MyGLSurfaceView(this, buff, size, colorMap); 247 mGLView = new MyGLSurfaceView(this, buff, size, colorMap, velocity); 248 colorBar.setVelocity(velocity.getVmax(), velocity.getVmin()); 249 colorBar.invalidate(); 245 250 frame.addView(mGLView); 246 251 } -
issm/trunk-jpl/src/mobile/android/ISSM_APP/src/gov/nasa/jpl/issm/MyGLSurfaceView.java
r14693 r14710 8 8 9 9 10 class MyGLSurfaceView extends GLSurfaceView10 public class MyGLSurfaceView extends GLSurfaceView 11 11 { 12 12 private MyGLRenderer mRend; … … 16 16 final int firstVelocity = 9; 17 17 ColorMap colorMap; 18 18 Velocity velocity; 19 19 // pinch to zoom 20 20 float oldDist = 100.0f; … … 22 22 23 23 int mode = 0; 24 public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap )24 public MyGLSurfaceView(Context context, DoubleBuffer db, int size, ColorMap colorMap, Velocity velocity) 25 25 { 26 26 super(context); … … 30 30 this.size = size; 31 31 this.colorMap = colorMap; 32 this.velocity = velocity; 32 33 vmin = db.get(firstVelocity); 33 34 findMinMaxVelocity(); 34 35 intialize(); 36 this.velocity.setVmin(vmin); 37 this.velocity.setVmax(vmax); 35 38 } 36 39 private void intialize()
Note:
See TracChangeset
for help on using the changeset viewer.