Skip to content

Commit 9b3014a

Browse files
committed
Add remove API for pie renderable
1 parent d5424e5 commit 9b3014a

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

include/fg/chart.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,16 @@ Remove a Histogram object from the current chart
308308
FGAPI fg_err fg_remove_histogram_from_chart(fg_chart pHandle,
309309
fg_histogram pHistogram);
310310

311+
/**
312+
Remove a Pie object from the current chart
313+
314+
\param[in] pHandle is chart handle
315+
\param[in] pPie is the handle of the pie object to remove
316+
317+
\return \ref fg_err error code
318+
*/
319+
FGAPI fg_err fg_remove_pie_from_chart(fg_chart pHandle, fg_pie pPie);
320+
311321
/**
312322
Remove a Plot object from the current chart
313323
@@ -526,6 +536,13 @@ class Chart {
526536
*/
527537
FGAPI void remove(const Histogram &pHistogram);
528538

539+
/**
540+
Remove an existing Pie object to the current chart
541+
542+
\param[in] pPie is the Pie to remove from the chart
543+
*/
544+
FGAPI void remove(const Pie &pPie);
545+
529546
/**
530547
Remove an existing Plot object to the current chart
531548

src/api/c/chart.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,21 @@ fg_err fg_remove_histogram_from_chart(fg_chart pChart,
375375
return FG_ERR_NONE;
376376
}
377377

378+
fg_err fg_remove_pie_from_chart(fg_chart pChart, fg_pie pPie) {
379+
try {
380+
ARG_ASSERT(0, (pPie != 0));
381+
ARG_ASSERT(1, (pChart != 0));
382+
383+
common::Chart* chrt = getChart(pChart);
384+
385+
common::Pie* pie = getPie(pPie);
386+
chrt->removeRenderable(pie->impl());
387+
}
388+
CATCHALL
389+
390+
return FG_ERR_NONE;
391+
}
392+
378393
fg_err fg_remove_plot_from_chart(fg_chart pChart, fg_plot pPlot) {
379394
try {
380395
ARG_ASSERT(0, (pPlot != 0));

src/api/cpp/chart.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ void Chart::remove(const Histogram& pHistogram) {
9292
FG_THROW(fg_remove_histogram_from_chart(get(), pHistogram.get()));
9393
}
9494

95+
void Chart::remove(const Pie& pPie) {
96+
FG_THROW(fg_remove_pie_from_chart(get(), pPie.get()));
97+
}
98+
9599
void Chart::remove(const Plot& pPlot) {
96100
FG_THROW(fg_remove_plot_from_chart(get(), pPlot.get()));
97101
}

0 commit comments

Comments
 (0)