LCOV - code coverage report
Current view: top level - basegfx/source/tools - numbertools.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 19 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <basegfx/tools/tools.hxx>
      11             : #include <basegfx/matrix/b2dhommatrix.hxx>
      12             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      13             : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      14             : 
      15             : #include <rtl/ustrbuf.hxx>
      16             : #include <rtl/math.hxx>
      17             : 
      18             : #include <utility>
      19             : 
      20             : namespace basegfx { namespace tools
      21             : {
      22           0 :     B2DPolyPolygon number2PolyPolygon(double fValue, sal_Int32 nTotalDigits, sal_Int32 nDecPlaces, bool bLitSegments)
      23             :     {
      24             :         // config here
      25             :         // {
      26           0 :         const double fSpace=0.2;
      27             :         // }
      28             :         // config here
      29             : 
      30           0 :         rtl::OUStringBuffer aNum;
      31             :         rtl::math::doubleToUStringBuffer(aNum,
      32             :                                          fValue,
      33             :                                          rtl_math_StringFormat_F,
      34             :                                          nDecPlaces, '.',
      35           0 :                                          0, ',');
      36             : 
      37           0 :         B2DPolyPolygon aRes;
      38           0 :         B2DHomMatrix aMat;
      39           0 :         double fCurrX=std::max(nTotalDigits-aNum.getLength(),
      40           0 :                                sal_Int32(0)) * (1.0+fSpace);
      41           0 :         for( sal_Int32 i=0; i<aNum.getLength(); ++i )
      42             :         {
      43           0 :             B2DPolyPolygon aCurr;
      44           0 :             aCurr=createSevenSegmentPolyPolygon(aNum[i],
      45           0 :                                                 bLitSegments);
      46             : 
      47           0 :             aMat.identity();
      48           0 :             aMat.translate(fCurrX,0.0);
      49           0 :             aCurr.transform(aMat);
      50             : 
      51           0 :             fCurrX += 1.0+fSpace;
      52             : 
      53           0 :             aRes.append(aCurr);
      54           0 :         }
      55             : 
      56           0 :         return aRes;
      57             :     }
      58             : 
      59             : } }
      60             : 
      61             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11