mracko / MSFS-Mobile-Companion-App

Mobile Companion App for MSFS 2020
GNU Affero General Public License v3.0
360 stars 39 forks source link

Feature Request: Waypoints #3

Open Revel8804 opened 3 years ago

Revel8804 commented 3 years ago

In the one I have built there is a simple box telling me the distance to my waypoint. With fullscreen map I like that, but not sure where to put a NM to waypoint. So I was thinking maybe putting the waypoint on the map and drawing a line to it? Like on the VFR map?

I am going to try and figure that out myself when I have time soon.

mracko commented 3 years ago

I like the idea! I've seen people asking for waypoints, so if you can come up with something, I'd be more than happy to implement it. I'm currently focusing on COMs and other features - nothing map related.

Revel8804 commented 3 years ago

So I have it marking the next waypoint. I can pull the previous waypoint too and mark it. Not seeing a way to pull all waypoint lat and long though. Still researching.

Also i have the distance to waypoint in NM. not sure where to stick it. Would be nice to have it maybe on the line?

The main issue I am having now is drawing the line. Figured I would at least update the progress.

image

mracko commented 3 years ago

This is looking great! Do you know how to make a GPS track line of your existing? I was thinking about implementing it but haven't looked into it.

Putting NM details on the line sounds great.

Btw - how does the waypoint placement work? Do you click somewhere and it opens a small window prompting you whether you want to add a waypoint?

Revel8804 commented 3 years ago

Its been while for me. Life..... ugh Still trying to figure out the line business. I believe it needs to be done in the leaflet stuff just not sure how. so in the meantime i have added distance to next waypoint by the unfollow button.

image

mracko commented 3 years ago

Great! We'll think about the UI later. I'll be testing the app a little more, especially now with the new update. Plus, I'll check if asobo fixed some SimConnect events that didn't work previously.

mracko commented 3 years ago

I've implemented the GPS track. This is what will come with the next update.

Capture
Revel8804 commented 3 years ago

How did you make the line? That has been driving me nuts!

mracko commented 3 years ago

polyline ist the way to go:

// Add a polyline to the map
trackline = L.polyline([], {color: 'red', smoothFactor: 3}).addTo(map);

// Update the polyline in the UpdateMap() function
trackline.addLatLng([latitude, longitude]);

I'll upload the files directly to the master later today/tomorrow.

cpt-fred commented 3 years ago

Hello guys.

Will the *.exe be available with new line and waypoints soon?

Thank you for the job!

Revel8804 commented 3 years ago

So now that I know how to draw the lines. Tomorrow I am going to work on getting them created for the waypoints.

I know 100% I can have it created for the next and previous waypoint. Will work on a way to pull all the way points and draw lines/dots.

This program is amazing and has come a long way. I wish I was able to spend more time helping out with it.

Revel8804 commented 3 years ago

@mracko if its good for you I will add the distance to way point at the bottom, with the same styling as you have with the gps track. I know for me that is huge help. I imagine others would like it too.

on a side note. do you have a discord or something setup that we could use for communicating? Might be a bit hard due to our time difference though.

Revel8804 commented 3 years ago

i have added the distance to next waypoint to the map page. I do not have permissions to push changes for your consideration though.

image

mracko commented 3 years ago

This looks good, but I'm afraid it won't look good on a smaller cell phone. Have you tried it on a smaller device?

The best would be to fork my repository and then create a pull request.

Revel8804 commented 3 years ago

this is from my iPhone. i would not want to add another item down there though. Could change the text to just waypoint too.

IMG_0486 IMG_0485

mracko commented 3 years ago

Sorry for the late replies. I've been busy the last couple of days.

I think the best would be to fork my repo and create a pull request with your changes. Nevertheless I was thinking about solving the UI as follows:

What do you say? Have you though about possibilities to display an entire flight plan?

Revel8804 commented 3 years ago

Ok so I forked it and have been making some updates you can check out. I accidently deleted what i already had..... so starting over

