cgv
Loading...
Searching...
No Matches
axis_config.h
1#pragma once
2
3#include <vector>
4#include <cgv/media/axis_aligned_box.h>
5#include <cgv/media/color.h>
6#include <cgv/gui/provider.h>
7
8#include "lib_begin.h"
9
10namespace cgv {
11 namespace plot {
12
14enum TickType
15{
16 TT_NONE,
17 TT_DASH,
18 TT_LINE,
19 TT_PLANE
20};
21
23struct CGV_API tick_config
24{
26 TickType type;
28 float step;
32 float length;
34 bool label;
38 bool operator == (const tick_config& tc) const;
40 tick_config(bool primary);
41};
42
44class CGV_API axis_config
45{
46private:
48 float min_tick_value;
50 float max_tick_value;
52 void update_tick_range();
54 float min_attribute_value_backup, max_attribute_value_backup;
55protected:
66public:
68 std::string name;
70 float get_attribute_min() const { return min_attribute_value; }
72 float get_attribute_max() const { return max_attribute_value; }
74 void put_backup_attribute_range(float& min_val, float& max_val) const;
76 float get_attribute_extent() const { return get_attribute_max() - get_attribute_min(); }
78 bool get_log_scale() const { return log_scale; }
80 float get_log_minimum() const { return log_minimum; }
82 void set_attribute_range(float _min, float _max);
84 void backup_attribute_range();
86 void restore_attribute_range();
88 void set_attribute_minimum(float _min);
90 void set_attribute_maximum(float _max);
92 void set_log_scale(bool enabled);
94 void set_log_minimum(float _min);
96 void set_log_config(bool enabled, float _min);
98 float extent;
100
114 bool operator == (const axis_config& ac) const;
116 float tick_space_from_attribute_space(float value) const;
118 float window_space_from_tick_space(float value) const;
120 float tick_space_from_window_space(float value) const;
122 float attribute_space_from_tick_space(float value) const;
124 float plot_space_from_window_space(float value) const;
126 float window_space_from_plot_space(float value) const;
128 float plot_space_from_attribute_space(float value) const;
130 float attribute_space_from_plot_space(float value) const;
132 axis_config();
134 void adjust_tick_marks_to_range(unsigned max_nr_secondary_ticks);
136 void create_gui(cgv::base::base* bp, cgv::gui::provider& p);
137};
138
139 }
140}
141
142#include <cgv/config/lib_end.h>
base class for all classes that can be registered with support for dynamic properties (see also secti...
Definition base.h:75
derive from this class to provide a gui to the current viewer
Definition provider.h:64
configuration information stored per domain axis
Definition axis_config.h:45
unsigned auto_adjust_max_snd_ticks
maximum number of secondary ticks for auto adjustment of ticks on changes to attribute range
Definition axis_config.h:65
tick_config primary_ticks
configuration of primary tickmarks
float extent
extent in world space
Definition axis_config.h:98
float log_minimum
minimum of logarithmic value in case that 0 is included in attribute range
Definition axis_config.h:63
bool get_log_scale() const
read access to log scale flag
Definition axis_config.h:78
float extent_scaling
potential constraint for scaling of plot extent in world space
float get_log_minimum() const
read access to minimum attribute value for robust log transformation
Definition axis_config.h:80
bool log_scale
whether axis is drawn with logarithmic scale
Definition axis_config.h:61
float line_width
line width
float max_attribute_value
maximum attribute value
Definition axis_config.h:59
std::string name
name of axis
Definition axis_config.h:68
float get_attribute_max() const
read access to attrbribute maximum value
Definition axis_config.h:72
float min_attribute_value
minimum attribute value
Definition axis_config.h:57
rgb color
color of axis
tick_config secondary_ticks
configuration of secondary tickmarks
float get_attribute_min() const
read access to attrbribute minimum value
Definition axis_config.h:70
float get_attribute_extent() const
compute the extent in attribute space
Definition axis_config.h:76
bool multi_axis_ticks
whether to show tick marks on both axes boundaries
the cgv namespace
Definition print.h:11
tickmark configuration of one tickmark type
Definition axis_config.h:24
float line_width
line width
Definition axis_config.h:30
bool label
whether to show text labels at tick
Definition axis_config.h:34
int precision
number of digits after decimal point, defaults to -1 which gives adaptive precision
Definition axis_config.h:36
float step
step width between two ticks along axis
Definition axis_config.h:28
float length
tick length relative to domain extent
Definition axis_config.h:32
TickType type
type of tick
Definition axis_config.h:26