LCOV - code coverage report
Current view: top level - chart2/source/view/main - Linear3DTransformation.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 24 28 85.7 %
Date: 2012-08-25 Functions: 4 6 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 13 22 59.1 %

           Branch data     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                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #include "Linear3DTransformation.hxx"
      21                 :            : #include <algorithm>
      22                 :            : 
      23                 :            : using namespace ::com::sun::star;
      24                 :            : 
      25                 :            : using ::com::sun::star::uno::Sequence;
      26                 :            : using ::com::sun::star::uno::RuntimeException;
      27                 :            : 
      28                 :            : namespace chart
      29                 :            : {
      30                 :            : 
      31                 :      10512 :     Linear3DTransformation::Linear3DTransformation( const drawing::HomogenMatrix& rHomMatrix, bool bSwapXAndY )
      32                 :            :     : m_Matrix(rHomMatrix)
      33                 :      10512 :     , m_bSwapXAndY(bSwapXAndY)
      34                 :      10512 : {}
      35                 :            : 
      36                 :      10512 : Linear3DTransformation::~Linear3DTransformation()
      37         [ -  + ]:      21024 : {}
      38                 :            : 
      39                 :            : // ____ XTransformation ____
      40                 :     116933 : Sequence< double > SAL_CALL Linear3DTransformation::transform(
      41                 :            :                         const Sequence< double >& rSourceValues )
      42                 :            :     throw (RuntimeException,
      43                 :            :            lang::IllegalArgumentException)
      44                 :            : {
      45                 :     116933 :     double fX = rSourceValues[0];
      46                 :     116933 :     double fY = rSourceValues[1];
      47                 :     116933 :     double fZ = rSourceValues[2];
      48         [ +  + ]:     116933 :     if(m_bSwapXAndY)
      49                 :        596 :         std::swap(fX,fY);
      50         [ +  - ]:     116933 :     Sequence< double > aNewVec(3);
      51                 :            :     double fZwi;
      52                 :            : 
      53                 :            :     fZwi = m_Matrix.Line1.Column1 * fX
      54                 :            :          + m_Matrix.Line1.Column2 * fY
      55                 :            :          + m_Matrix.Line1.Column3 * fZ
      56                 :     116933 :          + m_Matrix.Line1.Column4;
      57         [ +  - ]:     116933 :     aNewVec[0] = fZwi;
      58                 :            : 
      59                 :            :     fZwi = m_Matrix.Line2.Column1 * fX
      60                 :            :          + m_Matrix.Line2.Column2 * fY
      61                 :            :          + m_Matrix.Line2.Column3 * fZ
      62                 :     116933 :          + m_Matrix.Line2.Column4;
      63         [ +  - ]:     116933 :     aNewVec[1] = fZwi;
      64                 :            : 
      65                 :            :     fZwi = m_Matrix.Line3.Column1 * fX
      66                 :            :          + m_Matrix.Line3.Column2 * fY
      67                 :            :          + m_Matrix.Line3.Column3 * fZ
      68                 :     116933 :          + m_Matrix.Line3.Column4;
      69         [ +  - ]:     116933 :     aNewVec[2] = fZwi;
      70                 :            : 
      71                 :            :     fZwi = m_Matrix.Line4.Column1 * fX
      72                 :            :          + m_Matrix.Line4.Column2 * fY
      73                 :            :          + m_Matrix.Line4.Column3 * fZ
      74                 :     116933 :          + m_Matrix.Line4.Column4;
      75 [ +  + ][ +  - ]:     116933 :     if(fZwi != 1.0 && fZwi != 0.0)
      76                 :            :     {
      77         [ +  - ]:        156 :         aNewVec[0] /= fZwi;
      78         [ +  - ]:        156 :         aNewVec[1] /= fZwi;
      79         [ +  - ]:     116933 :         aNewVec[2] /= fZwi;
      80                 :            :     }
      81                 :     116933 :     return aNewVec;
      82                 :            : }
      83                 :            : 
      84                 :          0 : sal_Int32 SAL_CALL Linear3DTransformation::getSourceDimension()
      85                 :            :     throw (RuntimeException)
      86                 :            : {
      87                 :          0 :     return 3;
      88                 :            : }
      89                 :            : 
      90                 :          0 : sal_Int32 SAL_CALL Linear3DTransformation::getTargetDimension()
      91                 :            :     throw (RuntimeException)
      92                 :            : {
      93                 :          0 :     return 3;
      94                 :            : }
      95                 :            : 
      96                 :            : 
      97                 :            : }  // namespace chart
      98                 :            : 
      99                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10