chart2/Library_chartcore.mk | 3 chart2/source/view/charttypes/3DBarChart.cxx | 76 ------------------ chart2/source/view/charttypes/GL3DBarChart.cxx | 93 ++++++++++------------- chart2/source/view/charttypes/GL3DBarChart.hxx | 30 ------- chart2/source/view/charttypes/VSeriesPlotter.cxx | 3 chart2/source/view/inc/3DBarChart.hxx | 48 ----------- chart2/source/view/inc/GL3DBarChart.hxx | 53 +++++++++++++ chart2/source/view/main/ChartView.cxx | 4 8 files changed, 99 insertions(+), 211 deletions(-)
New commits: commit 8e98ac515f1e5cbffdc596187a752e7200c35955 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Thu Apr 10 10:08:51 2014 -0400 Rename 3DBarChart and Bar3DChart both to GL3DBarChart. The old GL3DBarChart has been removed. Change-Id: I0b052cdb875ee23a8c712772269ab0fcc4a1e758 diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index dae64e9..af3b6f3 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -86,14 +86,13 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\ chart2/source/view/axes/VPolarCoordinateSystem \ chart2/source/view/axes/VPolarGrid \ chart2/source/view/axes/VPolarRadiusAxis \ - chart2/source/view/charttypes/3DBarChart \ + chart2/source/view/charttypes/GL3DBarChart \ chart2/source/view/charttypes/AreaChart \ chart2/source/view/charttypes/BarChart \ chart2/source/view/charttypes/BarPositionHelper \ chart2/source/view/charttypes/BubbleChart \ chart2/source/view/charttypes/CandleStickChart \ chart2/source/view/charttypes/CategoryPositionHelper \ - chart2/source/view/charttypes/GL3DBarChart \ chart2/source/view/charttypes/NetChart \ chart2/source/view/charttypes/PieChart \ chart2/source/view/charttypes/Splines \ diff --git a/chart2/source/view/charttypes/3DBarChart.cxx b/chart2/source/view/charttypes/3DBarChart.cxx deleted file mode 100644 index 13e3faf..0000000 --- a/chart2/source/view/charttypes/3DBarChart.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <GL/glew.h> - -#include "3DBarChart.hxx" - -#include <glm/glm.hpp> -#include <glm/gtx/transform.hpp> - -#include "3DChartObjects.hxx" - -namespace chart { - -Bar3DChart::Bar3DChart(const std::vector<VDataSeries*>& rDataSeries): - maDataSeries(rDataSeries), - mxContext(new opengl3D::temporary::TemporaryContext()) -{ -} - -Bar3DChart::~Bar3DChart() -{ -} - -void Bar3DChart::create3DShapes() -{ - const float nBarSizeX = 10; - const float nBarSizeY = 10; - const float nBarDistanceX = nBarSizeX / 2; - const float nBarDistanceY = nBarSizeY / 2; - - maShapes.clear(); - maShapes.push_back(new opengl3D::Camera()); - sal_Int32 nSeriesIndex = 0; - for(std::vector<VDataSeries*>::const_iterator itr = maDataSeries.begin(), - itrEnd = maDataSeries.end(); itr != itrEnd; ++itr) - { - VDataSeries* pDataSeries = *itr; - sal_Int32 nPointCount = pDataSeries->getTotalPointCount(); - for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex) - { - float nVal = pDataSeries->getYValue(nIndex); - float nXPos = nIndex * (nBarSizeX + nBarDistanceX); - float nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY); - - glm::mat4 aBarPosition; - glm::scale(aBarPosition, nBarSizeX, nBarSizeY, nVal); - glm::translate(aBarPosition, nXPos, nYPos, nVal/2); - - maShapes.push_back(new opengl3D::Bar(aBarPosition)); - } - - ++nSeriesIndex; - } -} - -void Bar3DChart::render() -{ - mxContext->init(); - for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(), - itrEnd = maShapes.end(); itr != itrEnd; ++itr) - { - itr->render(); - } - mxContext->render(); -} - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index 0249a65..6ea785d 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -7,20 +7,20 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "GL3DBarChart.hxx" -#include <unonames.hxx> +#include <GL3DBarChart.hxx> -#include <com/sun/star/chart2/data/XDataSequence.hpp> -#include <com/sun/star/chart2/data/LabelOrigin.hpp> +#include <GL/glew.h> -#include <stdio.h> +#include <glm/glm.hpp> +#include <glm/gtx/transform.hpp> -using namespace com::sun::star; +#include "3DChartObjects.hxx" namespace chart { -GL3DBarChart::GL3DBarChart( const css::uno::Reference<css::chart2::XChartType>& xChartTypeModel ) : - VSeriesPlotter(xChartTypeModel, 3, false) +GL3DBarChart::GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries): + maDataSeries(rDataSeries), + mxContext(new opengl3D::temporary::TemporaryContext()) { } @@ -28,54 +28,47 @@ GL3DBarChart::~GL3DBarChart() { } -void GL3DBarChart::createShapes() +void GL3DBarChart::create3DShapes() { - fprintf(stdout, "GL3DBarChart::createShapes: type = '%s'\n", - rtl::OUStringToOString(m_xChartTypeModel->getChartType(), RTL_TEXTENCODING_UTF8).getStr()); - - uno::Reference<beans::XPropertySet> xPropSet(m_xChartTypeModel, uno::UNO_QUERY); - if (xPropSet.is()) + const float nBarSizeX = 10; + const float nBarSizeY = 10; + const float nBarDistanceX = nBarSizeX / 2; + const float nBarDistanceY = nBarSizeY / 2; + + maShapes.clear(); + maShapes.push_back(new opengl3D::Camera()); + sal_Int32 nSeriesIndex = 0; + for(std::vector<VDataSeries*>::const_iterator itr = maDataSeries.begin(), + itrEnd = maDataSeries.end(); itr != itrEnd; ++itr) { - bool bRoundedEdge = false; - if (xPropSet->getPropertyValue(CHART_UNONAME_ROUNDED_EDGE) >>= bRoundedEdge) - fprintf(stdout, "GL3DBarChart::createShapes: rounded edge = %d (%p)\n", bRoundedEdge, m_xChartTypeModel.get()); + VDataSeries* pDataSeries = *itr; + sal_Int32 nPointCount = pDataSeries->getTotalPointCount(); + for(sal_Int32 nIndex = 0; nIndex < nPointCount; ++nIndex) + { + float nVal = pDataSeries->getYValue(nIndex); + float nXPos = nIndex * (nBarSizeX + nBarDistanceX); + float nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY); + + glm::mat4 aBarPosition; + glm::scale(aBarPosition, nBarSizeX, nBarSizeY, nVal); + glm::translate(aBarPosition, nXPos, nYPos, nVal/2); + + maShapes.push_back(new opengl3D::Bar(aBarPosition)); + } + + ++nSeriesIndex; } +} -#if 0 - if (m_pExplicitCategoriesProvider) - { - uno::Reference<chart2::data::XDataSequence> xCats = m_pExplicitCategoriesProvider->getOriginalCategories(); - - OUString aSrcRange = xCats->getSourceRangeRepresentation(); - - fprintf(stdout, "GL3DBarChart::createShapes: source range = '%s'\n", rtl::OUStringToOString(aSrcRange, RTL_TEXTENCODING_UTF8).getStr()); - - uno::Sequence<OUString> aCats = m_pExplicitCategoriesProvider->getSimpleCategories(); - for (sal_Int32 i = 0; i < aCats.getLength(); ++i) - fprintf(stdout, "GL3DBarChart::createShapes: category = '%s'\n", rtl::OUStringToOString(aCats[i], RTL_TEXTENCODING_UTF8).getStr()); - } - - uno::Sequence<OUString> aSeriesNames = getSeriesNames(); - fprintf(stdout, "GL3DBarChart::createShapes: series name count = %d\n", aSeriesNames.getLength()); - for (sal_Int32 i = 0; i < aSeriesNames.getLength(); ++i) - fprintf(stdout, "GL3DBarChart::createShapes: name = '%s'\n", rtl::OUStringToOString(aSeriesNames[i], RTL_TEXTENCODING_UTF8).getStr()); - - std::vector<VDataSeries*> aAllSeries = getAllSeries(); - fprintf(stdout, "GL3DBarChart::createShapes: series count = %d\n", aAllSeries.size()); - for (size_t i = 0, n = aAllSeries.size(); i < n; ++i) +void GL3DBarChart::render() +{ + mxContext->init(); + for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(), + itrEnd = maShapes.end(); itr != itrEnd; ++itr) { - const VDataSeries* pSeries = aAllSeries[i]; - fprintf(stdout, "GL3DBarChart::createShapes: series %d: cid = '%s' particle = '%s'\n", - i, - rtl::OUStringToOString(pSeries->getCID(), RTL_TEXTENCODING_UTF8).getStr(), - rtl::OUStringToOString(pSeries->getSeriesParticle(), RTL_TEXTENCODING_UTF8).getStr()); - - uno::Sequence<double> aXValues = pSeries->getAllX(); - uno::Sequence<double> aYValues = pSeries->getAllY(); - for (size_t j = 0; j < aXValues.getLength(); ++j) - fprintf(stdout, "GL3DBarChart::createShapes: (x=%g,y=%g)\n", aXValues[j], aYValues[j]); + itr->render(); } -#endif + mxContext->render(); } } diff --git a/chart2/source/view/charttypes/GL3DBarChart.hxx b/chart2/source/view/charttypes/GL3DBarChart.hxx deleted file mode 100644 index 87128a8..0000000 --- a/chart2/source/view/charttypes/GL3DBarChart.hxx +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef CHART2_GL3DBARCHART_HXX -#define CHART2_GL3DBARCHART_HXX - -#include <VSeriesPlotter.hxx> - -namespace chart { - -class GL3DBarChart : public VSeriesPlotter -{ -public: - GL3DBarChart( const css::uno::Reference<css::chart2::XChartType>& xChartTypeModel ); - virtual ~GL3DBarChart(); - - virtual void createShapes() SAL_OVERRIDE; -}; - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 1027192..7433eb8 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -51,7 +51,6 @@ #include "CandleStickChart.hxx" #include "BubbleChart.hxx" #include "NetChart.hxx" -#include "GL3DBarChart.hxx" #include <com/sun/star/chart/ErrorBarStyle.hpp> #include <com/sun/star/chart/TimeUnit.hpp> @@ -2443,8 +2442,6 @@ VSeriesPlotter* VSeriesPlotter::createSeriesPlotter( pRet = new AreaChart(xChartTypeModel,nDimensionCount,false,true); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE) ) pRet = new BubbleChart(xChartTypeModel,nDimensionCount); - else if (aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_GL3DBAR)) - pRet = new GL3DBarChart(xChartTypeModel); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) pRet = new PieChart(xChartTypeModel,nDimensionCount, bExcludingPositioning ); else if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) diff --git a/chart2/source/view/inc/3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx similarity index 83% rename from chart2/source/view/inc/3DBarChart.hxx rename to chart2/source/view/inc/GL3DBarChart.hxx index 2f10ce2..6191fc1 100644 --- a/chart2/source/view/inc/3DBarChart.hxx +++ b/chart2/source/view/inc/GL3DBarChart.hxx @@ -7,6 +7,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifndef CHART2_GL3DBARCHART_HXX +#define CHART2_GL3DBARCHART_HXX + #include <vector> #include <boost/ptr_container/ptr_vector.hpp> #include "VDataSeries.hxx" @@ -25,11 +28,11 @@ class TemporaryContext; } } -class Bar3DChart +class GL3DBarChart { public: - Bar3DChart(const std::vector<VDataSeries*>& rDataSeries); - ~Bar3DChart(); + GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries); + ~GL3DBarChart(); void create3DShapes(); @@ -45,4 +48,6 @@ private: } +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index cd60243..da0e30a 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -48,7 +48,7 @@ #include "DateHelper.hxx" #include "defines.hxx" #include <unonames.hxx> -#include "3DBarChart.hxx" +#include <GL3DBarChart.hxx> #include <rtl/uuid.h> #include <comphelper/scopeguard.hxx> @@ -3149,7 +3149,7 @@ void ChartView::createShapes3D() } } - Bar3DChart aBarChart(aDataSeries); + GL3DBarChart aBarChart(aDataSeries); aBarChart.create3DShapes(); aBarChart.render(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits