// EPS: Elgaard Positioning System: GPS navigation software. // Copyright (C) 1997, 1999 Niels Elgaard Larsen // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Niels Elgaard Larsen, // import java.io.*; import java.awt.*; import java.net.*; class GMenv { String chartdir="charts"; public static WStringMenuItem wpfile= new WStringMenuItem("Initial Waypopint file"); public static WStringMenuItem rtfile=new WStringMenuItem("Initial Route file"); public static WStringMenuItem trfile=new WStringMenuItem("Initial Track file"); public static WStringMenuItem dgpsSrvMI = new WStringMenuItem("DGPS server") ; public static WIntMenuItem dgpsPortMI = new WIntMenuItem("DGPS port") ; URL epsBase; URL propURL; String epsfBase; //Dimension naturalDim = new Dimension(960,560); public int initZoom =1000; // Dot per degree int cw=-1, ch=-1; static boolean useFShield = false; String fileFormat="gpstrans"; static int posFormat=Pone.MDD; String units="Nautical"; static String dgpsServer= "none"; static int dgpsPort= 2101; static String commAPI="commapi"; static boolean GPSconnect=false; static WStringMenuItem portName = new WStringMenuItem("Comm Port") ; //static String sportName = ("Comm Port") ; static boolean isWin = false; static Dimension prefSize = new Dimension(800,600); String gtpgm; int UTC_off=0; static double speedMul = 1d; public static double lengthMul = 1d/1000d; public static String speedUnitName="m/s"; public static String lengthUnitName = "Km"; private static Color trackColor=Color.green, routeColor=Color.blue, waypointColor=Color.red; static int nFontSize=10, annoFontSize =8; static Color annoColors[] = {trackColor, routeColor, waypointColor}; static int TRACKCOLOR = 0; static int ROUTECOLOR = 1; static int WAYPOINTCOLOR = 2; DatumMenu positionDatum; DatumMenu chartDatum; double initLat=55.9089,initLong=12.6779; GMenv() { try { epsBase = new URL("http://www.diku.dk/users/elgaard/eps/"); } catch (MalformedURLException ioe) { System.out.println("m ex prp " + ioe); } } GMenv(String cd, URL ebase, int iz, int cw0, int ch0, String ff, String gt, DatumMenu mdatum,DatumMenu pdatum, double iLa, double iLo){ chartdir = cd; epsBase = ebase; initZoom = iz; cw=cw0; ch=ch0; fileFormat=ff; gtpgm=gt; //UTC_off = off; chartDatum = mdatum; positionDatum = pdatum; initLong = iLo; initLat = iLa; } static Color getColor(int cn) { return(annoColors[cn]); } static void setColor(int cn, Color cl) { annoColors[cn] = cl; } // These are synchornized so that wee will use the rigth unit public synchronized void setMetric() { speedMul=1d; lengthMul=1d; speedUnitName = "m/s"; lengthUnitName = "m"; units = "metric"; } public synchronized void setKmMetric() { speedMul=3.6d; lengthMul=1d/1000d; speedUnitName = "Km/h"; lengthUnitName = "Km"; units = "kmmetric"; } public synchronized void setNautical() { speedMul=3600d/1852d; lengthMul=1d/1852d; speedUnitName = "Kt"; lengthUnitName = "Nm"; units = "nautical"; } public synchronized void setStatute() { speedMul=3600d/1609.344; lengthMul=1d/1609.344d; speedUnitName = "Mi/h"; lengthUnitName = "Mi"; units = "statute"; } public String toString() { return("wf=" + wpfile+ " rf=" + rtfile + " tr="+trfile+ " cd ="+chartdir + "\n EPS Base=" +epsBase + "\nnd=" + initZoom + "\nch " + ch + " cw " + cw + " fileFormat="+fileFormat+ " gtpgm="+gtpgm+ " chart datum=" +chartDatum.theDatum.name + " pos datum=" + positionDatum.theDatum.name + " dlo="+initLong+" dLa="+initLat); } }