@@ -90,7 +90,7 @@ Geom::Point DrawAxes::getTitleBasePos(Gen::ChannelId axisIndex,
9090
9191 double orthogonal{0.0 };
9292
93- switch (titleStyle.position ->get (index).value ) {
93+ switch (titleStyle.position ->get_or_first (index).value ) {
9494 default :
9595 case Pos::min_edge: break ;
9696 case Pos::max_edge: orthogonal = 1.0 ; break ;
@@ -101,7 +101,7 @@ Geom::Point DrawAxes::getTitleBasePos(Gen::ChannelId axisIndex,
101101
102102 double parallel{0.0 };
103103
104- switch (titleStyle.vposition ->get (index).value ) {
104+ switch (titleStyle.vposition ->get_or_first (index).value ) {
105105 default :
106106 case VPos::end: parallel = 1.0 ; break ;
107107 case VPos::middle: parallel = 0.5 ; break ;
@@ -130,9 +130,9 @@ Geom::Point DrawAxes::getTitleOffset(Gen::ChannelId axisIndex,
130130 }
131131 };
132132
133- auto orthogonal = fades
134- ? calcSide (titleStyle.side ->get (index).value )
135- : titleStyle.side ->combine <double >(calcSide);
133+ auto orthogonal =
134+ fades ? calcSide (titleStyle.side ->get_or_first (index).value )
135+ : titleStyle.side ->combine <double >(calcSide);
136136
137137 auto calcVSide = [](const auto &side)
138138 {
@@ -145,9 +145,9 @@ Geom::Point DrawAxes::getTitleOffset(Gen::ChannelId axisIndex,
145145 }
146146 };
147147
148- auto parallel = fades
149- ? calcVSide (titleStyle.vside ->get (index).value )
150- : titleStyle.vside ->combine <double >(calcVSide);
148+ auto parallel =
149+ fades ? calcVSide (titleStyle.vside ->get_or_first (index).value )
150+ : titleStyle.vside ->combine <double >(calcVSide);
151151
152152 return axisIndex == Gen::ChannelId::x
153153 ? Geom::Point{parallel, -orthogonal}
@@ -165,12 +165,13 @@ void DrawAxes::drawTitle(Gen::ChannelId axisIndex) const
165165 || titleString.maxIndex ();
166166
167167 for (auto &&index : Type::Bools{fades}) {
168- auto title = titleString.get (index);
168+ auto title = titleString.get_or_first (index);
169169 if (title.value .empty ()) continue ;
170170
171- auto weight = title.weight
172- * titleStyle.position ->get (index).weight
173- * titleStyle.vposition ->get (index).weight ;
171+ auto weight =
172+ title.weight
173+ * titleStyle.position ->get_or_first (index).weight
174+ * titleStyle.vposition ->get_or_first (index).weight ;
174175
175176 const Gfx::Font font (titleStyle);
176177 canvas.setFont (font);
@@ -182,9 +183,8 @@ void DrawAxes::drawTitle(Gen::ChannelId axisIndex) const
182183
183184 auto normal = Geom::Point::Ident (true );
184185
185- auto offset = getTitleOffset (axisIndex,
186- index,
187- fades == ::Anim::secondIfExists);
186+ auto offset =
187+ getTitleOffset (axisIndex, index, fades == ::Anim::second);
188188
189189 auto posDir = coordSys.convertDirectionAt (
190190 {relCenter, relCenter + normal});
@@ -207,16 +207,17 @@ void DrawAxes::drawTitle(Gen::ChannelId axisIndex) const
207207
208208 auto angle =
209209 -M_PI / 2.0
210- * (fades == ::Anim::secondIfExists
211- ? titleStyle.orientation ->get (index).value
210+ * (fades == ::Anim::second
211+ ? titleStyle.orientation ->get_or_first (index)
212+ .value
212213 == Styles::AxisTitle::Orientation::vertical
213214 : titleStyle.orientation ->factor <double >(
214215 Styles::AxisTitle::Orientation::vertical));
215216
216217 auto orientedSize =
217- fades == ::Anim::secondIfExists
218+ fades == ::Anim::second
218219 ? calcOrientation (
219- titleStyle.orientation ->get (index).value )
220+ titleStyle.orientation ->get_or_first (index).value )
220221 : titleStyle.orientation ->combine <Geom::Size>(
221222 calcOrientation);
222223
@@ -315,11 +316,12 @@ void DrawAxes::drawDimensionLabel(bool horizontal,
315316 auto relCenter =
316317 refPos + ident * it->second .range .middle ();
317318
318- auto under = labelStyle.position ->interpolates ()
319- ? labelStyle.side ->get (index).value
320- == Styles::AxisLabel::Side::negative
321- : labelStyle.side ->factor <double >(
322- Styles::AxisLabel::Side::negative);
319+ auto under =
320+ labelStyle.position ->interpolates ()
321+ ? labelStyle.side ->get_or_first (index).value
322+ == Styles::AxisLabel::Side::negative
323+ : labelStyle.side ->factor <double >(
324+ Styles::AxisLabel::Side::negative);
323325
324326 auto sign = 1 - 2 * under;
325327
@@ -347,15 +349,16 @@ void DrawAxes::drawDimensionLabel(bool horizontal,
347349
348350 if (labelStyle.position ->interpolates ()
349351 && text.interpolates ())
350- draw (text.get (index), position.weight );
352+ draw (text.get_or_first (index), position.weight );
351353 if (!labelStyle.position ->interpolates ()
352354 && !text.interpolates ())
353- draw (text.get (::Anim::first));
355+ draw (text.get_or_first (::Anim::first));
354356 else if (labelStyle.position ->interpolates ())
355- draw (text.get (::Anim::first), position.weight );
357+ draw (text.get_or_first (::Anim::first),
358+ position.weight );
356359 else if (text.interpolates ()) {
357- draw (text.get (::Anim::first));
358- draw (text.get (::Anim::secondIfExists ));
360+ draw (text.get_or_first (::Anim::first));
361+ draw (text.get_or_first (::Anim::second ));
359362 }
360363 });
361364}
0 commit comments