Page 8 of 10
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Mar 03, 2018 11:22 am
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.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Mar 03, 2018 7:29 pm
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
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Mar 04, 2018 12:10 am
by Andre
Thank you very much, djes! The 2 panel / 2 maps example works like a charm now

(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
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!

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Mar 04, 2018 12:32 pm
by djes
Good to hear !

Let me know about your tests so that I can update the main.

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Fri Mar 16, 2018 8:36 pm
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:
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

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Fri Mar 16, 2018 10:04 pm
by djes
So bad... Are you using a timer? Debug can be activated by using verbose mode and compiling in console mode...
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Fri Mar 16, 2018 10:18 pm
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.)
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Mar 17, 2018 2:40 pm
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.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Mar 17, 2018 4:33 pm
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...
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...
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Mar 17, 2018 8:05 pm
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.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Mar 18, 2018 11:05 pm
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....

I will report again after some more 'stress tests'...
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Jun 10, 2018 3:23 am
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)
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Jun 10, 2018 8:21 pm
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!

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Mon Jun 11, 2018 6:33 am
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!

Thank you Andre !
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Mon Jun 11, 2018 9:25 am
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)