[Gpsbabel-code] Some more thoughts on architecture
Brought to you by:
robertl
From: Ron P. <pa...@fw...> - 2002-10-18 18:27:23
|
I've been thinking some more about some big-picture type things. Now obviously, this project is Robert's baby and I'm just being allowed to play peek-a-boo with it, so these are all just requests for comment, not concrete suggestions or laws or anything. Tossing around my question about the command-line parameter has led me into slightly different territory. My big concern was that if I steal -D or -N or whatever for a specific output module, that's one less letter that can be used for general options if they come along. So, it occurred to me that such a parameter should be specified using a prefix character of some sort. 'O' would make a decent prefix character, I suppose. So instead of what I said before, I envision something like this: gpsbabel -i geo -f foo.loc -o cetus -On "database name" -F foo.pdb This allows each output module to have its own set of switches, independent from the switches of every other output module. Expanding on this idea, of course, you'd have -I as a prefix for module-specific arguments to input modules. For example, I might choose to import only the waypoints in a particular category from some Palm format (this is hypothetical; none of the currently- supported Palm formats use categories, though magnav does require a category header.) To do that, I could use "-Ic Geocaching" to get just the waypoints in the "Geocaching" category. Finally, just before derailing completely, my train of thought wandered into the land of "coalesce" and "simplify" by way of a thought experiment involving a hypothetical filter that could grab NAPP/Terraserver imagery for each waypoint for use with GPSPilot. These things are all just filters; things that happen between when the waypoints get read and when they get written. They, too, will eventually suffer from a shortage of switch characters. Why not handle them all with a single switch, or pair of switches? -f and -F are unfortunately taken, but we could call them modifiers instead of filters: gpsbabel -i foo -f a.foo -f b.foo -m coalesce -o foo -F c.foo merges a.foo and b.foo into c.foo, removing duplicates. And, a really complicated example: gpsbabel -i bar -Ic "Geocaching" -f ${foo}.pdb \ -m declination -m cachedesc -Mp proxy.example.com \ -o gpspilot -On "GC Waypoints" -F ${foo}-wpt.pdb \ -o gpspilot_img -On "GC Imagery" -Or 1km \ -Op proxy.example.com -F ${foo}-img.pdb reads the "Geocaching" category from the bar-format database ${foo}.pdb, computes the magnetic declination for any point that doesn't already have one, fetches the geocaching.com cache description for each "GCxxxx" waypoint into the "long description" field, writes the resulting waypoints to a gpspilot waypoint database called "GC Waypoints," and fetches imagery for each waypoint to a radius of 1km, which it writes to a gpspilot imagery database called "GC Imagery." (gpspilot_img would be invalid as an input format, obviously.) Oh yeah, and our web connection is through a proxy. Simple, right? So... any thoughts? |