I have the patch for ps.map too. (attached).
Please comment on it too, if you want.
--Wolf
On 27.04.2008 14:18, Wolf Bergenheim wrote:
Hi!
I have a patch to d.labels that I intend to apply. This patch adds
support for positioning the label _exactly_ on the co-ordinated given in
the labels file. The reason I need this is that v.label.sa calculates
precise locations for labels, and naturally I want the labels to be
placed exactly on that point.
Feel free to comment on the patch. Next I need to look at how ps.map
positions labels...
Please see [1] for example screenshots.
--Wolf
[1] http://wolf.bergenheim.net/src/GRASS/v.label.sa
------------------------------------------------------------------------
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev
--
<:3 )---- Wolf Bergenheim ----( 8:>
Index: ps.map/scan_ref.c
===================================================================
--- ps.map/scan_ref.c (revision 31091)
+++ ps.map/scan_ref.c (working copy)
@@ -12,6 +12,7 @@
#define LOWER 0
#define UPPER 1
#define CENTER 2
+#define NONE 3
static int xok, yok;
static int ymatch (char *,int *);
@@ -51,6 +52,8 @@
*xref = LEFT;
else if (strcmp (word, "right") == 0)
*xref = RIGHT;
+ else if (strcmp (word, "none") == 0)
+ *xref = NONE;
else
return 0;
xok = 1;
@@ -73,6 +76,8 @@
*yref = LOWER;
else if (strcmp (word, "bottom") == 0)
*yref = LOWER;
+ else if (strcmp (word, "none") == 0)
+ *yref = NONE;
else
return 0;
yok = 1;
Index: ps.map/do_labels.c
===================================================================
--- ps.map/do_labels.c (revision 31091)
+++ ps.map/do_labels.c (working copy)
@@ -20,6 +20,7 @@
#define LOWER 0
#define UPPER 1
#define CENTER 2
+#define NONE 3
int
do_labels (int other)
@@ -141,12 +142,16 @@
X_just_offset = -35;
if (xref == CENTER)
X_just_offset = 0;
+ if (xref == NONE)
+ X_just_offset = 0;
if (yref == UPPER)
Y_just_offset = 35;
if (yref == LOWER)
Y_just_offset = -35;
if (yref == CENTER)
Y_just_offset = 0;
+ if (yref == NONE)
+ Y_just_offset = 0;
/* adjust padding for given rotation */
if(rotate != 0.0)
Index: ps.map/textbox.c
===================================================================
--- ps.map/textbox.c (revision 31091)
+++ ps.map/textbox.c (working copy)
@@ -10,6 +10,7 @@
#define LOWER 0
#define UPPER 1
#define CENTER 2
+#define NONE 3
int
text_box_path (double x, double y, int xref, int yref, char *text, int fontsize, float rotate)
@@ -31,6 +32,7 @@
{
case LEFT: fprintf(PS.fp, "LTX"); break;
case RIGHT: fprintf(PS.fp, "RTX"); break;
+ case NONE: fprintf(PS.fp, "LTX"); break;
case CENTER:
default:
fprintf(PS.fp, "CTX"); break;
@@ -44,6 +46,8 @@
case LOWER: fprintf(PS.fp, "LTY"); break;
+ case NONE: fprintf(PS.fp, "LTY"); break;
+
case CENTER:
default:
fprintf(PS.fp, "CTY"); break;
Index: ps.map/mtextbox.c
===================================================================
--- ps.map/mtextbox.c (revision 31091)
+++ ps.map/mtextbox.c (working copy)
@@ -10,6 +10,7 @@
#define LOWER 0
#define UPPER 1
#define CENTER 2
+#define NONE 3
int multi_text_box_path (double x, double y,
int xref, int yref, char *text, int fontsize, float rotate)
@@ -95,6 +96,7 @@
{
case LEFT: fprintf(PS.fp, "LMX"); break;
case RIGHT: fprintf(PS.fp, "RMX"); break;
+ case NONE: fprintf(PS.fp, "LMX"); break;
case CENTER:
default:
fprintf(PS.fp, "CMX"); break;
@@ -106,6 +108,7 @@
{
case UPPER: fprintf(PS.fp, "UMY"); break;
case LOWER: fprintf(PS.fp, "LMY"); break;
+ case NONE: fprintf(PS.fp, "LMY"); break;
case CENTER:
default:
fprintf(PS.fp, "CMY"); break;
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev