24static char key[100], data[500];
37 G_debug(3,
" get_key_data(): %s", buf);
53 G_debug(3,
" key = %s data = %s", key, data);
146 p->
coor.line.count = 0;
147 p->
coor.line.alloc = 0;
156 if (
el->coor.line.count ==
el->coor.line.alloc) {
157 el->coor.line.alloc += 10;
159 el->coor.line.x,
el->coor.line.alloc *
sizeof(
double));
161 el->coor.line.y,
el->coor.line.alloc *
sizeof(
double));
163 el->coor.line.x[
el->coor.line.count] =
x;
164 el->coor.line.y[
el->coor.line.count] = y;
165 el->coor.line.count++;
175 p->
coor.arc.clock = c;
192 while (
G_getl2(buf, 500, fp) != 0) {
196 if ((buf[0] ==
'#') || (buf[0] ==
'\0'))
201 if (
strcmp(key,
"END") == 0) {
206 if (
sscanf(buf,
"%lf %lf", &
x, &y) != 2) {
207 G_warning(
_(
"Cannot read symbol line coordinates: %s"), buf);
235 char group[500],
name[500], buf[2001],
buf2[2048];
256 G_warning(
_(
"Incorrect symbol name: '%s' (should be: group/name or "
257 "group/name@mapset)"),
266 G_debug(3,
" group: '%s' name: '%s'", group,
name);
269 snprintf(buf,
sizeof(buf),
"symbol/%s", group);
277 fp =
fopen(buf,
"r");
291 while (
G_getl2(buf, 2000, fp) != 0) {
296 if ((buf[0] ==
'#') || (buf[0] ==
'\0'))
301 if (
strcmp(key,
"VERSION") == 0) {
302 if (
strcmp(data,
"1.0") != 0) {
303 snprintf(buf,
sizeof(buf),
"Wrong symbol version: '%s'", data);
307 else if (
strcmp(key,
"BOX") == 0) {
308 if (
sscanf(data,
"%lf %lf %lf %lf", &
x, &y, &x2, &y2) != 4) {
309 snprintf(buf,
sizeof(buf),
"Incorrect box definition: '%s'",
313 symb->xscale = 1 / (x2 -
x);
314 symb->yscale = 1 / (y2 - y);
315 if (x2 -
x > y2 - y) {
322 else if (
strcmp(key,
"STRING") == 0) {
331 else if (
strcmp(key,
"POLYGON") == 0) {
337 else if (
strcmp(key,
"RING") == 0) {
343 else if (
strcmp(key,
"LINE") == 0) {
349 else if (
strcmp(key,
"ARC") == 0) {
358 if (
ret == 6 && (clock ==
'c' || clock ==
'C'))
365 else if (
strcmp(key,
"END") == 0) {
381 else if (
strcmp(key,
"COLOR") == 0) {
385 else if (
sscanf(data,
"%d %d %d", &
r, &
g, &
b) == 3) {
387 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
400 G_debug(4,
" color [%d %d %d] = [%.3f %.3f %.3f]",
r,
g,
b,
405 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
409 else if (
strcmp(key,
"FCOLOR") == 0) {
413 else if (
sscanf(data,
"%d %d %d", &
r, &
g, &
b) == 3) {
415 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
428 G_debug(4,
" color [%d %d %d] = [%.3f %.3f %.3f]",
r,
g,
b,
433 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
448 for (i = 0; i <
symb->count; i++) {
449 part =
symb->part[i];
450 G_debug(4,
" Part %d: type: %d number of chains: %d", i, part->
type,
456 G_debug(4,
" Chain %d: number of elements: %d",
j, chain->
count);
457 for (k = 0; k < chain->
count; k++) {
458 elem = chain->
elem[k];
459 G_debug(4,
" Element %d: type: %d", k, elem->
type);
461 G_debug(4,
" Number of points %d",
462 elem->
coor.line.count);
463 for (
l = 0;
l < elem->
coor.line.count;
l++) {
465 elem->
coor.line.y[
l]);
int G_getl2(char *, int, FILE *)
Gets a line of text from a file of any pedigree.
void G_free(void *)
Free allocated memory.
void G_warning(const char *,...) __attribute__((format(printf
const char * G_gisbase(void)
Get full path name of the top level module directory.
const char * G_find_file(const char *, char *, const char *)
Searches for a file from the mapset search list or in a specified mapset.
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
int int G_strcasecmp(const char *, const char *)
String compare ignoring case (upper or lower)
char * G_chop(char *)
Chop leading and trailing white spaces.
int G_debug(int, const char *,...) __attribute__((format(printf
void get_key_data(char *buf)
SYMBCHAIN * new_chain(void)
SYMBPART * new_part(int type)
SYMBEL * new_arc(double x, double y, double r, double a1, double a2, int c)
void add_part(SYMBOL *s, SYMBPART *p)
void add_chain(SYMBPART *p, SYMBCHAIN *s)
void read_coor(FILE *fp, SYMBEL *e)
SYMBOL * new_symbol(void)
SYMBOL * S_read(const char *sname)
void add_point(SYMBEL *el, double x, double y)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
void add_element(SYMBCHAIN *s, SYMBEL *e)