]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/skyline.hh
Run `make grand-replace'.
[lilypond.git] / lily / include / skyline.hh
1 /*
2   skyline.hh -- declare Skyline class.
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2006--2008 Joe Neeman <joeneeman@gmail.com>
7 */
8
9 #ifndef SKYLINE_HH
10 #define SKYLINE_HH
11
12 #include "lily-proto.hh"
13 #include "axis.hh"
14 #include "box.hh"
15 #include "interval.hh"
16 #include "direction.hh"
17 #include "std-vector.hh"
18 #include "smobs.hh"
19
20 #include <list>
21
22 struct Building
23 {
24   Real end_;
25   Real y_intercept_;
26   Real slope_;
27
28   void precompute (Real start, Real start_height, Real end_height, Real end);
29   Building (Real start, Real start_height, Real end_height, Real end);
30   Building (Box const &b, Real horizon_padding, Axis a, Direction d);
31   void print () const;
32
33   Real height (Real x) const;
34   Real intersection_x (Building const &other) const;
35   void leading_part (Real chop);
36   bool conceals (Building const &other, Real x) const;
37   Building sloped_neighbour (Real start, Real horizon_padding, Direction d) const;
38 };
39
40 class Skyline
41 {
42 private:
43   list<Building> buildings_;
44   Direction sky_;
45   
46   void internal_merge_skyline (list<Building>*, list<Building>*,
47                                list<Building> *const result);
48   list<Building> internal_build_skyline (list<Box>*, Real, Axis, Direction);
49
50   DECLARE_SIMPLE_SMOBS(Skyline);
51
52 public:
53   Skyline ();
54   Skyline (Skyline const &src);
55   Skyline (Direction sky);
56   Skyline (vector<Box> const &bldgs, Real horizon_padding, Axis a, Direction sky);
57   Skyline (Box const &b, Real horizon_padding, Axis a, Direction sky);
58   
59   vector<Offset> to_points (Axis) const;
60   void merge (Skyline const &);
61   void insert (Box const &, Real horizon_padding, Axis);
62   void print () const;
63   void print_points () const;
64   void raise (Real);
65   void shift (Real);
66   Real distance (Skyline const &) const;
67   Real height (Real airplane) const;
68   Real max_height () const;
69   void set_minimum_height (Real height);
70   bool is_empty () const;
71 };
72
73 extern bool debug_skylines;
74
75 #endif /* SKYLINE_HH */
76