MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ place_adornments()

void MayaFlux::Portal::Forma::internal::Atelier::place_adornments ( Surface surface,
const Plot::SeriesSpec spec,
uint32_t  relate_to 
)

Create and place every adornment declared on spec.

Builds one buffer per axis label, tick label, legend swatch, and legend label, then hands each to the corresponding Plot placement function. Each adornment is related to relate_to so removal and visibility cascade from the series element.

Lives here rather than in Plot because it constructs buffers, which requires the BufferManager. Plot composes placement from arguments it is given.

Parameters
surfaceSurface to place on.
specSeries spec carrying the adornment declarations.
relate_toElement id the adornments are related to.

Definition at line 152 of file Atelier.cpp.

156{
157 const auto& win = surface.window();
158
159 for (const auto& label : spec.labels) {
160 auto buf = create_buffer(
161 win,
162 k_text_label_capacity,
164 {},
165 { { "text", nullptr } });
166 (void)Plot::place_label(surface, std::move(buf), label, relate_to);
167 }
168
169 for (const auto& ticks : spec.tick_labels) {
170 for (const auto& label : Plot::plot_tick_labels(ticks)) {
171 auto buf = create_buffer(
172 win,
173 k_text_label_capacity,
175 {},
176 { { "text", nullptr } });
177 (void)Plot::place_label(surface, std::move(buf), label, relate_to);
178 }
179 }
180
181 if (spec.legend) {
182 auto layout = Plot::layout_legend(*spec.legend);
183
184 for (const auto& swatch : layout.swatches) {
185 auto buf = create_buffer(
186 win,
187 k_rect_capacity,
189 (void)Plot::place_rect(surface, std::move(buf), swatch, relate_to);
190 }
191
192 for (const auto& label : layout.labels) {
193 auto buf = create_buffer(
194 win,
195 k_text_label_capacity,
197 {},
198 { { "text", nullptr } });
199 (void)Plot::place_label(surface, std::move(buf), label, relate_to);
200 }
201 }
202}
std::shared_ptr< Buffers::FormaBuffer > create_buffer(std::shared_ptr< Core::Window > window, size_t capacity, Graphics::PrimitiveTopology topology, const std::string &texture_binding={}, std::vector< std::pair< std::string, std::shared_ptr< Core::VKImage > > > additional_textures={})
Capacity-explicit FormaBuffer construction.
Definition Atelier.cpp:108
LegendLayout layout_legend(const LegendSpec &spec)
Expand a legend spec into swatch rectangle specs and text label specs.
Definition PlotSpec.cpp:346
std::vector< LabelSpec > plot_tick_labels(const TickLabelsSpec &spec)
Generate construction-free tick label specs.
Definition PlotSpec.cpp:237
uint32_t place_label(Surface &surface, std::shared_ptr< Buffers::FormaBuffer > buf, const LabelSpec &spec, uint32_t relate_to)
Place a text label element onto surface using a pre-built buffer.
Definition Plot.cpp:15
uint32_t place_rect(Surface &surface, std::shared_ptr< Buffers::FormaBuffer > buf, const RectSpec &spec, uint32_t relate_to)
Place a filled rectangle element onto surface using a pre-built buffer.
Definition Plot.cpp:53

References create_buffer(), MayaFlux::Portal::Forma::Plot::SeriesSpec::labels, MayaFlux::Portal::Forma::Plot::layout_legend(), MayaFlux::Portal::Forma::Plot::SeriesSpec::legend, MayaFlux::Portal::Forma::Plot::place_label(), MayaFlux::Portal::Forma::Plot::place_rect(), MayaFlux::Portal::Forma::Plot::plot_tick_labels(), MayaFlux::Portal::Forma::Plot::SeriesSpec::tick_labels, MayaFlux::Portal::Graphics::TRIANGLE_LIST, MayaFlux::Portal::Graphics::TRIANGLE_STRIP, and MayaFlux::Portal::Forma::Surface::window().

Referenced by MayaFlux::Portal::Forma::plot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: