[Libreoffice-commits] core.git: 4 commits - chart2/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Mon May 26 13:55:58 PDT 2014


 chart2/source/view/charttypes/GL3DBarChart.cxx |   24 ++++++++++++------------
 chart2/source/view/inc/GL3DBarChart.hxx        |    3 ---
 2 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit 25cea66f6ac06897379b6d98fdf2e443e1d3e001
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon May 26 22:48:22 2014 +0200

    remove unused variables
    
    Change-Id: Ia94a501fa2571752286df0451a0a8a2b303a10c8

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index acb3692..3882f8b 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -312,7 +312,6 @@ void GL3DBarChart::clickedAt(const Point& /*rPos*/, sal_uInt16 nButtons)
     const BarInformation& rBarInfo = itr->second;
     mnStepsTotal = 100;
     mnStep = 0;
-    maOldCameraDirection = maCameraDirection;
     maCameraDirection = rBarInfo.maPos;
     render();
 
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index eb436db..de92660 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -77,9 +77,6 @@ private:
     glm::vec3 maCameraPosition;
     glm::vec3 maCameraDirection;
 
-    glm::vec3 maOldCameraPosition;
-    glm::vec3 maOldCameraDirection;
-
     Timer maTimer;
     glm::vec3 maStep;
     size_t mnStep;
commit e69e429d8f2a2269fe1f8e2a7faa1979d2067628
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon May 26 22:46:06 2014 +0200

    hardcode default camera height
    
    instead of having the magic number in 5 places
    
    Change-Id: I2550671572dcc36d9a710e56d9d9c1e99f732843

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 0e5cdca..acb3692 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -62,6 +62,7 @@ namespace {
 
 const float TEXT_HEIGHT = 15.0f;
 const sal_uLong TIMEOUT = 5;
+const float DEFAULT_CAMERA_HEIGHT = 200.0f;
 
 float calculateTextWidth(const OUString& rText)
 {
@@ -255,7 +256,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
     mnMaxX = nMaxPointCount * (nBarSizeX + nBarDistanceX) + 40;
     mnMaxY = nSeriesIndex * (nBarSizeY + nBarDistanceY) + 40;
 
-    maCameraPosition = glm::vec3(-30, -30, 200);
+    maCameraPosition = glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT);
     mpCamera->setPosition(maCameraPosition);
     maCameraDirection = glm::vec3(mnMaxX/2, mnMaxY/2, 0);
     mpCamera->setDirection(maCameraDirection);
@@ -355,29 +356,29 @@ glm::vec3 GL3DBarChart::getCornerPosition(sal_Int8 nId)
     {
         case 0:
         {
-            return glm::vec3(-30, -30, 200);
+            return glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT);
         }
         break;
         case 1:
         {
-            return glm::vec3(mnMaxX, -30, 200);
+            return glm::vec3(mnMaxX, -30, DEFAULT_CAMERA_HEIGHT);
         }
         break;
         case 2:
         {
-            return glm::vec3(mnMaxX, mnMaxY, 200);
+            return glm::vec3(mnMaxX, mnMaxY, DEFAULT_CAMERA_HEIGHT);
         }
         break;
         case 3:
         {
-            return glm::vec3(-30, mnMaxY, 200);
+            return glm::vec3(-30, mnMaxY, DEFAULT_CAMERA_HEIGHT);
         }
         break;
         default:
             assert(false);
     }
 
-    return glm::vec3(-30, -30, 200);
+    return glm::vec3(-30, -30, DEFAULT_CAMERA_HEIGHT);
 }
 
 void GL3DBarChart::moveToCorner()
commit 3c5392997d76d939f6dfc8730b9a6b405663d2d3
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon May 26 22:44:21 2014 +0200

    switch the direction of the series labels
    
    Change-Id: I718ee4782a8b1e265131f6e4e02093a59c17cb15

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index a965d53..0e5cdca 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -146,12 +146,12 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
                         *mpTextCache, aSeriesName, nId++));
             opengl3D::Text* p = static_cast<opengl3D::Text*>(&maShapes.back());
             glm::vec3 aTopLeft, aTopRight, aBottomRight;
-            aTopLeft.x = -nBarDistanceY;
-            aTopLeft.y = nYPos + 0.25 * nBarSizeY;
-            aTopRight.x = calculateTextWidth(aSeriesName) * -1.0 - nBarDistanceY;
+            aTopRight.x = -nBarDistanceY;
             aTopRight.y = nYPos + 0.25 * nBarSizeY;
+            aTopLeft.x = calculateTextWidth(aSeriesName) * -1.0 - nBarDistanceY;
+            aTopLeft.y = nYPos + 0.25 * nBarSizeY;
             aBottomRight = aTopRight;
-            aBottomRight.y += TEXT_HEIGHT;
+            aBottomRight.y -= TEXT_HEIGHT;
             p->setPosition(aTopLeft, aTopRight, aBottomRight);
         }
 
commit 3bc86e1c9238187c9970088441a0857c7769b464
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Mon May 26 22:24:28 2014 +0200

    use the center of the chart as camera direction
    
    Change-Id: I943273817a26235afd9f17e55d2ee14c5f94c409

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index b9c443f..a965d53 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -257,7 +257,7 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
 
     maCameraPosition = glm::vec3(-30, -30, 200);
     mpCamera->setPosition(maCameraPosition);
-    maCameraDirection = glm::vec3(0, 0, 0);
+    maCameraDirection = glm::vec3(mnMaxX/2, mnMaxY/2, 0);
     mpCamera->setDirection(maCameraDirection);
 }
 


More information about the Libreoffice-commits mailing list