Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 21-02-2011, 16:08   #1
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
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:	145
Size:	83.1 KB
ID:	24048  
Attached Files
File Type: doc gpsbabelimport.patch.doc (3.7 KB, 74 views)
nohal is offline   Reply With Quote
Old 22-02-2011, 11:38   #2
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
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, 11:45   #3
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
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, 12:08   #4
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
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, 01:09   #5
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
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, 09:08   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
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, 03:12   #7
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
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, 04:17   #8
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
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, 08:46   #9
Registered User
 
rooiedirk's Avatar

Join Date: Aug 2010
Location: Netherlands
Boat: Oneoff
Posts: 511
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


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 70 27-06-2022 18:18
What Are the Objects that Display . . . Gilletarom OpenCPN 47 08-09-2010 15:01
[Info] GPSBabel - Version 1.4.1 Available Netsurfer OpenCPN 0 29-07-2010 09:43
S-57: Add New Objects to CPN kasej OpenCPN 1 19-07-2010 05:55
Securing Objects to the Boat landonshaw Construction, Maintenance & Refit 6 28-05-2009 17:54

Advertise Here


All times are GMT -7. The time now is 21:20.


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

ShowCase vBulletin Plugins by Drive Thru Online, Inc.