21 #include <grass/ogsf.h>
26 #define FRINGE_FORE 0x000000
27 #define FRINGE_WIDTH 2
34 float Neast[] = { 0.8, 0.0, 0.6 };
35 float Nwest[] = { -0.8, 0.0, 0.6 };
36 float Ntop[] = { 0.0, 0.0, 1.0 };
54 float bot, xres, yres;
58 xres = surf->x_mod * surf->xres;
59 yres = surf->y_mod * surf->yres;
70 bot = elev - ((surf->zrange / 4.) * surf->z_exag);
77 if (where[0] || where[1]) {
91 if (where[2] || where[3]) {
105 if (where[0] || where[2]) {
118 if (where[1] || where[3]) {
148 int row_shift, max_row_shift;
164 pt[
X] = col * (surf->x_mod * surf->xres);
166 ((surf->rows - 1) * surf->yres) -
167 ((row + side) * (surf->y_mod * surf->yres));
171 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
175 while (!
GET_MAPATT(buff, offset, pt[Z]) && row_shift < max_row_shift) {
178 offset = ((row - row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
180 offset = ((row + row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
182 pt[Z] = pt[Z] * surf->z_exag;
185 for (col = 0; col < xcnt - 1; col++) {
187 pt[
X] = col * (surf->x_mod * surf->xres);
189 ((surf->rows - 1) * surf->yres) -
190 ((row + side) * (surf->y_mod * surf->yres));
195 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
197 while (!
GET_MAPATT(buff, offset, pt[Z]) && row_shift < max_row_shift) {
200 offset = ((row - row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
202 offset = ((row + row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
204 pt[Z] = pt[Z] * surf->z_exag;
232 int row_shift, max_row_shift;
249 pt[
X] = col * (surf->x_mod * surf->xres);
251 ((surf->rows - 1) * surf->yres) -
252 ((row + side) * (surf->y_mod * surf->yres));
257 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
259 while (!
GET_MAPATT(buff, offset, pt[Z]) && row_shift < max_row_shift) {
262 offset = ((row - row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
264 offset = ((row + row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
266 pt[Z] = pt[Z] * surf->z_exag;
269 for (col = 0; col < xcnt - 1; col++) {
271 pt[
X] = col * (surf->x_mod * surf->xres);
273 ((surf->rows - 1) * surf->yres) -
274 ((row + side) * (surf->y_mod * surf->yres));
275 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
277 while (!
GET_MAPATT(buff, offset, pt[Z]) && row_shift < max_row_shift) {
280 offset = ((row - row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
282 offset = ((row + row_shift) * surf->y_mod * surf->cols) + (col * surf->x_mod);
284 pt[Z] = pt[Z] * surf->z_exag;
289 pt[
X] = col * (surf->x_mod * surf->xres);
291 ((surf->rows - 1) * surf->yres) -
292 ((row + side) * (surf->y_mod * surf->yres));
297 pt[
X] = col * (surf->x_mod * surf->xres);
299 ((surf->rows - 1) * surf->yres) -
300 ((row + side) * (surf->y_mod * surf->yres));
329 int col_shift, max_col_shift;
345 pt[
X] = col * (surf->x_mod * surf->xres);
347 ((surf->rows - 1) * surf->yres) - (row * (surf->y_mod * surf->yres));
352 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
354 while (!
GET_MAPATT(buff, offset, pt[Z]) && col_shift < max_col_shift) {
357 offset = (row * surf->y_mod * surf->cols) + ((col - col_shift) * surf->x_mod);
359 offset = (row * surf->y_mod * surf->cols) + ((col + col_shift) * surf->x_mod);
361 pt[Z] = pt[Z] * surf->z_exag;
364 for (row = 0; row < ycnt - 1; row++) {
366 pt[
X] = col * (surf->x_mod * surf->xres);
368 ((surf->rows - 1) * surf->yres) -
369 (row * (surf->y_mod * surf->yres));
373 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
375 while (!
GET_MAPATT(buff, offset, pt[Z]) && col_shift < max_col_shift) {
378 offset = (row * surf->y_mod * surf->cols) + ((col - col_shift) * surf->x_mod);
380 offset = (row * surf->y_mod * surf->cols) + ((col + col_shift) * surf->x_mod);
382 pt[Z] = pt[Z] * surf->z_exag;
410 int col_shift, max_col_shift;
426 pt[
X] = col * (surf->x_mod * surf->xres);
428 ((surf->rows - 1) * surf->yres) - (row * (surf->y_mod * surf->yres));
433 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
435 while (!
GET_MAPATT(buff, offset, pt[Z]) && col_shift < max_col_shift) {
438 offset = (row * surf->y_mod * surf->cols) + ((col - col_shift) * surf->x_mod);
440 offset = (row * surf->y_mod * surf->cols) + ((col + col_shift) * surf->x_mod);
442 pt[Z] = pt[Z] * surf->z_exag;
445 for (row = 0; row < ycnt - 1; row++) {
447 pt[
X] = col * (surf->x_mod * surf->xres);
449 ((surf->rows - 1) * surf->yres) -
450 (row * (surf->y_mod * surf->yres));
451 offset = (row * surf->y_mod * surf->cols) + (col * surf->x_mod);
453 while (!
GET_MAPATT(buff, offset, pt[Z]) && col_shift < max_col_shift) {
456 offset = (row * surf->y_mod * surf->cols) + ((col - col_shift) * surf->x_mod);
458 offset = (row * surf->y_mod * surf->cols) + ((col + col_shift) * surf->x_mod);
460 pt[Z] = pt[Z] * surf->z_exag;
465 pt[
X] = col * (surf->x_mod * surf->xres);
467 ((surf->rows - 1) * surf->yres) - (row * (surf->y_mod * surf->yres));
472 pt[
X] = col * (surf->x_mod * surf->xres);
474 ((surf->rows - 1) * surf->yres) - (row * (surf->y_mod * surf->yres));
515 pt[
X] = surf->xmin + (col * (surf->x_mod * surf->xres));
516 pt[
Y] = surf->ymax - ((row + side) * (surf->y_mod * surf->yres));
522 pt[Z] = pt[Z] * surf->z_exag;
526 for (col = 0; col < xcnt - 1; col++) {
528 pt[
X] = surf->xmin + (col * (surf->x_mod * surf->xres));
529 pt[
Y] = surf->ymax - ((row + side) * (surf->y_mod * surf->yres));
530 offset = col * surf->x_mod;
532 pt[Z] = pt[Z] * surf->z_exag;
538 pt[
X] = surf->xmin + (col * (surf->x_mod * surf->xres));
539 pt[
Y] = surf->ymax - ((row + side) * (surf->y_mod * surf->yres));
void gsd_zwritemask(unsigned long n)
Write out z-mask.
void gsd_endqstrip(void)
ADD.
void gsd_do_scale(int doexag)
Set current scale.
void gsd_colormode(int cm)
Set color mode.
void gsd_color_func(unsigned int col)
Set current color.
void gsd_translate(float dx, float dy, float dz)
Multiply the current matrix by a translation matrix.
void gsd_pushmatrix(void)
Push the current matrix stack.
void gsd_bgnqstrip(void)
ADD.
void gsd_fringe_vert_poly(float bot, geosurf *surf, int col, int side)
Draw fringe outline in y direction.
typbuff * gs_get_att_typbuff(geosurf *gs, int desc, int to_write)
Get attribute data buffer.
void gsd_endline(void)
End line.
void gsd_fringe_horiz_poly(float bot, geosurf *surf, int row, int side)
Draw fringe polygon in x direction.
void gsd_fringe_horiz_line(float bot, geosurf *surf, int row, int side)
Draw fringe outline in x direction.
void gsd_vert_func(float *pt)
ADD.
void GS_set_draw(int where)
Sets which buffer to draw to.
void gsd_linewidth(short n)
Set width of rasterized lines.
void gsd_flush(void)
Mostly for flushing drawing commands accross a network.
void gsd_popmatrix(void)
Pop the current matrix stack.
void gsd_display_fringe(geosurf *surf, unsigned long clr, float elev, int where[4])
Display fridge.
void gsd_fringe_vert_line(float bot, geosurf *surf, int col, int side)
Draw fringe outline in y direction.
void gsd_bgnline(void)
Begin line.
void gsd_fringe_horiz_line2(float bot, geosurf *surf, int row, int side)
ADD.
void GS_done_draw(void)
Draw done, swap buffers.
#define GET_MAPATT(buff, offset, att)