• 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.

FSX Radar for Global reach Navigation and Flight Planning - Help Pls.

Messages
542
Country
australia
I have a Radar that has multiple functions and multiple modes.
The display modes are as follows:
(L:GrndMap_Variant,enum) 0 = Map at aircraft current position .
(L:GrndMap_Variant,enum) 1 = Map at aircraft current position .
(L:GrndMap_Variant,enum) 2 = Scrollable Fligt Plan list text .
(L:GrndMap_Variant,enum) 3 = Map at aircraft current position .
(L:GrndMap_Variant,enum) 4 = Map at aircraft current position .
(L:GrndMap_Variant,enum) 5 = Stand Off - Map at Next Waypoint(s) .

Item 1.
Enums 0 , 1 , 3 and 4 are all the same Map presentation each having different elevation tint colours.
The map position basis is the aircraft's current position as is determined by ;

<CustomDrawParam id="Latitude" Name="Latitude">
<Value>(A:pLANE LATITUDE,Radians)</Value>
</CustomDrawParam>

<CustomDrawParam id="Longitude" Name="Longitude">
<Value>(A:pLANE LONGITUDE,Radians)</Value>
</CustomDrawParam>

Item 2.
Enum 5 is a Map presentation whose position basis is the " Next Waypoint " , (any waypoint can be selected) as is determined by ;

<CustomDrawParam id="Latitude" Name="Latitude">
<Value>(A:GPS WP NEXT LAT, Radians)</Value>
</CustomDrawParam>

<CustomDrawParam id="Longitude" Name="Longitude">
<Value>(A:GPS WP NEXT LON, Radians)</Value>
</CustomDrawParam>

Item 3.
I have two separate Geo Calc functions that are based on ;

(A:pLANE LATITUDE,degrees)
(A:pLANE LONGITUDE,degrees)

Both work as desired.
I now need to implement the the same Geo Calc function when Enum 5 is selected ,
ie;

(A:GPS WP NEXT LAT,degrees)
(A:GPS WP NEXT LON,degrees)

Basically,

replace
(A:pLANE LATITUDE,degrees)

with
(A:pLANE LATITUDE,degrees) else (A:GPS WP NEXT LAT,degrees) if (L:GrndMap_Variant,enum) 5

and

replace
(A:pLANE LONGITUDE,degrees)

with
(A:pLANE LONGITUDE,degrees) else (A:GPS WP NEXT LON,degrees) if (L:GrndMap_Variant,enum) 5

How do I write the part that allows the Geo Calc to do the two Enum conditions ?

Cheers
Karol
 
Last edited:
First of all Karol, please let me say that I really enjoy seeing others work on navigation and map applications. It's my passion, of course. Your stuff always looks good and your ideas are very interesting.

So, let me see if I understand your question ... My first impression is that I would create a proxy for GeoCalcLatitude1 and Longitude1. Call it L:Reference_Latitude or Longitude, degrees.

If Grndmap_Variant is 5, then L:Reference_Latitude or Longitude is A:GPS WP NEXT LAT or LON, degrees. If not, then L:Reference_Latitude or Longitude, degrees is (A:pLANE LATITUDE or LONGITUDE, degrees).

Then, (L:Reference_Latitude or Longitude, degrees) (>C:fs9gps:GeoCalcLatitude1 or Longitude1, degrees).

But, honestly, since you are very good at this stuff, I presume you have thought of this ... and it isn't what you want???

Anyway, I know you will solve it.

Bob
 
Thanks Bob

I'll look at that and see if I can figure something out.
I often wish I was good at this stuff , but the truth is I am a rank amateur .

Cheers
Karol
 
Background details.
The first shot has the Radar (1) display based on (A:pLANE LATITUDE,degrees)/
(A:pLANE LONGITUDE,degrees) , the aircraft's current position at Amberley ,
in Australia. A clipboard (3) containing 5 pages of global ICAOs is utilised
as a souce of ICAOs to gererate a flight plan in the European region , the
Mission Adaptive Flight Plan Editor (2a) is used to enter a Direct To with
added legs half a world away.
VmnuO.jpg
fsx 2013-07-31 21-07-33-98.jpg


