diff options
author | Armin Weiss <aw@openoffice.org> | 2004-01-16 13:30:10 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2004-01-16 13:30:10 +0000 |
commit | 99a300e39ace4f9bd1af8ad85ef49f35f7117fc7 (patch) | |
tree | 9ef5e2b8c9359e42cd27ca82d6614249a9474314 /basegfx | |
parent | c794c5ce7ea7b11f7275a471821310dcd3dd552e (diff) |
Added == and != operators to ranges, some other goodies, too. Also changed remaining sal_Bool to bool. Renamed B(2|3)(d|i)box to ...volume.
Diffstat (limited to 'basegfx')
-rw-r--r-- | basegfx/inc/basegfx/point/b2dpoint.hxx | 15 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b1drange.hxx | 19 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b1irange.hxx | 14 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b2drange.hxx | 22 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b2irange.hxx | 16 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b3drange.hxx | 25 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b3dvolume.hxx | 78 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b3irange.hxx | 18 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/b3ivolume.hxx (renamed from basegfx/inc/basegfx/range/b3ibox.hxx) | 4 | ||||
-rw-r--r-- | basegfx/inc/basegfx/range/basicrange.hxx | 36 | ||||
-rw-r--r-- | basegfx/source/point/b2dpoint.cxx | 10 | ||||
-rw-r--r-- | basegfx/source/point/b3dpoint.cxx | 10 | ||||
-rw-r--r-- | basegfx/source/vector/b2dvector.cxx | 6 | ||||
-rw-r--r-- | basegfx/source/vector/b3dvector.cxx | 8 |
14 files changed, 251 insertions, 30 deletions
diff --git a/basegfx/inc/basegfx/point/b2dpoint.hxx b/basegfx/inc/basegfx/point/b2dpoint.hxx index b9c29ee312f9..a6828b3416fd 100644 --- a/basegfx/inc/basegfx/point/b2dpoint.hxx +++ b/basegfx/inc/basegfx/point/b2dpoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpoint.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: thb $ $Date: 2004-01-16 10:33:55 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:29:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,6 +158,17 @@ namespace basegfx return (const B2DPoint&) ::basegfx::B2DTuple::getEmptyTuple(); } }; + + // external operators + ////////////////////////////////////////////////////////////////////////// + + /** Transform B2DPoint by given transformation matrix. + + Since this is a Point, translational components of the + matrix are used. + */ + B2DPoint operator*( const B2DHomMatrix& rMat, const B2DPoint& rPoint ); + } // end of namespace basegfx #endif // _BGFX_POINT_B2DPOINT_HXX diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx index 202c8aa45115..538938cb1741 100644 --- a/basegfx/inc/basegfx/range/b1drange.hxx +++ b/basegfx/inc/basegfx/range/b1drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b1drange.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2004-01-16 13:40:16 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,16 @@ namespace basegfx maRange.reset(); } + bool operator==( const B1DRange& rRange ) const + { + return (maRange == rRange.maRange); + } + + bool operator!=( const B1DRange& rRange ) const + { + return (maRange != rRange.maRange); + } + void operator=(const B1DRange& rRange) { maRange = rRange.maRange; @@ -153,6 +163,11 @@ namespace basegfx { maRange.expand(rRange.maRange); } + + void grow(double fValue) + { + maRange.grow(fValue); + } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b1irange.hxx b/basegfx/inc/basegfx/range/b1irange.hxx index e5b2c4efbd9f..b22453e80290 100644 --- a/basegfx/inc/basegfx/range/b1irange.hxx +++ b/basegfx/inc/basegfx/range/b1irange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b1irange.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2004-01-15 19:57:00 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,6 +98,16 @@ namespace basegfx maRange.reset(); } + bool operator==( const B1IRange& rRange ) const + { + return (maRange == rRange.maRange); + } + + bool operator!=( const B1IRange& rRange ) const + { + return (maRange != rRange.maRange); + } + void operator=(const B1IRange& rRange) { maRange = rRange.maRange; diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx index b2c9454b9974..419e2ffe69fb 100644 --- a/basegfx/inc/basegfx/range/b2drange.hxx +++ b/basegfx/inc/basegfx/range/b2drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2drange.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2004-01-16 13:40:18 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,6 +129,18 @@ namespace basegfx maRangeY.reset(); } + bool operator==( const B2DRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY); + } + + bool operator!=( const B2DRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY); + } + void operator=(const B2DRange& rRange) { maRangeX = rRange.maRangeX; @@ -232,6 +244,12 @@ namespace basegfx maRangeX.expand(rRange.maRangeX); maRangeY.expand(rRange.maRangeY); } + + void grow(double fValue) + { + maRangeX.grow(fValue); + maRangeY.grow(fValue); + } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b2irange.hxx b/basegfx/inc/basegfx/range/b2irange.hxx index 50227a215831..e4e2060d03df 100644 --- a/basegfx/inc/basegfx/range/b2irange.hxx +++ b/basegfx/inc/basegfx/range/b2irange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2irange.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2004-01-16 13:40:21 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,6 +129,18 @@ namespace basegfx maRangeY.reset(); } + bool operator==( const B2IRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY); + } + + bool operator!=( const B2IRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY); + } + void operator=(const B2IRange& rRange) { maRangeX = rRange.maRangeX; diff --git a/basegfx/inc/basegfx/range/b3drange.hxx b/basegfx/inc/basegfx/range/b3drange.hxx index a778fdd87f32..d1dc82453576 100644 --- a/basegfx/inc/basegfx/range/b3drange.hxx +++ b/basegfx/inc/basegfx/range/b3drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3drange.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2004-01-16 13:40:23 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -147,6 +147,20 @@ namespace basegfx maRangeZ.reset(); } + bool operator==( const B3DRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY + && maRangeZ == rRange.maRangeZ); + } + + bool operator!=( const B3DRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY + || maRangeZ != rRange.maRangeZ); + } + void operator=(const B3DRange& rRange) { maRangeX = rRange.maRangeX; @@ -275,6 +289,13 @@ namespace basegfx maRangeY.expand(rRange.maRangeY); maRangeZ.expand(rRange.maRangeZ); } + + void grow(double fValue) + { + maRangeX.grow(fValue); + maRangeY.grow(fValue); + maRangeZ.grow(fValue); + } }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/range/b3dvolume.hxx b/basegfx/inc/basegfx/range/b3dvolume.hxx new file mode 100644 index 000000000000..80b488625e47 --- /dev/null +++ b/basegfx/inc/basegfx/range/b3dvolume.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * $RCSfile: b3dvolume.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2004-01-16 14:30:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _BGFX_RANGE_B3DBOX_HXX +#define _BGFX_RANGE_B3DBOX_HXX + +#ifndef _BGFX_RANGE_B3DRANGE_HXX +#include <basegfx/range/b3drange.hxx> +#endif + +namespace basegfx +{ + // syntactic sugar: a B3DRange exactly models a Volume in 3D, thus, + // for interface clarity, we provide an alias name + + /// Alias name for interface clarity (not everybody is aware of the identity) + typedef B3DRange B3DVolume; +} + +#endif // _BGFX_RANGE_B3DBOX_HXX diff --git a/basegfx/inc/basegfx/range/b3irange.hxx b/basegfx/inc/basegfx/range/b3irange.hxx index 5165e9f4903b..5e72987283a1 100644 --- a/basegfx/inc/basegfx/range/b3irange.hxx +++ b/basegfx/inc/basegfx/range/b3irange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3irange.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: thb $ $Date: 2004-01-16 13:40:26 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -146,6 +146,20 @@ namespace basegfx maRangeZ.reset(); } + bool operator==( const B3IRange& rRange ) const + { + return (maRangeX == rRange.maRangeX + && maRangeY == rRange.maRangeY + && maRangeZ == rRange.maRangeZ); + } + + bool operator!=( const B3IRange& rRange ) const + { + return (maRangeX != rRange.maRangeX + || maRangeY != rRange.maRangeY + || maRangeZ != rRange.maRangeZ); + } + void operator=(const B3IRange& rRange) { maRangeX = rRange.maRangeX; diff --git a/basegfx/inc/basegfx/range/b3ibox.hxx b/basegfx/inc/basegfx/range/b3ivolume.hxx index 8f99dcc85ff6..9db3c57fba7a 100644 --- a/basegfx/inc/basegfx/range/b3ibox.hxx +++ b/basegfx/inc/basegfx/range/b3ivolume.hxx @@ -1,10 +1,10 @@ /************************************************************************* * - * $RCSfile: b3ibox.hxx,v $ + * $RCSfile: b3ivolume.hxx,v $ * * $Revision: 1.1 $ * - * last change: $Author: thb $ $Date: 2004-01-15 19:58:01 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index 120e930c4523..3a8aab0ab51c 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: basicrange.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: thb $ $Date: 2004-01-16 10:34:10 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:06 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,6 +132,16 @@ namespace basegfx return !((rRange.mnMinimum < mnMinimum) || (rRange.mnMaximum > mnMaximum)); } + bool operator==( const BasicRange& rRange ) const + { + return (mnMinimum == rRange.mnMinimum && mnMaximum == rRange.mnMaximum); + } + + bool operator!=( const BasicRange& rRange ) const + { + return (mnMinimum != rRange.mnMinimum || mnMaximum != rRange.mnMaximum); + } + void operator=(const BasicRange& rRange) { mnMinimum = rRange.mnMinimum; @@ -164,11 +174,31 @@ namespace basegfx } } + void grow(T nValue) + { + bool bLessThanZero(nValue < 0); + + if(nValue > 0 || bLessThanZero) + { + mnMinimum -= nValue; + mnMaximum += nValue; + + if(bLessThanZero) + { + // test if range did collapse + if(mnMinimum > mnMaximum) + { + // if yes, collapse to center + mnMinimum = mnMaximum = (mnMinimum + mnMaximum) / 2.0; + } + } + } + } + typename Traits::DifferenceType getRange() const { return (mnMaximum - mnMinimum); } - }; // some pre-fabricated traits diff --git a/basegfx/source/point/b2dpoint.cxx b/basegfx/source/point/b2dpoint.cxx index dab49a9fe392..a2c1a2716597 100644 --- a/basegfx/source/point/b2dpoint.cxx +++ b/basegfx/source/point/b2dpoint.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpoint.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:04 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,12 @@ namespace basegfx return *this; } + + B2DPoint operator*( const ::basegfx::B2DHomMatrix& rMat, const B2DPoint& rPoint ) + { + B2DPoint aRes( rPoint ); + return aRes *= rMat; + } } // end of namespace basegfx // eof diff --git a/basegfx/source/point/b3dpoint.cxx b/basegfx/source/point/b3dpoint.cxx index 9ece7171af62..a0d9435b94e8 100644 --- a/basegfx/source/point/b3dpoint.cxx +++ b/basegfx/source/point/b3dpoint.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpoint.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:04 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,12 @@ namespace basegfx return *this; } + + B3DPoint operator*( const ::basegfx::B3DHomMatrix& rMat, const B3DPoint& rPoint ) + { + B3DPoint aRes( rPoint ); + return aRes *= rMat; + } } // end of namespace basegfx // eof diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index ea131f8a4a60..7614de743334 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dvector.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: thb $ $Date: 2004-01-16 10:34:37 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -199,7 +199,7 @@ namespace basegfx return aPerpendicular; } - B2DVector operator*( const B2DHomMatrix& rMat, const B2DVector& rVec ) + B2DVector operator*( const ::basegfx::B2DHomMatrix& rMat, const B2DVector& rVec ) { B2DVector aRes( rVec ); return aRes*=rMat; diff --git a/basegfx/source/vector/b3dvector.cxx b/basegfx/source/vector/b3dvector.cxx index 6e08ea0fffa7..67e960eef676 100644 --- a/basegfx/source/vector/b3dvector.cxx +++ b/basegfx/source/vector/b3dvector.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dvector.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:16 $ + * last change: $Author: aw $ $Date: 2004-01-16 14:30:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -114,7 +114,7 @@ namespace basegfx return aNew; } - B3DVector& B3DVector::operator*=( const B3DHomMatrix& rMat ) + B3DVector& B3DVector::operator*=( const ::basegfx::B3DHomMatrix& rMat ) { const double fTempX( rMat.get(0,0)*mfX + rMat.get(0,1)*mfY + rMat.get(0,2)*mfZ ); const double fTempY( rMat.get(1,0)*mfX + rMat.get(1,1)*mfY + rMat.get(1,2)*mfZ ); @@ -126,7 +126,7 @@ namespace basegfx return *this; } - B3DVector operator*( const B3DHomMatrix& rMat, const B3DVector& rVec ) + B3DVector operator*( const ::basegfx::B3DHomMatrix& rMat, const B3DVector& rVec ) { B3DVector aRes( rVec ); return aRes*=rMat; |