2 axis-group.cc -- implement Graphical_axis_group
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "graphical-axis-group.hh"
10 #include "axis-group-element.hh"
11 #include "graphical-element.hh"
14 /** don't copy anything: an element can only be in one
15 Graphical_axis_group at one time. */
16 Graphical_axis_group::Graphical_axis_group (Graphical_axis_group const&s)
23 Graphical_axis_group::contains_b (Graphical_element const *e) const
25 return elem_l_arr_.find_l (e);
29 Graphical_axis_group::extent (Axis axis) const
32 for (int i=0; i < elem_l_arr_.size(); i++)
33 r.unite (elem_l_arr_[i]->extent (axis));
38 Graphical_axis_group::add_element (Graphical_element*e)
40 Graphical_axis_group *& g1 = e->axis_group_l_a_[axis1_];
41 Graphical_axis_group *& g2 = e->axis_group_l_a_[axis2_];
43 assert (!g1 || g1 == this);
44 assert (!g2 || g2 == this);
53 Graphical_axis_group::remove_element (Graphical_element*e)
55 assert (contains_b (e));
56 elem_l_arr_.unordered_substitute (e,0);
58 e->axis_group_l_a_[axis1_] = 0;
59 e->axis_group_l_a_[axis2_] = 0;
63 Graphical_axis_group::remove_all ()
65 for (int i=0; i < elem_l_arr_.size(); i++)
67 Graphical_element*e=elem_l_arr_[i];
68 e->axis_group_l_a_[axis1_] = 0;
69 e->axis_group_l_a_[axis2_] = 0;
76 Graphical_axis_group::do_print() const
79 for (int i=0; i < elem_l_arr_.size(); i++)
80 DOUT << elem_l_arr_[i]->name () << " ";
84 Graphical_axis_group::Graphical_axis_group (Axis a1, Axis a2)
90 IMPLEMENT_IS_TYPE_B1(Graphical_axis_group, Graphical_element);