trase
Line.hpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2018, University of Oxford.
3 All rights reserved.
4 
5 University of Oxford means the Chancellor, Masters and Scholars of the
6 University of Oxford, having an administrative office at Wellington
7 Square, Oxford OX1 2JD, UK.
8 
9 This file is part of trase.
10 
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 * Redistributions of source code must retain the above copyright notice, this
14  list of conditions and the following disclaimer.
15 * Redistributions in binary form must reproduce the above copyright notice,
16  this list of conditions and the following disclaimer in the documentation
17  and/or other materials provided with the distribution.
18 * Neither the name of the copyright holder nor the names of its
19  contributors may be used to endorse or promote products derived from
20  this software without specific prior written permission.
21 
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
35 
36 #ifndef LINE_H_
37 #define LINE_H_
38 
39 #include "frontend/Geometry.hpp"
40 
41 namespace trase {
42 
51 class Line : public Geometry {
52 public:
54  explicit Line(Axis *parent) : Geometry(parent) {}
55  virtual ~Line() = default;
56 
57  TRASE_GEOMETRY_DISPATCH_BACKENDS
58 
62  template <typename AnimatedBackend> void draw(AnimatedBackend &backend);
63 
68  template <typename Backend> void draw(Backend &backend, float time);
69 
73  template <typename AnimatedBackend>
74  void draw_legend(AnimatedBackend &backend, const bfloat2_t &box);
75 
80  template <typename Backend>
81  void draw_legend(Backend &backend, float time, const bfloat2_t &box);
82 
83 private:
84  template <typename AnimatedBackend>
85  void draw_frames(AnimatedBackend &backend);
86  template <typename AnimatedBackend>
87  void draw_anim_highlights(AnimatedBackend &backend);
88  template <typename Backend> void draw_plot(Backend &backend);
89  template <typename Backend> void draw_highlights(Backend &backend);
90 };
91 
92 } // namespace trase
93 
94 #include "frontend/Line.tcc"
95 
96 #endif // LINE_H_
a base class for all the backends that support drawing a single frame
Definition: Backend.hpp:50
Line(Axis *parent)
create a new Line, connecting it to the parent
Definition: Line.hpp:54
An 2D axis that can contain zero or more Geometry objects.
Definition: Axis.hpp:85
void draw_legend(AnimatedBackend &backend, const bfloat2_t &box)
draw the full line legend animation
TRASE_GEOMETRY_DISPATCH_BACKENDS void draw(AnimatedBackend &backend)
draw the full line animation using the AnimatedBackend
a base class for all the backends that support animation over time
Definition: Backend.hpp:62
Definition: Geometry.hpp:54
A single line made up of one or more points connected by straight lines.
Definition: Line.hpp:51
Definition: Backend.cpp:39
available geometry types are Points, Line.