1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
21 #define INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
25 #include <basegfx/tuple/b2dtuple.hxx>
26 #include <basegfx/point/b2ipoint.hxx>
27 #include <basegfx/basegfxdllapi.h>
33 /** Base Point class with two double values
35 This class derives all operators and common handling for
36 a 2D data class from B2DTuple. All necessary extensions
37 which are special for points will be added here.
41 class SAL_WARN_UNUSED B2DPoint
: public ::basegfx::B2DTuple
46 The point is initialized to (0.0, 0.0)
55 This parameter is used to initialize the X-coordinate
59 This parameter is used to initialize the Y-coordinate
62 B2DPoint(double fX
, double fY
)
66 /** Create a copy of a 2D Point
69 The 2D Point which will be copied.
71 explicit B2DPoint(const ::basegfx::B2IPoint
& rPoint
)
75 /** constructor with tuple to allow copy-constructing
76 from B2DTuple-based classes
78 B2DPoint(const ::basegfx::B2DTuple
& rTuple
)
82 /** *=operator to allow usage from B2DPoint, too
84 B2DPoint
& operator*=( const B2DPoint
& rPnt
)
91 /** *=operator to allow usage from B2DPoint, too
93 B2DPoint
& operator*=(double t
)
100 /** assignment operator to allow assigning the results
101 of B2DTuple calculations
103 BASEGFX_DLLPUBLIC B2DPoint
& operator=( const ::basegfx::B2DTuple
& rPoint
);
105 /** Transform point by given transformation matrix.
107 The translational components of the matrix are, in
108 contrast to B2DVector, applied.
110 BASEGFX_DLLPUBLIC B2DPoint
& operator*=( const ::basegfx::B2DHomMatrix
& rMat
);
112 static const B2DPoint
& getEmptyPoint()
114 return static_cast<const B2DPoint
&>( ::basegfx::B2DTuple::getEmptyTuple() );
118 // external operators
120 /** Transform B2DPoint by given transformation matrix.
122 Since this is a Point, translational components of the
125 BASEGFX_DLLPUBLIC B2DPoint
operator*( const B2DHomMatrix
& rMat
, const B2DPoint
& rPoint
);
127 template< typename charT
, typename traits
>
128 inline std::basic_ostream
<charT
, traits
> & operator <<(
129 std::basic_ostream
<charT
, traits
> & stream
, const B2DPoint
& point
)
131 return stream
<< "(" << point
.getX() << "," << point
.getY() << ")";
134 } // end of namespace basegfx
136 #endif // INCLUDED_BASEGFX_POINT_B2DPOINT_HXX
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */