Ejemplo n.º 1
0
 protected internal MapsUIView()
 {
     NativeMap = new Mapsui.Map
     {
         BackColor = Color.Black
     };
 }
Ejemplo n.º 2
0
        public static Mapsui.Map CreateMap()
        {
            var map = new Mapsui.Map
            {
                BackColor = Mapsui.Styles.Color.Transparent,
                Home      = n => n.NavigateTo(new Mapsui.Geometries.Point(0, 0), 63000)
            };

            // OsmStreamSource source = null;
            // OsmSharp.Geo.Streams.IFeatureStreamSource features = null;
            // System.Collections.Generic.List<IFeature> features = null; ;
            NetTopologySuite.Features.FeatureCollection features = new NetTopologySuite.Features.FeatureCollection();


            // new Mapsui.Providers.MemoryProvider()
            Mapsui.Providers.IProvider source = null; // new Mapsui.Providers.MemoryProvider(features);

            Mapsui.Layers.ILayer layer = new Mapsui.Layers.MemoryLayer
            {
                Style      = null,
                DataSource = source,
                Name       = "Line"
            };

            map.Layers.Add(layer);
            return(map);
        }
Ejemplo n.º 3
0
        // https://github.com/AliFlux/VectorTileRenderer
        static void Main(string[] args)
        {
            ReadGeometryStream();
            System.Console.WriteLine("Hello World!");


            var viewport = new Mapsui.Viewport
            {
                Center     = new Mapsui.Geometries.Point(0, 0),
                Width      = 600,
                Height     = 400,
                Resolution = 63000
            };


            Mapsui.Map map = CreateMap();

            var mr = new Mapsui.Rendering.Skia.MapRenderer();

            using (System.IO.MemoryStream ms = mr.RenderToBitmapStream(viewport, map.Layers, map.BackColor))
            {
                byte[] bytes = ms.ToArray();
                System.IO.File.WriteAllBytes("GuessFileFormat.png", bytes);
            } // End Using System.IO.MemoryStream ms
        }     // End Sub Main
Ejemplo n.º 4
0
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        Mapsui.Map map2 = new Mapsui.Map();
        Mapsui.Styles.Color color2 = new Mapsui.Styles.Color();
        this.button1 = new System.Windows.Forms.Button();
        this.button2 = new System.Windows.Forms.Button();
        this.mapControl1 = new Mapsui.Forms.MapControl();
        this.SuspendLayout();
        // 
        // button1
        // 
        this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
        this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.button1.Location = new System.Drawing.Point(553, 12);
        this.button1.Name = "button1";
        this.button1.Size = new System.Drawing.Size(47, 44);
        this.button1.TabIndex = 1;
        this.button1.Text = "+";
        this.button1.UseVisualStyleBackColor = true;
        this.button1.Click += new System.EventHandler(this.button1_Click);
        // 
        // button2
        // 
        this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
        this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.button2.Location = new System.Drawing.Point(606, 12);
        this.button2.Name = "button2";
        this.button2.Size = new System.Drawing.Size(46, 44);
        this.button2.TabIndex = 2;
        this.button2.Text = "-";
        this.button2.UseVisualStyleBackColor = true;
        this.button2.Click += new System.EventHandler(this.button2_Click);
        // 
        // mapControl1
        // 
        this.mapControl1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.mapControl1.Location = new System.Drawing.Point(0, 0);
        color2.A = 255;
        color2.B = 255;
        color2.G = 255;
        color2.R = 255;
        this.mapControl1.Name = "mapControl1";
        this.mapControl1.Size = new System.Drawing.Size(664, 457);
        this.mapControl1.TabIndex = 3;
        this.mapControl1.Text = "mapControl1";
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(664, 457);
        this.Controls.Add(this.button2);
        this.Controls.Add(this.button1);
        this.Controls.Add(this.mapControl1);
        this.Name = "Form1";
        this.Text = "Form1";
        this.ResumeLayout(false);

    }
