GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
plot.c File Reference
#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
Include dependency graph for plot.c:

Go to the source code of this file.

Macros

#define POINT   struct point
 
#define X(e)   (left + xconv * ((e) - window.west))
 
#define Y(n)   (top + yconv * (window.north - (n)))
 
#define EAST(x)   (window.west + ((x)-left)/xconv)
 
#define NORTH(y)   (window.north - ((y)-top)/yconv)
 
#define OK   0
 
#define TOO_FEW_EDGES   2
 
#define NO_MEMORY   1
 
#define OUT_OF_SYNC   -1
 

Functions

int G_setup_plot (double t, double b, double l, double r, int(*Move)(int, int), int(*Cont)(int, int))
 returns east larger than west More...
 
int G_setup_fill (int gap)
 set row_fill routine to row_solid_fill or row_dotted_fill More...
 
int G_plot_where_xy (double east, double north, int *x, int *y)
 east,north to x,y More...
 
int G_plot_where_en (int x, int y, double *east, double *north)
 x,y to east,north More...
 
int G_plot_point (double east, double north)
 
int G_plot_line (double east1, double north1, double east2, double north2)
 plot line between latlon coordinates More...
 
int G_plot_line2 (double east1, double north1, double east2, double north2)
 
int G_plot_polygon (const double *x, const double *y, int n)
 plot filled polygon with n vertices More...
 
int G_plot_area (double *const *xs, double *const *ys, int *rpnts, int rings)
 plot multiple polygons More...
 
int G_plot_fx (double(*f)(double), double east1, double east2)
 plot f(east1) to f(east2) More...
 

Variables

 POINT
 
int y
 

Macro Definition Documentation

#define EAST (   x)    (window.west + ((x)-left)/xconv)

Definition at line 151 of file plot.c.

Referenced by G_plot_where_en().

#define NO_MEMORY   1
#define NORTH (   y)    (window.north - ((y)-top)/yconv)

Definition at line 152 of file plot.c.

Referenced by G_plot_where_en().

#define OUT_OF_SYNC   -1

Definition at line 387 of file plot.c.

Referenced by G_plot_area(), and G_plot_polygon().

#define POINT   struct point

Definition at line 31 of file plot.c.

Referenced by G_plot_area(), and G_plot_polygon().

#define TOO_FEW_EDGES   2

Definition at line 385 of file plot.c.

Referenced by G_plot_area(), and G_plot_polygon().

#define X (   e)    (left + xconv * ((e) - window.west))

Definition at line 148 of file plot.c.

Referenced by G_plot_area(), G_plot_polygon(), and G_plot_where_xy().

#define Y (   n)    (top + yconv * (window.north - (n)))

Definition at line 149 of file plot.c.

Referenced by G_plot_area(), G_plot_polygon(), and G_plot_where_xy().

Function Documentation

int G_plot_area ( double *const *  xs,
double *const *  ys,
int rpnts,
int  rings 
)

plot multiple polygons

Like G_plot_polygon, except it takes a set of polygons, each with {npts[i]} vertices, where the number of polygons is specified with the rings argument. It is especially useful for plotting vector areas with interior islands.

Parameters
xs
ys
npts
rings
Returns
int

Definition at line 546 of file plot.c.

References G_free(), G_warning(), n, NO_MEMORY, NULL, OK, OUT_OF_SYNC, POINT, TOO_FEW_EDGES, tools::window, X, y, and Y.

int G_plot_fx ( double(*)(double)  f,
double  east1,
double  east2 
)

plot f(east1) to f(east2)

The function f(east) is plotted from east1 to east2. The function f(east) must return the map northing coordinate associated with east.

Parameters
~
Returns
int

Definition at line 829 of file plot.c.

References G_plot_line().

int G_plot_line ( double  east1,
double  north1,
double  east2,
double  north2 
)

plot line between latlon coordinates

