Main Page | Alphabetical List | Data Structures | File List | Globals | Related Pages

gpsutil.h

Go to the documentation of this file.
00001 
00006 /*
00007    Copyright (C) 1999-2004 Christian Claveleira (Christian.Claveleira@cru.fr)
00008 
00009    This program is free software; you can redistribute it and/or
00010    modify it under the terms of the GNU General Public License
00011    as published by the Free Software Foundation; either version 2
00012    of the License, or (at your option) any later version.
00013    
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018    
00019    You should have received a copy of the GNU General Public License
00020    along with this program; if not, write to the Free Software
00021    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022  */
00023 
00024 /*      $Id: gpsutil.h,v 1.9 2004/11/17 21:13:54 clavelei Exp $  */
00025 
00026 //struct TrkDB
00027 //{                                    /* nouvelle structure header base de donnees de trackpoints */
00028 //  Object obj; /* objet contenant le header */
00029     /* D300_Trk_Point_Type tracks[]; // suivent les trackpoints (en format "host") */
00030 //};
00031 
00032 
00033 //#define TrkptsInTrkDB(rech) ((MemHandleSize (rech) - sizeof (Custom_Trk_Hdr_Type)-sizeof(((Object *)0)->header)) / sizeof (Custom_Trk_Point_Type))    /* nombre de trackpoints dans une trace */
00034 
00035 //struct RteDB
00036 //{                                    /*  structure base de donnees de routes */
00037 //    D201_Rte_Hdr_Type h;             /* header (verifier alignements) */
00038     /*Raw_D103_Wpt_Type w[];      suivent les waypoints (en format "network") */
00039 //};
00040 
00041 // #define WptsInRteDB(rech) (((unsigned int)(MemHandleSize (rech) - sizeof (struct RteDB))) / sizeof (Raw_D103_Wpt_Type))      /* nombre de wpts dans une route */
00042 
00043 
00044 #define PI  3.14159265358979323846
00045 static const UInt32 OnePower31 = (1UL << 31);   /* 1**31 */
00046 static const UInt32 OnePower31Pi = (1UL << 31) / PI;    /* 1**31/PI */
00047 
00048 /* Debugging : */
00049 #define GPSUDBG_INFOS 128                                  // informational
00050 #define GPSUDBG_CALLS 32                                   // procedures calls/exits
00051 #define GPSUDBG_UNEXP 8                                    // unexpected things
00052 
00053 #define BadCoordinate -1000.                               /* returned if error in coordinates conversion */
00054 #define OBJECTVERSION 2                                    /* object format version */
00055 
00056 // #define offsetof(s,m) ((UInt)&(((s *)0)->m))
00057 #define NextObject(o) ( (char *)o + SizeOfObject(o) )
00058 
00059 #ifndef GPSLDBG_INFOS // si gpslib pas deja inclus
00060 typedef void LogProc (char *p);
00061 typedef LogProc *LogProcPtr;
00062 #endif
00063 
00064 // object.c :
00065 extern UInt16 SizeOfObject (Object * p) UTIL_SECTION;
00066 extern UInt16 ObjectsInRec (MemHandle RecH) UTIL_SECTION;
00067 extern UInt16 OffsetOfObjectInRec (MemHandle RecH, UInt16 n) UTIL_SECTION;
00068 extern UInt16 G100ToCustom (Raw_D100_Wpt_Type * p100, Custom_Wpt_Type * pcust) UTIL_SECTION;
00069 extern UInt16 G102ToCustom (Raw_D102_Wpt_Type * p102, Custom_Wpt_Type * pcust) UTIL_SECTION;
00070 extern UInt16 G103ToCustom (Raw_D103_Wpt_Type * p103, Custom_Wpt_Type * pcust) UTIL_SECTION;
00071 extern UInt16 G104ToCustom (Raw_D104_Wpt_Type * p104, Custom_Wpt_Type * pcust) UTIL_SECTION;
00072 extern UInt16 G105ToCustom (Raw_D105_Wpt_Type * p105, Custom_Wpt_Type * pcust) UTIL_SECTION;
00073 extern UInt16 G107ToCustom (Raw_D107_Wpt_Type * p107, Custom_Wpt_Type * pcust) UTIL_SECTION;
00074 extern UInt16 G108ToCustom (Raw_D108_Wpt_Type * p108, Custom_Wpt_Type * pcust) UTIL_SECTION;
00075 extern UInt16 G109ToCustom (Raw_D109_Wpt_Type * p109, Custom_Wpt_Type * pcust) UTIL_SECTION;
00076 extern UInt16 CustomToG100 (Custom_Wpt_Type * pcust, Raw_D100_Wpt_Type * p100) UTIL_SECTION;
00077 extern UInt16 CustomToG102 (Custom_Wpt_Type * pcust, Raw_D102_Wpt_Type * p102) UTIL_SECTION;
00078 extern UInt16 CustomToG103 (Custom_Wpt_Type * pcust, Raw_D103_Wpt_Type * p103) UTIL_SECTION;
00079 extern UInt16 CustomToG104 (Custom_Wpt_Type * pcust, Raw_D104_Wpt_Type * p104) UTIL_SECTION;
00080 extern UInt16 CustomToG105 (Custom_Wpt_Type * pcust, Raw_D105_Wpt_Type * p105) UTIL_SECTION;
00081 extern UInt16 CustomToG107 (Custom_Wpt_Type * pcust, Raw_D107_Wpt_Type * p107) UTIL_SECTION;
00082 extern UInt16 CustomToB108 (Custom_Wpt_Type * pcust, B108_Wpt_Type * p108, Boolean merge) UTIL_SECTION;
00083 extern UInt16 CustomToB109 (Custom_Wpt_Type * pcust, B109_Wpt_Type * p109, Boolean merge) UTIL_SECTION;
00084 extern LocalFormatID PtrToCustomWpt (Object * recp, Custom_Wpt_Type * pcust) UTIL_SECTION;
00085 extern LocalFormatID HandleToCustomWpt (ObjectHandle RecH, Custom_Wpt_Type * pcust) UTIL_SECTION;
00086 extern LocalFormatID IndexToCustomWpt (UInt16 index, DmOpenRef DB, Custom_Wpt_Type * pcust) UTIL_SECTION;
00087 extern Err CustomToAnyWpt (Custom_Wpt_Type * pcust, LocalFormatID format, ObjectPtr newp,
00088                            Boolean merge) UTIL_SECTION;
00089 extern Object *AnyToAnyWpt (Object * from, Object * to, LocalFormatID toformat) UTIL_SECTION;
00090 extern UInt16 WptsInRteDB (MemHandle RecH) UTIL_SECTION;
00091 extern LocalFormatID PtrToCustomRteHdr (Object * recp, Custom_Rte_Hdr_Type * pcust) UTIL_SECTION;
00092 extern LocalFormatID HandleToCustomRteHdr (MemHandle RecH, Custom_Rte_Hdr_Type * pcust) UTIL_SECTION;
00093 extern Object *CustomToRteHdrObj (Custom_Rte_Hdr_Type * pcust, Object * o, LocalFormatID toformat) UTIL_SECTION;
00094 extern Object *AnyToAnyRteHdr (Object * from, Object * to, LocalFormatID toformat) UTIL_SECTION;
00095 extern UInt16 TrkptsInTrkDB (MemHandle rech) UTIL_SECTION;
00096 /*  extern void RawD301ToCustomTrkPt (Raw_D301_Trk_Point_Type * from, Custom_Trk_Point_Type * to); */
00097 /*  extern void RawD301ToCompactTrkPt (Raw_D301_Trk_Point_Type * from, Compact_Trk_Point_Type * to); */
00098 /*  extern void RawD300ToCustomTrkPt (Raw_D300_Trk_Point_Type * from, Custom_Trk_Point_Type * to); */
00099 /*  extern void RawD300ToCompactTrkPt (Raw_D300_Trk_Point_Type * from, Compact_Trk_Point_Type * to); */
00100 extern void CustomToRawD301TrkPt (Custom_Trk_Point_Type * from, Raw_D301_Trk_Point_Type * to) UTIL_SECTION;
00101 extern void CompactToRawD301TrkPt (Compact_Trk_Point_Type * from, Raw_D301_Trk_Point_Type * to) UTIL_SECTION;
00102 extern void CustomToRawD300TrkPt (Custom_Trk_Point_Type * from, Raw_D300_Trk_Point_Type * to) UTIL_SECTION;
00103 extern void CompactToRawD300TrkPt (Compact_Trk_Point_Type * from, Raw_D300_Trk_Point_Type * to) UTIL_SECTION;
00104 extern UInt16 AnyRawToAnyTrkPt (LocalFormatID in_format, LocalFormatID out_format,
00105                               GarminObject * from, TrkPts * to) UTIL_SECTION;
00106 extern void CustomTrkHdrToD310 (Object * trkhdr, D310_Trk_Hdr_Type * d310) UTIL_SECTION;
00107 extern Symbol_Type smblToSymbolType (byte smbl) UTIL_SECTION;
00108 extern byte SymbolTypeTosmbl (Symbol_Type smbl) UTIL_SECTION;
00109 extern UInt16 symb_gid2lid (Symbol_Type gid) UTIL_SECTION;
00110 extern Symbol_Type symb_lid2gid (UInt16 lid) UTIL_SECTION;
00111 
00112 
00113 // gpsutil.c :
00114 
00115 extern void *GetObjPtr (UInt16 objindex) UTIL_SECTION;
00116 extern void HideObject (UInt16 objID) UTIL_SECTION;
00117 extern void ShowObject (UInt16 objID) UTIL_SECTION;
00118 extern Int16 RecIdToPosition (DmOpenRef DB, UInt16 category, UInt32 recid, UInt16 * indexp) UTIL_SECTION;
00119 extern UInt32 GetRecordID (DmOpenRef DB, UInt16 index) UTIL_SECTION;
00120 extern char *DegreToDM (double coord, Boolean longitude, Boolean nmea) UTIL_SECTION;
00121 extern char *DegreToDMS (double coord, Boolean longitude) UTIL_SECTION;
00122 extern char *DegreToD (double coord, Boolean longitude) UTIL_SECTION;
00123 extern char *DegreToChars (double coord, Boolean longitude, DisplayFormat DispMode) UTIL_SECTION;
00124 extern double ReadCoord (char *string, Boolean * longitude) UTIL_SECTION;
00125 extern void SemiToDegre (Semicircle_Type * p, double *latitude, double *longitude) UTIL_SECTION;
00126 extern void DegreToSemi (double latitude, double longitude, Semicircle_Type * p) UTIL_SECTION;
00127 extern void DistBearToSemi (double dist, UInt16 bearing, Semicircle_Type * p) UTIL_SECTION;
00128 extern char *StrNCopySafe (char *dstp, char *srcp, UInt16 dstsize) UTIL_SECTION;
00129 extern void StrNCatSafe (char *dstp, char *srcp, UInt16 dstsize, UInt16 srcsize) UTIL_SECTION;
00130 extern double StrToD (char *p, char **endp) UTIL_SECTION;
00131 extern void StrNToField (char *str, UInt16 length, UInt16 fieldid) UTIL_SECTION;
00132 extern void Canonicalize (char *p, UInt16 l) UTIL_SECTION;
00133 extern double Distance (long lat1, long lon1, long lat2, long lon2, DistanceUnit unit) UTIL_SECTION;
00134 extern double PDistance (long lat1, long lon1, long lat2, long lon2) UTIL_SECTION;
00135 extern UInt16 Bearing (long slat1, long slon1, long slat2, long slon2) UTIL_SECTION;
00136 extern char *DToA (double x, UInt16 digits, UInt16 precision) UTIL_SECTION;
00137 extern void DrawCharsInWidth (char *string, Int16 x, Int16 y, UInt16 w, Boolean RightAligned) UTIL_SECTION;
00138 //extern LocalFormatID DbToCustomWpt (MemHandle RecH, Custom_Wpt_Type * pcust);
00139 extern Int16 DistComp (long lat1, long lon1, long lat2, long lon2, long reflat, long reflon) UTIL_SECTION;
00140 extern void SetMathLibRef (UInt16 ref) UTIL_SECTION;
00141 extern void GpsutilSetDebugLevel (UInt16 debuglevel, LogProcPtr logprocp) UTIL_SECTION;
00142 extern Boolean WptHit (Custom_Wpt_Type * wptp, Semicircle_Type * position) UTIL_SECTION;
00143 extern void SetControlValue (UInt16 objID, short value) UTIL_SECTION;
00144 extern short GetControlValue (UInt16 objID) UTIL_SECTION;
00145 extern void GetObjectBounds (UInt16 objID, RectanglePtr rp) UTIL_SECTION;

Generated on Sun Mar 13 09:36:01 2005 for GPilotS by doxygen 1.3.6