LCOV - code coverage report
Current view: top level - include/basegfx/point - b2dpoint.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 24 0.0 %
Date: 2014-04-14 Functions: 0 9 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             :  * 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             : #ifndef INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
      21             : #define INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
      22             : 
      23             : #include <ostream>
      24             : 
      25             : #include <basegfx/tuple/b2dtuple.hxx>
      26             : #include <basegfx/point/b2ipoint.hxx>
      27             : #include <basegfx/basegfxdllapi.h>
      28             : 
      29             : namespace basegfx
      30             : {
      31             :     // predeclaration
      32             :     class B2DHomMatrix;
      33             : 
      34             :     /** Base Point class with two double values
      35             : 
      36             :         This class derives all operators and common handling for
      37             :         a 2D data class from B2DTuple. All necessary extensions
      38             :         which are special for points will be added here.
      39             : 
      40             :         @see B2DTuple
      41             :     */
      42           0 :     class SAL_WARN_UNUSED B2DPoint : public ::basegfx::B2DTuple
      43             :     {
      44             :     public:
      45             :         /** Create a 2D Point
      46             : 
      47             :             The point is initialized to (0.0, 0.0)
      48             :         */
      49           0 :         B2DPoint()
      50           0 :         :   B2DTuple()
      51           0 :         {}
      52             : 
      53             :         /** Create a 2D Point
      54             : 
      55             :             @param fX
      56             :             This parameter is used to initialize the X-coordinate
      57             :             of the 2D Point.
      58             : 
      59             :             @param fY
      60             :             This parameter is used to initialize the Y-coordinate
      61             :             of the 2D Point.
      62             :         */
      63           0 :         B2DPoint(double fX, double fY)
      64           0 :         :   B2DTuple(fX, fY)
      65           0 :         {}
      66             : 
      67             :         /** Create a copy of a 2D Point
      68             : 
      69             :             @param rPoint
      70             :             The 2D Point which will be copied.
      71             :         */
      72           0 :         B2DPoint(const B2DPoint& rPoint)
      73           0 :         :   B2DTuple(rPoint)
      74           0 :         {}
      75             : 
      76             :         /** Create a copy of a 2D Point
      77             : 
      78             :             @param rPoint
      79             :             The 2D Point which will be copied.
      80             :         */
      81           0 :         explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
      82           0 :         :   B2DTuple(rPoint)
      83           0 :         {}
      84             : 
      85             :         /** constructor with tuple to allow copy-constructing
      86             :             from B2DTuple-based classes
      87             :         */
      88           0 :         B2DPoint(const ::basegfx::B2DTuple& rTuple)
      89           0 :         :   B2DTuple(rTuple)
      90           0 :         {}
      91             : 
      92           0 :         ~B2DPoint()
      93           0 :         {}
      94             : 
      95             :         /** *=operator to allow usage from B2DPoint, too
      96             :         */
      97           0 :         B2DPoint& operator*=( const B2DPoint& rPnt )
      98             :         {
      99           0 :             mfX *= rPnt.mfX;
     100           0 :             mfY *= rPnt.mfY;
     101           0 :             return *this;
     102             :         }
     103             : 
     104             :         /** *=operator to allow usage from B2DPoint, too
     105             :         */
     106             :         B2DPoint& operator*=(double t)
     107             :         {
     108             :             mfX *= t;
     109             :             mfY *= t;
     110             :             return *this;
     111             :         }
     112             : 
     113             :         /** assignment operator to allow assigning the results
     114             :             of B2DTuple calculations
     115             :         */
     116             :         BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& rPoint );
     117             : 
     118             :         /** Transform point by given transformation matrix.
     119             : 
     120             :             The translational components of the matrix are, in
     121             :             contrast to B2DVector, applied.
     122             :         */
     123             :         BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
     124             : 
     125           0 :         static const B2DPoint& getEmptyPoint()
     126             :         {
     127           0 :             return (const B2DPoint&) ::basegfx::B2DTuple::getEmptyTuple();
     128             :         }
     129             :     };
     130             : 
     131             :     // external operators
     132             : 
     133             :     /** Transform B2DPoint by given transformation matrix.
     134             : 
     135             :         Since this is a Point, translational components of the
     136             :         matrix are used.
     137             :     */
     138             :     BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
     139             : } // end of namespace basegfx
     140             : 
     141             : template< typename charT, typename traits >
     142             : inline std::basic_ostream<charT, traits> & operator <<(
     143             :     std::basic_ostream<charT, traits> & stream, const basegfx::B2DPoint& point )
     144             : {
     145             :     return stream << "(" << point.getX() << "," << point.getY() << ")";
     146             : }
     147             : 
     148             : #endif // INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10