Kaydet (Commit) e0dec4c7 authored tarafından Noel Grandin's avatar Noel Grandin

chart2: replace boost::ptr_vector with std::vector<unique_ptr>

Change-Id: Ia5c35cbd54045a79e896832adf2dbe68c5facf1f
üst 126103cd
......@@ -63,17 +63,15 @@ float calculateTextWidth(const OUString& rText)
return rText.getLength() * 10;
}
double findMaxValue(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer)
double findMaxValue(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer)
{
double nMax = 0.0;
for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
{
const VDataSeries& rDataSeries = *itr;
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex)
{
double nVal = rDataSeries.getYValue(nIndex);
double nVal = rDataSeries->getYValue(nIndex);
nMax = std::max(nMax, nVal);
}
}
......@@ -599,7 +597,7 @@ GL3DBarChart::~GL3DBarChart()
mpWindow->setRenderer(NULL);
}
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeriesContainer,
ExplicitCategoriesProvider& rCatProvider)
{
SharedResourceAccess aResGuard(maCond1, maCond2);
......@@ -654,24 +652,22 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
}
else
{
const VDataSeries& rFirstRow = *(rDataSeriesContainer.begin());
const VDataSeries& rFirstRow = *rDataSeriesContainer.begin()->get();
mnBarsInRow = rFirstRow.getTotalPointCount();
}
for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
for (const std::unique_ptr<VDataSeries>& rDataSeries : rDataSeriesContainer)
{
nYPos = nSeriesIndex * (BAR_SIZE_Y + BAR_DISTANCE_Y) + BAR_DISTANCE_Y;
const VDataSeries& rDataSeries = *itr;
sal_Int32 nPointCount = rDataSeries.getTotalPointCount();
sal_Int32 nPointCount = rDataSeries->getTotalPointCount();
nMaxPointCount = std::max(nMaxPointCount, nPointCount);
bool bMappedFillProperty = rDataSeries.hasPropertyMapping("FillColor");
bool bMappedFillProperty = rDataSeries->hasPropertyMapping("FillColor");
// Create series name text object.
OUString aSeriesName =
DataSeriesHelper::getDataSeriesLabel(
rDataSeries.getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
rDataSeries->getModel(), mxChartType->getRoleOfSequenceForSeriesLabel());
maSeriesNames.push_back(aSeriesName);
......@@ -696,12 +692,12 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
{
if(bMappedFillProperty)
{
double nPropVal = rDataSeries.getValueByProperty(nIndex, "FillColor");
double nPropVal = rDataSeries->getValueByProperty(nIndex, "FillColor");
if(!rtl::math::isNan(nPropVal))
nColor = static_cast<sal_uInt32>(nPropVal);
}
float nVal = rDataSeries.getYValue(nIndex);
float nVal = rDataSeries->getYValue(nIndex);
if (rtl::math::isNan(nVal))
continue;
......
......@@ -13,7 +13,6 @@
#include <GL3DPlotterBase.hxx>
#include <vector>
#include <boost/ptr_container/ptr_vector.hpp>
#include "VDataSeries.hxx"
#include <glm/glm.hpp>
......@@ -71,7 +70,7 @@ public:
virtual ~GL3DBarChart();
virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries>>& rDataSeries,
ExplicitCategoriesProvider& rCatProvider) override;
virtual void render() override;
......
......@@ -10,8 +10,9 @@
#ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
#define INCLUDED_CHART2_SOURCE_VIEW_INC_GL3DPLOTTERBASE_HXX
#include <boost/ptr_container/ptr_vector.hpp>
#include "VDataSeries.hxx"
#include <vector>
#include <memory>
namespace chart {
......@@ -22,7 +23,7 @@ class GL3DPlotterBase
public:
virtual ~GL3DPlotterBase();
virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
virtual void create3DShapes(const std::vector<std::unique_ptr<VDataSeries> >& rDataSeries,
ExplicitCategoriesProvider& rCatProvider) = 0;
virtual void render() = 0;
};
......
......@@ -3403,7 +3403,7 @@ void ChartView::createShapes3D()
if( !xDataSeriesContainer.is() )
return;
boost::ptr_vector<VDataSeries> aDataSeries;
std::vector<std::unique_ptr<VDataSeries> > aDataSeries;
uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
{
......@@ -3411,7 +3411,7 @@ void ChartView::createShapes3D()
if(!xDataSeries.is())
continue;
aDataSeries.push_back(new VDataSeries(xDataSeries));
aDataSeries.push_back(std::make_unique<VDataSeries>(xDataSeries));
}
std::unique_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment