summaryrefslogtreecommitdiff
path: root/basegfx/source/polygon/b3dpolypolygon.cxx
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2003-11-28 10:18:16 +0000
committerArmin Weiss <aw@openoffice.org>2003-11-28 10:18:16 +0000
commitd539c95155ccc7030411f7494704894a3ac610a8 (patch)
treedc3dbd283a5f501f6e48dd585d80bb158db920e3 /basegfx/source/polygon/b3dpolypolygon.cxx
parentce0ce72d1fd37f7b8e7cb4ebc372d8cd6b4ab9c0 (diff)
Removed in-between namespaces (curve, matrix, numeric, point, polygon, range, tuple, vector). Names were too common and e.g. vector leaded to problems with some defines. This is now avoided. Also some bug fixes, addition of 3d polygon tooling etc.
Diffstat (limited to 'basegfx/source/polygon/b3dpolypolygon.cxx')
-rw-r--r--basegfx/source/polygon/b3dpolypolygon.cxx331
1 files changed, 164 insertions, 167 deletions
diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx
index 28e43316f369..bb78552b24e5 100644
--- a/basegfx/source/polygon/b3dpolypolygon.cxx
+++ b/basegfx/source/polygon/b3dpolypolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpolypolygon.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:31:37 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:18:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,7 +77,7 @@
class ImplB3DPolyPolygon
{
- typedef ::std::vector< ::basegfx::polygon::B3DPolygon > PolygonVector;
+ typedef ::std::vector< ::basegfx::B3DPolygon > PolygonVector;
PolygonVector maPolygons;
sal_uInt32 mnRefCount;
@@ -123,17 +123,17 @@ public:
return sal_True;
}
- const ::basegfx::polygon::B3DPolygon& getB3DPolygon(sal_uInt32 nIndex) const
+ const ::basegfx::B3DPolygon& getB3DPolygon(sal_uInt32 nIndex) const
{
return maPolygons[nIndex];
}
- void setB3DPolygon(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rPolygon)
+ void setB3DPolygon(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rPolygon)
{
maPolygons[nIndex] = rPolygon;
}
- void insert(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rPolygon, sal_uInt32 nCount)
+ void insert(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rPolygon, sal_uInt32 nCount)
{
if(nCount)
{
@@ -144,7 +144,7 @@ public:
}
}
- void insert(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolyPolygon& rPolyPolygon)
+ void insert(sal_uInt32 nIndex, const ::basegfx::B3DPolyPolygon& rPolyPolygon)
{
const sal_uInt32 nCount = rPolyPolygon.count();
@@ -205,7 +205,7 @@ public:
}
}
- void transform(const ::basegfx::matrix::B3DHomMatrix& rMatrix)
+ void transform(const ::basegfx::B3DHomMatrix& rMatrix)
{
for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
{
@@ -218,232 +218,229 @@ public:
namespace basegfx
{
- namespace polygon
- {
- // init static default Polygon
- static ImplB3DPolyPolygon maStaticDefaultPolyPolygon;
+ // init static default Polygon
+ static ImplB3DPolyPolygon maStaticDefaultPolyPolygon;
- void B3DPolyPolygon::implForceUniqueCopy()
+ void B3DPolyPolygon::implForceUniqueCopy()
+ {
+ if(mpPolyPolygon->getRefCount())
{
- if(mpPolyPolygon->getRefCount())
- {
- mpPolyPolygon->decRefCount();
- mpPolyPolygon = new ImplB3DPolyPolygon(*mpPolyPolygon);
- }
+ mpPolyPolygon->decRefCount();
+ mpPolyPolygon = new ImplB3DPolyPolygon(*mpPolyPolygon);
}
+ }
+
+ B3DPolyPolygon::B3DPolyPolygon()
+ : mpPolyPolygon(&maStaticDefaultPolyPolygon)
+ {
+ mpPolyPolygon->incRefCount();
+ }
- B3DPolyPolygon::B3DPolyPolygon()
- : mpPolyPolygon(&maStaticDefaultPolyPolygon)
+ B3DPolyPolygon::B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon)
+ : mpPolyPolygon(rPolyPolygon.mpPolyPolygon)
+ {
+ mpPolyPolygon->incRefCount();
+ }
+
+ B3DPolyPolygon::~B3DPolyPolygon()
+ {
+ if(mpPolyPolygon->getRefCount())
{
- mpPolyPolygon->incRefCount();
+ mpPolyPolygon->decRefCount();
}
-
- B3DPolyPolygon::B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon)
- : mpPolyPolygon(rPolyPolygon.mpPolyPolygon)
+ else
{
- mpPolyPolygon->incRefCount();
+ delete mpPolyPolygon;
}
+ }
- B3DPolyPolygon::~B3DPolyPolygon()
+ B3DPolyPolygon& B3DPolyPolygon::operator=(const B3DPolyPolygon& rPolyPolygon)
+ {
+ if(mpPolyPolygon->getRefCount())
{
- if(mpPolyPolygon->getRefCount())
- {
- mpPolyPolygon->decRefCount();
- }
- else
- {
- delete mpPolyPolygon;
- }
+ mpPolyPolygon->decRefCount();
}
-
- B3DPolyPolygon& B3DPolyPolygon::operator=(const B3DPolyPolygon& rPolyPolygon)
+ else
{
- if(mpPolyPolygon->getRefCount())
- {
- mpPolyPolygon->decRefCount();
- }
- else
- {
- delete mpPolyPolygon;
- }
-
- mpPolyPolygon = rPolyPolygon.mpPolyPolygon;
- mpPolyPolygon->incRefCount();
-
- return *this;
+ delete mpPolyPolygon;
}
- sal_Bool B3DPolyPolygon::operator==(const B3DPolyPolygon& rPolyPolygon) const
- {
- if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
- {
- return sal_True;
- }
+ mpPolyPolygon = rPolyPolygon.mpPolyPolygon;
+ mpPolyPolygon->incRefCount();
- return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
- }
+ return *this;
+ }
- sal_Bool B3DPolyPolygon::operator!=(const B3DPolyPolygon& rPolyPolygon) const
+ sal_Bool B3DPolyPolygon::operator==(const B3DPolyPolygon& rPolyPolygon) const
+ {
+ if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
{
- if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
- {
- return sal_False;
- }
-
- return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
+ return sal_True;
}
- sal_uInt32 B3DPolyPolygon::count() const
+ return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
+ }
+
+ sal_Bool B3DPolyPolygon::operator!=(const B3DPolyPolygon& rPolyPolygon) const
+ {
+ if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
{
- return mpPolyPolygon->count();
+ return sal_False;
}
- B3DPolygon B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const
- {
- OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)");
+ return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
+ }
- return mpPolyPolygon->getB3DPolygon(nIndex);
- }
+ sal_uInt32 B3DPolyPolygon::count() const
+ {
+ return mpPolyPolygon->count();
+ }
- void B3DPolyPolygon::setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon)
- {
- OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)");
+ B3DPolygon B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const
+ {
+ OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)");
- if(mpPolyPolygon->getB3DPolygon(nIndex) != rPolygon)
- {
- implForceUniqueCopy();
- mpPolyPolygon->setB3DPolygon(nIndex, rPolygon);
- }
- }
+ return mpPolyPolygon->getB3DPolygon(nIndex);
+ }
- void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount)
- {
- OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)");
+ void B3DPolyPolygon::setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon)
+ {
+ OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)");
- if(nCount)
- {
- implForceUniqueCopy();
- mpPolyPolygon->insert(nIndex, rPolygon, nCount);
- }
+ if(mpPolyPolygon->getB3DPolygon(nIndex) != rPolygon)
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->setB3DPolygon(nIndex, rPolygon);
}
+ }
- void B3DPolyPolygon::append(const B3DPolygon& rPolygon, sal_uInt32 nCount)
+ void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount)
+ {
+ OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)");
+
+ if(nCount)
{
- if(nCount)
- {
- implForceUniqueCopy();
- mpPolyPolygon->insert(mpPolyPolygon->count(), rPolygon, nCount);
- }
+ implForceUniqueCopy();
+ mpPolyPolygon->insert(nIndex, rPolygon, nCount);
}
+ }
- void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon)
+ void B3DPolyPolygon::append(const B3DPolygon& rPolygon, sal_uInt32 nCount)
+ {
+ if(nCount)
{
- OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)");
-
- if(rPolyPolygon.count())
- {
- implForceUniqueCopy();
- mpPolyPolygon->insert(nIndex, rPolyPolygon);
- }
+ implForceUniqueCopy();
+ mpPolyPolygon->insert(mpPolyPolygon->count(), rPolygon, nCount);
}
+ }
+
+ void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon)
+ {
+ OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)");
- void B3DPolyPolygon::append(const B3DPolyPolygon& rPolyPolygon)
+ if(rPolyPolygon.count())
{
- if(rPolyPolygon.count())
- {
- implForceUniqueCopy();
- mpPolyPolygon->insert(mpPolyPolygon->count(), rPolyPolygon);
- }
+ implForceUniqueCopy();
+ mpPolyPolygon->insert(nIndex, rPolyPolygon);
}
+ }
- void B3DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
+ void B3DPolyPolygon::append(const B3DPolyPolygon& rPolyPolygon)
+ {
+ if(rPolyPolygon.count())
{
- OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B3DPolyPolygon Remove outside range (!)");
-
- if(nCount)
- {
- implForceUniqueCopy();
- mpPolyPolygon->remove(nIndex, nCount);
- }
+ implForceUniqueCopy();
+ mpPolyPolygon->insert(mpPolyPolygon->count(), rPolyPolygon);
}
+ }
- void B3DPolyPolygon::clear()
- {
- if(mpPolyPolygon->getRefCount())
- {
- mpPolyPolygon->decRefCount();
- }
- else
- {
- delete mpPolyPolygon;
- }
+ void B3DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
+ {
+ OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B3DPolyPolygon Remove outside range (!)");
- mpPolyPolygon = &maStaticDefaultPolyPolygon;
- mpPolyPolygon->incRefCount();
+ if(nCount)
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->remove(nIndex, nCount);
}
+ }
- sal_Bool B3DPolyPolygon::isClosed() const
+ void B3DPolyPolygon::clear()
+ {
+ if(mpPolyPolygon->getRefCount())
+ {
+ mpPolyPolygon->decRefCount();
+ }
+ else
{
- sal_Bool bRetval(sal_True);
+ delete mpPolyPolygon;
+ }
- // PolyPOlygon is closed when all contained Polygons are closed or
- // no Polygon exists.
- for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++)
- {
- if(!(mpPolyPolygon->getB3DPolygon(a)).isClosed())
- {
- bRetval = sal_False;
- }
- }
+ mpPolyPolygon = &maStaticDefaultPolyPolygon;
+ mpPolyPolygon->incRefCount();
+ }
- return bRetval;
- }
+ sal_Bool B3DPolyPolygon::isClosed() const
+ {
+ sal_Bool bRetval(sal_True);
- void B3DPolyPolygon::setClosed(sal_Bool bNew)
+ // PolyPOlygon is closed when all contained Polygons are closed or
+ // no Polygon exists.
+ for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++)
{
- if(bNew != isClosed())
+ if(!(mpPolyPolygon->getB3DPolygon(a)).isClosed())
{
- implForceUniqueCopy();
- mpPolyPolygon->setClosed(bNew);
+ bRetval = sal_False;
}
}
- void B3DPolyPolygon::flip()
+ return bRetval;
+ }
+
+ void B3DPolyPolygon::setClosed(sal_Bool bNew)
+ {
+ if(bNew != isClosed())
{
implForceUniqueCopy();
- mpPolyPolygon->flip();
+ mpPolyPolygon->setClosed(bNew);
}
+ }
- sal_Bool B3DPolyPolygon::hasDoublePoints() const
- {
- sal_Bool bRetval(sal_False);
-
- for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++)
- {
- if((mpPolyPolygon->getB3DPolygon(a)).hasDoublePoints())
- {
- bRetval = sal_True;
- }
- }
+ void B3DPolyPolygon::flip()
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->flip();
+ }
- return bRetval;
- }
+ sal_Bool B3DPolyPolygon::hasDoublePoints() const
+ {
+ sal_Bool bRetval(sal_False);
- void B3DPolyPolygon::removeDoublePoints()
+ for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++)
{
- if(hasDoublePoints())
+ if((mpPolyPolygon->getB3DPolygon(a)).hasDoublePoints())
{
- implForceUniqueCopy();
- mpPolyPolygon->removeDoublePoints();
+ bRetval = sal_True;
}
}
- void B3DPolyPolygon::transform(const ::basegfx::matrix::B3DHomMatrix& rMatrix)
+ return bRetval;
+ }
+
+ void B3DPolyPolygon::removeDoublePoints()
+ {
+ if(hasDoublePoints())
{
implForceUniqueCopy();
- mpPolyPolygon->transform(rMatrix);
+ mpPolyPolygon->removeDoublePoints();
}
- } // end of namespace polygon
+ }
+
+ void B3DPolyPolygon::transform(const ::basegfx::B3DHomMatrix& rMatrix)
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->transform(rMatrix);
+ }
} // end of namespace basegfx
// eof