Second shot shows the flight plan that has been created , the Radar display screen is now in Stand Off mode based on (A:GPS WP NEXT LAT,degrees)/
(A:GPS WP NEXT LON,degrees) , screen view is centred at Hucknall , England.
The aircraft still remains on the ground in Australia throughout.
The Stand Off Mode 6 Radar display views is scrolled through the flight plan
waypoints by either switch (4a) PREV/NEXT or switch (4b) as annotated in shot one , this changes the "Active Leg" and thus the display location.
These switches can be used to leapfrog long the flight plan.
Either the Clipboard or the Radar display can be used as a source of ICAOs
to generate as many legs as desired, therefor maps are not needed .
fsx 2013-08-04 23-33-17-69.jpg
kOgj6.jpg


Third shot ,the Stand Off radar display view is centered at Frankfurt EDDF.
It has been zoomed in to show the runways.
Two seperate Geo Calc element are shown on this Radar display just above the
small aircraft icon , both are erroneous as they are based on the aircraft
location in Australia , they are:
1. Flight Plan Index (SEQ) "00" it should read "05".
2. The small Red dot is touchscreen nominated position as are the text data
at the top of the Radar screen , this text is for a position at YAMB , Australia, it should be showing the , Distance, Bearing , Lat/Long
data exactly as is shown in the NRST page of the Left Hand MFD.
The reason for these two errors is that the Geo Calc is not yet based
on (A:GPS WP NEXT LAT,degrees)/(A:GPS WP NEXT LON,degrees) , this is the reason for this posted thread.
vgPhb.jpg
 
Last edited:
Karol,

I assume that you have checked that (A:GPS WP NEXT LAT,degrees)/(A:GPS WP NEXT LON,degrees) are the values you desire and that these have been properly written to GeoCalcLatitude1, Longitude1 (>C:fs9gps:GeoCalcLatitude1, degrees). However, GeoCalc does not return the correct numbers? Is that the right issue? Its a little hard for me to follow you completely.

That said, then, the following is a shot in the dark and may well miss the mark:

1) Check to be sure there are no competing GeoCalc computations within your <Update> section ... that the GeoCalc instructions associated with (L:GrndMap_Variant,enum) 5 are isolated from the rest by some condition such as a mouse click state, and vice versa.

2) Also, make sure that you are not doing anything that requires multiple update cycles to complete (like a NRST search or ICAO transfer) but you are trying to use results in the same update cycle before the gps engine delivers results. That issue happens a lot. In fact, in an attempt to insure a fresh initialization of GeoCalc when enum is 5, you might consider writing values to GeoCalcLatitude/Longitude 1 and 2 during one update cycle, then add in a 2 or 3 cycle skip before using the results of GeoCalc. Honestly, as I understand the module, this shouldn't be an issue, but I have not seen your code in its entirety, so I am still guessing.

Good Luck. You'll get it to work I know.

Bob
 
Last edited:
Bob

Due to the complexity of the Radar , and it's length , it's currently over 4,300 lines of code , together with the fact this change will appear about 40-50 times
in this instrument .... I am being a little wary.

I always have difficulties with conditional statements.
I came up with the following , but it does NOT look right to me ,
I am bothered with the double "if" at the beginning .
HTML:
			(L:ApplyRadarFocus, bool)	
		     if{ 
		     if{ 			 
			 (L:GrndMap_Variant,enum) 5 ==
			 if{
			 (A:GPS WP NEXT LAT,degrees) (>L:RadarFocus LAT,degrees) 
			 (A:GPS WP NEXT LON,degrees) (>L:RadarFocus LON,degrees)
			   }
			   }
		   else{ 
		     (A:PLANE LATITUDE,degrees) (>L:RadarFocus LAT,degrees)
			 (A:PLANE LONGITUDE,degrees) (>L:RadarFocus LON,degrees)
			   } 
			   }

Cheers
Karol
 
Karol,

Try:

Code:
(L:ApplyRadarFocus, bool) 1 ==	
 [COLOR="red"] if{[/COLOR]			 
    (L:GrndMap_Variant,enum) 5 ==
      [COLOR="purple"]if{[/COLOR]
        (A:GPS WP NEXT LAT,degrees) (>L:RadarFocus LAT,degrees) 
        (A:GPS WP NEXT LON,degrees) (>L:RadarFocus LON,degrees)
      [COLOR="Purple"]}[/COLOR]
     [COLOR="blue"] else{[/COLOR] 
        (A:PLANE LATITUDE,degrees) (>L:RadarFocus LAT,degrees)
        (A:PLANE LONGITUDE,degrees) (>L:RadarFocus LON,degrees)
     [COLOR="Blue"] }[/COLOR]
  [COLOR="red"]}[/COLOR]

