Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _BGFX_POINT_B2IPOINT_HXX
30 : : #define _BGFX_POINT_B2IPOINT_HXX
31 : :
32 : : #include <basegfx/tuple/b2ituple.hxx>
33 : : #include <basegfx/basegfxdllapi.h>
34 : :
35 : : namespace basegfx
36 : : {
37 : : // predeclaration
38 : : class B2DHomMatrix;
39 : :
40 : : /** Base Point class with two sal_Int32 values
41 : :
42 : : This class derives all operators and common handling for
43 : : a 2D data class from B2ITuple. All necessary extensions
44 : : which are special for points will be added here.
45 : :
46 : : @see B2ITuple
47 : : */
48 : 1625938 : class BASEGFX_DLLPUBLIC B2IPoint : public ::basegfx::B2ITuple
49 : : {
50 : : public:
51 : : /** Create a 2D Point
52 : :
53 : : The point is initialized to (0, 0)
54 : : */
55 : 0 : B2IPoint()
56 : 0 : : B2ITuple()
57 : 0 : {}
58 : :
59 : : /** Create a 2D Point
60 : :
61 : : @param nX
62 : : This parameter is used to initialize the X-coordinate
63 : : of the 2D Point.
64 : :
65 : : @param nY
66 : : This parameter is used to initialize the Y-coordinate
67 : : of the 2D Point.
68 : : */
69 : 71489093 : B2IPoint(sal_Int32 nX, sal_Int32 nY)
70 : 71489093 : : B2ITuple(nX, nY)
71 : 71489093 : {}
72 : :
73 : : /** Create a copy of a 2D Point
74 : :
75 : : @param rPoint
76 : : The 2D Point which will be copied.
77 : : */
78 : 6910392 : B2IPoint(const B2IPoint& rPoint)
79 : 6910392 : : B2ITuple(rPoint)
80 : 6910392 : {}
81 : :
82 : : /** constructor with tuple to allow copy-constructing
83 : : from B2ITuple-based classes
84 : : */
85 : 2942818 : B2IPoint(const ::basegfx::B2ITuple& rTuple)
86 : 2942818 : : B2ITuple(rTuple)
87 : 2942818 : {}
88 : :
89 : 81342303 : ~B2IPoint()
90 : 81342303 : {}
91 : :
92 : : /** *=operator to allow usage from B2IPoint, too
93 : : */
94 : : B2IPoint& operator*=( const B2IPoint& rPnt )
95 : : {
96 : : mnX *= rPnt.mnX;
97 : : mnY *= rPnt.mnY;
98 : : return *this;
99 : : }
100 : :
101 : : /** *=operator to allow usage from B2IPoint, too
102 : : */
103 : : B2IPoint& operator*=(sal_Int32 t)
104 : : {
105 : : mnX *= t;
106 : : mnY *= t;
107 : : return *this;
108 : : }
109 : :
110 : : /** assignment operator to allow assigning the results
111 : : of B2ITuple calculations
112 : : */
113 : : B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint );
114 : :
115 : : /** Transform point by given transformation matrix.
116 : :
117 : : The translational components of the matrix are, in
118 : : contrast to B2DVector, applied.
119 : : */
120 : : B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat );
121 : : };
122 : : } // end of namespace basegfx
123 : :
124 : : #endif /* _BGFX_POINT_B2IPOINT_HXX */
125 : :
126 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|