LCOV - code coverage report
Current view: top level - basegfx/inc/basegfx/point - b3dpoint.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 15 60.0 %
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_POINT_B3DPOINT_HXX
      30                 :            : #define _BGFX_POINT_B3DPOINT_HXX
      31                 :            : 
      32                 :            : #include <basegfx/tuple/b3dtuple.hxx>
      33                 :            : #include <basegfx/basegfxdllapi.h>
      34                 :            : 
      35                 :            : namespace basegfx
      36                 :            : {
      37                 :            :     // predeclaration
      38                 :            :     class B3DHomMatrix;
      39                 :            : 
      40                 :            :     /** Base Point class with three double values
      41                 :            : 
      42                 :            :         This class derives all operators and common handling for
      43                 :            :         a 3D data class from B3DTuple. All necessary extensions
      44                 :            :         which are special for points will be added here.
      45                 :            : 
      46                 :            :         @see B3DTuple
      47                 :            :     */
      48                 :      39416 :     class BASEGFX_DLLPUBLIC B3DPoint : public ::basegfx::B3DTuple
      49                 :            :     {
      50                 :            :     public:
      51                 :            :         /** Create a 3D Point
      52                 :            : 
      53                 :            :             The point is initialized to (0.0, 0.0, 0.0)
      54                 :            :         */
      55                 :          0 :         B3DPoint()
      56                 :          0 :         :   B3DTuple()
      57                 :          0 :         {}
      58                 :            : 
      59                 :            :         /** Create a 3D Point
      60                 :            : 
      61                 :            :             @param fX
      62                 :            :             This parameter is used to initialize the X-coordinate
      63                 :            :             of the 3D Point.
      64                 :            : 
      65                 :            :             @param fY
      66                 :            :             This parameter is used to initialize the Y-coordinate
      67                 :            :             of the 3D Point.
      68                 :            : 
      69                 :            :             @param fZ
      70                 :            :             This parameter is used to initialize the Z-coordinate
      71                 :            :             of the 3D Point.
      72                 :            :         */
      73                 :      98884 :         B3DPoint(double fX, double fY, double fZ)
      74                 :      98884 :         :   B3DTuple(fX, fY, fZ)
      75                 :      98884 :         {}
      76                 :            : 
      77                 :            :         /** Create a copy of a 3D Point
      78                 :            : 
      79                 :            :             @param rVec
      80                 :            :             The 3D Point which will be copied.
      81                 :            :         */
      82                 :     537042 :         B3DPoint(const B3DPoint& rVec)
      83                 :     537042 :         :   B3DTuple(rVec)
      84                 :     537042 :         {}
      85                 :            : 
      86                 :            :         /** constructor with tuple to allow copy-constructing
      87                 :            :             from B3DTuple-based classes
      88                 :            :         */
      89                 :          0 :         B3DPoint(const ::basegfx::B3DTuple& rTuple)
      90                 :          0 :         :   B3DTuple(rTuple)
      91                 :          0 :         {}
      92                 :            : 
      93                 :     597794 :         ~B3DPoint()
      94                 :     597794 :         {}
      95                 :            : 
      96                 :            :         /** *=operator to allow usage from B3DPoint, too
      97                 :            :         */
      98                 :            :         B3DPoint& operator*=( const B3DPoint& rPnt )
      99                 :            :         {
     100                 :            :             mfX *= rPnt.mfX;
     101                 :            :             mfY *= rPnt.mfY;
     102                 :            :             mfZ *= rPnt.mfZ;
     103                 :            :             return *this;
     104                 :            :         }
     105                 :            : 
     106                 :            :         /** *=operator to allow usage from B3DPoint, too
     107                 :            :         */
     108                 :            :         B3DPoint& operator*=(double t)
     109                 :            :         {
     110                 :            :             mfX *= t;
     111                 :            :             mfY *= t;
     112                 :            :             mfZ *= t;
     113                 :            :             return *this;
     114                 :            :         }
     115                 :            : 
     116                 :            :         /** assignment operator to allow assigning the results
     117                 :            :             of B3DTuple calculations
     118                 :            :         */
     119                 :            :         B3DPoint& operator=( const ::basegfx::B3DTuple& rVec )
     120                 :            :         {
     121                 :            :             mfX = rVec.getX();
     122                 :            :             mfY = rVec.getY();
     123                 :            :             mfZ = rVec.getZ();
     124                 :            :             return *this;
     125                 :            :         }
     126                 :            : 
     127                 :            :         /** Transform point by given transformation matrix.
     128                 :            : 
     129                 :            :             The translational components of the matrix are, in
     130                 :            :             contrast to B3DVector, applied.
     131                 :            :         */
     132                 :            :         B3DPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat );
     133                 :            : 
     134                 :            :         static const B3DPoint& getEmptyPoint()
     135                 :            :         {
     136                 :            :             return (const B3DPoint&) ::basegfx::B3DTuple::getEmptyTuple();
     137                 :            :         }
     138                 :            :     };
     139                 :            : 
     140                 :            :     // external operators
     141                 :            :     //////////////////////////////////////////////////////////////////////////
     142                 :            : 
     143                 :            :     /** Transform B3DPoint by given transformation matrix.
     144                 :            : 
     145                 :            :         Since this is a Point, translational components of the
     146                 :            :         matrix are used.
     147                 :            :     */
     148                 :            :     BASEGFX_DLLPUBLIC B3DPoint operator*( const B3DHomMatrix& rMat, const B3DPoint& rPoint );
     149                 :            : 
     150                 :            : } // end of namespace basegfx
     151                 :            : 
     152                 :            : #endif /* _BGFX_POINT_B3DPOINT_HXX */
     153                 :            : 
     154                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10