Bob

ps, I always like adding 1 == after the conditional bool ... not necessary, it just looks better to my eye
 
Last edited:
Bob

I tried that one , I added it in the update section , no joy.
All the Index/SEQ numbers were one on top of each other at focus point
in both the normal modes and the Stand Off mode 6 , that seems to indicate
that the Geo Calc is not calculating 'bearing and distance' , presumeably due
to the update not feeding the Lat/Lngs .

I tried a couple of variations to your code , no joy .

I set,
(A:GPS WP NEXT LAT,degrees)
(A:GPS WP NEXT LON,degrees)
into the Geo Calc , and that worked perfectly , exactly as required .

My guess is that it is only a small issue that currently stops it from working .
I'm still very optimistic about it.

Will create an instrument to read the L var returns (if any) , also experiment
with a secondary update section.

It also could be that the code might work in a " Visability " script .

Funny isn't it , often it's the little things that bug the works , and later on you tend to kick yourself for not having thought of the solution at the beginning.
However it's always worth the effort !

Cheers
Karol
 
Sawasdee khrab Khun Karol,

The syntax of the XML I sent you is correct, but quite obviously that doesn't guarantee your GeoCalc will work as intended.

When I was writing the example xml gauge included with the CustomDraw guidebook, I kinda recall difficulties getting GeoCalc to give me the values I wanted when I changed Latitude1, Longitude1 and/or Latitude2, Longitude2 on the fly, as if GeoCalc did not re-initialize with the new reference points. Whenever I sense something like this with the gps module, my initial strategy is to build in some delay (cycle-skipping) and also make sure that there are no competing GeoCalc instructions in the Update section. Think about that.

Maybe Tom Aguilo or someone else very familiar with the module has an idea. Part of the problem, frankly, may be that I still do not exactly understand what the problem is.

As for multiple <Update> sections, I believe we are limited to only one per gauge.

To get a read-out of the L:Vars, you can use BlackBox written by my son Robbie. Additionally, Doug Dawson has some apps on his website that will help the developer see real-time values of gauge variables. Check both out.

Finally, I have a little bad news. When it comes to pushing the limits of the gps module, it may not be the little things that bug the works. Some things, and your GeoCalc issue may be one, require experience and understanding of the module to get it to work for you - that is, not simply correct xml syntax.

Hang in there. I know you will solve it.

Cheers,

Bob
 
Last edited:
Bob

Thanks for the above input , it certainly gives me areas to consider.

I tried the following ;
One of the Geo Calc functions places the 'Flt Pln Index/SEQ number at the appropriate location on the Flt Pln line on the Radar screen.
I duplicated that code in the Radar ,

Version one for Modes 1, 2, 4, and 5 , basis was,
(A:pLANE LATITUDE,degrees)/(A:pLANE LONGITUDE,degrees)

Version two for "Stand Off" Mode 6 , basis was,
(A:GPS WP NEXT LAT,degrees) /(A:GPS WP NEXT LON,degrees)

The Visability statements were,
HTML:
<Visibility>(L:DanubeFltPlnIndex,enum) 1 ==; (L:GrndMap_Variant,enum) 5 ==; &amp;&amp;</Visibility>
<Visibility>(L:DanubeFltPlnIndex,enum) 1 ==; (L:GrndMap_Variant,enum) 4.5 &lt; &amp;&amp;</Visibility>

Not efficient but it worked beautifully.
Clicking the 'NEXT' button that is incorporated in the autopilot progressively steps through the flight plan legs , and if mode 6 (Stand Off) is selected
then the screen view is centred on the selected 'Active leg Waypoint' .
The top row of the shot below shows several resultant views.

Cheers
Karol
42H7P.jpg
 
