Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all 3384 articles
Browse latest View live

New Post: Short title inside a marker instead of a tooltip

$
0
0
Thank you very much for providing this map functionality, I like it very much.

Are there a way to add a very short "Title" to a marker, basically just a short number, t be shown directly over or inside the marker.

Today I'm using a tooltip for this with the MarkerTooltipMode set to Always, but it is not a particular pretty solution.

Thanks in advance

New Post: Short title inside a marker instead of a tooltip

$
0
0
you can make custom marker or custom tooltip

New Post: Short title inside a marker instead of a tooltip

$
0
0
hello,

could be a solution:
This is a cross with your text.

public class GMapMarker_Text : GMapMarker
{

    private Pen Pen = new Pen(Brushes.Blue, 3);
    private Brush FillBrush;

    private int drawingSize;
    private string _Name;
    //
    private string _yourText;


    private PointLatLng _p;
    public string Name {
        get { return _Name; }
    }




    public GMapMarker_Text(PointLatLng p, string Name, string yourText) : base(p)
    {

        _p = p;
        _Name = Name;
        _yourText = yourText;

        Size = new System.Drawing.Size(5, 5);
        Offset = new System.Drawing.Point(0, 0);

    }

    public override void OnRender(Graphics g)
    {
        drawingSize = 10;

        Position = _p;

        System.Drawing.Point p1 = new System.Drawing.Point(LocalPosition.X, LocalPosition.Y);
        p1.Offset(0, -drawingSize);
        System.Drawing.Point p2 = new System.Drawing.Point(LocalPosition.X, LocalPosition.Y);
        p2.Offset(0, drawingSize);

        System.Drawing.Point p3 = new System.Drawing.Point(LocalPosition.X, LocalPosition.Y);
        p3.Offset(-drawingSize, 0);
        System.Drawing.Point p4 = new System.Drawing.Point(LocalPosition.X, LocalPosition.Y);
        p4.Offset(drawingSize, 0);

        g.DrawLine(Pen, p1.X, p1.Y, p2.X, p2.Y);
        g.DrawLine(Pen, p3.X, p3.Y, p4.X, p4.Y);


        Font drawFont = new Font("Arial", 10);
        Pen OutlinePen = new Pen(Color.FromArgb(255, Color.Magenta), 2);

        g.DrawString(_yourText.ToString() + " km/h", drawFont, OutlinePen.Brush, LocalPosition.X + 4, LocalPosition.Y);

    }

}

New Post: Read Speed attribute from trackpoint

$
0
0
Hello

I have a problem getting the speed at a track/waypoint when importing from a GPX file. It seems that the wptType has no definition of speed, which is a part of GPX right?

Does anyone have an idea how I can get the speeds from my GPX file after deserializing? I can get elevation, lat and lon etc. but no speed.

Thanks
Z

New Post: Read Speed attribute from trackpoint

$
0
0
http://forum.locusmap.eu/index.php?topic=3426.0

"Speed was a tag in gpx 1.0 but removed with gpx 1.1. It was removed because you can calculate speed by the given coordinates.."

speed = distance / time; // distance is calculated using map.MapPrpvider.Projection.GetDistance

...anyway you can try modify gpx.cs and add this tag back

New Comment on "How to generate static map image"

New Post: Short title inside a marker instead of a tooltip

$
0
0
Thank you very much, I used RobbeEDE example of overloading the marker.

I also managed to change the cross to an elipse, and add the text inside the elipse, so now it looks really great.

I only have one problem left, which I can't solve on my own, since I'm pretty new to overloading, delegates etc.

Normally I use an eventHandler for handling the marker click event like below:
private void gmap_OnMarkerClick(GMapMarker item, MouseEventArgs e)
{
....
}

But on my overloaded class called GMapMarker_Text I have added a property called MyTag, and I would like to get that back when clicking on a marker.
So therefore I changed my OnMarkerClick eventHandler to the following:

private void gmap_OnMarkerClick(GMapMarker_Text item, MouseEventArgs e)

Then I get the following error message:
"No overload for 'gmap_OnMarkerClick' matches delegate 'GMap.NET.WindowsForms.MarkerClick'"

How do I overload this eventhandler or delegate or whatever it is?


Here is my overloaded GMapMarker class:
public class GMapMarker_Text : GMapMarker
{
    private Pen Pen = new Pen(Brushes.Blue, 3);
    private Brush FillBrush = new SolidBrush(Color.Blue);
    private int circleHeight;
    private int circleWidth;
    private string _MyTag;
    private string _markerTitle;
    private PointLatLng _p;
    public string MyTag
    {
        get { return _MyTag; }
    }


    public GMapMarker_Text(PointLatLng p, string MyTag, string markerTitle) : base(p) //Constructor
    {
        _p = p;
        _MyTag = MyTag;
        _markerTitle = markerTitle;
        Size = new System.Drawing.Size(5, 5);
        Offset = new System.Drawing.Point(0, 0);
    }

