BlosSOM
Interactive dimensionality reduction on large datasets (EmbedSOM and FLOWER combined)
renderer.h
Go to the documentation of this file.
1/* This file is part of BlosSOM.
2 *
3 * Copyright (C) 2021 Sona Molnarova
4 *
5 * BlosSOM is free software: you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free
7 * Software Foundation, either version 3 of the License, or (at your option)
8 * any later version.
9 *
10 * BlosSOM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * BlosSOM. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19#ifndef RENDERER_H
20#define RENDERER_H
21
22#include "graph_renderer.h"
23#include "scatter_renderer.h"
24#include "state.h"
25#include "ui_renderer.h"
26#include "view.h"
27
28/**
29 * @brief Handles rendering of the graph and scatter plot and handles IO.
30 *
31 */
33{
34public:
35 Renderer();
36 bool init();
37
38 /**
39 * @brief Render graph and scatterplot.
40 *
41 * @param state
42 * @param view
43 */
44 void render(const glm::vec2 &fb_size, const State &state, const View &view);
45
46 /**
47 * @brief Check whether the vertex was pressed and set flags.
48 *
49 * @param view
50 * @param mouse
51 * @param vert_ind
52 * @return true
53 * @return false
54 */
55 void check_pressed_vertex(const View &view, glm::vec2 mouse_pos);
56
57 void reset_pressed_vert();
58
59 bool get_vert_pressed();
60 size_t get_vert_ind();
61
62 void add_vert(State &state, View &view, glm::vec2 mouse_pos);
63 void remove_vert(State &state);
64 void move_vert(State &state, View &view, glm::vec2 mouse_pos);
65
66 void start_multiselect(glm::vec2 mouse_pos);
67
70
71 void update_multiselect(glm::vec2 mouse_pos, const LandmarkModel &model);
72
73 void reset_multiselect();
74 void stop_multiselect();
75
76 bool check_pressed_rect(glm::vec2 mouse_pos);
78
79 void move_selection(glm::vec2 mouse_pos, LandmarkModel &landmarks);
80
84
85 void draw_cursor_radius(const View &v, glm::vec2 mouse_pos, float r);
87
88 std::vector<size_t> get_landmarks_within_circle(
89 const View &view,
90 const glm::vec2 &pos,
91 float radius,
92 const LandmarkModel &landmarks);
93
94private:
98};
99
100#endif // RENDERER_H
Handles rendering of the graph and scatter plot and handles IO.
Definition: renderer.h:33
void render(const glm::vec2 &fb_size, const State &state, const View &view)
Render graph and scatterplot.
Definition: renderer.cpp:42
void stop_cursor_radius()
Definition: renderer.h:86
size_t get_vert_ind()
Definition: renderer.cpp:77
void check_pressed_vertex(const View &view, glm::vec2 mouse_pos)
Check whether the vertex was pressed and set flags.
Definition: renderer.cpp:54
void add_vert(State &state, View &view, glm::vec2 mouse_pos)
Definition: renderer.cpp:83
GraphRenderer graph_renderer
Definition: renderer.h:96
UiRenderer ui_renderer
Definition: renderer.h:97
ScatterRenderer scatter_renderer
Definition: renderer.h:95
void draw_cursor_radius(const View &v, glm::vec2 mouse_pos, float r)
Definition: renderer.cpp:162
bool is_active_multiselect()
Definition: renderer.cpp:119
bool init()
Definition: renderer.cpp:29
std::vector< size_t > get_landmarks_within_circle(const View &view, const glm::vec2 &pos, float radius, const LandmarkModel &landmarks)
Definition: renderer.cpp:168
void start_multiselect(glm::vec2 mouse_pos)
Definition: renderer.cpp:113
Renderer()
Definition: renderer.cpp:26
bool get_vert_pressed()
Definition: renderer.cpp:71
void start_brushing()
Definition: renderer.h:81
void move_vert(State &state, View &view, glm::vec2 mouse_pos)
Definition: renderer.cpp:104
void stop_brushing()
Definition: renderer.h:83
void remove_vert(State &state)
Definition: renderer.cpp:94
void reset_pressed_vert()
Definition: renderer.cpp:65
bool get_rect_pressed()
Definition: renderer.h:77
bool is_passive_multiselect()
Definition: renderer.cpp:125
void stop_multiselect()
Definition: renderer.cpp:144
void reset_multiselect()
Definition: renderer.cpp:137
void move_selection(glm::vec2 mouse_pos, LandmarkModel &landmarks)
Definition: renderer.cpp:156
void update_multiselect(glm::vec2 mouse_pos, const LandmarkModel &model)
Definition: renderer.cpp:131
bool is_brushing_active()
Definition: renderer.h:82
bool check_pressed_rect(glm::vec2 mouse_pos)
Definition: renderer.cpp:150
A small utility class that manages the viewport coordinates, together with the virtual "camera" posit...
Definition: view.h:37
Renderer of the 2D landmark graph.
Model of the high- and low-dimensional landmarks.
Renderer of the 2D data points.
Storage of data of used algorithms and input events.
Definition: state.h:50
Renderer of the objects that are needed in the user interaction with the dataset.
Definition: ui_renderer.h:36
bool is_brushing_active
If the brushing is active.
Definition: ui_renderer.h:43
bool draw_circle
Definition: ui_renderer.h:45
bool rect_pressed
Definition: ui_renderer.h:40