summaryrefslogtreecommitdiff
path: root/basegfx/inc
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2004-01-16 13:30:10 +0000
committerArmin Weiss <aw@openoffice.org>2004-01-16 13:30:10 +0000
commit99a300e39ace4f9bd1af8ad85ef49f35f7117fc7 (patch)
tree9ef5e2b8c9359e42cd27ca82d6614249a9474314 /basegfx/inc
parentc794c5ce7ea7b11f7275a471821310dcd3dd552e (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/inc')
-rw-r--r--basegfx/inc/basegfx/point/b2dpoint.hxx15
-rw-r--r--basegfx/inc/basegfx/range/b1drange.hxx19
-rw-r--r--basegfx/inc/basegfx/range/b1irange.hxx14
-rw-r--r--basegfx/inc/basegfx/range/b2drange.hxx22
-rw-r--r--basegfx/inc/basegfx/range/b2irange.hxx16
-rw-r--r--basegfx/inc/basegfx/range/b3drange.hxx25
-rw-r--r--basegfx/inc/basegfx/range/b3dvolume.hxx78
-rw-r--r--basegfx/inc/basegfx/range/b3irange.hxx18
-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.hxx36
10 files changed, 228 insertions, 19 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