A line from east1,north1 to east2,north2 is plotted in output x,y coordinates (e.g. pixels for graphics.) This routine handles global wrap-around for latitude-longitude databases.

Parameters
east1
north1
east2
north2
Returns
int

Definition at line 230 of file plot.c.

Referenced by G_plot_fx(), and G_plot_icon().

int G_plot_line2 ( double  east1,
double  north1,
double  east2,
double  north2 
)

Definition at line 235 of file plot.c.

int G_plot_point ( double  east,
double  north 
)

Definition at line 198 of file plot.c.

References G_plot_where_xy(), and y.

int G_plot_polygon ( const double *  x,
const double *  y,
int  n 
)

plot filled polygon with n vertices

The polygon, described by the n vertices east,north, is plotted in the output x,y space as a filled polygon.

Parameters
east
north
n
Returns
int

Definition at line 412 of file plot.c.

References G_warning(), n, NO_MEMORY, OK, OUT_OF_SYNC, POINT, TOO_FEW_EDGES, tools::window, X, and Y.

int G_plot_where_en ( int  x,
int  y,
double *  east,
double *  north 
)

x,y to east,north

The pixel coordinates x,y are converted to map coordinates east,north.

Parameters
x
y
east
north
Returns
int

Definition at line 190 of file plot.c.

References EAST, G_adjust_easting(), NORTH, and tools::window.

int G_plot_where_xy ( double  east,
double  north,
int x,
int y 
)

east,north to x,y

The map coordinates east,north are converted to pixel coordinates x,y.

Parameters
east
north
x
y
Returns
int

Definition at line 168 of file plot.c.

References G_adjust_easting(), tools::window, X, and Y.

Referenced by G_plot_point().

int G_setup_fill ( int  gap)

set row_fill routine to row_solid_fill or row_dotted_fill

After calling this function, G_plot_polygon() and G_plot_area() fill shapes with solid or dotted lines. If gap is greater than zero, this value will be used for row_dotted_fill. Otherwise, row_solid_fill is used.

Parameters
int
Returns
int

Definition at line 136 of file plot.c.