I am working on an entire flight plane, so far all I can find is how to pull the prev and next waypoint. so i have the lat, long, and ID of next and previous. I have the count of waypoints. just can not find a variable to list them all.

So with no dest wp set the count and index are 0. So i can put an if then do or do not show. Makes sense to me to do that. No need to show info if people dont need it. GPS_FLIGHT_PLAN_WP_COUNT":0.0,"GPS_FLIGHT_PLAN_WP_INDEX":0.0,

so here is a snippet of all the waypoint variables i have found so far. { "AI_WAYPOINT_LIST": null, "GPS_ETA": 0, "GPS_FLIGHT_PLAN_WP_COUNT": 7, "GPS_FLIGHT_PLAN_WP_INDEX": 1, "GPS_IS_ACTIVE_FLIGHT_PLAN": 1, "GPS_IS_ACTIVE_WAY_POINT": 1, "GPS_WP_CROSS_TRK": 1.2724601612390529e-8, "GPS_WP_DESIRED_TRACK": 1.3867708232790736, "GPS_WP_DISTANCE": 653.95, "GPS_WP_NEXT_ID": "SLVAA", "GPS_WP_NEXT_LAT": 33.462767, "GPS_WP_NEXT_LON": -84.036385, "GPS_WP_PREV_ID": "USER", "GPS_WP_PREV_LAT": 32.914897, "GPS_WP_PREV_LON": -97.050803, "GPS_WP_PREV_VALID": 1, }

still researching all the waypoints though. It knows how many there are.

mracko commented 3 years ago

I've done some research on it and it looks like reading out the flight plan with SimConnect alone will not be possible. See here: https://www.fsdeveloper.com/forum/threads/read-all-waypoints-from-player-flight-plan.449870/

We will need to locate the current flight plane on the drive and parse it. I think the toughest part will be finding the location.

Revel8804 commented 3 years ago

So find the flight plan was not to bad.

I am using the gamepass version and it is at C:\Users\{USERNAME}\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\MISSIONS\Custom\CustomFlight\CUSTOMFLIGHT.FLT

It only shows what you put on the world map page. So if you always do all your waypoints there. Then that is perfect.

If you are like me and pick destination and arrival. Then once in flight have the computer set your arrival procedure, then it does not work. I am trying to find the file that stores that. It has to be somewhere for simconnect to pull the wp id's.

RIGHT?!?!?! I may have dug too deep today.

Revel8804 commented 3 years ago

ok in my fork i have added the following image

i have also set it to use openstreet as default, since stadia seems to be having issues.

still trying to figure out the waypoints

mracko commented 3 years ago

Looking good! Sorry for the late reply but I've been quite busy these days. I should have more time on Monday (Jan 11) but until then the only thing I might do is a little CSS fix for iPad users.

One thing regarding the UI: What would you say about displaying the "Distance to next waypoint" without the blue button? Just plain black text with a white border so you can see the font on a dark background. I'm a little bit concerned that it might take up too much screen space on a phone.

I'll get back to you the week starting Jan 11 with more input.

Revel8804 commented 3 years ago

How do you feel about this? I made it 0.7em. So it should be responsive.

PC image

iPhone 12 Pro Max IMG_0542

iPad IMG_0062

iPhone 6 IMG_0001

mracko commented 3 years ago

I was actually thinking about using the -webkit-text-stroke CSS property to make a white outline. See documentation here https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-text-stroke. Seems to be pretty well supported https://caniuse.com/?search=Text-stroke

I don't know how it'll look though. Maybe your solution will be better.

Revel8804 commented 3 years ago

I dont think the outline is going to work. What if we do an if dark is true color = #FFF else color =#000 <--- not real code

image IMG_0556

mracko commented 3 years ago

True. That doesn't look good. I thought it would look like the font on the OSM screenshot you've posted previously. If you look at Mono Lake or Bodie Wilderness you'll notice that the stroke looks better. As if OSM would use outer stroke while my suggestion would do inner stroke.

I'll need to investigate further.