2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2008--2014 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 Skyline_pair::Skyline_pair ()
26 : skylines_ (Skyline (DOWN), Skyline (UP))
30 Skyline_pair::Skyline_pair (vector<Box> const &boxes, Axis a)
31 : skylines_ (Skyline (boxes, a, DOWN), Skyline (boxes, a, UP))
35 Skyline_pair::Skyline_pair (vector<Drul_array<Offset> > const &buildings, Axis a)
36 : skylines_ (Skyline (buildings, a, DOWN), Skyline (buildings, a, UP))
40 Skyline_pair::Skyline_pair (vector<Skyline_pair> const &skypairs)
41 : skylines_ (Skyline (skypairs, DOWN), Skyline (skypairs, UP))
45 Skyline_pair::Skyline_pair (Box const &b, Axis a)
46 : skylines_ (Skyline (b, a, DOWN), Skyline (b, a, UP))
51 Skyline_pair::raise (Real r)
53 skylines_[UP].raise (r);
54 skylines_[DOWN].raise (r);
58 Skyline_pair::deholify ()
60 skylines_[UP].deholify ();
61 skylines_[DOWN].deholify ();
65 Skyline_pair::shift (Real r)
67 skylines_[UP].shift (r);
68 skylines_[DOWN].shift (r);
72 Skyline_pair::insert (Box const &b, Axis a)
74 skylines_[UP].insert (b, a);
75 skylines_[DOWN].insert (b, a);
79 Skyline_pair::merge (Skyline_pair const &other)
81 skylines_[UP].merge (other[UP]);
82 skylines_[DOWN].merge (other[DOWN]);
86 Skyline_pair::print () const
88 skylines_[UP].print ();
89 skylines_[DOWN].print ();
93 Skyline_pair::left () const
95 return min (skylines_[UP].left (), skylines_[DOWN].left ());
99 Skyline_pair::right () const
101 return max (skylines_[UP].right (), skylines_[DOWN].right ());
105 Skyline_pair::print_points () const
107 skylines_[UP].print_points ();
108 skylines_[DOWN].print_points ();
112 Skyline_pair::is_empty () const
114 return skylines_[UP].is_empty ()
115 && skylines_[DOWN].is_empty ();
119 Skyline_pair::operator [] (Direction d)
125 Skyline_pair::operator [] (Direction d) const
130 const char Skyline_pair::type_p_name_[] = "ly:skyline-pair?";
134 Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
136 Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
139 scm_puts ("#<Skyline-pair>", port);
143 MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2);
145 Skyline_pair::skyline (SCM smob, SCM dir_scm)
147 Skyline_pair *sp = Skyline_pair::unsmob (smob);
148 Direction dir = robust_scm2dir (dir_scm, UP);
152 warning (_f ("direction must not be CENTER in ly:skyline-pair::skyline"));
156 return (*sp)[dir].smobbed_copy ();