restore correct repaint after changed value in 3D chart
Change-Id: Ied1904a56b8d526288a89fd8df0bed639cd317d0
This commit is contained in:
committed by
Markus Mohrhard
parent
9fbafe9fe8
commit
15e2c82acb
@@ -25,13 +25,10 @@ namespace chart {
|
||||
|
||||
GL3DBarChart::GL3DBarChart(
|
||||
const css::uno::Reference<css::chart2::XChartType>& xChartType,
|
||||
const boost::ptr_vector<VDataSeries>& rDataSeries,
|
||||
OpenGLWindow& rWindow, ExplicitCategoriesProvider& rCatProvider ) :
|
||||
OpenGLWindow& rWindow) :
|
||||
mxChartType(xChartType),
|
||||
maDataSeries(rDataSeries),
|
||||
mpRenderer(new opengl3D::OpenGL3DRenderer()),
|
||||
mrWindow(rWindow),
|
||||
mrCatProvider(rCatProvider)
|
||||
mrWindow(rWindow)
|
||||
{
|
||||
mrWindow.setRenderer(this);
|
||||
mpRenderer->init();
|
||||
@@ -42,7 +39,8 @@ GL3DBarChart::~GL3DBarChart()
|
||||
mrWindow.setRenderer(NULL);
|
||||
}
|
||||
|
||||
void GL3DBarChart::create3DShapes()
|
||||
void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
|
||||
ExplicitCategoriesProvider& rCatProvider)
|
||||
{
|
||||
// Each series of data flows from left to right, and multiple series are
|
||||
// stacked vertically along y axis.
|
||||
@@ -68,8 +66,8 @@ void GL3DBarChart::create3DShapes()
|
||||
maShapes.clear();
|
||||
maShapes.push_back(new opengl3D::Camera(mpRenderer.get()));
|
||||
sal_Int32 nSeriesIndex = 0;
|
||||
for (boost::ptr_vector<VDataSeries>::const_iterator itr = maDataSeries.begin(),
|
||||
itrEnd = maDataSeries.end(); itr != itrEnd; ++itr)
|
||||
for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
|
||||
itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
|
||||
{
|
||||
nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY) + nBarSizeY;
|
||||
|
||||
@@ -147,7 +145,7 @@ void GL3DBarChart::create3DShapes()
|
||||
pRect->setLineColor(COL_BLUE);
|
||||
|
||||
// Create category texts along X-axis at the bottom.
|
||||
uno::Sequence<OUString> aCats = mrCatProvider.getSimpleCategories();
|
||||
uno::Sequence<OUString> aCats = rCatProvider.getSimpleCategories();
|
||||
for (sal_Int32 i = 0; i < aCats.getLength(); ++i)
|
||||
{
|
||||
float nXPos = i * (nBarSizeX + nBarDistanceX);
|
||||
|
@@ -34,12 +34,12 @@ class GL3DBarChart : public GL3DPlotterBase, public IRenderer
|
||||
public:
|
||||
GL3DBarChart(
|
||||
const css::uno::Reference<css::chart2::XChartType>& xChartType,
|
||||
const boost::ptr_vector<VDataSeries>& rDataSeries, OpenGLWindow& rContext,
|
||||
ExplicitCategoriesProvider& rCatProvider );
|
||||
OpenGLWindow& rContext);
|
||||
|
||||
virtual ~GL3DBarChart();
|
||||
|
||||
virtual void create3DShapes() SAL_OVERRIDE;
|
||||
virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
|
||||
ExplicitCategoriesProvider& rCatProvider) SAL_OVERRIDE;
|
||||
|
||||
virtual void render() SAL_OVERRIDE;
|
||||
|
||||
@@ -49,12 +49,10 @@ public:
|
||||
|
||||
private:
|
||||
css::uno::Reference<css::chart2::XChartType> mxChartType;
|
||||
const boost::ptr_vector<VDataSeries>& maDataSeries;
|
||||
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
|
||||
|
||||
boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
|
||||
OpenGLWindow& mrWindow;
|
||||
ExplicitCategoriesProvider& mrCatProvider;
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -10,14 +10,20 @@
|
||||
#ifndef CHART2_GL3DPLOTTERBASE_HXX
|
||||
#define CHART2_GL3DPLOTTERBASE_HXX
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
#include "VDataSeries.hxx"
|
||||
|
||||
namespace chart {
|
||||
|
||||
class ExplicitCategoriesProvider;
|
||||
|
||||
class GL3DPlotterBase
|
||||
{
|
||||
public:
|
||||
virtual ~GL3DPlotterBase();
|
||||
|
||||
virtual void create3DShapes() = 0;
|
||||
virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
|
||||
ExplicitCategoriesProvider& rCatProvider) = 0;
|
||||
virtual void render() = 0;
|
||||
};
|
||||
|
||||
|
@@ -3115,65 +3115,67 @@ IMPL_LINK_NOARG(ChartView, UpdateTimeBased)
|
||||
|
||||
void ChartView::createShapes3D()
|
||||
{
|
||||
OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
|
||||
if(!pWindow)
|
||||
return;
|
||||
|
||||
uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
|
||||
uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
||||
if( !xCooSysContainer.is())
|
||||
return;
|
||||
|
||||
uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
||||
|
||||
if (aCooSysList.getLength() != 1)
|
||||
// Supporting multiple coordinates in a truly 3D chart (which implies
|
||||
// it's a Cartesian coordinate system) is a bit of a challenge, if not
|
||||
// impossible.
|
||||
return;
|
||||
|
||||
uno::Reference<XCoordinateSystem> xCooSys( aCooSysList[0] );
|
||||
|
||||
//iterate through all chart types in the current coordinate system
|
||||
uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
|
||||
OSL_ASSERT( xChartTypeContainer.is());
|
||||
if( !xChartTypeContainer.is() )
|
||||
return;
|
||||
|
||||
uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
|
||||
if (aChartTypeList.getLength() != 1)
|
||||
// Likewise, we can't really support multiple chart types here.
|
||||
return;
|
||||
|
||||
uno::Reference< XChartType > xChartType( aChartTypeList[0] );
|
||||
|
||||
if (!m_pGL3DPlotter)
|
||||
{
|
||||
uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
|
||||
uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
||||
if( !xCooSysContainer.is())
|
||||
return;
|
||||
|
||||
uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
||||
boost::ptr_vector<VDataSeries> aDataSeries;
|
||||
|
||||
if (aCooSysList.getLength() != 1)
|
||||
// Supporting multiple coordinates in a truly 3D chart (which implies
|
||||
// it's a Cartesian coordinate system) is a bit of a challenge, if not
|
||||
// impossible.
|
||||
return;
|
||||
|
||||
uno::Reference<XCoordinateSystem> xCooSys( aCooSysList[0] );
|
||||
|
||||
//iterate through all chart types in the current coordinate system
|
||||
uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
|
||||
OSL_ASSERT( xChartTypeContainer.is());
|
||||
if( !xChartTypeContainer.is() )
|
||||
return;
|
||||
|
||||
uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
|
||||
if (aChartTypeList.getLength() != 1)
|
||||
// Likewise, we can't really support multiple chart types here.
|
||||
return;
|
||||
|
||||
uno::Reference< XChartType > xChartType( aChartTypeList[0] );
|
||||
|
||||
uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
|
||||
OSL_ASSERT( xDataSeriesContainer.is());
|
||||
if( !xDataSeriesContainer.is() )
|
||||
return;
|
||||
|
||||
uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
|
||||
for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
|
||||
{
|
||||
uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
|
||||
if(!xDataSeries.is())
|
||||
continue;
|
||||
|
||||
aDataSeries.push_back(new VDataSeries(xDataSeries));
|
||||
}
|
||||
|
||||
OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
|
||||
if(!pWindow)
|
||||
return;
|
||||
|
||||
boost::scoped_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
|
||||
|
||||
pWindow->Show();
|
||||
|
||||
m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, aDataSeries, *pWindow, *pCatProvider));
|
||||
m_pGL3DPlotter->create3DShapes();
|
||||
m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, *pWindow));
|
||||
}
|
||||
|
||||
|
||||
uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
|
||||
OSL_ASSERT( xDataSeriesContainer.is());
|
||||
if( !xDataSeriesContainer.is() )
|
||||
return;
|
||||
|
||||
boost::ptr_vector<VDataSeries> aDataSeries;
|
||||
uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
|
||||
for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
|
||||
{
|
||||
uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
|
||||
if(!xDataSeries.is())
|
||||
continue;
|
||||
|
||||
aDataSeries.push_back(new VDataSeries(xDataSeries));
|
||||
}
|
||||
|
||||
boost::scoped_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
|
||||
|
||||
|
||||
m_pGL3DPlotter->create3DShapes(aDataSeries, *pCatProvider);
|
||||
|
||||
m_pGL3DPlotter->render();
|
||||
pWindow->Show();
|
||||
}
|
||||
|
||||
} //namespace chart
|
||||
|
Reference in New Issue
Block a user