int G_setup_plot ( double  t,
double  b,
double  l,
double  r,
int(*)(int, int Move,
int(*)(int, int Cont 
)

returns east larger than west

If the region projection is PROJECTION_LL, then this routine returns an equivalent east that is larger, but no more than 360 degrees larger, than the coordinate for the western edge of the region. Otherwise no adjustment is made and the original east is returned.

Parameters
east
region
Returns
double

initialize plotting routines

Initializes the plotting capability. This routine must be called once before calling the G_plot_*(~) routines described below. The parameters t, b, l, r are the top, bottom, left, and right of the output x,y coordinate space. They are not integers, but doubles to allow for subpixel registration of the input and output coordinate spaces. The input coordinate space is assumed to be the current GRASS region, and the routines supports both planimetric and latitude- longitude coordinate systems. Move and Cont are subroutines that will draw lines in x,y space. They will be called as follows: Move(x, y) move to x,y (no draw) Cont(x, y) draw from previous position to x,y. Cont(~) is responsible for clipping

Parameters
~
Returns
int

Definition at line 97 of file plot.c.

References b, G_get_set_window(), l, r, tools::window, ymax, and ymin.

Variable Documentation

POINT
Initial value:
{
double x

Definition at line 32 of file plot.c.

int y

Definition at line 34 of file plot.c.

Referenced by add_coor(), add_ipoint(), add_point(), alnorm(), anderson_darling(), anderson_darling_exp(), avl_copy(), avl_delete(), avl_probe(), avl_t_next(), avl_t_prev(), BM_create(), BM_create_sparse(), BM_dump_map_row_sparse(), BM_file_read(), BM_file_write_sparse(), chi_square(), chi_square_exp(), chouse(), chousv(), COM_Box_abs(), COM_Cont_abs(), COM_Move_abs(), COM_Move_rel(), cramer_von_mises(), cramer_von_mises_exp(), D_cont_abs(), D_cont_clip(), D_move_abs(), D_move_clip(), D_move_rel(), D_popup(), D_symbol(), D_symbol2(), dagostino_d(), dcmp(), dig_add_node(), dig_distance2_point_to_line(), dig_find_area_poly(), dig_find_node(), dig_spidx_add_node(), dmax(), dmax_exp(), drawchar(), durbins_exact(), extreme(), find_all_intersections(), G3d_changePrecision(), G3d_changeType(), G3d_compareFiles(), G3d_computeClippedTileDimensions(), G3d_flushTileCube(), G3d_getBlock(), G3d_getBlockNocache(), G3d_getVolumeA(), G3d_makeAlignedVolumeFile(), G3d_maskTile(), G3d_range_updateFromTile(), G3d_retile(), G3d_writeAscii(), G_abs_log_colors(), G_distance2_point_to_line(), G_distance_between_line_segments(), G_distance_point_to_line_segment(), G_geodesic_distance_lon_to_lon(), G_log_colors(), G_math_rand_gauss(), G_plot_area(), G_plot_point(), G_rotate_around_point_int(), geary_test(), get_epsilon(), gk_follow_frames(), gpd_obj_site_attr(), GS_distance(), GS_draw_flowline_at_xy(), GS_get_cat_at_xy(), GS_get_norm_at_xy(), GS_get_val_at_xy(), GS_look_here(), GS_P2distance(), GS_set_Narrow(), GS_set_rotation(), GS_write_ppm(), GS_write_tif(), GS_write_zoom(), gsd_rot(), gsd_write_mpegframe(), gvl_isosurf_calc(), gvld_isosurf(), gvld_slice(), house(), housev(), ident_win(), IL_matrix_create(), kolmogorov_smirnov(), kolmogorov_smirnov_exp(), kotz_families(), kuipers_v(), kuipers_v_exp(), main(), N_compute_gradient_field_components_2d(), N_compute_gradient_field_components_3d(), N_les_integrate_dirichlet_2d(), N_les_integrate_dirichlet_3d(), N_read_rast3d_to_array_3d(), N_read_rast_to_array_2d(), N_write_array_2d_to_rast(), N_write_array_3d_to_rast3d(), NetA_add_point_on_node(), new_arc(), Nviz_draw_all_surf(), Nviz_set_cplane_here(), Nviz_set_focus(), Nviz_set_light_position(), omnibus_moments(), P_scale(), PNG_Box_abs(), PNG_draw_bitmap(), PNG_scaled_raster(), process_command(), process_point(), qrbdi(), qrbdu1(), qrbdv(), qrecvc(), qreval(), qrevec(), quad_point_new(), read_bmp(), read_coor(), read_g3d_slice(), read_g3d_vol(), read_pgm(), read_png(), read_ppm(), royston(), S_read(), shapiro_francia(), shapiro_wilk(), shapiro_wilk_exp(), slice_calc(), stroke_chain(), tavl_delete(), tavl_probe(), translate_quad(), V_call(), Vect_append_point(), Vect_box_clip(), Vect_break_lines_list(), Vect_break_polygons(), Vect_clean_small_angles_at_nodes(), Vect_find_area(), Vect_find_island(), Vect_find_node(), Vect_get_point_in_poly_isl(), Vect_line_buffer(), Vect_line_insert_point(), Vect_line_intersection(), Vect_line_reverse(), Vect_snap_line(), Vect_snap_lines_list(), Vect_tin_get_z(), Vedit_add_vertex(), Vedit_connect_lines(), Vedit_move_lines(), Vedit_move_vertex(), Vedit_remove_vertex(), Vedit_snap_line(), Vedit_split_lines(), watson_u2(), watson_u2_exp(), weisberg_bingham(), wext(), write_bmp(), write_pgm(), write_png(), write_ppm(), and XY_intersect_plane().