bump product version to 4.1.6.2
[LibreOffice.git] / include / basegfx / point / b2dpoint.hxx
blobef73c8ab46c96ca85b91f3cbc715ed7887a6113b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _BGFX_POINT_B2DPOINT_HXX
21 #define _BGFX_POINT_B2DPOINT_HXX
23 #include <basegfx/tuple/b2dtuple.hxx>
24 #include <basegfx/point/b2ipoint.hxx>
25 #include <basegfx/basegfxdllapi.h>
27 //////////////////////////////////////////////////////////////////////////////
29 namespace basegfx
31 // predeclaration
32 class B2DHomMatrix;
34 /** Base Point class with two double values
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.
40 @see B2DTuple
42 class SAL_WARN_UNUSED B2DPoint : public ::basegfx::B2DTuple
44 public:
45 /** Create a 2D Point
47 The point is initialized to (0.0, 0.0)
49 B2DPoint()
50 : B2DTuple()
53 /** Create a 2D Point
55 @param fX
56 This parameter is used to initialize the X-coordinate
57 of the 2D Point.
59 @param fY
60 This parameter is used to initialize the Y-coordinate
61 of the 2D Point.
63 B2DPoint(double fX, double fY)
64 : B2DTuple(fX, fY)
67 /** Create a copy of a 2D Point
69 @param rPoint
70 The 2D Point which will be copied.
72 B2DPoint(const B2DPoint& rPoint)
73 : B2DTuple(rPoint)
76 /** Create a copy of a 2D Point
78 @param rPoint
79 The 2D Point which will be copied.
81 explicit B2DPoint(const ::basegfx::B2IPoint& rPoint)
82 : B2DTuple(rPoint)
85 /** constructor with tuple to allow copy-constructing
86 from B2DTuple-based classes
88 B2DPoint(const ::basegfx::B2DTuple& rTuple)
89 : B2DTuple(rTuple)
92 ~B2DPoint()
95 /** *=operator to allow usage from B2DPoint, too
97 B2DPoint& operator*=( const B2DPoint& rPnt )
99 mfX *= rPnt.mfX;
100 mfY *= rPnt.mfY;
101 return *this;
104 /** *=operator to allow usage from B2DPoint, too
106 B2DPoint& operator*=(double t)
108 mfX *= t;
109 mfY *= t;
110 return *this;
113 /** assignment operator to allow assigning the results
114 of B2DTuple calculations
116 BASEGFX_DLLPUBLIC B2DPoint& operator=( const ::basegfx::B2DTuple& rPoint );
118 /** Transform point by given transformation matrix.
120 The translational components of the matrix are, in
121 contrast to B2DVector, applied.
123 BASEGFX_DLLPUBLIC B2DPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
125 static const B2DPoint& getEmptyPoint()
127 return (const B2DPoint&) ::basegfx::B2DTuple::getEmptyTuple();
131 // external operators
132 //////////////////////////////////////////////////////////////////////////
134 /** Transform B2DPoint by given transformation matrix.
136 Since this is a Point, translational components of the
137 matrix are used.
139 BASEGFX_DLLPUBLIC B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint );
140 } // end of namespace basegfx
142 //////////////////////////////////////////////////////////////////////////////
144 #endif /* _BGFX_POINT_B2DPOINT_HXX */
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */