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