3#include <cgv/base/base.h>
5#include <cgv/media/axis_aligned_box.h>
6#include <cgv/render/drawable.h>
7#include <cgv/render/attribute_array_binding.h>
8#include <cgv/render/vertex_buffer.h>
9#include <cgv/render/shader_program.h>
10#include <libs/cgv_gl/rectangle_renderer.h>
11#include <cgv/media/color.h>
12#include <cgv/media/color_scale.h>
13#include <cgv/media/font/font.h>
14#include <cgv/render/view.h>
15#include <cgv/gui/provider.h>
16#include "axis_config.h"
99 mapped_size(
float s = 1.0f) : size(s), size_idx(-1) {}
107 mapped_rgba(
const rgba& c =
rgba(1, 1, 1, 1)) : color(c), color_idx(-1), opacity_idx(-1) {}
124 SPI_BAR_OUTLINE = 64,
190 float bar_base_window;
203 virtual void configure_chart(ChartType chart_type);
205 virtual void set_colors(
const rgb& base_color);
206 virtual void set_color_indices(
int idx);
208 virtual void set_opacities(
float _opa);
209 virtual void set_opacity_indices(
int idx);
211 virtual void set_sizes(
float _size);
212 virtual void set_size_indices(
int idx);
229 AttributeSource source;
232 const float* pointer;
241 attribute_source(
int sub_plot_index,
size_t ai,
size_t _count,
size_t _stride);
253 bool samples_out_of_date;
254 bool sources_out_of_date;
258 std::vector<attribute_source> attribute_sources;
265 LC_PRIMARY_COLOR = 1,
266 LC_SECONDARY_COLOR = 2,
267 LC_PRIMARY_OPACITY = 4,
268 LC_SECONDARY_OPACITY = 8,
269 LC_PRIMARY_SIZE = 16,
270 LC_SECONDARY_SIZE = 32,
276 virtual size_t size(
unsigned i)
const = 0;
277 virtual float operator() (
unsigned i,
unsigned k,
unsigned o)
const = 0;
298 : position(_position), label(_label), align(_align), scale(1.0f) {}
310 unsigned vertex_count;
312 unsigned first_label;
314 unsigned label_count;
316 tick_batch_info(
int _ai,
int _aj,
bool _primary,
unsigned _first_vertex = 0,
unsigned _first_label = 0);
333 void ensure_font_names();
358 vec3 world_space_from_plot_space(
const vecn& pnt_plot)
const;
360 vec3 transform_to_world(
const vecn& pnt_attr)
const;
381 static const unsigned MAX_NR_COLOR_MAPPINGS = 2;
383 int color_mapping[MAX_NR_COLOR_MAPPINGS];
385 cgv::media::ColorScale color_scale_index[MAX_NR_COLOR_MAPPINGS];
387 float color_scale_gamma[MAX_NR_COLOR_MAPPINGS];
389 float window_zero_position[MAX_NR_COLOR_MAPPINGS];
392 static const unsigned MAX_NR_OPACITY_MAPPINGS = 2;
394 int opacity_mapping[MAX_NR_OPACITY_MAPPINGS];
396 float opacity_gamma[MAX_NR_OPACITY_MAPPINGS];
398 bool opacity_is_bipolar[MAX_NR_OPACITY_MAPPINGS];
400 float opacity_window_zero_position[MAX_NR_OPACITY_MAPPINGS];
402 float opacity_min[MAX_NR_OPACITY_MAPPINGS];
404 float opacity_max[MAX_NR_OPACITY_MAPPINGS];
407 static const unsigned MAX_NR_SIZE_MAPPINGS = 2;
409 int size_mapping[MAX_NR_SIZE_MAPPINGS];
411 float size_gamma[MAX_NR_SIZE_MAPPINGS];
413 float size_min[MAX_NR_SIZE_MAPPINGS], size_max[MAX_NR_SIZE_MAPPINGS];
433 void on_font_selection();
435 void on_font_face_selection();
439 void prepare_extents();
453 std::vector<box2>& R, std::vector<rgb>& C, std::vector<float>& D,
size_t offset = 0);
456 std::vector<label_info>& tick_labels, std::vector<tick_batch_info>& tick_batches,
float depth);
458 size_t enable_attributes(
cgv::render::context& ctx,
int i,
const std::vector<std::vector<vec2>>& samples);
460 size_t enable_attributes(
cgv::render::context& ctx,
int i,
const std::vector<std::vector<vec3>>& samples);
464 void update_samples_out_of_date_flag();
466 virtual bool compute_sample_coordinate_interval(
int i,
int ai,
float& samples_min,
float& samples_max) = 0;
468 void draw_sub_plot_samples(
int count,
const plot_base_config& spc,
bool strip =
false);
472 void draw_legend(
cgv::render::context& ctx,
int layer_idx = 0,
bool is_first =
true,
bool* multi_axis_modes = 0);
474 bool extract_tick_rectangles_and_tick_labels(
475 std::vector<box2>& R, std::vector<rgb>& C, std::vector<float>& D,
476 std::vector<label_info>& tick_labels,
int ai,
int ci,
int ti,
float he,
477 float z_plot,
float plot_scale = 1.0f,
vec2 plot_offset =
vec2(0.0f,0.0f),
float d = 0.0f,
bool multi_axis =
true);
479 void extract_legend_tick_rectangles_and_tick_labels(
480 std::vector<box2>& R, std::vector<rgb>& C, std::vector<float>& D,
481 std::vector<label_info>& tick_labels, std::vector<tick_batch_info>& tick_batches,
float d,
482 bool clear_cache =
false,
bool is_first =
true,
bool* multi_axis_modes = 0);
486 plot_base(
unsigned dim,
unsigned nr_attributes = 0);
506 const box2 get_domain()
const;
508 const box3 get_domain3()
const;
510 void set_domain(
const box2& dom);
512 void set_domain3(
const box3& dom);
514 void set_extent(
const vecn& new_extent);
516 vecn get_extent()
const;
520 void set_extent_scaling(
float x_scale,
float y_scale,
float z_scale = 0);
522 void set_width(
float new_width,
bool constrained =
true);
524 void set_height(
float new_height,
bool constrained =
true);
526 void set_orientation(
const quat& _orientation);
528 void place_origin(
const vec3& new_origin_location);
530 void place_center(
const vec3& new_center_location);
532 void place_corner(
unsigned corner_index,
const vec3& new_corner_location);
534 vec3 get_origin()
const;
536 const quat& get_orientation()
const;
538 const vec3& get_center()
const;
540 vec3 get_corner(
unsigned i)
const;
542 const vec3 get_axis_direction(
unsigned ai)
const;
548 bool determine_axis_extent_from_subplot(
unsigned ai,
unsigned i,
float& sample_min,
float& sample_max);
550 void adjust_domain_axis_to_data(
unsigned ai,
bool adjust_min =
true,
bool adjust_max =
true,
bool only_visible =
true);
552 void adjust_domain_to_data(
bool only_visible =
true);
554 void include_axis_to_domain(
unsigned ai);
556 void adjust_tick_marks(
unsigned max_nr_secondary_ticks = 20,
bool adjust_to_attribute_ranges =
true);
558 void adjust_extent_to_domain_aspect_ratio(
int preserve_ai = 0);
564 unsigned get_nr_sub_plots()
const;
572 void set_samples_out_of_date(
unsigned i);
574 void set_sub_plot_colors(
unsigned i,
const rgb& base_color);
576 void set_sub_plot_attribute(
unsigned i,
unsigned ai,
int subplot_index,
size_t aj);
578 void set_sub_plot_attribute(
unsigned i,
unsigned ai,
const float* _pointer,
size_t count,
size_t stride);
580 void set_sub_plot_attribute(
unsigned i,
unsigned ai,
const cgv::render::vertex_buffer* _vbo_ptr,
size_t _offset,
size_t _count,
size_t _stride);
621#include <cgv/config/lib_end.h>
base class for all classes that can be registered with support for dynamic properties (see also secti...
derive from this class to provide a gui to the current viewer
base class for plot2d and plot3d, which can have several sub plots each
unsigned get_dim() const
return nr dimensions of plot
virtual unsigned add_sub_plot(const std::string &name)=0
add sub plot and return sub plot index
cgv::render::rectangle_render_style rrs
render style of rectangles
static std::string font_name_enum_def
concatenate font names to enum definition for dropdown control
static std::vector< const char * > font_names
store a vector with all fonts on the system
rgba legend_color
color and opacity of legend
LegendComponent legend_components
whether to show legend
std::vector< attribute_source_array > attribute_source_arrays
attribute sources
cgv::render::vertex_buffer vbo_legend
vbo for legend drawing
float layer_depth
depth offset of a single layer
vec2 legend_extent
width of legend
quat orientation
orientiation quaternion mapping from domain to world coordinates
unsigned dim
dimension of plot
domain_config dom_cfg
domain configuration
vec3 center_location
center location of domain in world coordinates
std::vector< plot_base_config * > configs
store one configuration per sub plot
ivec4 out_of_range_mode
handling of values that are out of range
std::vector< label_info > tick_labels
all tick labels
cgv::render::attribute_array_binding aab_legend
manage attributes for legend drawing
domain_config * dom_cfg_ptr
pointer to currently used domain config
virtual void delete_sub_plot(unsigned i)=0
delete the i-th sub plot
unsigned nr_attributes
number of additional attributes
cgv::media::font::font_face_ptr title_font_face
store pointer to title font face
int legend_axis
coordinate direction along which to draw legend
vec3 legend_location
center location of legend in domain coordinates
cgv::media::font::font_ptr title_font
store pointer to title font
std::vector< tick_batch_info > tick_batches
twice number of axis pairs with index of first tick label and number of tick labels for primary and s...
cgv::media::font::font_ptr label_font
store pointer to label font
cgv::media::font::font_face_ptr label_font_face
store pointer to label font face
vec3 extent
extents used for drawing current
the attribute_array_binding allows to define vertex attributes (i.e.
attribute array manager used to upload arrays to gpu
base class for all drawables, which is independent of the used rendering API.
base class for all drawables, which is independent of the used rendering API.
a shader program combines several shader code fragments to a complete definition of the shading pipel...
a vertex buffer is an unstructured memory block on the GPU.
defines a symmetric view with the following quantities:
TextAlignment
different text alignments
cgv::media::color< float, cgv::media::RGB, cgv::media::OPACITY > rgba
declare rgba color type with 32 bit components
cgv::media::color< float, cgv::media::RGB > rgb
declare rgb color type with 32 bit components
struct that manages attribute sources and corresponding gpu objects per subplot
store source of a single plot attribute (one coordinate axis or one float attribute)
rgba title_color
color of the title
bool show_domain
whether to show the coordinate axes including tickmarks and labels
unsigned title_font_index
store index of selected title font
float title_font_size
store selected title font size
float reference_size
store size of virtual pixel based measurement
unsigned label_font_index
store index of selected label font
bool fill
whether to fill the domain
std::string title
plot title
vecn title_pos
position of title
cgv::media::font::FontFaceAttributes label_ffa
store selected label font face attributes
std::vector< axis_config > axis_configs
store a vector of axis configurations (2/3 for plot2/3d plus several attribute axes)
cgv::media::font::FontFaceAttributes title_ffa
store selected title font face attributes
rgb color
color of the domain fill
float label_font_size
store selected label font size
float blend_width_in_pixel
store blend width in screen pixels used for antialiasing
bool show_title
whether to show the plot title
bool show_sub_plot_names
whether to show the sub plot names
render information stored per label
unsigned first_vertex
index of first tick vertex in batch
int ai
indices of coordinate axis used for definition of 2d points
plot independent configuration parameters of one sub plot in a 2d or 3d plot
mapped_size line_halo_width
width of line halo in pixel
int bar_coordinate_index
extended bar information
mapped_size line_width
line width
mapped_size bar_percentual_width
percentual width of bar computed assuming a uniform y-sampling distance
std::string name
name of sub plot
float stick_base_window
base window position of stick
bool show_lines
whether to connect data points with lines
mapped_rgba stick_color
color of the stick line
bool show_bars
whether to show bars
mapped_size bar_outline_width
line width of bar outlines
mapped_opacity ref_opacity
reference opacity, when changed, all opcities are adapted with set_opacity()
bool show_points
whether to show data points
mapped_size stick_width
line width of stick
mapped_rgba bar_color
bar fill color
SubPlotInfluence sub_plot_influence
store bit field to define which sub plots are influenced by reference values
mapped_rgba line_halo_color
color of line halo
mapped_rgba point_color
point color
mapped_size ref_size
reference size, when changed, all sizes are adapted with set_size()
size_t begin_sample
offset into samples defaults to 0, if larger than end_sample vector is split into two parts
int stick_coordinate_index
extended stick information
bool show_plot
whether to show sub plot
bool show_sticks
whether to show straight lines to the bottom of the plot, which are called sticks
mapped_rgba line_color
line color
mapped_rgb ref_color
reference color, when changed, all colors are adapted with set_colors()
mapped_size point_halo_width
width of point halo in pixel
mapped_rgba bar_outline_color
bar outline color
mapped_size point_size
point size in pixels
mapped_rgba point_halo_color
color of point halo
size_t end_sample
defaults to -1 and effectively is always the end of the sample vector
configuration of rectangle renderer