1 #ifndef __PGS_SBUFFER_H__ 2 #define __PGS_SBUFFER_H__ 3 4 /* Parser buffer declarations */ 5 6 #define STYPE_UNKNOWN 0 /* unknown type */ 7 #define STYPE_POINT 1 /* input is spherical type */ 8 #define STYPE_CIRCLE 2 /* input is spherical circle */ 9 #define STYPE_LINE 3 /* input is spherical line */ 10 #define STYPE_EULER 4 /* input is Euler transformation */ 11 #define STYPE_PATH 5 /* input is spherical path or polygon */ 12 #define STYPE_ELLIPSE 6 /* input is spherical ellipse */ 13 #define STYPE_BOX 7 /* input is spherical box */ 14 15 /* PGS_EULER_AXIS Euler axis */ 16 #define EULER_AXIS_X 1 /* x - axis for Euler transformation */ 17 #define EULER_AXIS_Y 2 /* y - axis for Euler transformation */ 18 #define EULER_AXIS_Z 3 /* z - axis for Euler transformation */ 19 20 int sphere_yylex(); 21 void sphere_yyerror(const char *str); 22 void sphere_flush_scanner_buffer(void); 23 24 /* Sets the data type */ 25 void set_spheretype(unsigned char st); 26 27 /* Initialize the input buffer */ 28 void init_buffer(char *buffer); 29 30 /* Resets the input buffer */ 31 void reset_buffer(void); 32 33 /* 34 * Read the "offset" number of bytes from "buf" buffer. 35 * Returns the number of read bytes. 36 */ 37 int get_buffer(char *buf, int offset); 38 39 /* 40 * Input of an angle. When is_deg > 0 then "a" is in degrees, 41 * otherwise it's in radians. Returns the unique ID (position) of the angle. 42 */ 43 int set_angle(unsigned char is_deg, double a); 44 45 /* 46 * Set the sign of an angle. "apos" is the angle. "s" is a sign of the angle 47 * ( < 0 .. - , > 0 .. + ). Returns the unique ID (position) of the angle. 48 */ 49 int set_angle_sign(int apos, int s); 50 51 /* 52 * Creates a spherical point. "lngpos" is the ID of a longitude angle, "latpos" 53 * is the ID of a latitude angle. Returns the unique ID (position) of the spherical 54 * point. 55 */ 56 int set_point(int lngpos, int latpos); 57 58 /* 59 * Creates a spherical circle. "spos" is the ID of a spherical point, "rpos" 60 * is the ID of a radius angle. 61 */ 62 void set_circle(int spos, int rpos); 63 64 /* 65 * Sets the length of a spherical line. "length" is the ID of a length angle. 66 */ 67 void set_line(int length); 68 69 /* 70 * Creates an Euler transformation. "phi" is the ID of a first angle, 71 * "theta" is the ID of a second angle, "psi" is the ID of a third angle, 72 * "etype" is the three letter code of Euler transformation axes. 73 */ 74 void set_euler(int phi, int theta, int psi, char *etype); 75 76 /* 77 * Creates a spherical ellipse. "r1" is the ID of a first radius angle, 78 * "r2" is the ID of a second radius angle, "sp" is the ID of a spherical 79 * point ( center ), "inc" is the ID of an inclination angle. 80 */ 81 void set_ellipse(int r1, int r2, int sp, int inc); 82 83 /* 84 * Returns the point parameters. "lng" is the pointer to a longitude 85 * value, "lat" is the pointer to a latitude value. Returns 0 if user 86 * input is a spherical point. 87 */ 88 int get_point(double *lng, double *lat); 89 90 /* 91 * Returns the circle parameters. "lng" is pointer to a longitude 92 * value of its center, "lat" is pointer to the latitude value of the center, 93 * "radius" is the pointer to the radius value. Returns 0 if user input 94 * is a spherical circle. 95 */ 96 int get_circle(double *lng, double *lat, double *radius); 97 98 /* 99 * Returns the ellipse parameters. "lng" is the pointer to a longitude value 100 * of its center, "lat" is the pointer to a latitude value of the center, "r1" 101 * is the pointer to a first radius value, "r2" is the pointer to a second 102 * radius value, "inc" is the pointer to an inclination angle. Returns 0 if user 103 * input is a spherical ellipse. 104 */ 105 int get_ellipse(double *lng, double *lat, double *r1, 106 double *r2, double *inc); 107 108 /* 109 * Returns the line parameters. "phi" is the pointer to the first angle 110 * of Euler transformation, "theta" is the pointer to the second angle of Euler 111 * transformation, "psi" is the pointer to the third angle of Euler transformation, 112 * "etype" is the pointer to the axes value of Euler transformation, "length" is 113 * the pointer to the length value. Returns 0 if user input is a spherical line. 114 */ 115 int get_line(double *phi, double *theta, double *psi, 116 unsigned char *etype, double *length); 117 118 /* 119 * Returns the Euler transformation parameters. "phi" is the pointer to the 120 * first angle of Euler transformation, "theta" is the pointer to the second 121 * angle of Euler transformation, "psi" is the pointer to the third angle of Euler 122 * transformation, "etype" is the pointer to the axes value of Euler transformation. 123 * Returns 0 if user input is an Euler transformation. 124 */ 125 int get_euler(double *phi, double *theta, 126 double *psi, unsigned char *etype); 127 128 /* 129 * Returns the number of path elements. 130 */ 131 int get_path_count(void); 132 133 /* 134 * Returns the elements of a path. "spos" is the number of element, "lng" is 135 * the ID of longitude angle, "lat" is the ID of a latitude angle. Returns 0 136 * if user input is a path or a polygon and "spos" is valid. 137 */ 138 int get_path_elem(int spos, double *lng, double *lat); 139 140 /* 141 * Returns the elements of a box. "lng1" is the ID of the first longitude 142 * angle, "lat1" is the ID of the first latitude angle, "lng2" is the ID of 143 * the second longitude angle, "lat2" is the ID of the second latitude angle. 144 * Returns 0 if user input is a box. 145 */ 146 int get_box(double *lng1, double *lat1, double *lng2, double *lat2); 147 148 #endif 149