Ejemplo n.º 5
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     Mapsui.Map          map2   = new Mapsui.Map();
     Mapsui.Styles.Color color2 = new Mapsui.Styles.Color();
     this.button1     = new System.Windows.Forms.Button();
     this.button2     = new System.Windows.Forms.Button();
     this.mapControl1 = new Mapsui.Forms.MapControl();
     this.SuspendLayout();
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Font     = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button1.Location = new System.Drawing.Point(553, 12);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(47, 44);
     this.button1.TabIndex = 1;
     this.button1.Text     = "+";
     this.button1.UseVisualStyleBackColor = true;
     this.button1.Click += new System.EventHandler(this.button1_Click);
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Font     = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button2.Location = new System.Drawing.Point(606, 12);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(46, 44);
     this.button2.TabIndex = 2;
     this.button2.Text     = "-";
     this.button2.UseVisualStyleBackColor = true;
     this.button2.Click += new System.EventHandler(this.button2_Click);
     //
     // mapControl1
     //
     this.mapControl1.Dock     = System.Windows.Forms.DockStyle.Fill;
     this.mapControl1.Location = new System.Drawing.Point(0, 0);
     color2.A = 255;
     color2.B = 255;
     color2.G = 255;
     color2.R = 255;
     this.mapControl1.Name     = "mapControl1";
     this.mapControl1.Size     = new System.Drawing.Size(664, 457);
     this.mapControl1.TabIndex = 3;
     this.mapControl1.Text     = "mapControl1";
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(664, 457);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.mapControl1);
     this.Name = "Form1";
     this.Text = "Form1";
     this.ResumeLayout(false);
 }
Ejemplo n.º 6
0
        public static Mapsui.Map CreateMap()
        {
            var map = new Mapsui.Map();

            map.Layers.Add(OpenStreetMap.CreateTileLayer());
            var b = CreateMbTilesLayer(mbpath);

            if (b != null)
            {
                map.Layers.Add(b);
            }
            var c = CreateMbTilesLayer(mbpath2);

            if (c != null)
            {
                map.Layers.Add(c);
            }

            // Get the lon lat coordinates from somewhere (Mapsui can not help you there)
            var centerOfLondonOntario = new Point(-81.2497, 42.9837);
            // OSM uses spherical mercator coordinates. So transform the lon lat coordinates to spherical mercator
            var sphericalMercatorCoordinate = SphericalMercator.FromLonLat(centerOfLondonOntario.X, centerOfLondonOntario.Y);

            // Set the center of the viewport to the coordinate. The UI will refresh automatically
            // Additionally you might want to set the resolution, this could depend on your specific purpose

            map.Layers.Add(CreatePointLayer());
            map.Layers.Add(CreateLayer());
            map.Layers.Add(CreateLineStringLayer());
            map.Layers.Add(new RasterizingLayer(CreateRandomPointLayer()));//, pixelDensity: pixelDensity));
            //map.Layers.Add(CreateMbTilesLayer());

            //mapView.Map.Layers.Add(CreateLineStringLayer());

            //mapView.Map.Viewport.Center = new Mapsui.Geometries.Point(-46.4, -23.2);
            //mapView.Rotation = false;
            // mapView.UnSnapRotationDegrees = 30;
            //mapView.ReSnapRotationDegrees = 5;

            //mapView.ev += OnPinClicked;
            //mapView.MapClicked += OnMapClicked;

            //mapView.la.UpdateMyLocation(new UI.Forms.Position());

            // mapView.Info += MapView_Info;

            //var abc = Task.Run(() => StartGPS());

            //setup(mapView);

            //Clicker = c;
            map.Home = n => n.NavigateTo(sphericalMercatorCoordinate, map.Resolutions[9]);

            return(map);
        }
