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