TPCCLIB
|
Create SVG plot contents for TPC SVG C library. More...
#include "libtpcsvg.h"
Go to the source code of this file.
Functions | |
int | get_line_intersection (const double a1x, const double a1y, const double a2x, const double a2y, const double b1x, const double b1y, const double b2x, const double b2y, double *ix, double *iy, int verbose) |
int | check_intersection_with_viewport (const double x1, const double y1, const double x2, const double y2, struct svg_viewport_pos *cavp, double *nx1, double *ny1, double *nx2, double *ny2, int verbose) |
int | svg_start_plot_viewport (FILE *fp, struct svg_viewports *vp, char *errmsg, int verbose) |
int | svg_end_plot_viewport (FILE *fp, char *errmsg, int verbose) |
int | svg_start_coordinate_viewport (FILE *fp, struct svg_viewports *vp, char *errmsg, int verbose) |
int | svg_end_coordinate_viewport (FILE *fp, char *errmsg, int verbose) |
int | svg_calculate_axes (struct svg_viewports *vp, int verbose) |
int | svg_write_axes (FILE *fp, struct svg_viewports *vp, char *errmsg, int verbose) |
int | svg_write_xticks (FILE *fp, struct svg_viewports *vp, char *errmsg, int verbose) |
int | svg_write_yticks (FILE *fp, struct svg_viewports *vp, char *errmsg, int verbose) |
int | svg_write_tac (FILE *fp, struct svg_viewports *vp, const int plot_type, const char *tac_id, const char *tac_title, double *x, double *y, const int data_nr, const char *color, const svgSymbolType symbol_type, const svgSymbolFill symbol_fill, char *errmsg, int verbose) |
Variables | |
int | SVG_INLINE |
Create SVG plot contents for TPC SVG C library.
Definition in file svg_plot.c.
int check_intersection_with_viewport | ( | const double | x1, |
const double | y1, | ||
const double | x2, | ||
const double | y2, | ||
struct svg_viewport_pos * | cavp, | ||
double * | nx1, | ||
double * | ny1, | ||
double * | nx2, | ||
double * | ny2, | ||
int | verbose ) |
Check the intersections between specified line and viewport borders.
x1 | x,y coordinates of line at points 1 and 2; x coordinate of point 1. |
y1 | y coordinate of point 1. |
x2 | x coordinate of point 2. |
y2 | y coordinate of point 2. |
cavp | Pointer to coordinate area viewport. |
nx1 | Pointers for (possibly) modified line coordinates; NULL if not needed. |
ny1 | new y coordinate of point 1. |
nx2 | new x coordinate of point 2. |
ny2 | new y coordinate of point 2. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 73 of file svg_plot.c.
Referenced by svg_write_tac().
int get_line_intersection | ( | const double | a1x, |
const double | a1y, | ||
const double | a2x, | ||
const double | a2y, | ||
const double | b1x, | ||
const double | b1y, | ||
const double | b2x, | ||
const double | b2y, | ||
double * | ix, | ||
double * | iy, | ||
int | verbose ) |
Check whether two lines, each drawn between two points, intersect each other.
If either end of lines intersects with the other line, that is NOT counted as intersection.
a1x | x,y coordinates of line a at points 1 and 2; x coordinate of point 1. |
a1y | y coordinate of point 1. |
a2x | x coordinate of point 2. |
a2y | y coordinate of point 2. |
b1x | x,y coordinates of line b at points 1 and 2; x coordinate of point 1. |
b1y | y coordinate of point 1. |
b2x | x coordinate of point 2. |
b2y | y coordinate of point 2. |
ix | Pointers for intersection point coordinates; NULL if not needed. |
iy | Intersection y coordinate |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 19 of file svg_plot.c.
Referenced by check_intersection_with_viewport().
int svg_calculate_axes | ( | struct svg_viewports * | vp, |
int | verbose ) |
Calculate the axis tick positions. Before calling this, viewport must be filled with curve min and max values. This routine checks that max>min, changing the values if necessary.
vp | Struct containing the viewport sizes. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 364 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_end_coordinate_viewport | ( | FILE * | fp, |
char * | errmsg, | ||
int | verbose ) |
End coordinate area viewport.
fp | SVG graphics file pointer. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 327 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_end_plot_viewport | ( | FILE * | fp, |
char * | errmsg, | ||
int | verbose ) |
End plot viewport.
fp | SVG graphics file pointer. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 238 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_start_coordinate_viewport | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
char * | errmsg, | ||
int | verbose ) |
Start coordinate area viewport.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 276 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_start_plot_viewport | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
char * | errmsg, | ||
int | verbose ) |
Start plot area viewport.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 181 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_write_axes | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
char * | errmsg, | ||
int | verbose ) |
Draw the axes into SVG plot coordinate area.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
errmsg | Pointer to string where error message is written; NULL if not needed. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 437 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_write_tac | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
const int | plot_type, | ||
const char * | tac_id, | ||
const char * | tac_title, | ||
double * | x, | ||
double * | y, | ||
const int | data_nr, | ||
const char * | color, | ||
const svgSymbolType | symbol_type, | ||
const svgSymbolFill | symbol_fill, | ||
char * | errmsg, | ||
int | verbose ) |
Draw sample curve in an SVG file.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
plot_type | Plot type: 1=line, 2=symbols, 0=both line and symbols. |
tac_id | Unique ID for the curve. |
tac_title | Title of the curve, which may be shown in the graph. |
x | Pointer to the polyline data x array (original quantities). |
y | Pointer to the polyline data y array (original quantities). |
data_nr | Nr of data points in the array (half of array length). |
color | SVG color name as a string, e.g. aqua,black,blue,fuchsia,gray, green,lime,maroon,navy,olive,purple,red,silver,teal,yellow. Note that this string is not tested. |
symbol_type | Symbol type: RECTANGLE,CIRCLE,UPTRIANGLE,DOWNTRIANGLE,DIAMOND, LEFTTRIANGLE, RIGHTTRIANGLE |
symbol_fill | Symbol filling: SYMBOLOPEN, SYMBOLFILLED |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 746 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_write_xticks | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
char * | errmsg, | ||
int | verbose ) |
Create SVG plot x axis ticks.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 555 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
int svg_write_yticks | ( | FILE * | fp, |
struct svg_viewports * | vp, | ||
char * | errmsg, | ||
int | verbose ) |
Create SVG plot y axis ticks.
fp | SVG graphics file pointer. |
vp | Struct containing the viewport sizes. |
errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 655 of file svg_plot.c.
Referenced by plot_fit_svg(), plot_fitrange_svg(), and plot_svg().
|
extern |
Write inline SVG (1) or separate SVG file (0)
Definition at line 12 of file svg_file.c.
Referenced by svg_end_coordinate_viewport(), svg_end_plot_viewport(), svg_start_coordinate_viewport(), svg_start_plot_viewport(), svg_write_axes(), svg_write_tac(), svg_write_xticks(), and svg_write_yticks().