    public override void OnRender(Graphics g)
    {
        circleHeight = 24;
        circleWidth = 24;
        g.FillEllipse(FillBrush, LocalPosition.X - circleWidth / 2, LocalPosition.Y - circleHeight / 2, circleWidth, circleHeight);

        Font drawFont = new Font("Arial", 11);
        Pen OutlinePen = new Pen(Color.FromArgb(255, Color.White), 5);
        g.DrawString(_markerTitle, drawFont, OutlinePen.Brush, LocalPosition.X - 6, LocalPosition.Y - 8);
    }        
}

New Post: Short title inside a marker instead of a tooltip

$
0
0
private void gmap_OnMarkerClick(GMapMarker item, MouseEventArgs e) 
{ 
  var myMarker = item as GMapMarker_Text;
  // ...
} 

New Post: Short title inside a marker instead of a tooltip

$
0
0
Thanks a lot, now it works like a charm

New Post: Add a heatmap as a layer to a map based on OpenStreetMap from C# WPF Visual Studio 2013

$
0
0
This question is related to my previous question. Currently, I just need to show a map with some less points of a heatmap on a map based on OpenStreetMap (OSM) .

I have created a heatmap as a bitmap image by GHEAT.NET control lib http://www.codeproject.com/Articles/88956/GHeat-NET.

I would like to add the heatmap image to a map based on OSM so that the points on the heatmap can be shown on the correct locations by latitude/longitude on the map of OSM.

I am working on C# VS2013 WPF. In my C# code, I used OSM control lib GMAP.NET at:

http://greatmaps.codeplex.com/

This is my C# code:
System.Drawing.Bitmap myCanvasImage = new System.Drawing.Bitmap(12 * 256 - (2 * 256), 15 * 256 - (5 * 256), System.Drawing.Imaging.PixelFormat.Format32bppArgb)
System.Drawing.Graphics g = Graphics.FromImage(myCanvasImage);
gheat.PointManager myPoints = new gheat.PointManager();
var xrange = Enumerable.Range(2, 12);
var yrange = Enumerable.Range(5, 15);
foreach (int x in xrange)
{
foreach (int y in yrange)
{
   System.Drawing.Bitmap tempImage = gheat.GHeat.GetTile(myPoints, "classic", zoom, x, y);
   g.DrawImage(tempImage, new System.Drawing.PointF(x * 256 - (2* 256), y * 256 - (5 * 256)));
}
}

I need to add the "myCanvasImage" to a map based on OSM.

I have checked this

http://www.independent-software.com/gmap-net-tutorial-maps-markers-and-polygons/

But, there is no "GMapOverLayer" class in GMAP.NET WPF.

Any help would be appreciated.
__

Source code checked in, #132a081e7742

$
0
0
Demo.WindowsForms: kmz export for static image

Updated Release: Hot Build (May 26, 2015)

Updated Release: Hot Build (Oct 09, 2015)

Source code checked in, #464b20bfe692

Updated Release: Hot Build (Oct 09, 2015)


Updated Release: Hot Build (Oct 09, 2015)

Updated Release: Hot Build (Oct 09, 2015)

Released: Hot Build (Oct 09, 2015)

Updated Release: Hot Build (Oct 09, 2015)

New Post: from C# WPF add a heatmap jpeg file as a layer to a map based on OpenStreetMap

$
0
0
I used GHEAT.NET (http://www.codeproject.com/Articles/88956/GHeat-NET) to generate a heatmap as a jpeg file. I need to add it as a layer to the map based on OpenStreetMap. (openstreetmap.com)

And, also the heatmap layer can be zoomed in/out as I zoom in/out the map.

I found the C# code from

https://msdn.microsoft.com/en-us/library/microsoft.maps.mapcontrol.wpf.maptilelayer.aspx

But, it is for microsoft.maps.mapcontrol.wpf not for GMAP.NET at https://greatmaps.codeplex.com/
private void AddTileOverlay()
{

    // Create a new map layer to add the tile overlay to.
    tileLayer = new MapTileLayer();

    // The source of the overlay.
    TileSource tileSource = new TileSource();
    tileSource.UriFormat = "{UriScheme}://ecn.t0.tiles.virtualearth.net/tiles/r{quadkey}.jpeg?g=129&mkt=en-us&shading=hill&stl=H";

    // Add the tile overlay to the map layer
    tileLayer.TileSource=tileSource;

    // Add the map layer to the map
    if (!MapTileOverlay.Children.Contains(tileLayer))  // in **GMAP.NET WPF, there is no definition for "MapTileOverlay"**
    {
        MapTileOverlay.Children.Add(tileLayer);
    }
    tileLayer.Opacity = tileOpacity;
}
Any help would be appreciated.
Viewing all 3384 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>