Page 2 of 3

Posted: Tue Aug 25, 2009 1:16 am
by netmaestro
Works fine here on Vista but I can't get it to run on XP SP3. Not sure what's missing.

Posted: Tue Aug 25, 2009 8:37 am
by Progi1984
@srod : Thanks :)
@ts-soft : Thanks :)
@Rook Zimbabwe : Thanks :) Keep me informed :)

@SFSxOI Yes, that use PB 4.40 beta 1. I think that runs with beta2.

@netmaestro :
netmaestro wrote:I dl'd the complete package and tried to run it but I get an error message saying "The application failed to initialize properly (Oxc0150002). What's wrong? (pb 4.4 b2 win xp)
....
Works fine here on Vista but I can't get it to run on XP SP3. Not sure what's missing.
I have found some clues on Internet.
I use Dependancy Walker for viewing all dependances of exe file. (http://www.dependencywalker.com/)
And my application uses these dlls : MSVCR90.DLL.
Could you install Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) and see the result ?

Source > in French

Posted: Tue Aug 25, 2009 10:58 am
by netmaestro
Thanks Progi1984, that was it. Works fine now, thanks so much for sharing.

Posted: Tue Aug 25, 2009 10:58 am
by akj
Installing Visual C++ 2008 did indeed resolve the error message
"The application failed to initialize properly (0xc0150002)"
under Windows XP, but I now get a different error. Any ideas as to the cause?

Run-time error: The specified "Memory ID" is not valid.

in the line: FreeMemory(*LibCurl_SharedMem)
in procedure: RW_LibCurl_InitData()
in module: RW_LibCurl_Inc.pb
when ran with the debugger on from LibCurl.pb or OpenStreetMap.pb
under Windows XP SP2 and PB4.40B2

Stack trace (line numbers may differ slightly from your version):

Line 253
OpenStreetMap.pb
OSM_GetImage(3, 7, 65, 4)

Line 186
OpenStreetMap.pb
RW_LibCurl_InitData()

Current code position:
Line 89
RW_Lib_Curl_Inc.pb

Posted: Tue Aug 25, 2009 12:53 pm
by Progi1984
@netmaestro : Good news :)

@akj : Plz, Could you replace your old function RW_LibCurl_InitData() with this new one :

Code: Select all

Procedure RW_LibCurl_InitData()
  Shared *LibCurl_SharedMem
  If *LibCurl_SharedMem
    FreeMemory(*LibCurl_SharedMem)
    *LibCurl_SharedMem = 0
  EndIf
EndProcedure

Posted: Tue Aug 25, 2009 2:39 pm
by akj
@Progi1984:

The program is working fine now, thank you.

Could you please add an enhancement:
On mouse-clicking on the map, the clicked point moves to the dead centre of the map. .

Also a window Minimise button would be nice.

Posted: Sat Aug 29, 2009 2:12 pm
by akj
Here's how to add a minimise button to the main window.
In OpenStreetMap.pb:

Change

Code: Select all

If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap",  #PB_Window_SystemMenu | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
to

Code: Select all

If OpenWindow(#Window_0, 260, 225, 700, 571, "OpenStreetMap",  #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
Change

Code: Select all

If CatchImage(0, plImageMem)
SetGadgetState(#Image_0+Image, ImageID(0))
FreeImage(0)
FreeMemory(plImageMem)
to

Code: Select all

If CatchImage(image, plImageMem)
SetGadgetState(#Image_0+Image, ImageID(image))
FreeMemory(plImageMem)
Change

Code: Select all

If CatchImage(0, plMemory, MemorySize(plMemory))
SetGadgetState(#Image_0+Image, ImageID(0))
FreeImage(0)
FreeMemory(plMemory)
to

Code: Select all

If CatchImage(image, plMemory, MemorySize(plMemory))
SetGadgetState(#Image_0+Image, ImageID(image))
FreeMemory(plMemory)

Posted: Mon Aug 31, 2009 1:04 am
by Xombie
Is it possible to color in US zip codes or other regions using this program?

Posted: Mon Aug 31, 2009 8:07 am
by Progi1984
@All : I updated the package :
http://partage.rootslabs.net/SourceCode_OSM.zip

Code: Select all

ADDED : Mimize Window
ADDED : Zoom with click on the ImageGadget
@akj ; See the code and say me if it was what you wanted...
@Xombie : I don't understand your request... more explanations, please :)

Posted: Mon Aug 31, 2009 3:54 pm
by Xombie
Progi,

Say you have a lot of sales people and you want to color-code their territories on a map. Or perhaps you want to color a map to show which parts of the country (by zip code in the US, for example) have the most sales dollars.

Posted: Mon Aug 31, 2009 6:59 pm
by Progi1984
@Xombie : No, after some searchs, i don't find any solution. So sorry for you...

Re: OpenStreetMap embedded in your application

Posted: Mon Mar 29, 2010 11:25 am
by jamirokwai
Hi,

you could add support for Mac OS, if you use this snippet in RW_LibCurl_Inc.pb from line 12 on:

Code: Select all

CompilerCase #PB_OS_MacOS
    Macro SymbolName(Val)
      DQuote#Val#DQuote
    EndMacro
    #LibCurl_ImportLib = "/usr/lib/libcurl.3.dylib"
    #LibCurl_SeparatorDir = "/"
For Mac OS X, you have to change add a "_" before the name of the function:

"curl_easy_init", "curl_easy_setopt", "curl_easy_perform", "curl_easy_cleanup"
become
"_curl_easy_init", "_curl_easy_setopt", "_curl_easy_perform", "_curl_easy_cleanup"

Now it compiles correctly, but won't display any map-data.

Re: OpenStreetMap embedded in your application

Posted: Mon Mar 29, 2010 4:50 pm
by GG
It compiles well from my side, but when running with PB 4.41 and Windows XP SP3 with 4Gb RAM, it crashes when it tries to allocate memory in RW_LibCurl_GetData : [ERROR] The specified MemoryID is NULL (Line 149 RW_LibCurl_inc.pb), this line :

Code: Select all

*LibCurl_NewMemory = AllocateMemory(MemorySize(*LibCurl_SharedMem))
Any idea ?

Re: OpenStreetMap embedded in your application

Posted: Tue Aug 31, 2010 5:48 pm
by kandl
http://vimeo.com/14579414


program based on (this) discussion:

http://purebasic.fr/english/viewtopic.p ... 217ca777be


but significantly modified:

multi-threaded
accelerated graphics
mouse control

Re: OpenStreetMap embedded in your application

Posted: Tue Aug 31, 2010 7:29 pm
by Progi1984
Don't hesitate to give your code... I will improve the package and put your credits... Very good job... But what can't do PB ?