#include <stdio.h>#include <stdlib.h>#include <math.h>#include <string.h>#include <time.h>#include "libtpcsvg.h"Go to the source code of this file.
Functions | |
| int | get_line_intersection (double a1x, double a1y, double a2x, double a2y, double b1x, double b1y, double b2x, double b2y, double *ix, double *iy) |
| int | check_intersection_with_viewport (double x1, double y1, double x2, double y2, struct svg_viewport_pos *cavp, double *nx1, double *ny1, double *nx2, double *ny2) |
| int | svg_start_plot_viewport (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_end_plot_viewport (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_start_coordinate_viewport (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_end_coordinate_viewport (FILE *fp, char *errmsg) |
| int | svg_calculate_axes (struct svg_viewports *vp) |
| int | svg_write_axes (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_write_xticks (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_write_yticks (FILE *fp, struct svg_viewports *vp, char *errmsg) |
| int | svg_write_tac (FILE *fp, struct svg_viewports *vp, int plot_type, char *tac_id, char *tac_title, double *x, double *y, int data_nr, char *color, svgSymbolType symbol_type, char *errmsg) |
Variables | |
| int | SVG_INLINE |
| int | SVG_TEST |
| int check_intersection_with_viewport | ( | double | x1, |
| double | y1, | ||
| double | x2, | ||
| double | y2, | ||
| struct svg_viewport_pos * | cavp, | ||
| double * | nx1, | ||
| double * | ny1, | ||
| double * | nx2, | ||
| double * | ny2 | ||
| ) |
| 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 |
Definition at line 132 of file svg_plot.c.
References get_line_intersection(), svg_viewport_pos::h, SVG_TEST, and svg_viewport_pos::w.
Referenced by svg_write_tac().
| int get_line_intersection | ( | double | a1x, |
| double | a1y, | ||
| double | a2x, | ||
| double | a2y, | ||
| double | b1x, | ||
| double | b1y, | ||
| double | b2x, | ||
| double | b2y, | ||
| double * | ix, | ||
| double * | iy | ||
| ) |
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 |
Definition at line 87 of file svg_plot.c.
References SVG_TEST.
Referenced by check_intersection_with_viewport().
| int svg_calculate_axes | ( | struct svg_viewports * | vp | ) |
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 |
Definition at line 381 of file svg_plot.c.
References axis_check_range(), axis_tick_positions(), svg_coord::fixed_max, svg_coord::fixed_min, svg_coord::max, MAX_TICK_NR, svg_coord::min, svg_coord::tick, svg_coord::tick_decimals, svg_coord::tick_label, svg_coord::tick_nr, svg_coord::tickscale, svg_viewports::x, and svg_viewports::y.
| int svg_end_coordinate_viewport | ( | FILE * | fp, |
| char * | errmsg | ||
| ) |
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 |
Definition at line 353 of file svg_plot.c.
References SVG_INLINE, and svg_write().
| int svg_end_plot_viewport | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
End plot 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 |
Definition at line 280 of file svg_plot.c.
References SVG_INLINE, and svg_write().
| int svg_start_coordinate_viewport | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
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 |
Definition at line 310 of file svg_plot.c.
References svg_viewports::coordinate_area_viewport, svg_viewport_pos::h, SVG_INLINE, svg_write(), svg_viewport_pos::w, svg_viewport_pos::x, and svg_viewport_pos::y.
| int svg_start_plot_viewport | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
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 |
Definition at line 234 of file svg_plot.c.
References svg_viewport_pos::h, svg_viewports::plot_area_viewport, svg_define_symbols(), SVG_INLINE, svg_write(), svg_viewport_pos::w, svg_viewport_pos::x, and svg_viewport_pos::y.
| int svg_write_axes | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
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 |
Definition at line 438 of file svg_plot.c.
References svg_viewports::coordinate_area_viewport, svg_viewport_pos::h, svg_coord::max, svg_coord::min, svg_coord::origo, svg_coord::scale, SVG_INLINE, SVG_TEST, svg_write(), svg_coord::upper_margin, svg_viewport_pos::w, svg_viewports::x, and svg_viewports::y.
| int svg_write_tac | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| int | plot_type, | ||
| char * | tac_id, | ||
| char * | tac_title, | ||
| double * | x, | ||
| double * | y, | ||
| int | data_nr, | ||
| char * | color, | ||
| svgSymbolType | symbol_type, | ||
| char * | errmsg | ||
| ) |
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 |
| errmsg | Char pointer to string (at least of length 128) where possible error description is copied; set to NULL if not necessary |
Definition at line 665 of file svg_plot.c.
References check_intersection_with_viewport(), CIRCLE, svg_viewports::coordinate_area_viewport, DIAMOND, DOWNTRIANGLE, svg_viewport_pos::h, LEFTTRIANGLE, svg_coord::origo, RECTANGLE, RIGHTTRIANGLE, svg_coord::scale, SVG_INLINE, SVG_TEST, svg_write(), UPTRIANGLE, svg_viewport_pos::w, svg_viewports::x, and svg_viewports::y.
| int svg_write_xticks | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
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 |
Definition at line 523 of file svg_plot.c.
References svg_viewport_pos::chr_size, svg_viewports::coordinate_area_viewport, svg_viewport_pos::h, svg_coord::origo, svg_viewports::plot_area_viewport, svg_coord::scale, SVG_INLINE, SVG_TEST, svg_write(), svg_coord::tick, svg_coord::tick_label, svg_coord::tick_nr, svg_coord::tickscale, svg_viewport_pos::w, and svg_viewports::x.
| int svg_write_yticks | ( | FILE * | fp, |
| struct svg_viewports * | vp, | ||
| char * | errmsg | ||
| ) |
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 |
Definition at line 591 of file svg_plot.c.
References svg_viewport_pos::chr_size, svg_viewports::coordinate_area_viewport, svg_viewport_pos::h, svg_coord::origo, svg_viewports::plot_area_viewport, svg_coord::scale, SVG_INLINE, SVG_TEST, svg_write(), svg_coord::tick, svg_coord::tick_decimals, svg_coord::tick_label, svg_coord::tick_nr, svg_coord::tickscale, svg_viewport_pos::w, and svg_viewports::y.
| int SVG_INLINE |
Definition at line 50 of file svg_file.c.
| int SVG_TEST |
Definition at line 51 of file svg_file.c.
1.8.0