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_B2IPOINT_HXX
21 : #define INCLUDED_BASEGFX_POINT_B2IPOINT_HXX
22 :
23 : #include <basegfx/tuple/b2ituple.hxx>
24 : #include <basegfx/basegfxdllapi.h>
25 :
26 : namespace basegfx
27 : {
28 : // predeclaration
29 : class B2DHomMatrix;
30 :
31 : /** Base Point class with two sal_Int32 values
32 :
33 : This class derives all operators and common handling for
34 : a 2D data class from B2ITuple. All necessary extensions
35 : which are special for points will be added here.
36 :
37 : @see B2ITuple
38 : */
39 2370116 : class BASEGFX_DLLPUBLIC SAL_WARN_UNUSED B2IPoint : public ::basegfx::B2ITuple
40 : {
41 : public:
42 : /** Create a 2D Point
43 :
44 : The point is initialized to (0, 0)
45 : */
46 0 : B2IPoint()
47 0 : : B2ITuple()
48 0 : {}
49 :
50 : /** Create a 2D Point
51 :
52 : @param nX
53 : This parameter is used to initialize the X-coordinate
54 : of the 2D Point.
55 :
56 : @param nY
57 : This parameter is used to initialize the Y-coordinate
58 : of the 2D Point.
59 : */
60 159244750 : B2IPoint(sal_Int32 nX, sal_Int32 nY)
61 159244750 : : B2ITuple(nX, nY)
62 159244750 : {}
63 :
64 : /** Create a copy of a 2D Point
65 :
66 : @param rPoint
67 : The 2D Point which will be copied.
68 : */
69 12505382 : B2IPoint(const B2IPoint& rPoint)
70 12505382 : : B2ITuple(rPoint)
71 12505382 : {}
72 :
73 : /** constructor with tuple to allow copy-constructing
74 : from B2ITuple-based classes
75 : */
76 2532798 : B2IPoint(const ::basegfx::B2ITuple& rTuple)
77 2532798 : : B2ITuple(rTuple)
78 2532798 : {}
79 :
80 174282930 : ~B2IPoint()
81 174282930 : {}
82 :
83 : /** *=operator to allow usage from B2IPoint, too
84 : */
85 : B2IPoint& operator*=( const B2IPoint& rPnt )
86 : {
87 : mnX *= rPnt.mnX;
88 : mnY *= rPnt.mnY;
89 : return *this;
90 : }
91 :
92 : /** *=operator to allow usage from B2IPoint, too
93 : */
94 : B2IPoint& operator*=(sal_Int32 t)
95 : {
96 : mnX *= t;
97 : mnY *= t;
98 : return *this;
99 : }
100 :
101 : /** assignment operator to allow assigning the results
102 : of B2ITuple calculations
103 : */
104 : B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint );
105 :
106 : /** Transform point by given transformation matrix.
107 :
108 : The translational components of the matrix are, in
109 : contrast to B2DVector, applied.
110 : */
111 : B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
112 : };
113 : } // end of namespace basegfx
114 :
115 : #endif // INCLUDED_BASEGFX_POINT_B2IPOINT_HXX
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|