Beispiel #1
0
        void AddPOI(string sName, string sclass, double lon, double lat, MAstroBody _body)
        {
            MPOI poi = new MPOI();

            poi.sClass   = sclass;
            poi.Position = MGISTools.LonLatMercatorToPosition(lon, lat, _body.Radius.X)
                           + _body.Position;
            poi.LonLat = new Vector3d(lon, lat, 0);
            poi.Name   = sName;
            if (sclass.Equals("suburb"))
            {
                Suburbs.Add(poi);
            }
            if (sclass.Equals("minor"))
            {
                PointsOfInterest.Add(poi);
            }
            if (sclass.Equals("tertiary"))
            {
                PointsOfInterest.Add(poi);
            }
            if (sclass.Equals("major"))
            {
                PointsOfInterest.Add(poi);
            }
            if (sclass.Equals("primary"))
            {
                PointsOfInterest.Add(poi);
            }
            if (sclass.Equals("highway"))
            {
                PointsOfInterest.Add(poi);
            }
            if (sclass.Equals("stream"))
            {
                PointsOfInterest.Add(poi);
            }
        }
Beispiel #2
0
        public void UpdateAvatarLonLat(Vector3d LonLat)
        {
            // Console.WriteLine(TileX + " : " + DistanceFromAvatar);

            if ((IsSetup == true) && (DistanceFromAvatar < PHYSICS_ACTIVE_DISTANCE) && (_physics == null))
            {
                DoSetupPhysics = true;
            }

            if (Settings.PointsOfInterest == true)
            {
                double Distance = 9999999999999999;
                foreach (MPOI p in PointsOfInterest)
                {
                    //double d = Vector3d.Distance(LonLat, p.LonLat);
                    double d = MGISTools.GetDistance(LonLat.Y, LonLat.X, p.LonLat.Y, p.LonLat.X);
                    if (d < Distance)
                    {
                        ClosestPOI = p;
                        Distance   = d;
                    }
                }

                Distance = 9999999999999999;
                foreach (MPOI p in Suburbs)
                {
                    //double d = Vector3d.Distance(LonLat, p.LonLat);
                    double d = MGISTools.GetDistance(LonLat.Y, LonLat.X, p.LonLat.Y, p.LonLat.X);
                    if (d < Distance)
                    {
                        ClosestSuburb = p;
                        Distance      = d;
                    }
                }
            }
        }