Exemplo n.º 1
0
        public FeatureCacheController(TopologyMap map)
        {
            var polyFeatures = new List <Feature>();
            var lineFeatures = new List <Feature>();

            Debug.WriteLine("Generating FeatureObject");
            var sw = Stopwatch.StartNew();

            for (var i = 0; i < map.Arcs.Length; i++)
            {
                lineFeatures.Add(new Feature(map, i));
            }

            Debug.WriteLine("LineFeature: " + sw.ElapsedMilliseconds + "ms");

            LineFeatures = lineFeatures.ToArray();

            sw.Restart();

            foreach (var i in map.Polygons)
            {
                polyFeatures.Add(new Feature(map, LineFeatures, i));
            }

            Debug.WriteLine("PolyFeature: " + sw.ElapsedMilliseconds + "ms");

            polyFeatures.AddRange(LineFeatures);
            Features = polyFeatures.ToArray();
        }
Exemplo n.º 2
0
        public static Location[] ToLocations(this IntVector[] points, TopologyMap map)
        {
            var    result = new Location[points.Length];
            double x      = 0;
            double y      = 0;

            for (var i = 0; i < result.Length; i++)
            {
                result[i] = new Location((float)((x += points[i].X) * map.Scale.X + map.Translate.X), (float)((y += points[i].Y) * map.Scale.Y + map.Translate.Y));
            }
            return(result);
        }
Exemplo n.º 3
0
 public Feature(TopologyMap map, int index)
 {
     Type     = map.Arcs[index].IsCoastline ? FeatureType.Coastline : FeatureType.AdminBoundary;         //map.Polygons.Count(p => p.Arcs.Any(i => (i < 0 ? Math.Abs(i) - 1 : i) == index)) > 1 ? FeatureType.AdminBoundary : FeatureType.Coastline;
     Points   = map.Arcs[index].Arc.ToLocations(map);
     IsClosed =
         Math.Abs(Points[0].Latitude - Points[^ 1].Latitude) < 0.001 &&