[GRASS-SVN] r51928 - grass/branches/develbranch_6/display/d.vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 2 01:01:09 PDT 2012
Author: mmetz
Date: 2012-06-02 01:01:08 -0700 (Sat, 02 Jun 2012)
New Revision: 51928
Modified:
grass/branches/develbranch_6/display/d.vect/attr.c
grass/branches/develbranch_6/display/d.vect/label.c
grass/branches/develbranch_6/display/d.vect/local_proto.h
grass/branches/develbranch_6/display/d.vect/main.c
grass/branches/develbranch_6/display/d.vect/plot1.c
grass/branches/develbranch_6/display/d.vect/topo.c
Log:
d.vect: display area labels also when centroids are not displayed (backport from trunk)
Modified: grass/branches/develbranch_6/display/d.vect/attr.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/attr.c 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/attr.c 2012-06-02 08:01:08 UTC (rev 51928)
@@ -54,7 +54,7 @@
else if (ltype == -2)
break;
- if (!(type & ltype))
+ if (!(type & ltype) && !((type & GV_AREA) && (ltype & GV_CENTROID)))
continue; /* used for both lines and labels */
R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
Modified: grass/branches/develbranch_6/display/d.vect/label.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/label.c 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/label.c 2012-06-02 08:01:08 UTC (rev 51928)
@@ -5,7 +5,7 @@
#include <grass/glocale.h>
#include "plot.h"
-int label(struct Map_info *Map, int type, int do_area,
+int label(struct Map_info *Map, int type,
struct cat_list *Clist, LATTR * lattr, int chcat)
{
int i, ltype;
@@ -30,7 +30,7 @@
return 0;
}
- if (!(type & ltype))
+ if (!(type & ltype)&& !((type & GV_AREA) && (ltype & GV_CENTROID)))
continue; /* used for both lines and labels */
R_RGB_color(lattr->color.R, lattr->color.G, lattr->color.B);
Modified: grass/branches/develbranch_6/display/d.vect/local_proto.h
===================================================================
--- grass/branches/develbranch_6/display/d.vect/local_proto.h 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/local_proto.h 2012-06-02 08:01:08 UTC (rev 51928)
@@ -2,12 +2,12 @@
FILE *open_vect(char *, char *);
int close_vect(FILE *);
-int plot1(struct Map_info *, int, int, struct cat_list *,
+int plot1(struct Map_info *, int, struct cat_list *,
const struct color_rgb *, const struct color_rgb *, int, char *,
double, char *, char *, int, int, int, char *, int, char *, double,
int, char *);
-int label(struct Map_info *, int, int, struct cat_list *, LATTR *, int);
-int topo(struct Map_info *, int, int, LATTR *);
+int label(struct Map_info *, int, struct cat_list *, LATTR *, int);
+int topo(struct Map_info *, int, LATTR *);
int dir(struct Map_info *, int, struct cat_list *, int);
int darea(struct Map_info *, struct cat_list *, const struct color_rgb *,
const struct color_rgb *, int, int, int, int, struct Cell_head *,
Modified: grass/branches/develbranch_6/display/d.vect/main.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/main.c 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/main.c 2012-06-02 08:01:08 UTC (rev 51928)
@@ -34,7 +34,7 @@
{
char *mapset;
int ret, level;
- int i, stat = 0, type, area, display;
+ int i, stat = 0, type, display;
int chcat = 0;
int r, g, b;
int has_color, has_fcolor;
@@ -494,32 +494,7 @@
G_warning(_("%d errors in cat option"), ret);
}
- i = 0;
- type = 0;
- area = FALSE;
- while (type_opt->answers[i]) {
- switch (type_opt->answers[i][0]) {
- case 'p':
- type |= GV_POINT;
- break;
- case 'l':
- type |= GV_LINE;
- break;
- case 'b':
- type |= GV_BOUNDARY;
- break;
- case 'f':
- type |= GV_FACE;
- break;
- case 'c':
- type |= GV_CENTROID;
- break;
- case 'a':
- area = TRUE;
- break;
- }
- i++;
- }
+ type = Vect_option_to_types(type_opt);
i = 0;
display = 0;
@@ -630,7 +605,7 @@
if (!wcolumn_opt->answer)
D_line_width(default_width);
- if (area) {
+ if (type & GV_AREA) {
if (level >= 2) {
if (display & DISP_SHAPE) {
stat = darea(&Map, Clist,
@@ -655,7 +630,7 @@
G_warning(_("Unable to display lines by id, topology not available"));
}
else {
- stat = plot1(&Map, type, area, Clist,
+ stat = plot1(&Map, type, Clist,
has_color ? &color : NULL,
has_fcolor ? &fcolor : NULL, chcat, icon_opt->answer,
size, sizecolumn_opt->answer, rotcolumn_opt->answer,
@@ -682,7 +657,7 @@
R_line_width(0);
if (display & DISP_CAT)
- stat = label(&Map, type, area, Clist, &lattr, chcat);
+ stat = label(&Map, type, Clist, &lattr, chcat);
if (display & DISP_ATTR)
stat =
@@ -693,7 +668,7 @@
if (display & DISP_TOPO) {
if (level >= 2)
- stat = topo(&Map, type, area, &lattr);
+ stat = topo(&Map, type, &lattr);
else
G_warning(_("Unable to display topology, not available"));
}
Modified: grass/branches/develbranch_6/display/d.vect/plot1.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/plot1.c 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/plot1.c 2012-06-02 08:01:08 UTC (rev 51928)
@@ -126,7 +126,7 @@
/* *************************************************************** */
/* *************************************************************** */
/* *************************************************************** */
-int plot1(struct Map_info *Map, int type, int area, struct cat_list *Clist,
+int plot1(struct Map_info *Map, int type, struct cat_list *Clist,
const struct color_rgb *color, const struct color_rgb *fcolor,
int chcat, char *symbol_name, double size, char *size_column,
char *rot_column, int id_flag, int table_colors_flag,
Modified: grass/branches/develbranch_6/display/d.vect/topo.c
===================================================================
--- grass/branches/develbranch_6/display/d.vect/topo.c 2012-06-02 07:28:14 UTC (rev 51927)
+++ grass/branches/develbranch_6/display/d.vect/topo.c 2012-06-02 08:01:08 UTC (rev 51928)
@@ -5,7 +5,7 @@
#include "plot.h"
#include <grass/glocale.h>
-int topo(struct Map_info *Map, int type, int do_area, LATTR * lattr)
+int topo(struct Map_info *Map, int type, LATTR * lattr)
{
int i, ltype, num, el;
double xl, yl;
More information about the grass-commit
mailing list