X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fskyline.cc;h=b2805f56000a33f4de6b1578813b3192a53515bc;hb=ee22403a07d90468270214cc85a5ef31a07b6cb7;hp=473b2cbb1278447edbaf2a12d78cb624dfdabfca;hpb=deabe8e6c21ae6080e13b269bab24901f74a2254;p=lilypond.git diff --git a/lily/skyline.cc b/lily/skyline.cc index 473b2cbb12..b2805f5600 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -1,12 +1,25 @@ -/* skyline.cc -- implement the Skyline class +/* + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter - - (c) 2006--2007 Joe Neeman + Copyright (C) 2006--2009 Joe Neeman + + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "skyline.hh" #include +#include #include "ly-smobs.icc" @@ -266,7 +279,7 @@ non_overlapping_skyline (list *const boxes, Real horizon_padding, Axis hori } if (iv[LEFT] - horizon_padding > last_end + EPS) - result.push_front (Building (last_end, -infinity_f, -infinity_f, iv[LEFT] - horizon_padding)); + result.push_front (Building (last_end, -infinity_f, -infinity_f, iv[LEFT] - 2*horizon_padding)); Building b (*i, horizon_padding, horizon_axis, sky); bool sloped_neighbours = horizon_padding > 0 && !isinf (iv.length ()); @@ -317,7 +330,7 @@ Skyline::internal_build_skyline (list *boxes, Real horizon_padding, Axis ho { list result; single_skyline (Building (boxes->front (), horizon_padding, horizon_axis, sky), - boxes->front ()[horizon_axis][LEFT], horizon_axis, &result); + boxes->front ()[horizon_axis][LEFT], horizon_padding, &result); return result; } @@ -541,66 +554,11 @@ Skyline::is_empty () const return b.end_ == infinity_f && b.y_intercept_ == -infinity_f; } -Skyline_pair::Skyline_pair () - : skylines_ (Skyline (DOWN), Skyline (UP)) -{ -} - -Skyline_pair::Skyline_pair (vector const &boxes, Real padding, Axis a) - : skylines_ (Skyline (boxes, padding, a, DOWN), Skyline (boxes, padding, a, UP)) -{ -} - -Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a) - : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP)) -{ -} - -void -Skyline_pair::raise (Real r) -{ - skylines_[UP].raise (r); - skylines_[DOWN].raise (r); -} - -void -Skyline_pair::shift (Real r) -{ - skylines_[UP].shift (r); - skylines_[DOWN].shift (r); -} - -void -Skyline_pair::insert (Box const &b, Real padding, Axis a) -{ - skylines_[UP].insert (b, padding, a); - skylines_[DOWN].insert (b, padding, a); -} - void -Skyline_pair::merge (Skyline_pair const &other) +Skyline::clear () { - skylines_[UP].merge (other[UP]); - skylines_[DOWN].merge (other[DOWN]); -} - -bool -Skyline_pair::is_empty () const -{ - return skylines_[UP].is_empty () - && skylines_[DOWN].is_empty (); -} - -Skyline& -Skyline_pair::operator [] (Direction d) -{ - return skylines_[d]; -} - -Skyline const& -Skyline_pair::operator [] (Direction d) const -{ - return skylines_[d]; + buildings_.clear (); + empty_skyline (&buildings_); } /****************************************************************/ @@ -610,10 +568,6 @@ IMPLEMENT_SIMPLE_SMOBS (Skyline); IMPLEMENT_TYPE_P (Skyline, "ly:skyline?"); IMPLEMENT_DEFAULT_EQUAL_P (Skyline); -IMPLEMENT_SIMPLE_SMOBS (Skyline_pair); -IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?"); -IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair); - SCM Skyline::mark_smob (SCM) { @@ -631,19 +585,3 @@ Skyline::print_smob (SCM s, SCM port, scm_print_state *) return 1; } - -SCM -Skyline_pair::mark_smob (SCM) -{ - return SCM_EOL; -} - -int -Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *) -{ - Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s); - (void) r; - - scm_puts ("#", port); - return 1; -}