1 /* 2 * gog-axis.h : 3 * 4 * Copyright (C) 2003-2004 Jody Goldberg (jody@gnome.org) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of the 9 * License, or (at your option) version 3. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 19 * USA 20 */ 21 22 #ifndef GOG_AXIS_H 23 #define GOG_AXIS_H 24 25 #include <goffice/goffice.h> 26 27 G_BEGIN_DECLS 28 29 typedef enum { 30 GOG_AXIS_POLAR_UNIT_DEGREES, 31 GOG_AXIS_POLAR_UNIT_RADIANS, 32 GOG_AXIS_POLAR_UNIT_GRADS, 33 GOG_AXIS_POLAR_UNIT_MAX 34 } GogAxisPolarUnit; 35 36 typedef enum { 37 GOG_AXIS_ELEM_MIN = 0, 38 GOG_AXIS_ELEM_MAX, 39 GOG_AXIS_ELEM_MAJOR_TICK, 40 GOG_AXIS_ELEM_MINOR_TICK, 41 GOG_AXIS_ELEM_CROSS_POINT, 42 GOG_AXIS_ELEM_MAX_ENTRY 43 } GogAxisElemType; 44 45 typedef enum { 46 GOG_AXIS_METRICS_INVALID = -1, 47 GOG_AXIS_METRICS_DEFAULT, 48 GOG_AXIS_METRICS_ABSOLUTE, 49 GOG_AXIS_METRICS_RELATIVE, 50 GOG_AXIS_METRICS_RELATIVE_TICKS, 51 GOG_AXIS_METRICS_MAX 52 } GogAxisMetrics; 53 54 typedef struct _GogAxisMap GogAxisMap; 55 56 GType gog_axis_map_get_type (void); 57 GogAxisMap* gog_axis_map_new (GogAxis *axis, double offset, double length); 58 double gog_axis_map (GogAxisMap *map, double value); 59 double gog_axis_map_to_view (GogAxisMap *map, double value); 60 double gog_axis_map_derivative_to_view (GogAxisMap *map, double value); 61 double gog_axis_map_from_view (GogAxisMap *map, double value); 62 gboolean gog_axis_map_finite (GogAxisMap *map, double value); 63 double gog_axis_map_get_baseline (GogAxisMap *map); 64 void gog_axis_map_get_extents (GogAxisMap *map, double *start, double *stop); 65 void gog_axis_map_get_real_extents (GogAxisMap *map, double *start, double *stop); 66 void gog_axis_map_get_bounds (GogAxisMap *map, double *minimum, double *maximum); 67 void gog_axis_map_get_real_bounds (GogAxisMap *map, double *minimum, double *maximum); 68 void gog_axis_map_free (GogAxisMap *map); 69 gboolean gog_axis_map_is_valid (GogAxisMap *map); 70 gboolean gog_axis_map_is_inverted (GogAxisMap *map); 71 gboolean gog_axis_map_is_discrete (GogAxisMap *map); 72 73 /*****************************************************************************/ 74 75 #define GOG_TYPE_AXIS (gog_axis_get_type ()) 76 #define GOG_AXIS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOG_TYPE_AXIS, GogAxis)) 77 #define GOG_IS_AXIS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOG_TYPE_AXIS)) 78 79 GType gog_axis_get_type (void); 80 81 GogAxisType gog_axis_get_atype (GogAxis const *axis); 82 gboolean gog_axis_is_center_on_ticks (GogAxis const *axis); 83 gboolean gog_axis_is_discrete (GogAxis const *axis); 84 gboolean gog_axis_is_inverted (GogAxis const *axis); 85 gboolean gog_axis_get_bounds (GogAxis const *axis, 86 double *minima, double *maxima); 87 void gog_axis_set_bounds (GogAxis *axis, 88 double minimum, double maximum); 89 void gog_axis_set_extents (GogAxis *axis, double start, double stop); 90 void gog_axis_get_effective_span (GogAxis const *axis, 91 double *start, double *end); 92 GOFormat *gog_axis_get_format (GogAxis const *axis); 93 GOFormat *gog_axis_get_effective_format (GogAxis const *axis); 94 gboolean gog_axis_set_format (GogAxis *axis, GOFormat *fmt); 95 const GODateConventions *gog_axis_get_date_conv (GogAxis const *axis); 96 unsigned gog_axis_get_ticks (GogAxis *axis, GogAxisTick **ticks); 97 GOData *gog_axis_get_labels (GogAxis const *axis, 98 GogPlot **plot_that_labeled_axis); 99 100 double gog_axis_get_entry (GogAxis const *axis, GogAxisElemType i, 101 gboolean *user_defined); 102 103 void gog_axis_add_contributor (GogAxis *axis, GogObject *contrib); 104 void gog_axis_del_contributor (GogAxis *axis, GogObject *contrib); 105 GSList const *gog_axis_contributors (GogAxis *axis); 106 void gog_axis_clear_contributors (GogAxis *axis); 107 void gog_axis_bound_changed (GogAxis *axis, GogObject *contrib); 108 109 void gog_axis_data_get_bounds (GogAxis *axis, GOData *data, double *minimum, double *maximum); 110 111 gboolean gog_axis_is_zero_important (GogAxis *axis); 112 113 GogGridLine *gog_axis_get_grid_line (GogAxis *axis, gboolean major); 114 115 void gog_axis_set_polar_unit (GogAxis *axis, GogAxisPolarUnit unit); 116 GogAxisPolarUnit gog_axis_get_polar_unit (GogAxis *axis); 117 double gog_axis_get_polar_perimeter (GogAxis *axis); 118 double gog_axis_get_circular_rotation (GogAxis *axis); 119 GogAxisColorMap const *gog_axis_get_color_map (GogAxis *axis); 120 GogColorScale *gog_axis_get_color_scale (GogAxis *axis); 121 GogAxisMetrics gog_axis_get_metrics (GogAxis const *axis); 122 GogAxis *gog_axis_get_ref_axis (GogAxis const *axis); 123 double gog_axis_get_major_ticks_distance (GogAxis const *axis); 124 /* private */ 125 void _gog_axis_set_color_scale (GogAxis *axis, GogColorScale *scale); 126 127 G_END_DECLS 128 129 #endif /* GOG_AXIS_H */ 130