Jump to content
Sign in to follow this  
Guest bartels

GPS Distance to last WPT

Recommended Posts

Guest harry3

Hi!1. qu.)I looked for a variable for the distance to the last WPT of a GPS flight plan, but I couldn't find anything!Which VAR do you need to get the distance to the last WPT?(XML or C).2. qu.)Can I show my own String in the little help window which appears if you move the cursor above a gauge? In XML it's easy to do it with String , but how to do this in C?MOUSE_BEGIN(pause_wpt_mouse_rect,0,0,0) <--???Regards,Harry

Share this post


Link to post
Share on other sites
Guest bartels

to 1. in C and only FS2002 so far, you can use the info from "gps_info.h" to load the complet eflightplan and thus having the last waypoint's coordinates. AFAIK the needed gps_export.dll is for FS2002 only, hopefully the FS2004 SDK will include a new version.to 2. tryMOUSE_BEGIN(pause_wpt_mouse_rect,0,0,0)... MOUSE_PARENT_BEGIN(0,0,width,height,HELP_NONE) MOUSE_TOOLTIP_STRING("string") MOUSE_PARENT_END...MOUSE_END"string" can be a fully qualified XML tooltip stringArne Bartels

Share this post


Link to post
Share on other sites

Harry,Did you try something with:GPS WP DISTANCE GPS WP ETE in combination with:GPS WP PREV ID GPS WP PREV LAT GPS WP PREV LON Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest bartels

MOUSE_BEGIN(pause_wpt_mouse_rect,0,0,0) MOUSE_TOOLTIP_STRING("string")MOUSE_ENDis the minimum code.Arne Bartels

Share this post


Link to post
Share on other sites

Part of formula:Something like, not sure, tested:L:Lat2,number) (A:PLANE LATITUDE, degrees) dgrd (>L:Lat1,number) (A:GPS WP PREV LON,degrees ) (A:PLANE LONGITUDE, degrees) - dgrd (>L:DiffLon,number)(L:Lat1,number) sin (L:Lat2,number) sin * (L:Lat1,number) cos (L:Lat2,number) cos * (L:DiffLon,number) cos * + acos (>L:Dist,number) (L:Dist,number) gives the distance between plane and last waypoint.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites
Guest harry3

Hi!Thank you for your answers!I wanted to do the Gauge in C, as I've started it there. I can't really figure out how to get information from the last WPT!(I've had a look at the gps_info.h, but didn't help) How to get some information about the last WPT?(distance or time to goal or position or whatever is possible...!?)(BTW I'm using FS2002...so no GPS functions in XML I'm afraid)Regards,Harry

Share this post


Link to post
Share on other sites
Guest bartels

I haven't programmed anything with it yet, but the SDK.Flightmap.c suggests://include the gps_info header:#include "gps_info.h"//use "hook" to gpds datastatic GPS_INFO* gpsinfo = NULL;//In a gauges_cb hook the pointer to the data:void FSAPI FlightMapCallback ( PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data ){ switch (service_id) { case PANEL_SERVICE_PRE_UPDATE: if (!gpsinfo) { //if not on hook retry MODULE_VAR var; initialize_var_by_name (&var, GPS_INFO_PANEL_VARIABLE_NAME); gpsinfo = var.var_ptr; } //do something with the gps data if (gpsinfo && gpsinfo->dwSize >= sizeof (GPS_INFO)) //the expected gps data are present { int i; //loop through waypoints for (i = 0; i < gpsinfo->lWpCounts; i++) { if(gpsinfo->pWpData&&gpsinfo->pWpData.dwSize==sizeof(GPS_WP_INFO)) //do something with the waypoint data } } break; }}e.g. gpsinfo->pWpData[gpsinfo->lWpCounts-1].vPosition is the last waypoints positionArne Bartels

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...