LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/basegfx/vector - b2ivector.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 15 73.3 %
Date: 2012-08-25 Functions: 4 6 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _BGFX_VECTOR_B2IVECTOR_HXX
      30                 :            : #define _BGFX_VECTOR_B2IVECTOR_HXX
      31                 :            : 
      32                 :            : #include <basegfx/tuple/b2ituple.hxx>
      33                 :            : #include <basegfx/vector/b2enums.hxx>
      34                 :            : #include <basegfx/basegfxdllapi.h>
      35                 :            : 
      36                 :            : namespace basegfx
      37                 :            : {
      38                 :            :     // predeclaration
      39                 :            :     class B2DHomMatrix;
      40                 :            : 
      41                 :            :     /** Base Point class with two sal_Int32 values
      42                 :            : 
      43                 :            :         This class derives all operators and common handling for
      44                 :            :         a 2D data class from B2ITuple. All necessary extensions
      45                 :            :         which are special for 2D Vectors are added here.
      46                 :            : 
      47                 :            :         @see B2ITuple
      48                 :            :     */
      49                 :          0 :     class BASEGFX_DLLPUBLIC B2IVector : public ::basegfx::B2ITuple
      50                 :            :     {
      51                 :            :     public:
      52                 :            :         /** Create a 2D Vector
      53                 :            : 
      54                 :            :             The vector is initialized to (0, 0)
      55                 :            :         */
      56                 :          0 :         B2IVector()
      57                 :          0 :         :   B2ITuple()
      58                 :          0 :         {}
      59                 :            : 
      60                 :            :         /** Create a 2D Vector
      61                 :            : 
      62                 :            :             @param nX
      63                 :            :             This parameter is used to initialize the X-coordinate
      64                 :            :             of the 2D Vector.
      65                 :            : 
      66                 :            :             @param nY
      67                 :            :             This parameter is used to initialize the Y-coordinate
      68                 :            :             of the 2D Vector.
      69                 :            :         */
      70                 :   12770131 :         B2IVector(sal_Int32 nX, sal_Int32 nY)
      71                 :   12770131 :         :   B2ITuple(nX, nY)
      72                 :   12770131 :         {}
      73                 :            : 
      74                 :            :         /** Create a copy of a 2D Vector
      75                 :            : 
      76                 :            :             @param rVec
      77                 :            :             The 2D Vector which will be copied.
      78                 :            :         */
      79                 :          5 :         B2IVector(const B2IVector& rVec)
      80                 :          5 :         :   B2ITuple(rVec)
      81                 :          5 :         {}
      82                 :            : 
      83                 :            :         /** constructor with tuple to allow copy-constructing
      84                 :            :             from B2ITuple-based classes
      85                 :            :         */
      86                 :    9359006 :         B2IVector(const ::basegfx::B2ITuple& rTuple)
      87                 :    9359006 :         :   B2ITuple(rTuple)
      88                 :    9359006 :         {}
      89                 :            : 
      90                 :   22091469 :         ~B2IVector()
      91                 :   22091469 :         {}
      92                 :            : 
      93                 :            :         /** *=operator to allow usage from B2IVector, too
      94                 :            :         */
      95                 :            :         B2IVector& operator*=( const B2IVector& rPnt )
      96                 :            :         {
      97                 :            :             mnX *= rPnt.mnX;
      98                 :            :             mnY *= rPnt.mnY;
      99                 :            :             return *this;
     100                 :            :         }
     101                 :            : 
     102                 :            :         /** *=operator to allow usage from B2IVector, too
     103                 :            :         */
     104                 :            :         B2IVector& operator*=(sal_Int32 t)
     105                 :            :         {
     106                 :            :             mnX *= t;
     107                 :            :             mnY *= t;
     108                 :            :             return *this;
     109                 :            :         }
     110                 :            : 
     111                 :            :         /** assignment operator to allow assigning the results
     112                 :            :             of B2ITuple calculations
     113                 :            :         */
     114                 :            :         B2IVector& operator=( const ::basegfx::B2ITuple& rVec );
     115                 :            : 
     116                 :            :         /** Set the length of this 2D Vector
     117                 :            : 
     118                 :            :             @param fLen
     119                 :            :             The to be achieved length of the 2D Vector
     120                 :            :         */
     121                 :            :         B2IVector& setLength(double fLen);
     122                 :            : 
     123                 :            :         /** Calculate the Scalar with another 2D Vector
     124                 :            : 
     125                 :            :             @param rVec
     126                 :            :             The second 2D Vector
     127                 :            : 
     128                 :            :             @return
     129                 :            :             The Scalar value of the two involved 2D Vectors
     130                 :            :         */
     131                 :            :         double scalar( const B2IVector& rVec ) const;
     132                 :            : 
     133                 :            :         /** Transform vector by given transformation matrix.
     134                 :            : 
     135                 :            :             Since this is a vector, translational components of the
     136                 :            :             matrix are disregarded.
     137                 :            :         */
     138                 :            :         B2IVector& operator*=( const B2DHomMatrix& rMat );
     139                 :            :     };
     140                 :            : 
     141                 :            :     // external operators
     142                 :            :     //////////////////////////////////////////////////////////////////////////
     143                 :            : 
     144                 :            :     /** Transform vector by given transformation matrix.
     145                 :            : 
     146                 :            :         Since this is a vector, translational components of the
     147                 :            :         matrix are disregarded.
     148                 :            :     */
     149                 :            :     BASEGFX_DLLPUBLIC B2IVector operator*( const B2DHomMatrix& rMat, const B2IVector& rVec );
     150                 :            : 
     151                 :            : } // end of namespace basegfx
     152                 :            : 
     153                 :            : #endif /* _BGFX_VECTOR_B2IVECTOR_HXX */
     154                 :            : 
     155                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10