grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

draw2.c File Reference
#include <math.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/display.h>
#include <grass/glocale.h>
#include "driver.h"
#include "path.h"
#include "clip.h"
Include dependency graph for draw2.c:

Go to the source code of this file.

Classes

struct  vector
 

Macros

#define min(x, y)   ((x) < (y) ? (x) : (y))
 
#define max(x, y)   ((x) > (y) ? (x) : (y))
 

Functions

static int shift_count (double dx)
 
static double shift_angle (double dx)
 
static double coerce (double x)
 
static int euclidify (struct path *p, int no_pole)
 
static void ll_wrap_path (struct path *dst, const struct path *src, int no_pole)
 
static void conv_path (struct path *dst, const struct path *src)
 
static void reduce_path (struct path *dst, const struct path *src, double eps)
 
void D_set_clip (double t, double b, double l, double r)
 set clipping window More...
 
void D_clip_to_map (void)
 set clipping window to map window More...
 
void D_set_clip_mode (int mode)
 
void D_set_reduction (double e)
 
void D_line_width (double d)
 
void D_get_text_box (const char *text, double *t, double *b, double *l, double *r)
 
void D_pos_abs (double x, double y)
 
void D_pos_rel (double x, double y)
 
static void do_path (int no_pole)
 
void D_begin (void)
 
void D_end (void)
 
void D_move_abs (double x, double y)
 
void D_cont_abs (double x, double y)
 
void D_close (void)
 
void D_stroke (void)
 
void D_fill (void)
 
void D_dots (void)
 
static void poly_abs (const double *x, const double *y, int n)
 
void D_polyline_abs (const double *x, const double *y, int n)
 
void D_polygon_abs (const double *x, const double *y, int n)
 
void D_polydots_abs (const double *x, const double *y, int n)
 
void D_line_abs (double x1, double y1, double x2, double y2)
 
void D_box_abs (double x1, double y1, double x2, double y2)
 
static void poly_rel (const double *x, const double *y, int n)
 
void D_move_rel (double x, double y)
 
void D_cont_rel (double x, double y)
 
void D_polydots_rel (const double *x, const double *y, int n)
 
void D_polyline_rel (const double *x, const double *y, int n)
 
void D_polygon_rel (const double *x, const double *y, int n)
 
void D_line_rel (double x1, double y1, double x2, double y2)
 
void D_box_rel (double x2, double y2)
 

Variables

static struct path path
 
static int clip_mode = M_NONE
 
static double epsilon = 0.0
 
static struct path ll_path clip_path raw_path eps_path
 
static struct vector cur
 
static struct rectangle clip
 
static int window_set
 

Macro Definition Documentation

◆ max

#define max (   x,
 
)    ((x) > (y) ? (x) : (y))

Definition at line 32 of file draw2.c.

◆ min

#define min (   x,
 
)    ((x) < (y) ? (x) : (y))

Definition at line 31 of file draw2.c.

Function Documentation

◆ coerce()

static double coerce ( double  x)
static

Definition at line 46 of file draw2.c.

References shift_angle(), and x.

Referenced by D_dots(), and euclidify().

◆ conv_path()

static void conv_path ( struct path dst,
const struct path src 
)
static

Definition at line 101 of file draw2.c.

References D_u_to_d_col(), D_u_to_d_row(), dst, path_copy(), src, vertex::x, and vertex::y.

Referenced by do_path().

◆ D_begin()

void D_begin ( void  )

Definition at line 291 of file draw2.c.

References path_begin().

Referenced by D_box_abs(), D_line_abs(), poly_abs(), poly_rel(), and symbol().

◆ D_box_abs()

void D_box_abs ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 408 of file draw2.c.

References cur, D_begin(), D_close(), D_cont_abs(), D_end(), D_fill(), D_move_abs(), x1, and x2.

Referenced by D_box_rel().

◆ D_box_rel()

void D_box_rel ( double  x2,
double  y2 
)

Definition at line 485 of file draw2.c.

References cur, D_box_abs(), vector::x, x2, and vector::y.

