Browse Source

add support for basic and fancy compass

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57719 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman 11 years ago
parent
commit
346dea38c4
2 changed files with 24 additions and 5 deletions
  1. 21 2
      display/d.northarrow/draw_n_arrow.c
  2. 3 3
      display/d.northarrow/main.c

+ 21 - 2
display/d.northarrow/draw_n_arrow.c

@@ -59,8 +59,14 @@ int draw_n_arrow(double east, double north, double fontsize, char *n_arrow_num)
     	    D_text("N");
     	    break;
     	case '9':
+	case 'f':
     	    D_pos_abs(x_pos - (tr + tl) / 2, y_pos - 55);
     	    D_text("N");
+	    break;
+    	case 'b':
+    	    D_pos_abs(x_pos - (tr + tl) / 2, y_pos - 48.5);
+    	    D_text("N");
+    	    break;
     	case '2':
     	case '5':
     	case '6':
@@ -119,6 +125,12 @@ int draw_n_arrow(double east, double north, double fontsize, char *n_arrow_num)
     case '9':
     	symbol_size = 17.;
     	break;
+    case 'b':
+    	symbol_size = 80.;
+    	break;
+    case 'f':
+    	symbol_size = 100.;
+    	break;
     default:
     	G_fatal_error(_("Could not parse symbol"));
     }
@@ -126,8 +138,15 @@ int draw_n_arrow(double east, double north, double fontsize, char *n_arrow_num)
     x0 = D_d_to_u_col(x_pos);
     y0 = D_d_to_u_row(y_pos);
 
-    strcpy(icon, "n_arrows/n_arrow");
-    strncat(icon, n_arrow_num, 32);
+    if (n_arrow_num[0] == 'b')
+	strcpy(icon, "n_arrows/compass");
+    else if (n_arrow_num[0] == 'f')
+	strcpy(icon, "n_arrows/fancy_compass");
+    else {
+	strcpy(icon, "n_arrows/n_arrow");
+	strncat(icon, n_arrow_num, 32);
+    }
+
     Symb = S_read(icon);
 
     if(!Symb)

+ 3 - 3
display/d.northarrow/main.c

@@ -44,8 +44,8 @@ int main(int argc, char **argv)
 
     n_arrow = G_define_option();
     n_arrow->key = "style";
-    n_arrow->description = _("North arrow style (used only with the -n flag)");
-    n_arrow->options = "1a,1b,2,3,4,5,6,7a,7b,8a,8b,9";
+    n_arrow->description = _("North arrow style");
+    n_arrow->options = "1a,1b,2,3,4,5,6,7a,7b,8a,8b,9,fancy_compass,basic_compass";
     n_arrow->answer = "1a";
     n_arrow->guisection = _("Style");
 
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
     fsize->key = "fontsize";
     fsize->type = TYPE_DOUBLE;
     fsize->required = NO;
-    fsize->answer = "12";
+    fsize->answer = "14";
     fsize->options = "1-360";
     fsize->description = _("Font size");