[GRASS-dev] [grass-code I][377] d.vect map disp=dir now broken: G_plot_icon() bug?

code I item #377, was opened at 2007-04-21 22:05
Status: Open
Priority: 3
Submitted By: Markus Neteler (markusn)
Assigned to: Nobody (None)
Summary: d.vect map disp=dir now broken: G_plot_icon() bug?
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: None
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD):

Initial Comment:
Since a few days the "disp=dir" no longer works.
I recall to have seen some G_plot_icon() modifications. Could this
be related? The positioning is right but the symbol invisible:

#spearfish
d.vect roads
d.vect roads disp=dir

-> directional arrow no more visible

This functionality is important for graph related work such as LRS or vector network analysis.

Markus

----------------------------------------------------------------------

You can respond by visiting:
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=377&group_id=21

grass-codei@wald.intevation.org wrote:

code I item #377, was opened at 2007-04-21 22:05
Status: Open
Priority: 3
Submitted By: Markus Neteler (markusn)
Assigned to: Nobody (None)
Summary: d.vect map disp=dir now broken: G_plot_icon() bug?
Issue type: module bug
Issue status: None
GRASS version: CVS HEAD
GRASS component: None
Operating system: all
Operating system version:
GRASS CVS checkout date, if applies (YYMMDD):

Initial Comment:
Since a few days the "disp=dir" no longer works.
I recall to have seen some G_plot_icon() modifications. Could this
be related? The positioning is right but the symbol invisible:

It could be related. I ended up multiplying by the scale twice, so if
the scale factor is significantly less than unity, the icons could end
up invisible.

Try changing lines 29-30 of lib/gis/icon.c to:

  x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
  y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;

I'll commit this when CVS comes back to life.

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

On Sat, Apr 21, 2007 at 09:13:14PM +0100, Glynn Clements wrote:

grass-codei@wald.intevation.org wrote:

> code I item #377, was opened at 2007-04-21 22:05
> Status: Open
> Priority: 3
> Submitted By: Markus Neteler (markusn)
> Assigned to: Nobody (None)
> Summary: d.vect map disp=dir now broken: G_plot_icon() bug?
> Issue type: module bug
> Issue status: None
> GRASS version: CVS HEAD
> GRASS component: None
> Operating system: all
> Operating system version:
> GRASS CVS checkout date, if applies (YYMMDD):
>
>
> Initial Comment:
> Since a few days the "disp=dir" no longer works.
> I recall to have seen some G_plot_icon() modifications. Could this
> be related? The positioning is right but the symbol invisible:

It could be related. I ended up multiplying by the scale twice, so if
the scale factor is significantly less than unity, the icons could end
up invisible.

Try changing lines 29-30 of lib/gis/icon.c to:

  x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
  y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;

I'll commit this when CVS comes back to life.

I have tried but it doesn't seem to help.
Does it work for you now?

Markus

Markus Neteler wrote:

> > Since a few days the "disp=dir" no longer works.
> > I recall to have seen some G_plot_icon() modifications. Could this
> > be related? The positioning is right but the symbol invisible:
>
> It could be related. I ended up multiplying by the scale twice, so if
> the scale factor is significantly less than unity, the icons could end
> up invisible.
>
> Try changing lines 29-30 of lib/gis/icon.c to:
>
> x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
> y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;
>
> I'll commit this when CVS comes back to life.

I have tried but it doesn't seem to help.
Does it work for you now?

That was only half of the problem; this deals with the other half:

Index: icon.c

RCS file: /grassrepository/grass6/lib/gis/icon.c,v
retrieving revision 1.8
diff -u -r1.8 icon.c
--- icon.c 21 Apr 2007 20:37:46 -0000 1.8
+++ icon.c 21 Apr 2007 21:24:44 -0000
@@ -28,8 +28,11 @@

     for ( i = 0; i < n_points; i++)
     {
- x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
- y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;
+ double xi = x[i];
+ double yi = y[i];
+
+ x[i] = m[0][0] * xi + m[0][1] * yi + xc;
+ y[i] = m[1][0] * xi + m[1][1] * yi + yc;
     }
}

I have tested this and it appears to work now.

Committed to CVS.

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

On Sat, Apr 21, 2007 at 10:29:25PM +0100, Glynn Clements wrote:

Markus Neteler wrote:

> > > Since a few days the "disp=dir" no longer works.
> > > I recall to have seen some G_plot_icon() modifications. Could this
> > > be related? The positioning is right but the symbol invisible:
> >
> > It could be related. I ended up multiplying by the scale twice, so if
> > the scale factor is significantly less than unity, the icons could end
> > up invisible.
> >
> > Try changing lines 29-30 of lib/gis/icon.c to:
> >
> > x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
> > y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;
> >
> > I'll commit this when CVS comes back to life.
>
> I have tried but it doesn't seem to help.
> Does it work for you now?

That was only half of the problem; this deals with the other half:

Index: icon.c

RCS file: /grassrepository/grass6/lib/gis/icon.c,v
retrieving revision 1.8
diff -u -r1.8 icon.c
--- icon.c 21 Apr 2007 20:37:46 -0000 1.8
+++ icon.c 21 Apr 2007 21:24:44 -0000
@@ -28,8 +28,11 @@

     for ( i = 0; i < n_points; i++)
     {
- x[i] = m[0][0] * x[i] + m[0][1] * y[i] + xc;
- y[i] = m[1][0] * x[i] + m[1][1] * y[i] + yc;
+ double xi = x[i];
+ double yi = y[i];
+
+ x[i] = m[0][0] * xi + m[0][1] * yi + xc;
+ y[i] = m[1][0] * xi + m[1][1] * yi + yc;
     }
}

I have tested this and it appears to work now.

Committed to CVS.

Very nice. Also works for me.
Thanks,
Markus