[Libreoffice-commits] core.git: Branch 'feature/chart-3d-chart2' - 4 commits - chart2/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Mon May 26 13:56:34 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 0c368ca4215c0ae58e9a7427db31d6e1b66c3bc8
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 e75a762..263bf50 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -334,7 +334,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 fed3fc6a3c173629ada79b3e21e45de7e32bcaf1
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 462e7f0..e75a762 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);
@@ -377,29 +378,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 7bb617093b43bd779ed79404312b1566235590de
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 1493e60..462e7f0 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 3de7d803a699d47eb7c2c625a3bd6c2fdf07913d
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 3f330a8..1493e60 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