Opened 16 years ago

Closed 15 years ago

#600 closed enhancement (fixed)

d.vect: add new size_column=, rotation_column= options

Reported by: hamish Owned by: grass-dev@…
Priority: normal Milestone: 6.5.0
Component: Vector Version: svn-develbranch6
Keywords: d.vect Cc:
CPU: All Platform: All

Description

Hi,

it would be nice if d.vect had two new options for display of points/icons: size_column= and rotation_column=.

I think to do it we'd just have to clone the code from the existing rgb_column=, wcolumn= options, then: (as in d.graph)

-  S_stroke(Symb, size, 0.0, 0);
+  S_stroke(Symb, size, double rotation, 0);

angle is measured in degrees CCW from East.

we'd have to verify that cats with NULL attributes for rotation angle use rotation=0.0 and not just whatever the angle of the last cat was. I guess that the wcolumn= option already has code to check that the given column is numeric.

workaround using d.graph:

#spearfish dataset
#create example values using the cat number for angle
# rotation is measured in degrees CCW from East

g.copy vect=archsites,test_rotate
v.db.addcol test_rotate column='rotation double precision'
v.db.update test_rotate column=rotation value='CAT'

v.out.ascii test_rotate column=rotation | \
   awk -F'|' '{printf("rotation %s\nsymbol geology/strike_triangle 12 %s %s black black\n", $4, $1, $2)}' \
   > test_rotate_graph.rules

d.graph -m test_rotate_graph.rules
d.vect test_rotate disp=cat yref=top

thanks, Hamish

Change History (3)

comment:1 by hamish, 15 years ago

implemented in devbr6/trunk with r38508/r38509.

please test -- I'm a bit concerned about a possible double-free() in source:grass/trunk/display/d.vect/plot1.c@38509#L542

The effect of S_stroke() seems to be cumulative, so we need to re-read in the symbol each time to reset it. Maybe a better way would be to read in a master copy then memcpy() SYMBOL *Symb to a disposable copy and S_stroke()+D_symbol()+G_free() the disposable version?

spearfish example:

d.vect -c archsites icon=basic/triangle rot_col=cat size_col=cat

Hamish

comment:2 by hamish, 15 years ago

todo for GRASS 7: change S_stroke()'s size parameter to take double instead of int.

Hamish

comment:3 by hamish, 15 years ago

Resolution: fixed
Status: newclosed

S_stroke() updated in trink to take doubles for size. closing wish.

Note: See TracTickets for help on using tickets.