public static Map PointsWithBitmapRotatedAndOffset() { var map = new Map { Viewport = { Center = new Point(80, 80), Width = 200, Height = 200, Resolution = 1 } }; var layer = new MemoryLayer { DataSource = Utilities.CreateProviderWithRotatedBitmapSymbols(), Name = "Points with rotated bitmaps", Style = null }; map.Layers.Add(layer); return map; }
public static Map PointsWithBitmapSymbols() { var map = new Map { Viewport = { Center = new Point(100, 100), Width = 200, Height = 200, Resolution = 1 } }; var layer = new MemoryLayer { Style = null, DataSource = Utilities.CreateProviderWithPointsWithSymbolStyles(), Name = "Points with bitmaps" }; map.Layers.Add(layer); return map; }
private static MemoryLayer CreateRandomPointLayer() { var provider = new MemoryProvider(); var rnd = new Random(); for (var i = 0; i < 100; i++) { var feature = new Feature { Geometry = new Geometries.Point(rnd.Next(0, 5000000), rnd.Next(0, 5000000)) }; provider.Features.Add(feature); } var layer = new MemoryLayer {DataSource = provider}; return layer; }
public static Map PointsWithDifferentSymbolTypes() { var map = new Map { Viewport = { Center = new Point(0, 0), Width = 200, Height = 100, Resolution = 0.5 } }; var features = new Features { Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Ellipse}), Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Rectangle}) }; var layer = new MemoryLayer { DataSource = new MemoryProvider(features), Name = "Points with different symbol types" }; map.Layers.Add(layer); return map; }
public static MemoryLayer CreateLayer() { var geodanAmsterdam = new Geometries.Point(122698, 483922); var geodanDenBosch = new Geometries.Point(148949, 411446); var imageStream = EmbeddedResourceLoader.Load("Images.location.png", typeof(GeodanOfficesSample)); var layer = new MemoryLayer { DataSource = new MemoryProvider(new[] {geodanAmsterdam, geodanDenBosch}), Style = new SymbolStyle { BitmapId = BitmapRegistry.Instance.Register(imageStream), SymbolOffset = new Offset {Y = 64}, SymbolScale = 0.25 }, CRS = "EPSG:28992", Name = "Geodan Offices" }; return layer; }
private static ILayer CreatePolygonLayer() { var layer = new MemoryLayer {Name = PolygonLayerName}; var provider = new MemoryProvider(); var feature = new Feature { Geometry = new Polygon(new LinearRing(new[] { new Point(1000000, 1000000), new Point(1000000, -1000000), new Point(-1000000, -1000000), new Point(-1000000, 1000000), new Point(1000000, 1000000) })), ["Name"] = "Polygon 1" }; provider.Features.Add(feature); layer.DataSource = provider; return layer; }
public static Map CreateMap() { var map = new Map { BackColor = Color.Transparent, Viewport = { Center = new Point(0, 0), Width = 600, Height = 400, Resolution = 63000 } }; var layer = new MemoryLayer { DataSource = CreatePolygonProvider(), Name = "Polygon" }; map.Layers.Add(layer); return map; }
public static Map CreateMap() { var map = new Map { BackColor = Color.Transparent, Viewport = { Center = new Point(80, 80), Width = 200, Height = 200, Resolution = 1 } }; var layer = new MemoryLayer { DataSource = CreateProviderWithRotatedBitmapSymbols(), Name = "Points with rotated bitmaps", Style = null }; map.Layers.Add(layer); return map; }
public static Map CreateMap() { var features = new Features { CreateFeature(-20, 0, UnitType.Pixel), CreateFeature(20, 0, UnitType.WorldUnit) }; var layer = new MemoryLayer { Style = null, DataSource = new MemoryProvider(features), Name = "Points in world units" }; var map = new Map { BackColor = Color.Transparent, Viewport = {Center = new Point(0, 0), Width = 200, Height = 100, Resolution = 0.5} }; map.Layers.Add(layer); return map; }
private static ILayer CreateMutatingTriangleLayer(BoundingBox envelope) { var layer = new MemoryLayer(); var polygon = new Polygon(new LinearRing(GenerateRandomPoints(envelope, 3))); var feature = new Feature() { Geometry = polygon }; var features = new Features(); features.Add(feature); layer.DataSource = new MemoryProvider(features); PeriodicTask.Run(() => { polygon.ExteriorRing = new LinearRing(GenerateRandomPoints(envelope, 3)); // Clear cache for change to show feature.RenderedGeometry.Clear(); // Trigger DataChanged notification layer.ViewChanged(true, layer.Envelope, 1); }, TimeSpan.FromMilliseconds(1000)); return layer; }
private void GenerateLayers(List <Helper.SvgLayer> layers) { List <Task> layerLoadTasks = new List <Task>(); int terrainWidth = 0; foreach (var svgLayer in layers) { var layer = new Mapsui.Layers.MemoryLayer(svgLayer.name); if ( svgLayer.name == "forests" || svgLayer.name == "countLines" || svgLayer.name == "rocks" || svgLayer.name == "grid" ) { layer.Enabled = false; if (System.Environment.OSVersion.Platform == PlatformID.Unix) //Android { continue; } } terrainWidth = svgLayer.width; currentBounds = new Mapsui.Geometries.BoundingBox(0, 0, terrainWidth, terrainWidth); var features = new Features(); var feature = new Feature { Geometry = new BoundBox(currentBounds), ["Label"] = svgLayer.name }; var x = new SvgStyle { image = new Svg.Skia.SKSvg() }; layerLoadTasks.Add( Task.Run(() => { using (var stream = svgLayer.content.GetStream()) { x.image.Load(stream); } })); feature.Styles.Add(x); features.Add(feature); // layer.DataSource = new MemoryProvider(features); MapControl.Map.Layers.Add(layer); } Task.WaitAll(layerLoadTasks.ToArray()); //var layer = new Mapsui.Layers.ImageLayer("Base"); //layer.DataSource = CreateMemoryProviderWithDiverseSymbols(); //MapControl.Map.Layers.Add(layer); MapControl.Map.Limiter = new ViewportLimiter(); MapControl.Map.Limiter.PanLimits = new Mapsui.Geometries.BoundingBox(0, 0, terrainWidth, terrainWidth); MapControl.Map.Limiter.ZoomLimits = new MinMax(0.01, 10); GPSTrackerLayer.IsMapInfoLayer = true; GPSTrackerLayer.DataSource = new GPSTrackerProvider(GPSTrackerLayer, currentBounds); GPSTrackerLayer.Style = null; // remove white circle https://github.com/Mapsui/Mapsui/issues/760 MapControl.Map.Layers.Add(GPSTrackerLayer); GPSTrackerLayer.DataChanged += (a, b) => MapControl.RefreshData(); // ^ without this create/delete only updates when screen is moved MapMarkersLayer.IsMapInfoLayer = true; MapMarkersLayer.DataSource = new MapMarkerProvider(MapMarkersLayer, currentBounds, MarkerVisibilityManager); MapMarkersLayer.Style = null; // remove white circle https://github.com/Mapsui/Mapsui/issues/760 MapControl.Map.Layers.Add(MapMarkersLayer); MapMarkersLayer.DataChanged += (a, b) => MapControl.RefreshData(); // ^ without this create/delete only updates when screen is moved //LayerList.Initialize(MapControl.Map.Layers); //MapControl.ZoomToBox(new Point(0, 0), new Point(8192, 8192)); MapControl.Navigator.ZoomTo(1, 0); }
public static Map Polygon() { var map = new Map { Viewport = { Center = new Point(0, 0), Width = 600, Height = 400, Resolution = 63000 } }; var layer = new MemoryLayer { DataSource = Utilities.CreatePolygonProvider(), Name = "Polygon" }; map.Layers.Add(layer); return map; }
public static Map PointsWithWorldUnits() { var map = new Map { Viewport = { Center = new Point(0, 0), Width = 200, Height = 100, Resolution = 0.5 } }; var features = new Features { Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {UnitType = UnitType.Pixel}), Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {UnitType = UnitType.WorldUnit}) }; var layer = new MemoryLayer { DataSource = new MemoryProvider(features), Name = "Points in world units"}; map.Layers.Add(layer); return map; }
public static Map Line() { var map = new Map { Viewport = { Center = new Point(0, 0), Width = 600, Height = 400, Resolution = 63000 } }; var layer = new MemoryLayer { Style = null, DataSource = Utilities.CreateLineProvider(), Name = "Line" }; map.Layers.Add(layer); return map; }