2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2008--2015 Han-Wen Nienhuys <hanwen@lilypond.org>
7 LilyPond is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 LilyPond is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 #include "skyline-pair.hh"
23 #include "international.hh"
25 ADD_SMOB_INIT (Skyline_pair);
27 Skyline_pair::Skyline_pair ()
28 : skylines_ (Skyline (DOWN), Skyline (UP))
32 Skyline_pair::Skyline_pair (vector<Box> const &boxes, Axis a)
33 : skylines_ (Skyline (boxes, a, DOWN), Skyline (boxes, a, UP))
37 Skyline_pair::Skyline_pair (vector<Drul_array<Offset> > const &buildings, Axis a)
38 : skylines_ (Skyline (buildings, a, DOWN), Skyline (buildings, a, UP))
42 Skyline_pair::Skyline_pair (vector<Skyline_pair> const &skypairs)
43 : skylines_ (Skyline (skypairs, DOWN), Skyline (skypairs, UP))
47 Skyline_pair::Skyline_pair (Box const &b, Axis a)
48 : skylines_ (Skyline (b, a, DOWN), Skyline (b, a, UP))
53 Skyline_pair::raise (Real r)
55 skylines_[UP].raise (r);
56 skylines_[DOWN].raise (r);
60 Skyline_pair::shift (Real r)
62 skylines_[UP].shift (r);
63 skylines_[DOWN].shift (r);
67 Skyline_pair::insert (Box const &b, Axis a)
69 skylines_[UP].insert (b, a);
70 skylines_[DOWN].insert (b, a);
74 Skyline_pair::merge (Skyline_pair const &other)
76 skylines_[UP].merge (other[UP]);
77 skylines_[DOWN].merge (other[DOWN]);
81 Skyline_pair::print () const
83 skylines_[UP].print ();
84 skylines_[DOWN].print ();
88 Skyline_pair::left () const
90 return min (skylines_[UP].left (), skylines_[DOWN].left ());
94 Skyline_pair::right () const
96 return max (skylines_[UP].right (), skylines_[DOWN].right ());
100 Skyline_pair::print_points () const
102 skylines_[UP].print_points ();
103 skylines_[DOWN].print_points ();
107 Skyline_pair::is_empty () const
109 return skylines_[UP].is_empty ()
110 && skylines_[DOWN].is_empty ();
114 Skyline_pair::operator [] (Direction d)
120 Skyline_pair::operator [] (Direction d) const
125 const char Skyline_pair::type_p_name_[] = "ly:skyline-pair?";
128 MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2);
130 Skyline_pair::skyline (SCM smob, SCM dir_scm)
132 Skyline_pair *sp = Skyline_pair::unsmob (smob);
133 Direction dir = robust_scm2dir (dir_scm, UP);
137 warning (_f ("direction must not be CENTER in ly:skyline-pair::skyline"));
141 return (*sp)[dir].smobbed_copy ();