Copyright associated to MapProvider

Topics: WPF
Dec 6, 2012 at 3:29 AM

Hi Radioman!


I need change or hide the Copyright associated to the MapProvider object. I saw that each Provider changes the Copyright of the GMapProvider class, but this property can be changed from outside?


I tried doing as:


GMapControl map= new GMapControl()
....
map.MapProvider = GMapProviders.BingMap;

map.MapProvider.Copyright = String.Empty.


but it not worked :(


Thanks

 

 


Dec 6, 2012 at 11:37 AM

change the string before creating control instance

Dec 6, 2012 at 4:58 PM

Oh, excelent!! It worked fine ;)

Other question, I have a Thread where this gets the Lat and Lng values of the GPS. In each update I change the Position of the GMapControl, as:

     map.Position = new PointLatLng(latitud, longitud)

but, if you previously change the current position dragging with the mouse, this position is lost by the update of the Thread. I need to change the position, for loading the initial map, but I want to keep the position of the drag on the map. It is feasible?


Dec 6, 2012 at 5:06 PM

don't update while map.IsDragging == true

Dec 6, 2012 at 5:42 PM

mmm, Yes but the problem is when you release the dragging. 

What I did the first time set starting position, to load the map, and then only update the marker, as:

this.MainMap.Markers[0].Position = new PointLatLng(latitude, longitude).

This way, I could move on the map and not lose position because only the the marker is updated. Makes sense?

What happened to me with this approach is that the first values sent by the GPS was incorrect, then the map loaded initially was not correct. In this case, you seem correct to compare the distances (Lat, Lng) sent by the GPS with the above of the GMapControl? If the distance is quite, set the position for which I load a new map. 

What do you think?

Dec 6, 2012 at 6:10 PM

well you can skip position updates until hdof > 10, or something..

Dec 6, 2012 at 6:26 PM
radioman wrote:

well you can skip position updates until hdof > 10, or something..

maybe ;)

Sorry, another question. The map performs some internal update? because I disconnect the network cable and the app is frozen. I have this code:

if (!isNetworkLikelyAvailable())
{
MainMap.Manager.Mode = AccessMode.CacheOnly;
MainMap.MapProvider = GMapProviders.EmptyProvider; return; }
else
{
MainMap.MapProvider = GMapProviders.BingMap; 
MainMap.Manager.Mode = AccessMode.ServerAndCache;
}

private bool isNetworkLikelyAvailable()
{
try {
string myAddress = "www.google.com";
IPAddress[] addresslist = Dns.GetHostAddresses(myAddress);
return addresslist[0].ToString().Length > 6; }
catch { return false; }
}

but not worked. Any suggestions for this?

Thanks

Dec 6, 2012 at 6:40 PM

it works, but with long timeout

check this http://www.codeproject.com/Answers/76139/check-internet-connection-available-or-not-in-c#answer3 

Dec 6, 2012 at 6:59 PM
radioman wrote:

it works, but with long timeout

check this http://www.codeproject.com/Answers/76139/check-internet-connection-available-or-not-in-c#answer3 

Yes, but the freeze is due to the change of AccessMode.ServerAndCache by AccessMode.CacheOnly. If you disconnect the cable and not change the AccessMode works correctly.

I need to change the AccessMode to AccessMode.CacheOnly by the problem mentioned in the post following: http://greatmaps.codeplex.com/discussions/401091

How to solve it?


Thanks

Dec 6, 2012 at 7:05 PM

whats the problem?

Dec 6, 2012 at 7:11 PM

The problem is that when I have configured AccessMode.ServerAndCache and I haven't internet, when I zoom on the map for example, shows me a black popup with a Exception. According to post http://greatmaps.codeplex.com/discussions/401091 should be configured AccessMode.CacheOnly. But making that change at any given time when detects no internet, my application hangs. :(

Dec 6, 2012 at 7:30 PM

 black popup with a Exception?

Dec 6, 2012 at 7:32 PM

Yes, a dialog message with the Exception: The remote name couldn't be resolved.....

Dec 6, 2012 at 7:38 PM

because cable is unplugged, and it has nothing to do with map control ;} i've posted link already anyway

Dec 6, 2012 at 7:42 PM

mmm I don't know. 

* If you run the app with the cable unplugged, and the AccessMode is set to AccessMode.CacheOnly works well.

* If you run the app with the cable plugged, the AccessMode is set to AccessMode.ServerAndCache. If then unplugged the cable and change the AccessMode to AccessMode.CacheOnly, the app hangs, until you connect the cable again.

Dec 6, 2012 at 7:52 PM

just keep that cable alone ;}

Dec 6, 2012 at 8:13 PM

p.s. i've changed detection code in demos, you can use that, it has 4s timeout

Dec 6, 2012 at 8:32 PM
radioman wrote:

p.s. i've changed detection code in demos, you can use that, it has 4s timeout

I'm using the libraries compiled GMap.NET.Core.dll and GMap.NET.WindowsPresentation.dll. How do I get this change?

Thanks

Dec 6, 2012 at 8:46 PM

copy/paste the code

Dec 6, 2012 at 9:38 PM

Please could you send me the link in order to download this new code?

Thanks

Dec 6, 2012 at 10:29 PM
Edited Dec 6, 2012 at 10:29 PM

http://greatmaps.codeplex.com/SourceControl/changeset/view/de168844db45#Demo.WindowsForms%2fForms%2fMainForm.cs

Dec 6, 2012 at 10:43 PM

Thanks, I saw the code, but I think that the problem is when switch between a AccessMode to other, for example from ServerAndCache to CacheOnly. Could you test it?