Reputation: 832
Can I display my own pattern/color background in GMap.NET in case that there is not any map available and display all the markers on it?
Perticullary I would like to provide to the user a net of circle of longitude and meridians (with some background) and allow him to work with points and polygons. Then, if the maps would be available, display his places on a usual map.
Upvotes: 0
Views: 1063
Reputation: 502
Are you willing to modify the source code of the GMap.net control? If so, take a look at the method in the GMapCpntrol class:
void DrawMap(Graphics g)
{
if (Core.updatingBounds || MapProvider == EmptyProvider.Instance || MapProvider == null)
{
Debug.WriteLine("Core.updatingBounds");
return;
}
...
}
Inside this method you will find the portion that draws the missing tile information:
if (!found) //if the tiles are NOT found
{
lock (Core.FailedLoads)
{
var lt = new LoadTask(tilePoint.PosXY, Core.Zoom);
if (Core.FailedLoads.ContainsKey(lt))
{
var ex = Core.FailedLoads[lt];
//This is where you would handle what to do when your tiles are not available
g.FillRectangle(EmptytileBrush, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height));
g.DrawString("Exception: " + ex.Message, MissingDataFont, Brushes.Red, new RectangleF(Core.tileRect.X + 11, Core.tileRect.Y + 11, Core.tileRect.Width - 11, Core.tileRect.Height - 11));
g.DrawString(EmptyTileText, MissingDataFont, Brushes.Blue, new RectangleF(Core.tileRect.X, Core.tileRect.Y, Core.tileRect.Width, Core.tileRect.Height), CenterFormat);
g.DrawRectangle(EmptyTileBorders, (int)Core.tileRect.X, (int)Core.tileRect.Y, (int)Core.tileRect.Width, (int) Core.tileRect.Height);
}
}
}
If you do not want to modify the source your only option is to add an overlay and draw everything on this, such as the polygons, and lines to use for the lat long net. You will also need to change these properties to something appropriate:
gMapControl1.EmptyMapBackground
gMapControl1.EmptyTileBorders
gMapControl1.EmptyTileColor
gMapControl1.EmptyTileText
As for determining IF you have tiles or not, I don't believe there is an easy way without modifying the source.
Upvotes: 1