Beispiel #1
0
        private BfGps getGPSVectorFromArg(string arg)
        {
            string[] argv = arg.Split(':');
            if (argv.Length >= 5)
            {
                BfGps gps = new BfGps();
                gps.name   = argv[1];
                gps.vector = new Vector3D(parseDouble(argv[2]), parseDouble(argv[3]), parseDouble(argv[4]));
                return(gps);
            }

            return(null);
        }
Beispiel #2
0
        private Dictionary <string, BfGps> addWaypointsToDict(string data, Dictionary <string, BfGps> Waypoints)
        {
            System.Text.RegularExpressions.Regex           regex   = new System.Text.RegularExpressions.Regex(GPS_PARSE_PATTERN);
            System.Text.RegularExpressions.MatchCollection matches = regex.Matches(data);
            for (int i = 0; i < matches.Count; i++)
            {
                BfGps gps = getGPSVectorFromArg(matches[i].Value);
                if (!Waypoints.ContainsKey(gps.name))
                {
                    Waypoints.Add(gps.name, gps);
                }
            }

            return(Waypoints);
        }
Beispiel #3
0
        private bool updatePanel(IMyTextPanel TextPanel)
        {
            List <BfGps>  Waypoints = getGpsWaypoints(TextPanel);
            StringBuilder Text      = new StringBuilder();

            if (TextPanel.GetPublicTitle().Trim().Length > 0)
            {
                Text.AppendLine(TextPanel.GetPublicTitle());
            }
            for (int i = 0; i < Waypoints.Count; i++)
            {
                BfGps Gps = Waypoints[i];
                if (Gps != null)
                {
                    double distance = Math.Round(Vector3D.Distance(PbPos, Gps.vector), 2);
                    Text.AppendLine(Gps.name + ": " + distance.ToString("### ### ### ###.00") + " m");
                }
            }

            return(displayOnPrivateText(TextPanel, Text) || displayOnPublicText(TextPanel, Text));
        }