symbol.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef GRASS_SYMB_H
  2. #define GRASS_SYMB_H
  3. /* definitions and structures */
  4. /* Warning : structure is not exactly the same as format. */
  5. #define S_NONE 0 /* no object (used for reading) */
  6. /* elements */
  7. #define S_LINE 1 /* line */
  8. #define S_ARC 2 /* arc */
  9. /* parts */
  10. #define S_STRING 1
  11. #define S_POLYGON 2
  12. #define S_COL_DEFAULT 1 /* default color */
  13. #define S_COL_NONE 2 /* no color */
  14. #define S_COL_DEFINED 3 /* color defined in symbol file */
  15. typedef struct {
  16. int color; /* reset default */
  17. int r, g, b;
  18. double fr, fg, fb;
  19. } SYMBCOLOR;
  20. /* symbol element: line or arc */
  21. typedef struct {
  22. int type; /* S_LINE or S_ARC */
  23. union {
  24. struct {
  25. int count, alloc;
  26. double *x, *y;
  27. } line;
  28. struct {
  29. int clock; /* 1 clockwise, 0 counter clockwise */
  30. double x, y, r, a1, a2;
  31. } arc;
  32. } coor;
  33. } SYMBEL;
  34. /* string of elements */
  35. typedef struct {
  36. int count, alloc; /* number of elements */
  37. SYMBEL **elem; /* array of elements */
  38. int scount, salloc; /* number of points in stroked version */
  39. int *sx, *sy; /* coordinates in stroked version */
  40. } SYMBCHAIN;
  41. /* part */
  42. typedef struct {
  43. int type; /* S_STRING or S_POLYGON */
  44. SYMBCOLOR color;
  45. SYMBCOLOR fcolor;
  46. int count, alloc; /* number of rings */
  47. SYMBCHAIN **chain; /* array strings */
  48. } SYMBPART;
  49. typedef struct {
  50. double scale; /* to get symbol of size 1, each vertex must be multiplied by this scale */
  51. int count, alloc;/* numer of parts */
  52. SYMBPART **part; /* objects ( parts ) */
  53. } SYMBOL;
  54. /* prototypes */
  55. SYMBOL *S_read ( char *sname );
  56. void S_stroke ( SYMBOL *symb, int size, double rotation, int tolerance );
  57. #endif