Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Native.Initialize();

            // enable logging and use the console as output.
            OsmSharp.Logging.Log.Enable();
            OsmSharp.Logging.Log.RegisterListener(
                new OsmSharp.WinForms.UI.Logging.ConsoleTraceListener());

            // initialize mapcss interpreter.
            var mapCSSInterpreter = new MapCSSInterpreter(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Service.Tiles.Sample.SelfHost.custom.mapcss"),
                new MapCSSDictionaryImageSource());

            var scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List <float>(new float[] {
                16, 14, 12, 10
            }));
            var target = new StyleOsmStreamSceneTarget(
                mapCSSInterpreter, scene, new WebMercator());
            var source = new PBFOsmStreamSource(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Service.Tiles.Sample.SelfHost.kempen.osm.pbf"));
            var progress = new OsmStreamFilterProgress();

            progress.RegisterSource(source);
            target.RegisterSource(progress);
            target.Pull();

            var merger = new Scene2DObjectMerger();

            scene = merger.BuildMergedScene(scene);

            // create a new instance (with a cache).
            var instance = new RenderingInstance();

            instance.Map.AddLayer(new LayerScene(scene));

            // add a default test instance.
            ApiBootstrapper.AddInstance("default", instance);

            // start hosting this!
            using (var host = new NancyHost(new Uri("http://*****:*****@ http://localhost:1234");
                System.Diagnostics.Process.Start("http://localhost:1234/default");
                Console.ReadLine();
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            Native.Initialize();

            // enable logging and use the console as output.
            OsmSharp.Logging.Log.Enable();
            OsmSharp.Logging.Log.RegisterListener(
                new OsmSharp.WinForms.UI.Logging.ConsoleTraceListener());

            // initialize mapcss interpreter.
            var mapCSSInterpreter = new MapCSSInterpreter(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Service.Tiles.Sample.SelfHost.custom.mapcss"),
                new MapCSSDictionaryImageSource());

            var scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), new List<float>(new float[] {
                16, 14, 12, 10 }));
            var target = new StyleOsmStreamSceneTarget(
                mapCSSInterpreter, scene, new WebMercator());
            var source = new PBFOsmStreamSource(
                Assembly.GetExecutingAssembly().GetManifestResourceStream("OsmSharp.Service.Tiles.Sample.SelfHost.kempen.osm.pbf"));
            var progress = new OsmStreamFilterProgress();
            progress.RegisterSource(source);
            target.RegisterSource(progress);
            target.Pull();

            var merger = new Scene2DObjectMerger();
            scene = merger.BuildMergedScene(scene);

            // create a new instance (with a cache).
            var instance = new RenderingInstance();
            instance.Map.AddLayer(new LayerScene(scene));

            // add a default test instance.
            ApiBootstrapper.AddInstance("default", instance);

            // start hosting this!
            using (var host = new NancyHost(new Uri("http://*****:*****@ http://localhost:1234");
                System.Diagnostics.Process.Start("http://localhost:1234/default");
                Console.ReadLine();
            }
        }