Exemple #1
0
        /// <summary>
        /// Creates a new OSM data layer.
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="styleInterpreter"></param>
        public LayerGraph(IRoutingAlgorithmData<Edge> dataSource, 
                                         StyleInterpreter styleInterpreter)
        {
            _dataSource = dataSource;
            _styleInterpreter = styleInterpreter;

            _scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), 16);
            _interpretedObjects = new Dictionary<int, HashSet<ArcId>>();
        }
        /// <summary>
        /// Creates a new OSM data layer.
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="styleInterpreter"></param>
        public LayerDynamicGraphLiveEdge(IBasicRouterDataSource<LiveEdge> dataSource, 
            StyleInterpreter styleInterpreter)
        {
            _dataSource = dataSource;
            _styleInterpreter = styleInterpreter;

            _scene = new Scene2D(new OsmSharp.Math.Geo.Projections.WebMercator(), 16);
            _interpretedObjects = new Dictionary<int, HashSet<ArcId>>();
        }
        /// <summary>
        /// Creates a new OSM data layer.
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="styleInterpreter"></param>
        public LayerDynamicGraphLiveEdge(IBasicRouterDataSource<LiveEdge> dataSource, 
            StyleInterpreter styleInterpreter)
        {
            _dataSource = dataSource;
            _styleInterpreter = styleInterpreter;

            this.Scene = new Scene2DSimple();
            _interpretedObjects = new Dictionary<int, HashSet<ArcId>>();
            this.Cache = false;
        }
Exemple #4
0
        /// <summary>
        /// Creates a new OSM data layer.
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="styleInterpreter"></param>
        /// <param name="projection"></param>
        public LayerOsm(IDataSourceReadOnly dataSource, StyleInterpreter styleInterpreter, IProjection projection)
        {
            // build the zoom-level cutoffs.
            List<float> zoomFactors = new List<float>();
            zoomFactors.Add(16);
            zoomFactors.Add(14);
            zoomFactors.Add(12);
            zoomFactors.Add(10);

            _dataSource = dataSource;
            _styleSceneManager = new StyleSceneManager(styleInterpreter, projection, zoomFactors);
        }
Exemple #5
0
        /// <summary>
        /// Creates a new style scene manager.
        /// </summary>
        /// <param name="scene">The scene to manage.</param>
        /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
        public StyleSceneManager(Scene2D scene,
            StyleInterpreter interpreter)
        {
            _scene = scene;
            _interpreter = interpreter;

            _interpretedNodes = new LongIndex();
            _interpretedWays = new LongIndex();
            _interpretedRelations = new LongIndex();

            SimpleColor? color = _interpreter.GetCanvasColor();
            //this.Scene.BackColor = color.HasValue ? color.Value.Value : SimpleColor.FromArgb(0, 255, 255, 255).Value;
        }
        /// <summary>
        /// Creates a new style scene manager.
        /// </summary>
        /// <param name="scene">The scene to manage.</param>
        /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
        public StyleSceneManager(Scene2D scene,
                                 StyleInterpreter interpreter)
        {
            _scene       = scene;
            _interpreter = interpreter;

            _interpretedNodes     = new LongIndex();
            _interpretedWays      = new LongIndex();
            _interpretedRelations = new LongIndex();

            SimpleColor?color = _interpreter.GetCanvasColor();
            //this.Scene.BackColor = color.HasValue ? color.Value.Value : SimpleColor.FromArgb(0, 255, 255, 255).Value;
        }
Exemple #7
0
        /// <summary>
        /// Creates a new OSM data layer.
        /// </summary>
        /// <param name="dataSource"></param>
        /// <param name="styleInterpreter"></param>
        public LayerOsm(IDataSourceReadOnly dataSource, StyleInterpreter styleInterpreter, IProjection projection)
        {
            // build the zoom-level cutoffs.
            List<float> zoomLevelCutoffs = new List<float>();
            zoomLevelCutoffs.Add((float)projection.ToZoomFactor(18));
            //zoomLevelCutoffs.Add((float)projection.ToZoomFactor(16));
            //zoomLevelCutoffs.Add((float)projection.ToZoomFactor(14));
            //zoomLevelCutoffs.Add((float)projection.ToZoomFactor(12));
            //zoomLevelCutoffs.Add((float)projection.ToZoomFactor(10));
            //zoomLevelCutoffs.Add((float)projection.ToZoomFactor(8));
            zoomLevelCutoffs.Add((float)projection.ToZoomFactor(0));

            _dataSource = dataSource;
            _styleSceneManager = new StyleSceneManager(styleInterpreter, zoomLevelCutoffs);
            //_styleSceneManager = new StyleSceneManager(styleInterpreter);
        }
