PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

Great ! I love to work like this. I can't code by now, but in Pbmap.pb you can change the refresh() function like this

Code: Select all

Procedure Refresh(MapGadget.i)
    Protected *PBMap.PBMap = PBMaps(Str(MapGadget))
    *PBMap\Redraw = #True
    ; Drawing()
  EndProcedure
SetActiveGadget() shouldn't change the returned GetActiveWindow() value. I think it's a PB bug.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

Last bugs should be corrected. I have included your example in the branch, would you agree to include it in the master ?

https://github.com/djes/PBMap/tree/djes
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

djes wrote:Last bugs should be corrected. I have included your example in the branch, would you agree to include it in the master ?

https://github.com/djes/PBMap/tree/djes
Thank you very much, djes! The 2 panel / 2 maps example works like a charm now :D
(It should do also in my GeoWorldEditor, but this still need to be adapted to the new syntax...)

And of course - feel free to add the new PBMap example to the master :mrgreen:

By the way: the mentioned SetActiveGadget() problem is now also gone (since the latest PBMap update), don't know why, but I couldn't reproduce it in small test code... (else I would have made a bug-report).

Edit: I just finished the adaption of my project source according to the new PBMap syntax, and also this 'real world' with two PBMap CanvasGadgets runs now stable. Now I only need to do some 'stress tests' with working 2-3 hours with the editor, to check if there are some randomly crashes (see my earlier reports) left.... but for now: awesome work, djes! :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

Good to hear ! :)
Let me know about your tests so that I can update the main. :mrgreen:
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

This evening I wanted to do the 'stress test' and I got randomly "invaiid memory-access" crashes (at line 1470 in PBMap include) again. So this should have nothing to do with the latest changes, but with an earlier problem instead!?

There is no unique way to recreate the crash, it occurs especially if I'm re-using the same map position several times (= calling the canvas in my application with the same coordinates), and clicking in the map for a new position...

If it's of any help here are two screenshots of my application and of my PB IDE at the point of the crash:
Image Image

Edit: next time I got a crash at line 1464

Code: Select all

                DrawVectorImage(ImageID(*timg\nImage), 255 * *PBMap\Layers()\Alpha)
Maybe you can provide a "Debug" version of PBMap, which helps to find the bug?

Thank you :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

So bad... Are you using a timer? Debug can be activated by using verbose mode and compiling in console mode...
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

djes wrote:So bad... Are you using a timer? Debug can be activated by using verbose mode and compiling in console mode...
No timer (at least I don't know/find one).

But I'm using threads for a busy window (but this is only called when a sub-window with GeoNames is open and searching/filling listicon) and for filling the listicons in the main window (right side, when a country is selected in the combobox then all related admin. divisions, mountains, etc. are filled into the listicons).

Do you see a problem for PBMap because of this?

(Btw. in previous post I've added another point where the invalid memory access occurs.)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

If threads are protected and not using PBMap resources without protection, no problem.

I've corrected the debug mode, which forced me to specify which window was used. See your multiple pbmap example.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

Hi djes,

I've installed your latest PBMap update here and have seen the active Console window logging the image accesses (?) of PBMap.

Do you mean, that I should also add

Code: Select all

    PBMap::SetOption(#Map, "Verbose", "1")
to my tool for debugging purposes?


Sorry to say, but I'm not really familar with using threads. So if you mean with "protected" the use of semaphores and mutexes - no I don't have... :oops:

I didn't know that the threaded listicon updates according to combobox changes would have any influence on the PBMap ressources and its Canvas gadget displaying the map. Does it?
At least from the point of crash noted above (invalid memory access with the OSM images) I couldn't imagine any correlation...
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

Using the verbose option will give you full debug detail in the console window. It's then possible to track the latest action leading to a hang.

I can't say it your thread is leading to a bug. I don't think it's because of a PBMap conflict but thread bugs are sometimes difficult to track. Could you simply try to not create your thread, to easily see if the bug still occurs ? If yes, your thread is not the cause.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

djes wrote:Could you simply try to not create your thread, to easily see if the bug still occurs ? If yes, your thread is not the cause.
I've adapted my GeoWorldEditor to use the threaded combobox filling only optional. I'm currently testing with this threads disabled. No problems so far.... :D I will report again after some more 'stress tests'...
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
vwidmer
Enthusiast
Enthusiast
Posts: 282
Joined: Mon Jan 20, 2014 6:32 pm

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by vwidmer »

I am trying to get the cords under the mouse but seems to be coming back a little off should this be right?

Debug Pixel2Lat(CanvasMouseX)
Debug Pixel2Lon(CanvasMouseY)
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Andre »

@djes: Just forgot to say, that my GeoWorldEditor is running like a charm after deactivating the threaded listicon filling. So the PBMap include is now running always fine, even in heavy stress-tests / production mode. Thank you for this! :D
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by djes »

vwidmer wrote:I am trying to get the cords under the mouse but seems to be coming back a little off should this be right?

Debug Pixel2Lat(CanvasMouseX)
Debug Pixel2Lon(CanvasMouseY)
Seems right to me.
Andre wrote:@djes: Just forgot to say, that my GeoWorldEditor is running like a charm after deactivating the threaded listicon filling. So the PBMap include is now running always fine, even in heavy stress-tests / production mode. Thank you for this! :D
Thank you Andre !
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget

Post by Michael Vogel »

Just wanted to check the Pixel2LatLon conversations but when doing a lot of double clicks on the map I will get memory access errors here (code from djes branch):

Code: Select all

[09:48:58] Waiting for executable to start...
[09:48:57] Executable type: Windows - x86  (32bit, Unicode, Thread)
[09:48:58] Executable started.
[09:51:23] [ERROR] Line: 1241
[09:51:23] [ERROR] Invalid memory access. (read error at address 4294967293)
[09:53:48] The debugged executable quit unexpectedly.
[09:57:21] Waiting for executable to start...
[09:57:21] Executable type: Windows - x86  (32bit, Unicode, Thread)
[09:57:21] Executable started.
[09:58:19] [ERROR] Line: 1143
[09:58:19] [ERROR] Invalid memory access. (read error at address 4294967293)
[09:58:45] The debugged executable quit unexpectedly.
Concerning the conversion routine - the procedure 'Pixel2LatLon' looks correct for me, I'd only remove one redundant Mod (as well as in 'ClipLongitude'):

Code: Select all

x=7
n=6

Debug Mod(Mod(x / n * 360.0, 360.0) + 360.0, 360.0) - 180
Debug Mod(x / n * 360.0+360.0, 360.0) - 180;  <<<  : ) 
Debug Mod((1+x/n)*360,360)-180

Debug ""

y=7

Debug Degree(ATan(SinH(#PI * (1.0 - 2.0 * y / n))))
Debug Degree(ASin(TanH(#PI * (1.0 - 2.0 * y / n))))
Debug Degree(2*ATan(Exp(#PI*(1.0- 2.0 * y/n))) -#PI/2)
Post Reply