Beispiel #1
0
 private static XElement GetRandomStyle(GSection sec)
 {
     return new XElement("Style",
         new XAttribute("id", GetStyleName(sec)),
         new XElement("LineStyle",
             new XElement("color", "ff" + colors[idx = (idx + 1) % colors.Count] ),
             new XElement("width", 3)));
 }
Beispiel #2
0
 private static IEnumerable<GSection> LoadSections(Stream str, int PostsCount)
 {
     int pc = 0;
     while (pc < PostsCount)
     {
         var sec = new GSection() { Posts = LoadPosts(str).ToList() };
         pc += sec.Posts.Count;
         yield return sec;
     }
 }
Beispiel #3
0
        private static IEnumerable <GSection> LoadSections(Stream str, int PostsCount)
        {
            int pc = 0;

            while (pc < PostsCount)
            {
                var sec = new GSection()
                {
                    Posts = LoadPosts(str).ToList()
                };
                pc += sec.Posts.Count;
                yield return(sec);
            }
        }
Beispiel #4
0
 private static String GetStyleName(GSection sec)
 {
     return string.Format("section{0}", sec.GetHashCode().ToString());
 }
Beispiel #5
0
        private static IEnumerable<PositionedGObject> PositeObjects(GSection sec, GPost post)
        {
            GPost p2 = sec.Posts
                        .Where(pp =>   (int)post.Direction * (post.Ordinate - pp.Ordinate) > 0)
                        .OrderBy(pp => (int)post.Direction * (post.Ordinate - pp.Ordinate)).FirstOrDefault();

            if (p2 == null) yield break;

            double l = post.Point.DistanceTo(p2.Point);
            foreach (var o in post.Tracks.First().Objects)
            {
                double ratio = (o.Ordinate - post.Ordinate) / l;
                var o_point =
                    new EarthPoint(
                        (1 - ratio) * post.Point.Latitude  + ratio * p2.Point.Latitude,
                        (1 - ratio) * post.Point.Longitude + ratio * p2.Point.Longitude);
                yield return new PositionedGObject() { Object = o, Point = o_point };
            }
        }