◆ D_clip_to_map()

void D_clip_to_map ( void  )

set clipping window to map window

Sets the clipping window to the pixel window that corresponds to the current database region. This is the default.

Parameters
~

Definition at line 171 of file draw2.c.

References b, D_get_src(), D_set_clip(), l, r, and t.

Referenced by D_dots(), and do_path().

◆ D_close()

void D_close ( void  )

Definition at line 318 of file draw2.c.

References path_close().

Referenced by D_box_abs(), D_polygon_abs(), and D_polygon_rel().

◆ D_cont_abs()

void D_cont_abs ( double  x,
double  y 
)

Definition at line 310 of file draw2.c.

References cur, path_cont(), x, vector::x, vector::y, and vertex::y.

Referenced by D_box_abs(), D_cont_rel(), D_line_abs(), poly_abs(), and symbol().

◆ D_cont_rel()

void D_cont_rel ( double  x,
double  y 
)

Definition at line 444 of file draw2.c.

References cur, D_cont_abs(), x, vector::x, and vector::y.

Referenced by poly_rel().

◆ D_dots()

◆ D_end()

void D_end ( void  )

Definition at line 296 of file draw2.c.

Referenced by D_box_abs(), D_line_abs(), and symbol().

◆ D_fill()

void D_fill ( void  )

Definition at line 329 of file draw2.c.

References COM_Fill(), and do_path().

Referenced by D_box_abs(), D_polygon_abs(), and D_polygon_rel().

◆ D_get_text_box()

void D_get_text_box ( const char *  text,
double *  t,
double *  b,
double *  l,
double *  r 
)

Definition at line 194 of file draw2.c.

References b, COM_Get_text_box(), D_d_to_u_col(), D_d_to_u_row(), l, r, t, and tmp.

◆ D_line_abs()

void D_line_abs ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 399 of file draw2.c.

References D_begin(), D_cont_abs(), D_end(), D_move_abs(), D_stroke(), x1, and x2.

Referenced by D_line_rel(), and line().

◆ D_line_rel()

void D_line_rel ( double  x1,
double  y1,
double  x2,
double  y2 
)

Definition at line 468 of file draw2.c.

References cur, D_line_abs(), vector::x, x1, x2, and vector::y.

◆ D_line_width()

void D_line_width ( double  d)

Definition at line 189 of file draw2.c.

References COM_Line_width(), and d.

◆ D_move_abs()

void D_move_abs ( double  x,
double  y 
)

Definition at line 302 of file draw2.c.

References cur, path_move(), x, vector::x, vector::y, and vertex::y.

Referenced by D_box_abs(), D_line_abs(), D_move_rel(), poly_abs(), and symbol().

◆ D_move_rel()

void D_move_rel ( double  x,
double  y 
)

Definition at line 439 of file draw2.c.

References cur, D_move_abs(), x, vector::x, and vector::y.

Referenced by poly_rel().

◆ D_polydots_abs()

void D_polydots_abs ( const double *  x,
const double *  y,
int  n 
)

Definition at line 393 of file draw2.c.

References D_dots(), poly_abs(), x, and vertex::y.

◆ D_polydots_rel()

void D_polydots_rel ( const double *  x,
const double *  y,
int  n 
)

Definition at line 449 of file draw2.c.

References D_dots(), poly_rel(), x, and vector::y.

◆ D_polygon_abs()

void D_polygon_abs ( const double *  x,
const double *  y,
int  n 
)

Definition at line 386 of file draw2.c.

References D_close(), D_fill(), poly_abs(), x, and vertex::y.

Referenced by symbol().

◆ D_polygon_rel()

void D_polygon_rel ( const double *  x,
const double *  y,
int  n 
)

Definition at line 461 of file draw2.c.

References D_close(), D_fill(), poly_rel(), x, and vector::y.

◆ D_polyline_abs()

void D_polyline_abs ( const double *  x,
const double *  y,
int  n 
)

Definition at line 380 of file draw2.c.

References D_stroke(), poly_abs(), x, and vertex::y.

◆ D_polyline_rel()

