Update of /cvsroot/rcpilot/src/rcpilot/rcgs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3284/rcpilot/rcgs
Modified Files:
RcgsMap.java
Log Message:
Added 1,2, and 4 mile range rings around home. These rings correctly take into account the changing arcSec/mile ratio as latitude increases. This can result in egg shaped range rings. I believe this is correct.
Index: RcgsMap.java
===================================================================
RCS file: /cvsroot/rcpilot/src/rcpilot/rcgs/RcgsMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RcgsMap.java 26 Jun 2004 10:20:49 -0000 1.6
--- RcgsMap.java 27 Jun 2004 00:31:30 -0000 1.7
***************
*** 38,45 ****
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import javax.swing.*;
!
import java.io.*;
--- 38,46 ----
import java.awt.*;
+ import java.awt.geom.*;//Arc2D.Float;
import java.awt.image.*;
import java.awt.event.*;
import javax.swing.*;
! //import javax.swing.plaf.basic.*; // for BasicArrowButton
import java.io.*;
***************
*** 149,152 ****
--- 150,154 ----
mapHpix = mapImg.getWidth(null);
mapVpix = mapImg.getHeight(null);
+
}
***************
*** 292,296 ****
getHeight());
! // in seconds/pixel
Hscale = mapHsecs / mapImg.getWidth(null);
Vscale = mapVsecs / mapImg.getHeight(null);
--- 294,298 ----
getHeight());
! // in hundredths of a second/pixel
Hscale = mapHsecs / mapImg.getWidth(null);
Vscale = mapVsecs / mapImg.getHeight(null);
***************
*** 320,324 ****
// over map.
! // in seconds
int homeLatSecs = UserPreferences.getHomeLatitude();
int homeLonSecs = UserPreferences.getHomeLongitude();
--- 322,326 ----
// over map.
! // in hundredths of a second
int homeLatSecs = UserPreferences.getHomeLatitude();
int homeLonSecs = UserPreferences.getHomeLongitude();
***************
*** 343,349 ****
// draw home
home = Shapes.getShapeIcon(Shapes.HOME_SHAPE, homeLonPix, homeLatPix, 0);
! g2.setColor(Color.green);
g2.fill(home);
g2.setColor(Color.black);
--- 345,369 ----
// draw home
+
+ // calculate arcseconds/mile for this latitude
+ // so we can draw accurate 1,2,...,N mile radius
+ // arcs around home base.
+
+ double homeLatDegrees = (double)homeLatSecs/360000;
+
+ displayDebugInfo();
+
+ double asecVPerMile = 5186;
+ double asecHPerMile = 129600000/(24988*Math.cos(Math.toRadians(homeLatDegrees)));
+
+ // number of pixels on each axis
+ // corresponding to one mile.
+
+ double oneMileArcVRadius = asecVPerMile * (1/(double)Vscale);
+ double oneMileArcHRadius = asecHPerMile * (1/(double)Hscale);
+
home = Shapes.getShapeIcon(Shapes.HOME_SHAPE, homeLonPix, homeLatPix, 0);
! g2.setColor(Color.green);
g2.fill(home);
g2.setColor(Color.black);
***************
*** 353,356 ****
--- 373,398 ----
g2.drawString("H",homeLonPix-3,homeLatPix+7);
+ // draw arcs around home
+
+ g2.setColor(Color.black);
+
+ for(int i = 0; i < 36; i++) {
+ g2.draw(new Arc2D.Float(homeLonPix-(int)oneMileArcHRadius,
+ homeLatPix-(int)oneMileArcVRadius,
+ (int)(oneMileArcHRadius*2), // one mile diameter
+ (int)(oneMileArcVRadius*2), // ditto
+ i*10,5,Arc2D.OPEN));
+ g2.draw(new Arc2D.Float(homeLonPix-(int)(oneMileArcHRadius*2),
+ homeLatPix-(int)(oneMileArcVRadius*2),
+ (int)(oneMileArcHRadius*4), // 2 mile diameter
+ (int)(oneMileArcVRadius*4), // ditto
+ i*10,5,Arc2D.OPEN));
+ g2.draw(new Arc2D.Float(homeLonPix-(int)(oneMileArcHRadius*4),
+ homeLatPix-(int)(oneMileArcVRadius*4),
+ (int)(oneMileArcHRadius*8), // 4 mile diameter
+ (int)(oneMileArcVRadius*8), // ditto
+ i*10,5,Arc2D.OPEN));
+ }
+
// draw arrow
arrow = Shapes.getShapeIcon(Shapes.ARROW_SHAPE, 200, 200, 90);
***************
*** 378,381 ****
--- 420,426 ----
System.out.println("bopLonSecs: " + srcBotLonSecs);
+ System.out.println("mapHSecs: " + mapHsecs);
+ System.out.println("mapVSecs: " + mapVsecs);
+
System.out.println("Hscale: " + Hscale);
System.out.println("Vscale: " + Vscale);
|