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_B3IPOINT_HXX 25 #define _BGFX_POINT_B3IPOINT_HXX 26 27 #include <basegfx/tuple/b3ituple.hxx> 28 29 namespace basegfx 30 { 31 // predeclaration 32 class B3DHomMatrix; 33 34 /** Base Point class with three sal_Int32 values 35 36 This class derives all operators and common handling for 37 a 3D data class from B3ITuple. All necessary extensions 38 which are special for points will be added here. 39 40 @see B3ITuple 41 */ 42 class B3IPoint : public ::basegfx::B3ITuple 43 { 44 public: 45 /** Create a 3D Point 46 47 The point is initialized to (0, 0, 0) 48 */ B3IPoint()49 B3IPoint() 50 : B3ITuple() 51 {} 52 53 /** Create a 3D Point 54 55 @param nX 56 This parameter is used to initialize the X-coordinate 57 of the 3D Point. 58 59 @param nY 60 This parameter is used to initialize the Y-coordinate 61 of the 3D Point. 62 63 @param nZ 64 This parameter is used to initialize the Z-coordinate 65 of the 3D Point. 66 */ B3IPoint(sal_Int32 nX,sal_Int32 nY,sal_Int32 nZ)67 B3IPoint(sal_Int32 nX, sal_Int32 nY, sal_Int32 nZ) 68 : B3ITuple(nX, nY, nZ) 69 {} 70 71 /** Create a copy of a 3D Point 72 73 @param rVec 74 The 3D Point which will be copied. 75 */ B3IPoint(const B3IPoint & rVec)76 B3IPoint(const B3IPoint& rVec) 77 : B3ITuple(rVec) 78 {} 79 80 /** constructor with tuple to allow copy-constructing 81 from B3ITuple-based classes 82 */ B3IPoint(const::basegfx::B3ITuple & rTuple)83 B3IPoint(const ::basegfx::B3ITuple& rTuple) 84 : B3ITuple(rTuple) 85 {} 86 ~B3IPoint()87 ~B3IPoint() 88 {} 89 90 /** *=operator to allow usage from B3IPoint, too 91 */ operator *=(const B3IPoint & rPnt)92 B3IPoint& operator*=( const B3IPoint& rPnt ) 93 { 94 mnX *= rPnt.mnX; 95 mnY *= rPnt.mnY; 96 mnZ *= rPnt.mnZ; 97 return *this; 98 } 99 100 /** *=operator to allow usage from B3IPoint, too 101 */ operator *=(sal_Int32 t)102 B3IPoint& operator*=(sal_Int32 t) 103 { 104 mnX *= t; 105 mnY *= t; 106 mnZ *= t; 107 return *this; 108 } 109 110 /** assignment operator to allow assigning the results 111 of B3ITuple calculations 112 */ operator =(const::basegfx::B3ITuple & rVec)113 B3IPoint& operator=( const ::basegfx::B3ITuple& rVec ) 114 { 115 mnX = rVec.getX(); 116 mnY = rVec.getY(); 117 mnZ = rVec.getZ(); 118 return *this; 119 } 120 121 /** Transform point by given transformation matrix. 122 123 The translational components of the matrix are, in 124 contrast to B3DVector, applied. 125 */ 126 B3IPoint& operator*=( const ::basegfx::B3DHomMatrix& rMat ); 127 getEmptyPoint()128 static const B3IPoint& getEmptyPoint() 129 { 130 return (const B3IPoint&) ::basegfx::B3ITuple::getEmptyTuple(); 131 } 132 }; 133 } // end of namespace basegfx 134 135 #endif /* _BGFX_POINT_B3IPOINT_HXX */ 136