[GRASS-dev] NVIZ state file format (was GRASS6.3 on Windows, nviz)
bcovill at tekmap.ns.ca
Thu Aug 30 10:24:45 EDT 2007
On Thu, 2007-08-30 at 03:56 +0100, Glynn Clements wrote:
> Bob Covill wrote:
> > > > thats the kicker... I do not know enough about XML in a C environment to do
> > > > this / and a MS thesis is looming over my head right now... Sorry!
> > > >
> > >
> > > Indeed! Summer is over and my time is short too.
> > >
> > > Unless someone that does have expertise in XML and time to do it is out
> > > there, I propose to fix this with minimal changes in the current, simple
> > > ascii state file for the upcoming 6.3 release.
> > If there is an easy fix, you may as well apply it for the upcoming
> > release. There is probably no point in adding an XML parser to the TCL
> > interface, as its days are probably numbered.
> Agreed. If wxPython is used for a new interface, the core Python
> libraries include XML parsing.
> > > We should rethink this for any subsequent releases, including 7. I don't
> > > want to keep saying that we'll do it better in wxPython, but there are
> > > available xml parsers there (e.g., SAX) that would make this easier. But
> > > again, it will depend on available expertise.
> > A number of UI's (GTK(glib), C#, ...) have their own XML parser which
> > could be taken advantage of when nviz is moved to a new interface. As a
> > proof of concept I have been playing around with the OpenGL GTK
> > interface GtkGLExt ( http://www.k-3d.org/gtkglext/Main_Page ) to view
> > and navigate GRASS data via ogsf. It works fine.
> Personally, I'd suggest using an interpreted language for programs
> which are primarily user interfaces. It makes it much easier for users
> to add tweaks for their specific needs. FWIW, wxPython includes a
> GLCanvas class (analogous to Togl).
Unfortunately, I have never successfully compiled the the version of
wxPython required for the GRASS UI. I have tried a couple of times, but
eventually given up!
> Do you have any code available? In terms of replacing NVIZ, it would
> be useful to have a relatively simple example of how to use the OGSF
> library; NVIZ itself is far too complex for that.
I have uploaded my grass_gtk Glade project which includes the ogsf code
to http://www.tekmap.ns.ca/tekmap_download/grass_gtk.tar.bz2 . The ogsf
calls are made in src/visualization. These include ogsf initialization,
raster loading, vector loading, setting lights, fast draw, and full
draw, navigation, etc. For example, to load a raster ....
new_id = GS_new_surface();
ret = GS_load_att_map(new_id, name, ATT_TOPO);
GS_set_drawres(new_id, max2, max2, max, max);
GS_set_drawmode(new_id, DM_GOURAUD | DM_POLY | DM_GRID_SURF );
ret = GS_load_att_map(new_id, name, ATT_COLOR); /* set color */
ret = GS_set_att_const(new_id, ATT_TRANSP, 0.0);
To move to a view position ...
tmp = 100.;
tmp = 100.;
tmp = 2500.;
Hope this helps.
More information about the grass-dev