Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 21-02-2011, 17:08   #1
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,019
GPSBabel Integration in the Import of Nav Objects

Howdy!
Thought there are not enough new features to play with these days so hacked together a basic ability to import data in other formats than GPX

If it's possible to run GPSBabel (it's in the PATH environment variable or in the same directory as the OpenCPN executable), the types of data it supports are added to the list of file types in the file selection dialog and a conversion to GPX is attempted as part of the file opening.
There is virtually no error handling and I've done only a very limited testing on my Win machine with gpsbabel 1.4.2, so have absolutely no idea whether it will work on Linux or with other gpsbabel releases in it's present state at all...
Meant more like a proof of concept to investigate doability and usability of such a feature. Doing the same for export would of course be easy...
Opinions? Suggestions?
Patch generated against plain 2.3.1 source, if you want to try it.

Pavel
Attached Thumbnails
Click image for larger version

Name:	gpsbabel.png
Views:	103
Size:	83.1 KB
ID:	24048  
Attached Files
File Type: doc gpsbabelimport.patch.doc (3.7 KB, 41 views)
__________________

__________________
nohal is offline   Reply With Quote
Old 22-02-2011, 12:38   #2
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 303
Re: GPSBabel Integration in the Import of Nav Objects

Hoi Nohal,
I did give it a try at linux for you.
When compiling I had a few warnings.
[ 51%] Building CXX object CMakeFiles/opencpn.dir/src/navutil.cpp.o
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp: In member function 'void MyConfig::ImportGPX(wxWindow*)':
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'class wxString' through '...'; call will abort at runtime
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'class wxString' through '...'; call will abort at runtime
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'class wxString' through '...'; call will abort at runtime
[ 51%] Building CXX object CMakeFiles/opencpn.dir/src/routeman.cpp.o

And when I tried to import, there was a list with all kind of Import options, but when i chose one ( I used txt import) crash.
grjes
Dirk
__________________

__________________
rooiedirk is offline   Reply With Quote
Old 22-02-2011, 12:45   #3
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,019
Re: GPSBabel Integration in the Import of Nav Objects

ahhh,
my favorite coding error is back I have to find out how to produce this warning with msvc as well...

Thanks

Pavel
__________________
nohal is offline   Reply With Quote
Old 22-02-2011, 13:08   #4
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,019
Re: GPSBabel Integration in the Import of Nav Objects

Dirk,
replacing line 4087 with
Code:
cmd = wxString::Format( wxT("gpsbabel -i %s -f \"%s\" -o gpx -F %s"), inputformat.mb_str(), path.mb_str(), tmpfile.mb_str());
should do do trick


Pavel
__________________
nohal is offline   Reply With Quote
Old 23-02-2011, 02:09   #5
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 303
Re: GPSBabel Integration in the Import of Nav Objects

Pavel,
Sorry, it does't. same behaviour and crashing when importing.
Code:
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp: In member function 'void MyConfig::ImportGPX(wxWindow*)':
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'const class wxCharBuffer' through '...'; call will abort at runtime
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'const class wxCharBuffer' through '...'; call will abort at runtime
/home/dirk/opencpn/GitOpenCPN/opencpn/src/navutil.cpp:4087: warning: cannot pass objects of non-POD type 'const class wxCharBuffer' through '...'; call will abort at runtime
Dirk
__________________
rooiedirk is offline   Reply With Quote
Old 24-02-2011, 10:08   #6
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,019
Re: GPSBabel Integration in the Import of Nav Objects

c_str(), not mb_str() should it be...
I should place a new tattoo on my forearm
Will release a better patch in a few days.

Pavel
__________________
nohal is offline   Reply With Quote
Old 25-02-2011, 04:12   #7
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 303
Re: GPSBabel Integration in the Import of Nav Objects

It is an improvement. no warnings anymore and no crashing. unfortunally no import either. (Choise list from gpsbabel is there)
Dirk
__________________
rooiedirk is offline   Reply With Quote
Old 25-02-2011, 05:17   #8
Registered User

Join Date: Feb 2010
Location: On the go. Not in Prague.
Posts: 4,019
Re: GPSBabel Integration in the Import of Nav Objects

Dirk,
thanx for info...
Did you try to import something that should actually be imported? I mean something you know gpsbabel can convert to gpx with gpsbabel -i FRM -f FILE -o gpx -F /tmp/xxx.gpx?
As I said before, there is no error handling right now so you can't tell me much more without digging into the code yourself...
Not that this behavior was not expected but I'm curious. Will do more on it past the weekend when I will also chance to see a linux version myself.

Pavel
__________________
nohal is offline   Reply With Quote
Old 25-02-2011, 09:46   #9
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 303
Re: GPSBabel Integration in the Import of Nav Objects

Pavel,
I convertet a gpx file in a terminal to comma seperated. Then again import in OCPN, super.
Dirk
__________________

__________________
rooiedirk is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Organizing Nav Objects into Layers PjotrC OpenCPN 68 31-03-2011 07:53
What Are the Objects that Display . . . Gilletarom OpenCPN 47 08-09-2010 16:01
[Info] GPSBabel - Version 1.4.1 Available Netsurfer OpenCPN 0 29-07-2010 10:43
S-57: Add New Objects to CPN kasej OpenCPN 1 19-07-2010 06:55
Securing Objects to the Boat landonshaw Construction, Maintenance & Refit 6 28-05-2009 18:54



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 09:15.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.