For information only.
The previously advised "Visability" structure was modified to overcome small flaws.
Is now as follows.
HTML:
<Element id="FltPln_Titles">
    <Visibility>(L:DanubeFltPlnIndex,enum) 1 ==</Visibility>
        <!--This Visability brackets following 2 Visabilities-->
        <!--Is On/Off condition  controls if symbol and text show up-->

   <Element id="FltPln_Titles_Mode,1,2,4,5">
      <Visibility>(L:GrndMap_Variant,enum) 4.5 &lt;</Visibility>
        <!--Based on  (A:PLANE LATITUDE,degrees)/(A:PLANE LONGITUDE,degrees)-->
        <!--Multiple Element groups to position symbol and SEQ text -->
   </Element>

   <Element id="FltPln_Titles_Mode,6">
      <Visibility>(L:GrndMap_Variant,enum) 5 ==</Visibility>
        <!--Based on  (A:GPS WP NEXT LAT,degrees)/(A:GPS WP NEXT LON,degrees)-->
        <!--Multiple Element groups to position symbol and SEQ text -->
   </Element>

</Element>

Cheers
Karol
 
Karol,

I've just read the complete thread and, honestly, cannot get the point. Did you finally solved the Geocalc issue?

One thing I noticed is that you seem to use two <CustomDraw> objects, one for (L:GrndMap_Variant,enum) 0 to 4 and another for 5. If both are much the same but differ in PLANE LAT/LON - GPS WP NEXT, then a single <CustomDraw> could be used with:

Code:
<CustomDrawParam id="Latitude" Name="Latitude">
<Value>(A:PLANE LATITUDE,Radians) (A:GPS WP NEXT LAT,Radians) (L:GrndMap_Variant,enum) 5 != ?</Value>
</CustomDrawParam>

and the same for Longitude.

I'm sure this is not the central point, but it's all I can share so far...

Tom
 
Tom

Still working on the Geo Calc .
There are two Geo Calc reliant functions involved.
1. One places the Flt Pln Index labels on the Flt Pln line , this aids in determining Index numbers should the Flt Plan be modified with the Flight Plan editor , either by addition or replacement of Waypoints , I now have this working in both normal and Stand Off modes .

2. The other enables any location on the Radar map to be nominated and subsequently added as a Waypoint anywhere in a flight plan , this is based on Bob's " Custom Draw manual" method , I have this working in the normal mode
which is based on the aircraft's present position.
What I am trying to do is to get it working in the Stand Off mode as well , this would enable random Lat/Long positions to be nominated at any distance from the aircraft's current position .

Why Stand Off .
It started off as a method to project the Radar view forwards to pre view a ground target prior to a bombing Run In.
Basically it is like the 'Pan function' on steroids , however it is tied to Waypoints contained in a flight plan , the Radar screen view can be projected forward simply by activating a later flight plan leg.
From a navigation perspective it allows large scale long distance flight plans to be created even if maps are not available.
For the future , I desire the Stand Off nomination function for use in conjunction with another separate instrument.

Regards your Custom draw code , I created this Radar several years ago before I was aware of that possibility , I then created multiple Custom Draw sections to allow different colour contours , colours are difficult in custom draw maps , I wanted a stark contour terracing that enabled in the weeds nap of the earth flying day or night or zero visability , and that required the different colours for different terrain elevations , thus the different maps.

Cheers
Karol
 
2. The other enables any location on the Radar map to be nominated and subsequently added as a Waypoint anywhere in a flight plan , this is based on Bob's " Custom Draw manual" method , I have this working in the normal mode
which is based on the aircraft's present position.
What I am trying to do is to get it working in the Stand Off mode as well , this would enable random Lat/Long positions to be nominated at any distance from the aircraft's current position .l

Ok, then posting a file/code snippet of the logic involved would be of great help.

Regards your Custom draw code , I created this Radar several years ago before I was aware of that possibility , I then created multiple Custom Draw sections to allow different colour contours , colours are difficult in custom draw maps , I wanted a stark contour terracing that enabled in the weeds nap of the earth flying day or night or zero visability , and that required the different colours for different terrain elevations , thus the different maps.

Right, but then remember that each <CustomDraw> object you define is processed on every cycle, whether being <Visible> or not, with a performance cost -significant or not- that should be evaluated.

Tom
 
Tom

