예제 #1
0
        public void CanCalculateLatDistance()
        {
            double dist = GeoTools.LatDistance(lat - 1, lat);

            Assert.AreEqual(GeoTools.NauticalMile * -60, dist);

            dist = GeoTools.LatDistance(lat + 1, lat);
            Assert.AreEqual(GeoTools.NauticalMile * 60, dist);

            double leftTopLat = GeoTools.DistanceToLat(lat, -MapSize / 2);

            dist = GeoTools.LatDistance(leftTopLat, lat);
            Assert.AreEqual(-MapSize / 2, dist, 0.01);
        }
예제 #2
0
        protected virtual void AddSegmentToTrack(Track track, Segment segment)
        {
            foreach (Osm.Node node in segment.Nodes)
            {
                int x = (int)GeoTools.LonDistance(node.Lon, lon, lat);
                int y = (int)GeoTools.LatDistance(node.Lat, lat);

                // do not add segments that are outside the map
                if (!OnMap(x, y))
                {
                    // TODO: try to make outside connection
                    continue;
                }

                track.Nodes.Add(CreateNode(track, segment, node, x, y));
            }
        }