[GRASS-SVN] r68961 - in grass/trunk: include lib/symbol

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 14 11:53:48 PDT 2016


Author: annakrat
Date: 2016-07-14 11:53:48 -0700 (Thu, 14 Jul 2016)
New Revision: 68961

Modified:
   grass/trunk/include/symbol.h
   grass/trunk/lib/symbol/read.c
Log:
symbols: add x and y scale attribute to get symbol size in both dimensions, which is needed for vector legend layout

Modified: grass/trunk/include/symbol.h
===================================================================
--- grass/trunk/include/symbol.h	2016-07-14 18:39:21 UTC (rev 68960)
+++ grass/trunk/include/symbol.h	2016-07-14 18:53:48 UTC (rev 68961)
@@ -67,6 +67,8 @@
 typedef struct
 {
     double scale;		/* to get symbol of size 1, each vertex must be multiplied by this scale */
+    double yscale;		/* scale in x dimension */
+    double xscale;		/* scale in y dimension */
     int count, alloc;		/* numer of parts */
     SYMBPART **part;		/* objects ( parts ) */
 } SYMBOL;

Modified: grass/trunk/lib/symbol/read.c
===================================================================
--- grass/trunk/lib/symbol/read.c	2016-07-14 18:39:21 UTC (rev 68960)
+++ grass/trunk/lib/symbol/read.c	2016-07-14 18:53:48 UTC (rev 68961)
@@ -312,10 +312,14 @@
 		sprintf(buf, "Incorrect box definition: '%s'", data);
 		return (err(fp, symb, buf));
 	    }
-	    if (x2 - x > y2 - y)
-		symb->scale = 1 / (x2 - x);
-	    else
-		symb->scale = 1 / (y2 - y);
+	    symb->xscale = 1 / (x2 - x);
+	    symb->yscale = 1 / (y2 - y);
+	    if (x2 - x > y2 - y) {
+		symb->scale = symb->xscale;
+	    }
+	    else {
+		symb->scale = symb->yscale;
+	    }
 	}
 	else if (strcmp(key, "STRING") == 0) {
 	    G_debug(4, "  STRING >");



More information about the grass-commit mailing list