Ejemplo n.º 7
0
        public MapsUIView()
        {
            NativeMap           = new Mapsui.Map();
            NativeMap.BackColor = Mapsui.Styles.Color.White;

            try
            {
                SimpleIoc.Default.GetInstance <MapService>().Initialize(NativeMap);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 8
0
        public MapView()
        {
            InitializeComponent();
            var map = new Mapsui.Map
            {
                CRS            = "EPSG:3857",
                Transformation = new MinimalTransformation()
            };
            var tileLayer = new HttpTileSource(new GlobalSphericalMercator(),
                                               "https://api.maptiler.com/maps/hybrid/{z}/{x}/{y}.jpg?key=UNzmzzs5vM5fHNT7gBDM",
                                               new[] { "a", "b", "c" }, name: "OpenStreetMap",
                                               attribution: OpenStreetMapAttribution);

            map.Layers.Add(new TileLayer(tileLayer));
            map.Home = n => n.NavigateTo(SphericalMercator.FromLonLat(-2.32624, 51.37795), mapView.Map.Resolutions[14]);
            mapView.IsMyLocationButtonVisible = false;
            mapView.IsNorthingButtonVisible   = false;
            mapView.Map = map;
            mapView.MyLocationLayer.UpdateMyLocation(new Mapsui.UI.Forms.Position(51.37795, -2.32624));
            var pin = new Pin()
            {
                Position = new Position(51.38019, -2.33172),
                Label    = "Target",
            }
            ;

            pin.Callout.Anchor             = new Point(0, pin.Height * pin.Scale);
            pin.Callout.RectRadius         = 5;
            pin.Callout.ArrowHeight        = 5;
            pin.Callout.ArrowWidth         = 5;
            pin.Callout.ArrowAlignment     = 0;
            pin.Callout.ArrowPosition      = 0.5;
            pin.Callout.StrokeWidth        = 5;
            pin.Callout.BackgroundColor    = Color.Transparent;
            pin.Callout.RotateWithMap      = true;
            pin.Callout.Type               = CalloutType.Detail;
            pin.Callout.TitleFontSize      = 15;
            pin.Callout.TitleTextAlignment = TextAlignment.Center;
            pin.Callout.TitleFontColor     = Color.Black;
            mapView.Pins.Add(pin);
            pin.ShowCallout();
        }
Ejemplo n.º 9
0
 protected internal MapsUIView()
 {
     NativeMap           = new Mapsui.Map();
     NativeMap.BackColor = Color.Black; //This Color should match the map - I prefer Black over White here
 }
Ejemplo n.º 10
0
 protected internal MapsuiView()
 {
     NativeMap = new Mapsui.Map();
 }
Ejemplo n.º 11
0
 protected internal MapsUIView()
 {
     NativeMap           = new Mapsui.Map();
     NativeMap.BackColor = Color.Black; //Colour matches map (black over white here)
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     Mapsui.Map          map1   = new Mapsui.Map();
     Mapsui.Styles.Color color1 = new Mapsui.Styles.Color();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     this.button1     = new System.Windows.Forms.Button();
     this.button2     = new System.Windows.Forms.Button();
     this.mapControl1 = new Mapsui.UI.WinForms.MapControl();
     this.SampleList  = new System.Windows.Forms.FlowLayoutPanel();
     this.SuspendLayout();
     //
     // button1
     //
     this.button1.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.button1.Font     = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button1.Location = new System.Drawing.Point(753, 12);
     this.button1.Name     = "button1";
     this.button1.Size     = new System.Drawing.Size(47, 44);
     this.button1.TabIndex = 1;
     this.button1.Text     = "+";
     this.button1.UseVisualStyleBackColor = true;
     this.button1.Click += new System.EventHandler(this.button1_Click);
     //
     // button2
     //
     this.button2.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     this.button2.Font     = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     this.button2.Location = new System.Drawing.Point(806, 12);
     this.button2.Name     = "button2";
     this.button2.Size     = new System.Drawing.Size(46, 44);
     this.button2.TabIndex = 2;
     this.button2.Text     = "-";
     this.button2.UseVisualStyleBackColor = true;
     this.button2.Click += new System.EventHandler(this.button2_Click);
     //
     // mapControl1
     //
     this.mapControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                      | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
     this.mapControl1.BackColor = System.Drawing.Color.White;
     this.mapControl1.Location  = new System.Drawing.Point(199, 0);
     color1.A                  = 255;
     color1.B                  = 255;
     color1.G                  = 255;
     color1.R                  = 255;
     map1.BackColor            = color1;
     map1.CRS                  = null;
     map1.HoverInfoLayers      = ((System.Collections.Generic.IList <Mapsui.Layers.ILayer>)(resources.GetObject("map1.HoverInfoLayers")));
     map1.InfoLayers           = ((System.Collections.Generic.IList <Mapsui.Layers.ILayer>)(resources.GetObject("map1.InfoLayers")));
     map1.Lock                 = false;
     map1.Transformation       = null;
     this.mapControl1.Map      = map1;
     this.mapControl1.Name     = "mapControl1";
     this.mapControl1.Size     = new System.Drawing.Size(665, 535);
     this.mapControl1.TabIndex = 3;
     this.mapControl1.Text     = "mapControl1";
     //
     // SampleList
     //
     this.SampleList.AutoScroll    = true;
     this.SampleList.BackColor     = System.Drawing.Color.White;
     this.SampleList.Dock          = System.Windows.Forms.DockStyle.Left;
     this.SampleList.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
     this.SampleList.Location      = new System.Drawing.Point(0, 0);
     this.SampleList.Name          = "SampleList";
     this.SampleList.Size          = new System.Drawing.Size(200, 535);
     this.SampleList.TabIndex      = 5;
     this.SampleList.WrapContents  = false;
     //
     // Form1
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(864, 535);
     this.Controls.Add(this.SampleList);
     this.Controls.Add(this.button2);
     this.Controls.Add(this.button1);
     this.Controls.Add(this.mapControl1);
     this.Name = "Form1";
     this.Text = "Form1";
     this.ResumeLayout(false);
 }
Ejemplo n.º 13
0
 protected internal MapsUIView()
 {
     NativeMap           = new Mapsui.Map();
     NativeMap.BackColor = Color.Black;
 }
Ejemplo n.º 14
0
 public MapsUIView()
 {
     NativeMap           = new Mapsui.Map();
     NativeMap.BackColor = Color.Black;
 }