|
cgv
|
The plot3d class draws 2d plots with potentially several sub plots of different plot configuration.
More...
#include <plot3d.h>
Public Member Functions | |
| plot3d (unsigned nr_attributes=0) | |
| construct 3d plot with given number of additional attributes and default parameters | |
management of sub plots | |
| unsigned | add_sub_plot (const std::string &name) |
| add sub plot and return reference to samples | |
| void | set_samples_per_row (unsigned i, unsigned N) |
| set the number of samples of the i-th sub plot to N | |
| unsigned | get_samples_per_row (unsigned i) const |
| return the number of samples per row | |
| void | delete_sub_plot (unsigned i) |
| delete the i-th sub plot | |
| plot3d_config & | ref_sub_plot3d_config (unsigned i=0) |
| return a reference to the plot3d configuration of the i-th plot | |
| std::vector< vec3 > & | ref_sub_plot_samples (unsigned i=0) |
| return the samples of the i-th sub plot | |
| void | create_line_config_gui (cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc) |
| create the gui for a line subplot | |
| void | create_bar_config_gui (cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc) |
| create the gui for a bar subplot | |
| void | create_config_gui (cgv::base::base *bp, cgv::gui::provider &p, unsigned i) |
| create the gui for a subplot configuration | |
| bool | init (cgv::render::context &ctx) |
| this method is called after creation or recreation of the context, return whether all necessary functionality is supported | |
| void | draw (cgv::render::context &ctx) |
| overload to draw the content of this drawable | |
| void | clear (cgv::render::context &ctx) |
| clear all objects living in the context like textures or display lists | |
| void | create_gui (cgv::base::base *bp, cgv::gui::provider &p) |
| create a gui for the plot with gui for all configs | |
Public Member Functions inherited from cgv::plot::plot_base | |
| void | set_label_font (float font_size, cgv::media::font::FontFaceAttributes ffa=cgv::media::font::FFA_REGULAR, const std::string &font_name="") |
| configure the label font | |
| const domain_config * | get_domain_config_ptr () const |
| return const pointer to domain configuration | |
| domain_config * | get_domain_config_ptr () |
| return pointer to domain configuration | |
| void | set_domain_config_ptr (domain_config *_new_ptr) |
| set the domain configuration to an external configuration in order to synch several plots, if set to null, the internal domain config is used again | |
| const box2 | get_domain () const |
| return 2d domain shown in plot | |
| const box3 | get_domain3 () const |
| return 3d domain shown in plot | |
| void | set_domain (const box2 &dom) |
| set the domain for 2d plots | |
| void | set_domain3 (const box3 &dom) |
| set the domain for 3d plots | |
| void | set_extent (const vecn &new_extent) |
| set the plot extend in 2D coordinates | |
| vecn | get_extent () const |
| query the plot extend in 2D coordinates | |
| void | set_extent_scaling (float x_scale, float y_scale, float z_scale=0) |
| set extent_scaling values for all axes | |
| void | set_width (float new_width, bool constrained=true) |
| set the plot width to given value and if constrained == true the height, such that the aspect ration is the same as the aspect ratio of the domain | |
| void | set_height (float new_height, bool constrained=true) |
| set the plot height to given value and if constrained == true the width, such that the aspect ration is the same as the aspect ratio of the domain | |
| void | set_orientation (const quat &_orientation) |
| set new orientation quaternion | |
| void | place_origin (const vec3 &new_origin_location) |
| place the origin of the plot in 3D to the given location | |
| void | place_center (const vec3 &new_center_location) |
| place the plot extent center in 3D to the given location (this might can change the current origin location) | |
| void | place_corner (unsigned corner_index, const vec3 &new_corner_location) |
| place a corner (0 .. lower left, 1 .. lower right, 2 .. upper left, 3 .. upper right) to a given 3D location ((this might can change the current origin / center location) | |
| vec3 | get_origin () const |
| return the current origin in 3D coordinates | |
| const quat & | get_orientation () const |
| get current orientation quaternion | |
| const vec3 & | get_center () const |
| return the current plot center in 3D coordinates | |
| vec3 | get_corner (unsigned i) const |
| return the i-th plot corner in 3D coordinates | |
| const vec3 | get_axis_direction (unsigned ai) const |
| return true world direction of x, y or z axis | |
| bool | determine_axis_extent_from_subplot (unsigned ai, unsigned i, float &sample_min, float &sample_max) |
adjust the domain with respect to ai th axis to the i-th subplot | |
| void | adjust_domain_axis_to_data (unsigned ai, bool adjust_min=true, bool adjust_max=true, bool only_visible=true) |
adjust the domain with respect to ai th axis to the visible or all data depending on last parameter | |
| void | adjust_domain_to_data (bool only_visible=true) |
| adjust selected axes of domain to the visible or all data depending on last parameter | |
| void | include_axis_to_domain (unsigned ai) |
| extend domain such that given axis is included | |
| void | adjust_tick_marks (unsigned max_nr_secondary_ticks=20, bool adjust_to_attribute_ranges=true) |
| adjust tick marks of all axes based on maximum number of secondary ticks and domain min and max in coordinate of axis | |
| void | adjust_extent_to_domain_aspect_ratio (int preserve_ai=0) |
| adjust the extent such that it has same aspect ration as domain | |
| unsigned | get_nr_sub_plots () const |
| return current number of sub plots | |
| plot_base_config & | ref_sub_plot_config (unsigned i) |
| return a reference to the plot base configuration of the i-th plot | |
| void | set_samples_out_of_date (unsigned i) |
| notify plot that samples of given subplot are out of date | |
| void | set_sub_plot_colors (unsigned i, const rgb &base_color) |
| set the colors for all plot features of the i-th sub plot as variation of the given color | |
| void | set_sub_plot_attribute (unsigned i, unsigned ai, int subplot_index, size_t aj) |
| define a sub plot attribute ai from coordinate aj of the i-th internal sample container | |
| void | set_sub_plot_attribute (unsigned i, unsigned ai, const float *_pointer, size_t count, size_t stride) |
| define a sub plot attribute from an external pointer | |
| 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) |
| define a sub plot attribute from a vbo (attribute must be stored in float type in vbo) | |
| bool | init (cgv::render::context &ctx) |
| build legend prog and create aab | |
| void | clear (cgv::render::context &ctx) |
| destruct shader programs | |
| plot_base (unsigned dim, unsigned nr_attributes=0) | |
| construct from plot dimension and number of additional attributes with default parameters | |
| unsigned | get_dim () const |
| return nr dimensions of plot | |
| void | set_view_ptr (cgv::render::view *_view_ptr) |
| set the view ptr | |
| void | ensure_font_names () |
| ensure that font names have been enumerate | |
| virtual void | create_plot_gui (cgv::base::base *bp, cgv::gui::provider &p) |
| create the gui for the plot without gui for sub plots | |
| virtual void | create_base_config_gui (cgv::base::base *bp, cgv::gui::provider &p, unsigned i) |
| create the gui for base subplot settings | |
| virtual void | create_point_config_gui (cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc) |
| create the gui for a point subplot | |
| virtual void | create_stick_config_gui (cgv::base::base *bp, cgv::gui::provider &p, plot_base_config &pbc) |
| create the gui for a stick subplot | |
Public Member Functions inherited from cgv::render::drawable | |
| drawable () | |
| default construction | |
| void | hide () |
| hide the drawable | |
| void | show () |
| show the drawable | |
| bool | is_visible () const |
| check whether the drawable is visible | |
| context * | get_context () const |
| access the current context. The context will be available latestly in the init method but not in the contructor. | |
| void | set_context (context *_ctx) |
| set the current focus context, this should only be called by the context itself | |
| view * | find_view_as_node (size_t view_idx=0) const |
| convenience function to find the view control in the current hierarchy | |
| bool | get_world_location (int x, int y, const view &V, dvec3 &world_location, double *window_z_ptr=0) const |
| use given view together with depth buffer of context in order to compute the world location of the point at mouse pointer location (x,y) | |
| void | post_redraw () |
| posts a redraw event to the current context if one is available | |
| void | force_redraw () |
| forces a redraw right now. This cannot be called from init, init_frame, draw, finish_draw, finish_frame and clear | |
| virtual void | resize (unsigned int w, unsigned int h) |
| callback to announce resizing of the output window | |
| virtual void | init_frame (context &) |
| this method is called in one pass over all drawables before the draw method | |
| virtual void | finish_draw (context &) |
| this method is called when the current drawable is left in a tree traversal that calls the draw method | |
| virtual void | finish_frame (context &) |
| this method is called in one pass over all drawables after drawing | |
| virtual void | after_finish (context &) |
| this method is called in one pass over all drawables after finish frame | |
Public Member Functions inherited from cgv::base::traverse_policy | |
| traverse_policy (int _policy=TP_ALL+TP_STOP_ON_SUCCESS, bool _active=true, int _focus=-1) | |
| construct default traverse policy that visits everything | |
| int | get_policy () const |
| return the policy without the stop on success flag | |
| bool | stop_on_success () const |
| return whether to stop on success | |
| bool | stop_on_failure () const |
| return whether to stop on failure | |
| void | set_policy (int _policy) |
| set a new policy, always add stop on success flag if needed | |
| int | get_focused_child () const |
| return the focused child or -1 if none is focused | |
| void | set_focused_child (int _focused_child) |
| set the focused child | |
| bool | get_active () const |
| return whether the current node is active | |
| void | set_active (bool _active) |
| set the active flag of the current node | |
Protected Member Functions | |
| void | compute_tick_render_information () |
| overloaded in derived classes to compute complete tick render information | |
Protected Member Functions inherited from cgv::plot::plot_base | |
| vec3 | world_space_from_plot_space (const vecn &pnt_plot) const |
| vec3 | transform_to_world (const vecn &pnt_attr) const |
| transform from attribute space to world space | |
| void | on_legend_axis_change (cgv::gui::provider &p, cgv::gui::control< int > &ctrl) |
| void | on_font_selection () |
| callback to change fonts | |
| void | on_font_face_selection () |
| callback to change font face | |
| void | prepare_extents () |
| prepare extents for drawing | |
| void | set_plot_uniforms (cgv::render::context &ctx, cgv::render::shader_program &prog) |
| set the uniforms for plot configurations | |
| void | set_mapping_uniforms (cgv::render::context &ctx, cgv::render::shader_program &prog) |
| set the uniforms for defining the mappings to visual variables | |
| void | draw_rectangles (cgv::render::context &ctx, cgv::render::attribute_array_manager &aam, std::vector< box2 > &R, std::vector< rgb > &C, std::vector< float > &D, size_t offset=0) |
| void | draw_tick_labels (cgv::render::context &ctx, cgv::render::attribute_array_manager &aam_ticks, std::vector< label_info > &tick_labels, std::vector< tick_batch_info > &tick_batches, float depth) |
| size_t | enable_attributes (cgv::render::context &ctx, int i, const std::vector< std::vector< vec2 > > &samples) |
| set vertex shader input attributes based on attribute source information | |
| size_t | enable_attributes (cgv::render::context &ctx, int i, const std::vector< std::vector< vec3 > > &samples) |
| set vertex shader input attributes based on attribute source information | |
| void | disable_attributes (cgv::render::context &ctx, int i) |
| void | update_samples_out_of_date_flag () |
| void | draw_sub_plot_samples (int count, const plot_base_config &spc, bool strip=false) |
| void | draw_title (cgv::render::context &ctx, vec2 pos, float depth, int si=-1) |
| void | draw_legend (cgv::render::context &ctx, int layer_idx=0, bool is_first=true, bool *multi_axis_modes=0) |
| bool | extract_tick_rectangles_and_tick_labels (std::vector< box2 > &R, std::vector< rgb > &C, std::vector< float > &D, std::vector< label_info > &tick_labels, int ai, int ci, int ti, float he, float z_plot, float plot_scale=1.0f, vec2 plot_offset=vec2(0.0f, 0.0f), float d=0.0f, bool multi_axis=true) |
| void | extract_legend_tick_rectangles_and_tick_labels (std::vector< box2 > &R, std::vector< rgb > &C, std::vector< float > &D, std::vector< label_info > &tick_labels, std::vector< tick_batch_info > &tick_batches, float d, bool clear_cache=false, bool is_first=true, bool *multi_axis_modes=0) |
| void | update_ref_opacity (unsigned i, cgv::gui::provider &p) |
| void | update_ref_opacity_index (unsigned i, cgv::gui::provider &p) |
| void | update_ref_size (unsigned i, cgv::gui::provider &p) |
| void | update_ref_size_index (unsigned i, cgv::gui::provider &p) |
| void | update_ref_color (unsigned i, cgv::gui::provider &p) |
| void | update_ref_color_index (unsigned i, cgv::gui::provider &p) |
Protected Attributes | |
| std::vector< std::vector< vec3 > > | samples |
Protected Attributes inherited from cgv::plot::plot_base | |
| unsigned | dim |
| dimension of plot | |
| unsigned | nr_attributes |
| number of additional attributes | |
| domain_config | dom_cfg |
| domain configuration | |
| domain_config * | dom_cfg_ptr |
| pointer to currently used domain config | |
| std::vector< plot_base_config * > | configs |
| store one configuration per sub plot | |
| cgv::render::view * | view_ptr |
| std::vector< label_info > | tick_labels |
| all tick labels | |
| std::vector< label_info > | legend_tick_labels |
| 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 secondary ticks | |
| std::vector< tick_batch_info > | legend_tick_batches |
| float | layer_depth |
| depth offset of a single layer | |
| quat | orientation |
| orientiation quaternion mapping from domain to world coordinates | |
| vec3 | center_location |
| center location of domain in world coordinates | |
| 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 | |
| cgv::media::font::font_ptr | title_font |
| store pointer to title font | |
| cgv::media::font::font_face_ptr | title_font_face |
| store pointer to title font face | |
| cgv::render::vertex_buffer | vbo_legend |
| vbo for legend drawing | |
| cgv::render::attribute_array_binding | aab_legend |
| manage attributes for legend drawing | |
| std::vector< attribute_source_array > | attribute_source_arrays |
| attribute sources | |
| vec3 | extent |
| extents used for drawing current | |
| cgv::render::rectangle_render_style | rrs |
| render style of rectangles | |
| cgv::render::rectangle_render_style | font_rrs |
| cgv::render::attribute_array_manager | aam_legend |
| cgv::render::attribute_array_manager | aam_legend_ticks |
| cgv::render::attribute_array_manager | aam_title |
Protected Attributes inherited from cgv::base::traverse_policy | |
| TraversePolicy | policy |
| bool | active |
| int | focus |
Additional Inherited Members | |
Public Attributes inherited from cgv::plot::plot_base | |
| LegendComponent | legend_components |
| whether to show legend | |
| vec3 | legend_location |
| center location of legend in domain coordinates | |
| vec2 | legend_extent |
| width of legend | |
| int | legend_axis |
| coordinate direction along which to draw legend | |
| rgba | legend_color |
| color and opacity of legend | |
| ivec4 | out_of_range_mode |
| handling of values that are out of range | |
| int | color_mapping [MAX_NR_COLOR_MAPPINGS] |
| index of attribute mapped to primary and secondary color | |
| cgv::media::ColorScale | color_scale_index [MAX_NR_COLOR_MAPPINGS] |
| color scale indices of primary and secondary color mapping | |
| float | color_scale_gamma [MAX_NR_COLOR_MAPPINGS] |
| gamma adjustments for primary and secondary color mapping | |
| float | window_zero_position [MAX_NR_COLOR_MAPPINGS] |
| window space position of zero for primary and secondary color mapping | |
| int | opacity_mapping [MAX_NR_OPACITY_MAPPINGS] |
| index of attribute mapped to primary and secondary opacity | |
| float | opacity_gamma [MAX_NR_OPACITY_MAPPINGS] |
| gamma adjustments for primary and secondary opacity mapping | |
| bool | opacity_is_bipolar [MAX_NR_OPACITY_MAPPINGS] |
| flag whether opacity mapping is bipolar for primary and secondary opacity mapping | |
| float | opacity_window_zero_position [MAX_NR_OPACITY_MAPPINGS] |
| window space position of zero for primary and secondary opacity mapping | |
| float | opacity_min [MAX_NR_OPACITY_MAPPINGS] |
| minimum opacity value for primary and secondary opacity mapping | |
| float | opacity_max [MAX_NR_OPACITY_MAPPINGS] |
| maximum opacity value for primary and secondary opacity mapping | |
| int | size_mapping [MAX_NR_SIZE_MAPPINGS] |
| index of attribute mapped to size | |
| float | size_gamma [MAX_NR_SIZE_MAPPINGS] |
| and independent gamma adjustments | |
| float | size_min [MAX_NR_SIZE_MAPPINGS] |
| min and max of mapped size | |
| float | size_max [MAX_NR_SIZE_MAPPINGS] |
Static Public Attributes inherited from cgv::plot::plot_base | |
| static const unsigned | MAX_NR_COLOR_MAPPINGS = 2 |
| define maximum number of color mappings | |
| static const unsigned | MAX_NR_OPACITY_MAPPINGS = 2 |
| define maximum number of opacity mappings | |
| static const unsigned | MAX_NR_SIZE_MAPPINGS = 2 |
| define maximum number of size mappings | |
Static Protected Attributes inherited from cgv::plot::plot_base | |
| static std::vector< const char * > | font_names |
| store a vector with all fonts on the system | |
| static std::string | font_name_enum_def |
| concatenate font names to enum definition for dropdown control | |
The plot3d class draws 2d plots with potentially several sub plots of different plot configuration.
| cgv::plot::plot3d::plot3d | ( | unsigned | nr_attributes = 0 | ) |
construct 3d plot with given number of additional attributes and default parameters
Definition at line 66 of file plot3d.cxx.
References cgv::plot::domain_config::axis_configs, cgv::plot::domain_config::blend_width_in_pixel, cgv::render::surface_render_style::culling_mode, cgv::plot::plot_base::get_domain_config_ptr(), cgv::render::surface_render_style::illumination_mode, cgv::plot::plot_base::legend_location, cgv::render::surface_render_style::map_color_to_material, cgv::plot::plot_base::nr_attributes, and cgv::utils::to_string().
|
virtual |
add sub plot and return reference to samples
Implements cgv::plot::plot_base.
Definition at line 84 of file plot3d.cxx.
References cgv::plot::plot_base::attribute_source_arrays, cgv::plot::plot_base::configs, cgv::plot::plot_base::get_nr_sub_plots(), cgv::plot::plot_base_config::name, ref_sub_plot3d_config(), and cgv::plot::plot_base::ref_sub_plot_config().
|
virtual |
clear all objects living in the context like textures or display lists
Reimplemented from cgv::render::drawable.
Definition at line 538 of file plot3d.cxx.
References cgv::plot::plot_base::clear(), cgv::render::shader_program::destruct(), cgv::render::ref_box_renderer(), and cgv::render::ref_cone_renderer().
|
protected |
overloaded in derived classes to compute complete tick render information
Definition at line 16 of file plot3d.cxx.
|
virtual |
create the gui for a bar subplot
Reimplemented from cgv::plot::plot_base.
Definition at line 558 of file plot3d.cxx.
References cgv::plot::plot3d_config::bar_percentual_depth, and cgv::plot::plot_base::create_bar_config_gui().
|
virtual |
create the gui for a subplot configuration
Reimplemented from cgv::plot::plot_base.
Definition at line 565 of file plot3d.cxx.
References cgv::gui::provider::add_member_control(), cgv::gui::provider::add_view(), cgv::gui::provider::align(), cgv::gui::provider::begin_tree_node(), cgv::plot::plot_base::create_config_gui(), cgv::gui::provider::end_tree_node(), cgv::plot::plot3d_config::face_illumination, ref_sub_plot3d_config(), cgv::plot::plot3d_config::samples_per_row, cgv::render::drawable::show(), cgv::plot::plot3d_config::show_surface, cgv::plot::plot3d_config::surface_color, and cgv::plot::plot3d_config::wireframe.
|
virtual |
create a gui for the plot with gui for all configs
Reimplemented from cgv::plot::plot_base.
Definition at line 582 of file plot3d.cxx.
References cgv::gui::provider::add_decorator(), cgv::gui::provider::add_gui(), cgv::gui::provider::align(), cgv::gui::provider::begin_tree_node(), cgv::plot::plot_base::create_gui(), and cgv::gui::provider::end_tree_node().
|
virtual |
create the gui for a line subplot
Reimplemented from cgv::plot::plot_base.
Definition at line 552 of file plot3d.cxx.
References cgv::gui::provider::add_member_control(), cgv::plot::plot_base::create_line_config_gui(), and cgv::plot::plot3d_config::show_line_orientation.
|
virtual |
delete the i-th sub plot
Implements cgv::plot::plot_base.
Definition at line 108 of file plot3d.cxx.
References cgv::plot::plot_base::configs.
|
virtual |
overload to draw the content of this drawable
Reimplemented from cgv::render::drawable.
Definition at line 504 of file plot3d.cxx.
References cgv::plot::plot_base::center_location, cgv::plot::plot_base::get_domain_config_ptr(), cgv::plot::plot_base::legend_components, cgv::render::context::mul_modelview_matrix(), cgv::plot::plot_base::orientation, cgv::render::context::pop_modelview_matrix(), cgv::plot::plot_base::prepare_extents(), cgv::render::context::push_modelview_matrix(), and cgv::math::quaternion< T >::put_homogeneous_matrix().
| unsigned cgv::plot::plot3d::get_samples_per_row | ( | unsigned | i | ) | const |
return the number of samples per row
Definition at line 123 of file plot3d.cxx.
References ref_sub_plot3d_config(), and cgv::plot::plot3d_config::samples_per_row.
|
virtual |
this method is called after creation or recreation of the context, return whether all necessary functionality is supported
Reimplemented from cgv::render::drawable.
Definition at line 142 of file plot3d.cxx.
References cgv::render::shader_program::build_program(), cgv::plot::plot_base::init(), cgv::render::ref_box_renderer(), cgv::render::ref_cone_renderer(), and cgv::render::shader_program::set_uniform().
| plot3d_config & cgv::plot::plot3d::ref_sub_plot3d_config | ( | unsigned | i = 0 | ) |
return a reference to the plot3d configuration of the i-th plot
return a reference to the plot base configuration of the i-th plot
Definition at line 129 of file plot3d.cxx.
References cgv::plot::plot_base::ref_sub_plot_config().
Referenced by add_sub_plot(), create_config_gui(), get_samples_per_row(), and set_samples_per_row().
| std::vector< vec3 > & cgv::plot::plot3d::ref_sub_plot_samples | ( | unsigned | i = 0 | ) |
return the samples of the i-th sub plot
Definition at line 136 of file plot3d.cxx.
| void cgv::plot::plot3d::set_samples_per_row | ( | unsigned | i, |
| unsigned | N | ||
| ) |
set the number of samples of the i-th sub plot to N
Definition at line 117 of file plot3d.cxx.
References ref_sub_plot3d_config(), and cgv::plot::plot3d_config::samples_per_row.
|
protected |