21static char key[100], data[500];
34 G_debug(3,
" get_key_data(): %s", buf);
50 G_debug(3,
" key = %s data = %s", key, data);
143 p->
coor.line.count = 0;
144 p->
coor.line.alloc = 0;
153 if (
el->coor.line.count ==
el->coor.line.alloc) {
154 el->coor.line.alloc += 10;
156 el->coor.line.x,
el->coor.line.alloc *
sizeof(
double));
158 el->coor.line.y,
el->coor.line.alloc *
sizeof(
double));
160 el->coor.line.x[
el->coor.line.count] =
x;
161 el->coor.line.y[
el->coor.line.count] = y;
162 el->coor.line.count++;
172 p->
coor.arc.clock = c;
189 while (
G_getl2(buf, 500, fp) != 0) {
193 if ((buf[0] ==
'#') || (buf[0] ==
'\0'))
198 if (
strcmp(key,
"END") == 0) {
203 if (
sscanf(buf,
"%lf %lf", &
x, &y) != 2) {
204 G_warning(
_(
"Cannot read symbol line coordinates: %s"), buf);
232 char group[500],
name[500], buf[2001],
buf2[2048];
253 G_warning(
_(
"Incorrect symbol name: '%s' (should be: group/name or "
254 "group/name@mapset)"),
263 G_debug(3,
" group: '%s' name: '%s'", group,
name);
266 snprintf(buf,
sizeof(buf),
"symbol/%s", group);
274 fp =
fopen(buf,
"r");
288 while (
G_getl2(buf, 2000, fp) != 0) {
293 if ((buf[0] ==
'#') || (buf[0] ==
'\0'))
298 if (
strcmp(key,
"VERSION") == 0) {
299 if (
strcmp(data,
"1.0") != 0) {
300 snprintf(buf,
sizeof(buf),
"Wrong symbol version: '%s'", data);
304 else if (
strcmp(key,
"BOX") == 0) {
305 if (
sscanf(data,
"%lf %lf %lf %lf", &
x, &y, &x2, &y2) != 4) {
306 snprintf(buf,
sizeof(buf),
"Incorrect box definition: '%s'",
310 symb->xscale = 1 / (x2 -
x);
311 symb->yscale = 1 / (y2 - y);
312 if (x2 -
x > y2 - y) {
319 else if (
strcmp(key,
"STRING") == 0) {
328 else if (
strcmp(key,
"POLYGON") == 0) {
334 else if (
strcmp(key,
"RING") == 0) {
340 else if (
strcmp(key,
"LINE") == 0) {
346 else if (
strcmp(key,
"ARC") == 0) {
355 if (
ret == 6 && (clock ==
'c' || clock ==
'C'))
362 else if (
strcmp(key,
"END") == 0) {
378 else if (
strcmp(key,
"COLOR") == 0) {
382 else if (
sscanf(data,
"%d %d %d", &
r, &
g, &
b) == 3) {
384 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
397 G_debug(4,
" color [%d %d %d] = [%.3f %.3f %.3f]",
r,
g,
b,
402 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
406 else if (
strcmp(key,
"FCOLOR") == 0) {
410 else if (
sscanf(data,
"%d %d %d", &
r, &
g, &
b) == 3) {
412 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
425 G_debug(4,
" color [%d %d %d] = [%.3f %.3f %.3f]",
r,
g,
b,
430 G_warning(
_(
"Incorrect symbol color: '%s', using default."),
445 for (i = 0; i <
symb->count; i++) {
446 part =
symb->part[i];
447 G_debug(4,
" Part %d: type: %d number of chains: %d", i, part->
type,
453 G_debug(4,
" Chain %d: number of elements: %d",
j, chain->
count);
454 for (k = 0; k < chain->
count; k++) {
455 elem = chain->
elem[k];
456 G_debug(4,
" Element %d: type: %d", k, elem->
type);
458 G_debug(4,
" Number of points %d",
459 elem->
coor.line.count);
460 for (
l = 0;
l < elem->
coor.line.count;
l++) {
462 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)