File size: 4,797 Bytes
2b6ccf8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
 * Copyright (C) 1999 Anthony Lomax <lomax@faille.unice.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */


/*  GridGraphicsLib.h

	include file for grid graphics functions

*/



/*------------------------------------------------------------/ */
/* Anthony Lomax           | email: lomax@faille.unice.fr     / */
/* UMR Geosciences Azur    | web: www-geoazur.unice.fr/~lomax / */
/* 250 Rue Albert Einstein | tel: 33 (0) 4 93 95 43 25        / */
/* 06560 Valbonne, FRANCE  | fax: 33 (0) 4 93 65 27 17        / */
/*------------------------------------------------------------/ */



/* include files */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/*#include <errno.h> */
#include <time.h>
/*#include <float.h> */


/* defines */





/*------------------------------------------------------------/ */
/* macros */
/*------------------------------------------------------------/ */


/* */
/*------------------------------------------------------------/ */




/*------------------------------------------------------------/ */
/* structures */
/*------------------------------------------------------------/ */


	/* colors */

typedef struct {
    double r;	/* red */
    double g;	/* red */
    double b;	/* red */
} ColRGB;


	/* stations */

struct GrStation {
    int n_sta;      	/* station id number */
    char name[11];      /* name */
    int txt_pos;      	/* text position code 0=lower left, 1=ul, 2=ur, 3=lr */
    double txt_size;   	/* text size as fraction of default size */
    char col[11];		/* color */
    double zloc;    	/* z location */
    double yloc;    	/* y location */
    double xloc;    	/* x location */
};
extern int gr_num_sta;		/* number of stations read */

#define MAX_NUM_STA 100
extern struct GrStation sta_array[MAX_NUM_STA];


	/* graphics text */

struct GrTxt {
    char plot[5];		/* view SECT or MAP */
    char text[51];      /* name */
    char col[11];		/* color */
    double size;    	/* text size factor */
    double zloc;    	/* z location */
    double yloc;    	/* y location */
    double xloc;    	/* x location */
    int rot;   		 	/* rotation in deg */
};

extern int gr_num_txt;		/* number of text strings read */

#define MAX_NUM_TXT 100
extern struct GrTxt txt_array[MAX_NUM_TXT];

	/* graphics lines */

struct GrLine {
    char plot[5];		/* view SECT or MAP */
    double z1;    		/* z location */
    double y1;    		/* y location */
    double x1;    		/* x location */
    double z2;    		/* z location */
    double y2;    		/* y location */
    double x2;    		/* x location */
    char col[11];		/* color */
    char style[11];     /* style */
};

extern int gr_num_line;		/* number of lines read */

#define MAX_NUM_LINE 100
extern struct GrLine line_array[MAX_NUM_LINE];

	/* map line files */

struct GrMapLines {
    char format[MAXLINE];      	/* file format */
    char name[2*MAXLINE];		/* filename */
    char line_style[11];	/* linesytle */
    ColRGB rgb;			/* line color */
};

extern int gr_num_map_files;	/* number of map files */

#define MAX_NUM_MAP 10
extern struct GrMapLines mapfile[MAX_NUM_MAP];







/* */
/*------------------------------------------------------------/ */




/*------------------------------------------------------------/ */
/* globals  */
/*------------------------------------------------------------/ */



/* */
/*------------------------------------------------------------/ */




/*------------------------------------------------------------/ */
/* function declarations */
/*------------------------------------------------------------/ */

void SetGraphicConstants(void);
int ReadGraphicsInput(FILE* , char* , char* , int );
int get_maplines(char* );
char *get_timestamp();
int Err2GMT(FILE* , double , double , double , double , double , double );
Vect2D* Cov2Ellipse(double , double, double, double , double , Vect2D* , int );
int Vect2DArray2GMT(FILE* , Vect2D* , int );
Vect3D* toEllipsoid3D(Vect3D , Vect3D , Vect3D , int );
Vect2D*  Vect3D2To2D(Vect3D *, Vect2D* , int , int );

/* */
/*------------------------------------------------------------/ */