void D_polyline_rel ( const double *  x,
const double *  y,
int  n 
)

Definition at line 455 of file draw2.c.

References D_stroke(), poly_rel(), x, and vector::y.

◆ D_pos_abs()

void D_pos_abs ( double  x,
double  y 
)

Definition at line 218 of file draw2.c.

References COM_Pos_abs(), cur, D_u_to_d_col(), D_u_to_d_row(), x, vector::x, vector::y, and vertex::y.

Referenced by D_pos_rel().

◆ D_pos_rel()

void D_pos_rel ( double  x,
double  y 
)

Definition at line 229 of file draw2.c.

References cur, D_pos_abs(), x, vector::x, vector::y, and vertex::y.

◆ D_set_clip()

void D_set_clip ( double  t,
double  b,
double  l,
double  r 
)

set clipping window

Sets the clipping window to the pixel window that corresponds to the current database region. This is the default.

Parameters
ttop
bbottom
lleft
rright

Definition at line 152 of file draw2.c.

References b, l, max, min, r, t, clip::top, and window_set.

Referenced by D_clip_to_map().

◆ D_set_clip_mode()

void D_set_clip_mode ( int  mode)

Definition at line 179 of file draw2.c.

References mode().

◆ D_set_reduction()

void D_set_reduction ( double  e)

Definition at line 184 of file draw2.c.

References epsilon.

◆ D_stroke()

void D_stroke ( void  )

Definition at line 323 of file draw2.c.

References COM_Stroke(), and do_path().

Referenced by D_line_abs(), D_polyline_abs(), D_polyline_rel(), and symbol().

◆ do_path()

◆ euclidify()

static int euclidify ( struct path p,
int  no_pole 
)
static

Definition at line 54 of file draw2.c.

References coerce(), path::count, count, max, min, shift_count(), path::vertices, vertex::x, x0, x1, and vertex::y.

Referenced by ll_wrap_path().

◆ ll_wrap_path()

static void ll_wrap_path ( struct path dst,
const struct path src,
int  no_pole 
)
static

Definition at line 85 of file draw2.c.

References count, dst, euclidify(), vertex::mode, path_append(), path_copy(), src, vertex::x, and vertex::y.

Referenced by do_path().

◆ poly_abs()

static void poly_abs ( const double *  x,
const double *  y,
int  n 
)
static

Definition at line 367 of file draw2.c.

References D_begin(), D_cont_abs(), D_move_abs(), x, and vertex::y.

Referenced by D_polydots_abs(), D_polygon_abs(), and D_polyline_abs().

◆ poly_rel()

static void poly_rel ( const double *  x,
const double *  y,
int  n 
)
static

Definition at line 426 of file draw2.c.

References D_begin(), D_cont_rel(), D_move_rel(), x, and vector::y.

Referenced by D_polydots_rel(), D_polygon_rel(), and D_polyline_rel().

◆ reduce_path()

static void reduce_path ( struct path dst,
const struct path src,
double  eps 
)
static

Definition at line 114 of file draw2.c.

References dst, vertex::mode, P_MOVE, path_append(), path_reset(), src, vertex::x, and vertex::y.

Referenced by do_path().

◆ shift_angle()

static double shift_angle ( double  dx)
static

Definition at line 41 of file draw2.c.

References shift_count().

Referenced by coerce().

◆ shift_count()

static int shift_count ( double  dx)
static

Definition at line 36 of file draw2.c.

Referenced by euclidify(), and shift_angle().

Variable Documentation

◆ clip

struct rectangle clip
static

Definition at line 27 of file draw2.c.

◆ clip_mode

int clip_mode = M_NONE
static

Definition at line 21 of file draw2.c.

◆ cur

◆ eps_path

struct path ll_path clip_path raw_path eps_path
static

Definition at line 23 of file draw2.c.

Referenced by do_path().

◆ epsilon

double epsilon = 0.0
static

◆ path

◆ window_set

int window_set
static

Definition at line 29 of file draw2.c.

Referenced by D_dots(), D_set_clip(), and do_path().