• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA Creating a Save Position Button

Messages
278
Country
ca-britishcolumbia
Hi All,

Working on a another feature of my gauge.

I have created a button that when clicked displays the Lat/Long position. Easy enough. Now is there a way to have it saved or frozen if you will until the button is clicked again? Currently it keeps current with the aircraft position.

Here is what i have so far:

The Macro:
Code:
<Macro id="DisplayPostion" Name="DisplayPosition">
<MacroValue> ((A:GPS POSITION LAT, degrees) ((A:GPS POSITION LON, Degrees) 
and if{ 1 (>L:DisplayPosition,bool) } 
els{ 0 (>L:DisplayPosition,bool) }
</MacroValue>
</Macro>

The Element Section:
Code:
<!--**************** Save Position Feature ****************-->
<Element id="SavPos">
<FloatPosition>0.000,0.000</FloatPosition>
<Visibility>(L:DisplayPosition,bool)</Visibility>

<Element id="PosLat">
<FloatPosition>225.000,586.000</FloatPosition>
<GaugeText id="GaugeText">
<BackgroundColor>0x000000</BackgroundColor>
<Bold>True</Bold>
<Bright>True</Bright>
<FontColor>Red</FontColor>
<FontFaceLocalize>True</FontFaceLocalize>
<FontHeightScript>@FontHeight</FontHeightScript>
<FontWeight>2</FontWeight>
<GaugeString>LAT %((A:GPS POSITION LAT, degrees))%!.4f!</GaugeString>
<HeightScript>@TextHeight</HeightScript>
<WidthScript>300</WidthScript>
<Transparent>True</Transparent>
</GaugeText>
</Element>

<Element id="PosLon">
<FloatPosition>225.000,612.000</FloatPosition>
<GaugeText id="GaugeText">
<BackgroundColor>0x000000</BackgroundColor>
<Bold>True</Bold>
<Bright>True</Bright>
<FontColor>Red</FontColor>
<FontFaceLocalize>True</FontFaceLocalize>
<FontHeightScript>@FontHeight</FontHeightScript>
<FontWeight>2</FontWeight>
<GaugeString>LON %((A:GPS POSITION LON, Degrees))%!.4f!</GaugeString>
<HeightScript>@TextHeight</HeightScript>
<WidthScript>300</WidthScript>
<Transparent>True</Transparent>
</GaugeText>
</Element>
</Element>

The Mouse Section:
Code:
<MouseArea id="Save Position">
<Visibility>(L:WSoffon,bool)</Visibility>
<FloatPosition>150.000,677.000</FloatPosition>
<Size>65,61</Size>
<CursorType>Hand</CursorType>
<HelpId></HelpId>
<MouseClick id="MouseClick">
<Script>(L:DisplayPosition,bool) ! (&gt;L:DisplayPosition,bool)</Script>
</MouseClick>
</MouseArea>

Thanks for any ideas or help with this.

Greg
 
I have created a button that when clicked displays the Lat/Long position. Easy enough. Now is there a way to have it saved or frozen if you will until the button is clicked again? Currently it keeps current with the aircraft position.

One easy way would be to put the following within your Mouse Click code:

Code:
(A:PLANE LATITUDE, degrees) (>L:PlaneLatDisplayed, degrees)
(A:PLANE LONGITUDE, degrees) (>L:PlaneLonDisplayed, degrees)

and then display the values of (L:PlaneLatDisplayed, degrees) and (L:PlaneLonDisplayed, degrees) rather than the A:Vars. The L:Vars will be refreshed only when you click.

One other quite minor point. Maybe your application would benefit from using (A:PLANE LATITUDE, degrees) rather than (A:GPS POSITION LAT, degrees). The GPS A:Vars are updated every one second, but the A:PLANE LATITUDE / LONGITUDE variables are updated every cycle, IIRC.

Bob
 
Once you have stored the position, it is not very complicated to calculate range and bearing back to that point. This is done by comparing current position to the stored position using standard equations.

Expanding on that principle you can make a Nav Computer where you can enter and store multiple waypoints manually or by overflight or by using the mouse to click on the gps map. In the one I developed I also have capability to select from stored airfield data which also sets up Nav frequencies and runway heading.

Knowing distance to waypoint, current groundspeed and fuel consumption, my computer gives time to go to waypoint and projected fuel state at the waypoint.

Nothing new here, but interesting to develop and makes high speed low altitude navigation a lot easier.

Roy
 
Perfect, Thank you

Thanks Bob,
Worked perfect. Displays as intended and i never knew about the time difference between the GPS and plane varibles. Scrolling that one away.

Also thanks to you Roy. You're on to me, well kind off. Yes i can see the almost endless possiblities with this. and who really nows where i am going to end up with this project, currently a traffic radar with some "nav" features.

The save position button is a result from flying over areas that would look cool for an airport, allowing me to save a position and pass it on to some friends that are into airport design. Only time will tell where this goes. Thanks again for your help.

Greg
 
Back
Top