symbol.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef GRASS_SYMBOL_H
  2. #define GRASS_SYMBOL_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. {
  17. int color; /* reset default */
  18. int r, g, b;
  19. double fr, fg, fb;
  20. } SYMBCOLOR;
  21. /* symbol element: line or arc */
  22. typedef struct
  23. {
  24. int type; /* S_LINE or S_ARC */
  25. union
  26. {
  27. struct
  28. {
  29. int count, alloc;
  30. double *x, *y;
  31. } line;
  32. struct
  33. {
  34. int clock; /* 1 clockwise, 0 counter clockwise */
  35. double x, y, r, a1, a2;
  36. } arc;
  37. } coor;
  38. } SYMBEL;
  39. /* string of elements */
  40. typedef struct
  41. {
  42. int count, alloc; /* number of elements */
  43. SYMBEL **elem; /* array of elements */
  44. int scount, salloc; /* number of points in stroked version */
  45. double *sx, *sy; /* coordinates in stroked version */
  46. } SYMBCHAIN;
  47. /* part */
  48. typedef struct
  49. {
  50. int type; /* S_STRING or S_POLYGON */
  51. SYMBCOLOR color;
  52. SYMBCOLOR fcolor;
  53. int count, alloc; /* number of rings */
  54. SYMBCHAIN **chain; /* array strings */
  55. } SYMBPART;
  56. typedef struct
  57. {
  58. double scale; /* to get symbol of size 1, each vertex must be multiplied by this scale */
  59. double yscale; /* scale in x dimension */
  60. double xscale; /* scale in y dimension */
  61. int count, alloc; /* numer of parts */
  62. SYMBPART **part; /* objects ( parts ) */
  63. } SYMBOL;
  64. #include <grass/defs/symbol.h>
  65. #endif