[GRASS-dev] North Arrow updates

Hamish & Michael,

I have just applied a couple of changes to NVIZ to pick up some problems
I was having with the new North Arrow args. I have added the updated
arrow routine to togl_flythrough.c (it won't build without it) and I
fixed the number of allowable argc in Ndraw_Narrow_cmd (draw.c).

I have also removed a duplicate place_narrow procedure from
panel_fringe.tcl which was calling Ndraw_Narrow with the old number of
args. I also set the default arrow and text colors in panel_main.tcl to
black (you might want to change these).

Hopefully this has not broken anything you were trying to do.

--
Bob

On 12/7/06 12:22 PM, "Bob Covill" <bcovill@tekmap.ns.ca> wrote:

Hamish & Michael,

I have just applied a couple of changes to NVIZ to pick up some problems
I was having with the new North Arrow args. I have added the updated
arrow routine to togl_flythrough.c (it won't build without it) and I
fixed the number of allowable argc in Ndraw_Narrow_cmd (draw.c).

I have also removed a duplicate place_narrow procedure from
panel_fringe.tcl which was calling Ndraw_Narrow with the old number of
args. I also set the default arrow and text colors in panel_main.tcl to
black (you might want to change these).

Hopefully this has not broken anything you were trying to do.

--
Bob

I just committed my changes from last night and this morning and am
compiling it all. So I can test in a few minutes.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 12/7/06 12:22 PM, "Bob Covill" <bcovill@tekmap.ns.ca> wrote:

Hamish & Michael,

I have just applied a couple of changes to NVIZ to pick up some problems
I was having with the new North Arrow args. I have added the updated
arrow routine to togl_flythrough.c (it won't build without it) and I
fixed the number of allowable argc in Ndraw_Narrow_cmd (draw.c).

I have also removed a duplicate place_narrow procedure from
panel_fringe.tcl which was calling Ndraw_Narrow with the old number of
args. I also set the default arrow and text colors in panel_main.tcl to
black (you might want to change these).

Hopefully this has not broken anything you were trying to do.

--
Bob

I just updated and compiled GRASS 6.3 from the cvs. I don't see any visual
change in the arrow panel. Is the new code not implemented yet?

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

> I have just applied a couple of changes to NVIZ to pick up some
> problems I was having with the new North Arrow args. I have added
> the updated arrow routine to togl_flythrough.c (it won't build
> without it) and I fixed the number of allowable argc in
> Ndraw_Narrow_cmd (draw.c).

thanks. I've now done the same for the new scalebar code as well.

> I also set the default arrow and text colors in
> panel_main.tcl to black (you might want to change these).

I changed the default text color to white as the two are drawn
on top of each other. Note the text color is ignored. I will look
into this next.

> Hopefully this has not broken anything you were trying to do.

on the contrary, thanks for filling in bits I missed.

I just updated and compiled GRASS 6.3 from the cvs. I don't see any
visual change in the arrow panel. Is the new code not implemented yet?

No, Bob's changes didn't add to the panel, just finished the job I
started yesterday. You will need to add in the color selection code to
panel_arrow.tcl (I suggest copying it from panel_fringe.tcl).

For the scalebar panel I think we should wait until the arrow panel is
finalized, then just copy it vs. duplicating changes during development.

How do folks like the new shape of the north arrow? To me it looks a bit
like an arrowhead or spear. (shrug)

Hamish

Hamish wrote:

> > I also set the default arrow and text colors in
> > panel_main.tcl to black (you might want to change these).

I changed the default text color to white as the two are drawn
on top of each other. Note the text color is ignored. I will look
into this next.

A bit stuck...

The north arrow "North" text uses basically the same method as the
panel_label.tcl text (which works), but "North" always comes out white.

If I add:
  gsd_colormode(CM_COLOR);
before the gl commands I get the color through, but then the 3D surface
goes all black. If after the gl calls I add:
  gsd_colormode(CM_AD);
it mostly gets back to normal, but looks a bit washed out.*

The 3D surface stays black if I do:
  gsd_colormode(CM_DIFFUSE);
instead of CM_AD.

(I don't know what the colormodes do, I'm just trying things here)

[*] bug #4238 ? I'm not sure if the bug is really in my video card driver,
as no one else has reported the same problem AFAIK.
  https://intevation.de/rt/webrt?serial_num=4238

here's some of the code:

=======================================

lib/ogsf/gsd_objs.c gsd_north_arrow() :
    gsd_color_func(text_clr);
    txt = "North";
...
    glRasterPos3fv(base[0]);
    glListBase(fontbase);
    glCallLists(strlen(txt), GL_BYTE, (GLubyte *) txt);
    GS_done_draw();

    gsd_popmatrix();
    gsd_flush();

=======================================

panel_label.tcl leads to:

lib/ogsf/gsd_label.c:
    /* Set text color */
    gsd_color_func(color);
    do_label_display(fontbase, labpt, text);

lib/ogsf/gsd_fonts.c
/*****************************************/
void do_label_display(GLuint fontbase, float *lab_pos, char *txt)
{
    glRasterPos2f(lab_pos, lab_pos[Y]);
    glListBase(fontbase);
    glCallLists(strlen(txt), GL_BYTE, (GLubyte *) txt);

    return;
}

=======================================

I don't see the difference. (beyond 2D/3D placement)

?
Hamish

Hamish,

For me the text color is working. The default color is set in
panel_main.tcl is where the color is currently being set (initialized).
For example if you change the value for arw_text_clr to 0xFF0000 you
should see a red "North". Presumably this will eventually be a user
controlled option in the arrow panel.

Did you intend the text "North" color to be changed differently?

--
Bob

On Fri, 2006-12-08 at 13:25 +1300, Hamish wrote:

Hamish wrote:
> > > I also set the default arrow and text colors in
> > > panel_main.tcl to black (you might want to change these).
>
> I changed the default text color to white as the two are drawn
> on top of each other. Note the text color is ignored. I will look
> into this next.

A bit stuck...

The north arrow "North" text uses basically the same method as the
panel_label.tcl text (which works), but "North" always comes out white.

If I add:
  gsd_colormode(CM_COLOR);
before the gl commands I get the color through, but then the 3D surface
goes all black. If after the gl calls I add:
  gsd_colormode(CM_AD);
it mostly gets back to normal, but looks a bit washed out.*

The 3D surface stays black if I do:
  gsd_colormode(CM_DIFFUSE);
instead of CM_AD.

(I don't know what the colormodes do, I'm just trying things here)

[*] bug #4238 ? I'm not sure if the bug is really in my video card driver,
as no one else has reported the same problem AFAIK.
  https://intevation.de/rt/webrt?serial_num=4238

here's some of the code:

=======================================

lib/ogsf/gsd_objs.c gsd_north_arrow() :
    gsd_color_func(text_clr);
    txt = "North";
...
    glRasterPos3fv(base[0]);
    glListBase(fontbase);
    glCallLists(strlen(txt), GL_BYTE, (GLubyte *) txt);
    GS_done_draw();

    gsd_popmatrix();
    gsd_flush();

=======================================

panel_label.tcl leads to:

lib/ogsf/gsd_label.c:
    /* Set text color */
    gsd_color_func(color);
    do_label_display(fontbase, labpt, text);

lib/ogsf/gsd_fonts.c
/*****************************************/
void do_label_display(GLuint fontbase, float *lab_pos, char *txt)
{
    glRasterPos2f(lab_pos, lab_pos[Y]);
    glListBase(fontbase);
    glCallLists(strlen(txt), GL_BYTE, (GLubyte *) txt);

    return;
}

=======================================

I don't see the difference. (beyond 2D/3D placement)

?
Hamish

some NVIZ compiler warnings that might be worth looking into:

        -o OBJ.i686-pc-linux-gnu/site_attr_commands.o -c site_attr_commands.c
site_attr_commands.c: In function `Nsite_attr_get_fields_name_cmd':
site_attr_commands.c:336: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `Nsite_attr_get_fields_type_cmd':
site_attr_commands.c:369: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `Nsite_attr_get_fields_name_and_type_cmd':
site_attr_commands.c:404: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `Nsite_attr_get_field_values_cmd':
site_attr_commands.c:459: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `Nsite_attr_get_field_not_emtpy_cats_cmd':
site_attr_commands.c:506: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `Nsite_attr_get_record_values_cmd':
site_attr_commands.c:562: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `site_attr_close_map':
site_attr_commands.c:628: warning: passing arg 1 of `G_sites_close' from incompatible pointer type
site_attr_commands.c: In function `site_attr_set':
site_attr_commands.c:662: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_attr_commands.c:663: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_attr_commands.c:678: warning: passing arg 5 of `site_attr_set_size' from incompatible pointer type
site_attr_commands.c:678: warning: passing arg 6 of `site_attr_set_size' from incompatible pointer type
site_attr_commands.c:687: warning: passing arg 5 of `site_attr_set_color' from incompatible pointer type
site_attr_commands.c:687: warning: passing arg 6 of `site_attr_set_color' from incompatible pointer type
site_attr_commands.c: In function `Nget_interpolated_values_cmd':
site_attr_commands.c:915: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_attr_commands.c:916: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_attr_commands.c:921: warning: passing arg 2 of `attr_interp_colors' from incompatible pointer type
site_attr_commands.c:921: warning: passing arg 3 of `attr_interp_colors' from incompatible pointer type
site_attr_commands.c:924: warning: passing arg 2 of `attr_interp_entries' from incompatible pointer type
site_attr_commands.c:924: warning: passing arg 3 of `attr_interp_entries' from incompatible pointer type
site_attr_commands.c:930: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
gcc -I/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/include -ggdb -march=pentium4 -Wall -I/usr/include/tcl8.3 -I/usr/include/tcl8.3 -I/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/include -I/usr/include -I/usr/X11R6/include -DPACKAGE=\""grassmods"\" -I/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/include \
        -o OBJ.i686-pc-linux-gnu/site_highlight_commands.o -c site_highlight_commands.c
site_highlight_commands.c: In function `Nsite_highlight_list_cmd':
site_highlight_commands.c:386: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_highlight_commands.c:393: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:399: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:405: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:410: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:414: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:418: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c: In function `Nsite_unhighlight_list_cmd':
site_highlight_commands.c:465: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
site_highlight_commands.c:469: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:472: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:475: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type
site_highlight_commands.c:478: warning: passing arg 2 of `site_highlight_loop' from incompatible pointer type

?
Hamish

Bob Covill wrote:

For me the text color is working.

That's good news.

The default color is set in panel_main.tcl is where the color is
currently being set (initialized). For example if you change the value
for arw_text_clr to 0xFF0000 you should see a red "North".

It's always white for me no matter what I change arw_text_clr to.
I have to call gsd_colormode(CM_COLOR); to get the color to change.
(but that then messes up the lighting for everything else)

so more likely:

> [*] bug #4238 ? I'm not sure if the bug is really in my video card
> driver, as no one else has reported the same problem AFAIK.
> https://intevation.de/rt/webrt?serial_num=4238

?

Presumably this will eventually be a user controlled option in the
arrow panel.

yes.

Did you intend the text "North" color to be changed differently?

as you've stated above.

Hamish

Hamish wrote:

Hamish wrote:
> > > I also set the default arrow and text colors in
> > > panel_main.tcl to black (you might want to change these).
>
> I changed the default text color to white as the two are drawn
> on top of each other. Note the text color is ignored. I will look
> into this next.

A bit stuck...

The north arrow "North" text uses basically the same method as the
panel_label.tcl text (which works), but "North" always comes out white.

If I add:
  gsd_colormode(CM_COLOR);
before the gl commands I get the color through, but then the 3D surface
goes all black. If after the gl calls I add:
  gsd_colormode(CM_AD);
it mostly gets back to normal, but looks a bit washed out.*

The 3D surface stays black if I do:
  gsd_colormode(CM_DIFFUSE);
instead of CM_AD.

(I don't know what the colormodes do, I'm just trying things here)

After gsd_init_lightmodel(), the state will initially be equivalent to
CM_NULL, although it may subsequently be changed, possibly to a state
which doesn't correspond to anything which can be achieved through
gsd_colormode().

For safety, I suggest using glPushAttrib(GL_LIGHTING_BIT) and
glPopAttrib() to save and restore the lighting state.

--
Glynn Clements <glynn@gclements.plus.com>