Exemple #8
0
 /// <summary>
 /// Adds a graph layer with the given data and style.
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="styleInterpreter"></param>
 /// <returns></returns>
 public LayerGraph AddLayerGraph(IRoutingAlgorithmData<Edge> dataSource,
     StyleInterpreter styleInterpreter)
 {
     var layerGraph = new LayerGraph(dataSource, styleInterpreter);
     this.AddLayer(layerGraph);
     return layerGraph;
 }
Exemple #9
0
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 public StyleSceneManager(StyleInterpreter interpreter, List <float> zoomLevelCutoffs) : this(
         new Scene2DLayered(zoomLevelCutoffs), interpreter)
 {
 }
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 public StyleSceneManager(StyleInterpreter interpreter)
     : this(new Scene2DSimple(), interpreter)
 {
 }
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 public StyleSceneManager(StyleInterpreter interpreter, List<float> zoomLevelCutoffs)
     : this(new Scene2DLayered(zoomLevelCutoffs), interpreter)
 {
 }
Exemple #12
0
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 /// <param name="zoomLevels"></param>
 public StyleSceneManager(StyleInterpreter interpreter, IProjection projection, List<float> zoomLevels)
     : this(new Scene2D(projection, zoomLevels), interpreter) { }
Exemple #13
0
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 /// <param name="zoomLevels"></param>
 public StyleSceneManager(StyleInterpreter interpreter, IProjection projection, List <float> zoomLevels)
     : this(new Scene2D(projection, zoomLevels), interpreter)
 {
 }
Exemple #14
0
        internal LayerOsm AddLayerOsm(IDataSourceReadOnly dataSource, StyleInterpreter interpreter = null)
        {
            var osmLayer = _map.AddLayerOsm(dataSource, interpreter ?? DefaultInterpreter);

            if (Center == null && dataSource.BoundingBox != null)
            {
                Center = dataSource.BoundingBox.Center;
            }

            return osmLayer;
        }
        /// <summary>
        /// Builds a rendering instance.
        /// </summary>
        /// <param name="streamSource">Source data.</param>
        /// <param name="interpreter">The style interpreter.</param>
        /// <returns></returns>
        public static RenderingInstance Build(OsmStreamSource streamSource, StyleInterpreter interpreter)
        {
            var instance = new RenderingInstance();

            // load data into memory.
            var dataSource = MemoryDataSource.CreateFrom(streamSource);

            // add layer to map.
            instance.Map.AddLayer(new LayerOsm(dataSource, interpreter, instance.Map.Projection));

            return instance;
        }
Exemple #16
0
 ///// <summary>
 ///// Adds a new scene layer with the given primitives source as it's source.
 ///// </summary>
 ///// <param name="scene"></param>
 ///// <returns></returns>
 //public LayerScene AddLayerScene(IScene2DPrimitivesSource scene)
 //{
 //    LayerScene layerScene = new LayerScene(scene);
 //    this.AddLayer(layerScene);
 //    return layerScene;
 //}
 /// <summary>
 /// Adds a graph layer with the given data and style.
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="styleInterpreter"></param>
 /// <returns></returns>
 public LayerDynamicGraphLiveEdge AddLayerGraph(IBasicRouterDataSource<LiveEdge> dataSource,
     StyleInterpreter styleInterpreter)
 {
     LayerDynamicGraphLiveEdge layerGraph = new LayerDynamicGraphLiveEdge(dataSource, styleInterpreter);
     this.AddLayer(layerGraph);
     return layerGraph;
 }
Exemple #17
0
 /// <summary>
 /// Adds a layer displaying osm data from a given data source using the given style.
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="styleInterpreter"></param>
 /// <returns></returns>
 public LayerOsm AddLayerOsm(IDataSourceReadOnly dataSource, StyleInterpreter styleInterpreter)
 {
     LayerOsm layerOsm = new LayerOsm(dataSource, styleInterpreter, this.Projection);
     this.AddLayer(layerOsm);
     return layerOsm;
 }
Exemple #18
0
 /// <summary>
 /// Creates a new style scene manager.
 /// </summary>
 /// <param name="interpreter">The intepreter converting OSM-objects into scene-objects.</param>
 public StyleSceneManager(StyleInterpreter interpreter)
     : this(new Scene2DSimple(), interpreter)
 {
 }