This is the relevant code from the update section , it has the code mentioned above included in it and Lat/Long references are in the body of the Geo Calc.
Note the Monitor calibration is for a 4x3 monitor.
HTML:
(L:ApplyRadarFocus, bool) 1 ==	
  if{			 
    (L:GrndMap_Variant,enum) 5 ==
      if{
        (A:GPS WP NEXT LAT,degrees) (>L:RadarFocusLAT,degrees) 
        (A:GPS WP NEXT LON,degrees) (>L:RadarFocusLON,degrees)
      }
      else{ 
        (A:PLANE LATITUDE,degrees) (>L:RadarFocusLAT,degrees)
        (A:PLANE LONGITUDE,degrees) (>L:RadarFocusLON,degrees)
      }
  }	

            10.56470243 (>L:Scale_X, number)	
			11.82 (>L:Scale_Y, number)  

			1 (>L:Sim_FSX, bool)
			
			1 (>L:Sim_FSX, bool)

			350 (>L:MapSizeGU_X, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->
			350 (>L:MapSizeGU_Y, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->		

			(L:MapSizeGU_X, enum) 2 / (>L:VertCursor, number)
			(L:MapSizeGU_Y, enum) 2 / (>L:HorizCursor, number)				

			1 (>L:TrackUp, bool)
			1 (>L:MovingMap, bool)				
			
			175 (>L:CenterX, number)
			260 (>L:CenterY, number)  <!-- User aircraft is not centered in the map -->							

			1 (>L:Update_Always, bool)			
			1 (>L:Map_Priority, bool)		
			1 (>L:Map_Loading, bool)	<!-- Not sure as to function of this variable -->

			3440.065 (>L:EarthRadius, nmiles)				
                }
			(L:CalculateClikDist, bool)	
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				(L:RadarFocusLAT,degrees) (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				(L:RadarFocusLAT, radians) (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg (L:RadarFocusLON,degrees) + (>L:ClikLongitude, degrees)
				(L:RadarFocusLAT, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
				(L:RadarFocusLON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						(L:RadarFocusLAT, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
						(L:RadarFocusLON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}
			0 (>L:CalculateClikDist, bool)
			}

Cheers
Karol
PS the above modified update DOES NOT work at all in either Normal or Stand Off modes.
 
Last edited:
This is the previous update code that works .
Of course it only works in Normal mode ( 1, 2, 4, 5)

Karol
HTML:
            10.56470243 (>L:Scale_X, number)	
			11.82 (>L:Scale_Y, number)

			1 (>L:Sim_FSX, bool)
			
			1 (>L:Sim_FSX, bool)

			350 (>L:MapSizeGU_X, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->
			350 (>L:MapSizeGU_Y, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->		

			(L:MapSizeGU_X, enum) 2 / (>L:VertCursor, number)
			(L:MapSizeGU_Y, enum) 2 / (>L:HorizCursor, number)				

			1 (>L:TrackUp, bool)
			1 (>L:MovingMap, bool)				
			
			175 (>L:CenterX, number)
			260 (>L:CenterY, number)  <!-- User aircraft is not centered in the map -->							

			1 (>L:Update_Always, bool)			
			1 (>L:Map_Priority, bool)		
			1 (>L:Map_Loading, bool)	<!-- Not sure as to function of this variable -->

			3440.065 (>L:EarthRadius, nmiles)				
                }
			(L:CalculateClikDist, bool)	
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				(A:PLANE LATITUDE, degrees) (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				(A:PLANE LATITUDE, radians) (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg (A:PLANE LONGITUDE, degrees) + (>L:ClikLongitude, degrees)
				(A:PLANE LATITUDE, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
				(A:PLANE LONGITUDE, degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						(A:PLANE LATITUDE, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
						(A:PLANE LONGITUDE, degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}
			0 (>L:CalculateClikDist, bool)
			}
 
Right, but then remember that each <CustomDraw> object you define is processed on every cycle, whether being <Visible> or not, with a performance cost -significant or not- that should be evaluated.

Interesting , I have 11 separate instances of Custom Draws in operation .
For 10 of them , I do not notice a frame rate impact , however the
<CustomDraw id="CustomDraw" Name="fs9view:view"> which is used in my Pave Tack viewer , you do notice the impact , but only if it is switched on.

Cheers
Karol
 
OK ... Got it working !!!

The clue was in the "duplication method" that I used earlier for the Flight Plan labels ( little circles and Index/SEQ numbers on the Flt Pln ) .
That method is best described above at post # 11 above .

Following is for Radar touchscreen nomination of Lat/Long for entry as Waypoints into a Flight Plan.

FOR MODES, 1, 2, 4, 5.
See above at post # 16 above .

FOR MODE, 6 (Stand Off) .
The following works .
HTML:
            10.56470243 (>L:Scale_X, number)	
			11.82 (>L:Scale_Y, number)

			1 (>L:Sim_FSX, bool)
			
			1 (>L:Sim_FSX, bool)

			350 (>L:MapSizeGU_X, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->
			350 (>L:MapSizeGU_Y, enum) <!-- The X and Y size of the fs9gps:Map screen must be indicated -->		

			(L:MapSizeGU_X, enum) 2 / (>L:VertCursor, number)
			(L:MapSizeGU_Y, enum) 2 / (>L:HorizCursor, number)				

			1 (>L:TrackUp, bool)
			1 (>L:MovingMap, bool)				
			
			175 (>L:CenterX, number)
			260 (>L:CenterY, number)  <!-- User aircraft is not centered in the map -->							

			1 (>L:Update_Always, bool)			
			1 (>L:Map_Priority, bool)		
			1 (>L:Map_Loading, bool)	<!-- Not sure as to function of this variable -->

			3440.065 (>L:EarthRadius, nmiles)				
                }
			(L:CalculateClikDist, bool)	  
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				(A:GPS WP NEXT LAT,degrees) (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				(A:GPS WP NEXT LAT, radians) (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg (A:GPS WP NEXT LON,degrees) + (>L:ClikLongitude, degrees)
				(A:GPS WP NEXT LAT,degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
				(A:GPS WP NEXT LON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						(A:GPS WP NEXT LAT,degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
						(A:GPS WP NEXT LON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}
			0 (>L:CalculateClikDist, bool)
			}

From my point of view , the most important aspect is that what I was after works , that is a relief .
Now we know it is possible .

Now all that is required is similar Visability type statement within the update section to differentiate between this Mode 6-Stand Off code and the code detailed at post # 16 .

Cheers
Karol
 
Tom

I placed the following duplication into the update section , initial testing reveals that it works .
Still needs more testing just to be on the safe side .

Could you please have a look at it and see if my syntax appears to be correct .

HTML:
			(L:CalculateClikDist, bool) (L:GrndMap_Variant,enum) 4.5 &lt;	
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				(A:PLANE LATITUDE, degrees) (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				(A:PLANE LATITUDE, radians) (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg (A:PLANE LONGITUDE, degrees) + (>L:ClikLongitude, degrees)
				(A:PLANE LATITUDE, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
				(A:PLANE LONGITUDE, degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						(A:PLANE LATITUDE, degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
						(A:PLANE LONGITUDE, degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}
			0 (>L:CalculateClikDist, bool)
			}				
			(L:CalculateClikDist, bool) (L:GrndMap_Variant,enum) 5 ==	  
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				(A:GPS WP NEXT LAT,degrees) (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				(A:GPS WP NEXT LAT, radians) (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg (A:GPS WP NEXT LON,degrees) + (>L:ClikLongitude, degrees)
				(A:GPS WP NEXT LAT,degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
				(A:GPS WP NEXT LON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						(A:GPS WP NEXT LAT,degrees) (>C:fs9gps:GeoCalcLatitude1, degrees)
						(A:GPS WP NEXT LON,degrees) (>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}
			0 (>L:CalculateClikDist, bool)
			}

Initial testing reveals that
1. in Mode, 1, 2, 4, and 5 , if I click a location on the Radar screen and enter that spot into a flight plan , it's location is correct.

then change the Mode,

2. in Mode 6 Stand Off , I leapfrog along the flight plan to a location that is well away from where the aircraft is actually located , and then click a location on the Radar screen and enter that spot into a flight plan , it's location is correct.

In both the above cases , I determined the accuracy by clicking on a nearby "Airport" , then checking that the nominated entered waypoint Lat/Long actually matched the Lat/Long for that particular Airport .
In testing they matched to a high order.

Cheers
Karol
 
Karol,

Inspecting your latest code snippet, I find all the calculations -except the use of different vars PLANE LAT/LON and GPS WP NEXT- are exactly the same in both cases (0-4 and 5). I suggest you to leave only one and replace those var names with proper macros.
So, at the beginning of the gauge, in the macros area, write:

Code:
<Macro Name="Lat_Origin">
      	(L:GrndMap_Variant,enum) 5 != 
      	if{ (A:PLANE LATITUDE, @1) }
      	els{ (A:GPS WP NEXT LAT,@1) }
</Macro>
      <Macro Name="Lon_Origin">
      	(L:GrndMap_Variant,enum) 5 != 
      	if{ (A:PLANE LONGITUDE, @1) }
      	els{ (A:GPS WP NEXT LON,@1) }
</Macro>

Then the single part would be:

Code:
			(L:CalculateClikDist, bool)	
		     if{	
				(L:map_ZoomFactor, number) 1852 * (>L:Zoom, number)
				(L:Mouse_X, number) (L:MovingMap, bool) 1 == if{ (L:CenterX, number) } els{ @GaugeXY (L:S_Gauge_X, number) } - (>L:MouseDelta_X, number)						
				(L:Mouse_Y, number) (L:MovingMap, bool) 1 == if{ (L:CenterY, number) } els{ @GaugeXY (L:S_Gauge_Y, number) } - (>L:MouseDelta_Y, number)
				(L:MouseDelta_Y, number) (L:Scale_Y, number) * (L:map_ZoomFactor, number) * 1852 / (>L:ClikArcLength_Y, nmiles)
				(L:ClikArcLength_Y, nmiles) (L:EarthRadius, nmiles) / (>L:DeltaLatitude, radians)
				[COLOR="Red"]@Lat_Origin(degrees)[/COLOR] (L:DeltaLatitude, degrees) - (>L:ClikLatitude, degrees)					
				(L:ClikLatitude, radians) cos (>L:cosClikLat, number)
				[COLOR="Red"]@Lat_Origin(radians)[/COLOR] (L:ClikLatitude, radians) + 2 / cos (>L:CosAvgLat, number)
				(L:Sim_FSX, bool) 1 == (L:Zoom, number) 500000 &lt; and 
					 if{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (>L:ClikArcLength_X, nmiles) }
					els{ (L:MouseDelta_X, number) (L:Scale_X, number) * (L:map_ZoomFactor, number) *  1852 / (L:cosClikLat, number) * (>L:ClikArcLength_X, nmiles) }
				(L:ClikArcLength_X, nmiles) (L:EarthRadius, nmiles) (L:cosClikLat, number) * / rddg [COLOR="red"]@Lon_Origin(degrees)[/COLOR] + (>L:ClikLongitude, degrees)
				[COLOR="red"]@Lat_Origin(degrees)[/COLOR] (>C:fs9gps:GeoCalcLatitude1, degrees)
				[COLOR="red"]@Lon_Origin(degrees)[/COLOR] (>C:fs9gps:GeoCalcLongitude1, degrees)
				(L:ClikLatitude, degrees) (>C:fs9gps:GeoCalcLatitude2, degrees)
				(L:ClikLongitude, degrees) (>C:fs9gps:GeoCalcLongitude2, degrees)
				(C:fs9gps:GeoCalcDistance, nmiles) (>L:ClikDistance, nmiles)
				(C:fs9gps:GeoCalcBearing, degrees) d (>L:ClikBearingTrue, degrees) (A:MAGVAR, degrees) - (>L:ClikBearingMag, degrees)
				
				(L:TrackUp, bool) 1 == (L:Zoom, number) 500000 &lt; and
					if{
						[COLOR="red"]@Lat_Origin(degrees)[/COLOR] (>C:fs9gps:GeoCalcLatitude1, degrees)
						[COLOR="red"]@Lon_Origin(degrees) [/COLOR](>C:fs9gps:GeoCalcLongitude1, degrees)							
						(L:ClikDistance, nmiles) (>C:fs9gps:GeoCalcLength, nmiles) 
						(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)				
						(C:fs9gps:GeoCalcAzimuth1, degrees) (>L:ClikBearingTrue, degrees)
						(C:fs9gps:GeoCalcExtrapolationLatitude, degrees) (>L:ClikLatitude, degrees)
						(C:fs9gps:GeoCalcExtrapolationLongitude, degrees) (>L:ClikLongitude, degrees)							
					}

Macros are highlighted in red. Notice that you can assign the proper unit as required -degrees or radians).

Now, inspecting your code I found this:

Code:
(L:ClikBearingTrue, degrees) (A:GPS GROUND TRUE TRACK, degrees) + dnor (>C:fs9gps:GeoCalcAzimuth1, degrees)

(A:GPS GROUND TRUE TRACK, degrees) is the current track the aircraft is flying on/pointing when parked, so I guess it can give a wrong result when in Radar (5) mode if it is not North (0) ?

Tom
 
Back
Top