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 - OpenStreetMap in a Canvas gadget

Post by djes »

BasicallyPure wrote:Hi Djes,

Fails syntax check because a shared variable (ReceiveData.s) required in the include file has not been defined in main code.
This patch fixes the problem.
Apparently the variable is not actually used in your code.

Code: Select all

  Define ReceivedData.s ;<-- added ReceiveData.s,-- BasicallyPure
  IncludeFile "libcurl.pbi" ; https://github.com/deseven/pbsamples/tree/master/crossplatform/libcurl
In fact, the distributed libcurl include has been fixed for that. Anyway, you're right, if I share the original URL, I should include the definition ;)
Please note that the pbmap code includes a curl "downloadtofile" that is not present in the curl pbi. I will post it somewhere in the forum...

edit: here it is : http://www.purebasic.fr/english/viewtop ... 12&t=66527
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

The code have been updated on the Github deposit (master)
User avatar
minimy
Enthusiast
Enthusiast
Posts: 344
Joined: Mon Jul 08, 2013 8:43 pm

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by minimy »

Thanks for share!
This open a world of new features.
Very good work Djes!!
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

minimy wrote:Thanks for share!
This open a world of new features.
Very good work Djes!!
Thank you ! I'm not alone, actually we're 3 on the project, initiated by Typhoon, and now with Idle. Users are very important, don't hesitate to ask and comment ! :)
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8425
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by netmaestro »

I tried it here on Windows 7 with PB 5.5 x86 and it works very well. There are two string gadgets for Lat and Long but I miss a button to take the map there if I put values in. Is that something that users should be able to do or are they informational only (in which case text gadgets might be less confusing) Good work!
BERESHEIT
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

netmaestro wrote:I tried it here on Windows 7 with PB 5.5 x86 and it works very well. There are two string gadgets for Lat and Long but I miss a button to take the map there if I put values in. Is that something that users should be able to do or are they informational only (in which case text gadgets might be less confusing) Good work!
Thank you for your test ! The example app contains just a little part of the functionalities. It is already possible to create such button, I put it on my todo list :) What will miss however is a converter from different systems.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

New version to test here : 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 - OpenStreetMap in a Canvas gadget

Post by Andre »

Hi djes,

the latest improved versions from 09th + 13th September work both like charm, many thanks for it! :D

I already successfully implemented the PBMap into an own (currently only internal) application, used for collecting landscape and other images and selecting their correct latitude/longitude position using PBMap (OpenStreetMap) on the map. So a very worthful help for me. Credits to you and your team are already noted (as soon the complete project will be released to the public, probably first version next year...). :mrgreen:

As I have already created a dialog with all needed gadgets before using the PBMap stuff, I've also an already existing CanvasGadget. To implement this correctly for using it with PBMap I've extended the MapGadget procedure like below (see the ElseIf statement):

Code: Select all

  Procedure MapGadget(Gadget.i, X.i, Y.i, Width.i, Height.i)
    If Gadget = #PB_Any
      PBMap\Gadget = CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard) ;#PB_Canvas_Keyboard has to be set for mousewheel to work on windows
    ElseIf Gadget < 0     ; this is an addition by Andre for adapting the PBMap module to the GeoWorldEditor (we are using an already existing CanvasGadget here! => GadgetID will be given as negative number!)  
      PBMap\Gadget = Abs(Gadget)
    Else
      PBMap\Gadget = Gadget
      CanvasGadget(PBMap\Gadget, X, Y, Width, Height, #PB_Canvas_Keyboard) 
    EndIf 
    BindGadgetEvent(PBMap\Gadget, @CanvasEvents())
    AddWindowTimer(PBMap\Window, PBMap\Timer, PBMap\Options\TimerInterval)
    BindEvent(#PB_Event_Timer, @TimerEvents())
    ;AddKeyboardShortcut(#PB_Shortcut_Delete
  EndProcedure
Calling the procedure like this with negative Gadget number:
PBMap::MapGadget(-#PicDB_MapCanvas, 5, 5, GadgetWidth(#PicDB_MapCanvas)-10, GadgetHeight(#PicDB_MapCanvas)-10) ; the GadgetID of the MapCanvas will be given as negative number => this avoids, that the PBMap module is creating a new CanvasGadget!!!
So again, many thanks!
I will follow all further development on this... 8)
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 - OpenStreetMap in a Canvas gadget

Post by djes »

Thank you very much Andre ! :D
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

A lot of modifications in this version, multi-trackers, select/delete on markers and trackers, text modification on trackers, geolocalisation (address required for now), and so on. I let you discover and test : 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 - OpenStreetMap in a Canvas gadget

Post by Andre »

Thanks djes! :D

For sure I haven't tested all possibilities of this great piece of code, but it's working fine, even if included in my project!

I would be happy if you can consider including my little extension to the MapGadget() function mentioned above, for using existing (previously created) CanvasGadget with PBMap. Or maybe you have a better solution... :mrgreen:
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 - OpenStreetMap in a Canvas gadget

Post by djes »

Thank you Andre ! :)
I've created a BindMapGadget(Gadget.i) especially for you, I think it's more elegant than passing a negative number, I hope it will not be a problem for you this way. If you want to contribute to the project, I can make an access for you, just ask. My personal project will be to add geo-referenced images and some edit/comment possibilities.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by Andre »

djes wrote:I've created a BindMapGadget(Gadget.i) especially for you, I think it's more elegant than passing a negative number, I hope it will not be a problem for you this way. If you want to contribute to the project, I can make an access for you, just ask. My personal project will be to add geo-referenced images and some edit/comment possibilities.
I think every solution, which I can simply include in my project, is welcome. :D
Currently there is no download of the new version (mentioned above) available yet, right?
As long I can't really imagine if/how the BindMapGadget() stuff will work.

Thank you for the offer about contributing to the project, but beside my very limited time (causing my own project having a development timeline of nearly 10 years now... :?) I think I'm having too less knowledge about this stuff. Currently I'm probably only using a small part of the PBMap project, showing a movable/zoomable OpenStreetMap used for placing the images of landscape/sights on their exact place and getting their longitude/latitude position...
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 - OpenStreetMap in a Canvas gadget

Post by djes »

Ok, you're welcome if you want !
You can download one of the latest versions here : https://github.com/djes/PBMap/tree/djes?files=1
It is regularly updated. Actually, the update concerns a better error handling in curl, alpha loading tiles, some fixes about enter key in gadgets (I hate this), and some more.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: PBMap - OpenStreetMap in a Canvas gadget

Post by djes »

Code updated on deposit : https://github.com/djes/PBMap
Post Reply