1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _BGFX_POINT_B2IPOINT_HXX 25 #define _BGFX_POINT_B2IPOINT_HXX 26 27 #include <basegfx/tuple/b2ituple.hxx> 28 29 namespace basegfx 30 { 31 // predeclaration 32 class B2DHomMatrix; 33 34 /** Base Point class with two sal_Int32 values 35 36 This class derives all operators and common handling for 37 a 2D data class from B2ITuple. All necessary extensions 38 which are special for points will be added here. 39 40 @see B2ITuple 41 */ 42 class B2IPoint : public ::basegfx::B2ITuple 43 { 44 public: 45 /** Create a 2D Point 46 47 The point is initialized to (0, 0) 48 */ B2IPoint()49 B2IPoint() 50 : B2ITuple() 51 {} 52 53 /** Create a 2D Point 54 55 @param nX 56 This parameter is used to initialize the X-coordinate 57 of the 2D Point. 58 59 @param nY 60 This parameter is used to initialize the Y-coordinate 61 of the 2D Point. 62 */ B2IPoint(sal_Int32 nX,sal_Int32 nY)63 B2IPoint(sal_Int32 nX, sal_Int32 nY) 64 : B2ITuple(nX, nY) 65 {} 66 67 /** Create a copy of a 2D Point 68 69 @param rPoint 70 The 2D Point which will be copied. 71 */ B2IPoint(const B2IPoint & rPoint)72 B2IPoint(const B2IPoint& rPoint) 73 : B2ITuple(rPoint) 74 {} 75 76 /** constructor with tuple to allow copy-constructing 77 from B2ITuple-based classes 78 */ B2IPoint(const::basegfx::B2ITuple & rTuple)79 B2IPoint(const ::basegfx::B2ITuple& rTuple) 80 : B2ITuple(rTuple) 81 {} 82 ~B2IPoint()83 ~B2IPoint() 84 {} 85 86 /** *=operator to allow usage from B2IPoint, too 87 */ operator *=(const B2IPoint & rPnt)88 B2IPoint& operator*=( const B2IPoint& rPnt ) 89 { 90 mnX *= rPnt.mnX; 91 mnY *= rPnt.mnY; 92 return *this; 93 } 94 95 /** *=operator to allow usage from B2IPoint, too 96 */ operator *=(sal_Int32 t)97 B2IPoint& operator*=(sal_Int32 t) 98 { 99 mnX *= t; 100 mnY *= t; 101 return *this; 102 } 103 104 /** assignment operator to allow assigning the results 105 of B2ITuple calculations 106 */ 107 B2IPoint& operator=( const ::basegfx::B2ITuple& rPoint ); 108 109 /** Transform point by given transformation matrix. 110 111 The translational components of the matrix are, in 112 contrast to B2DVector, applied. 113 */ 114 B2IPoint& operator*=( const ::basegfx::B2DHomMatrix& rMat ); 115 getEmptyPoint()116 static const B2IPoint& getEmptyPoint() 117 { 118 return (const B2IPoint&) ::basegfx::B2ITuple::getEmptyTuple(); 119 } 120 }; 121 } // end of namespace basegfx 122 123 #endif /* _BGFX_POINT_B2IPOINT_HXX */ 124