[Libreoffice-commits] .: binfilter/bf_svx
Joseph Powers
jpowers at kemper.freedesktop.org
Tue Jan 11 06:19:03 PST 2011
binfilter/bf_svx/source/engine3d/svx_poly3d.cxx | 482 +++++++++++-------------
1 file changed, 240 insertions(+), 242 deletions(-)
New commits:
commit a34d08320836cb5c1abb3c67065103c276c3b744
Author: Joseph Powers <jpowers27 at cox.net>
Date: Tue Jan 11 05:30:17 2011 -0800
Remove DECLARE_LIST(Polygon3DList, Polygon3D*)
diff --git a/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx b/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx
index 8bf00f1..0858f1b 100644
--- a/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx
+++ b/binfilter/bf_svx/source/engine3d/svx_poly3d.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,12 +36,10 @@
#endif
#include "xpoly.hxx"
-
#include "poly3d.hxx"
-
#include <tools/poly.hxx>
-
+#include <vector>
namespace binfilter {
@@ -54,19 +52,18 @@ namespace binfilter {
|*
\************************************************************************/
-/*N*/ DECLARE_LIST(Polygon3DList, Polygon3D*)//STRIP008 ;
+typedef ::std::vector< Polygon3D* > Polygon3DList;
/*N*/ class ImpPolyPolygon3D
/*N*/ {
/*N*/ public:
/*N*/ Polygon3DList aPoly3DList;
/*N*/ UINT16 nRefCount;
-/*N*/
-/*N*/ ImpPolyPolygon3D(UINT16 nInitSize = 4, UINT16 nResize = 4)
-/*N*/ : aPoly3DList(1024, nInitSize, nResize) { nRefCount = 1; }
+/*N*/
+/*N*/ ImpPolyPolygon3D() { nRefCount = 1; }
/*N*/ ImpPolyPolygon3D(const ImpPolyPolygon3D& rImpPolyPoly3D);
/*N*/ ~ImpPolyPolygon3D();
-/*N*/
+/*N*/
/*N*/ BOOL operator==(const ImpPolyPolygon3D& rImpPolyPoly3D) const;
/*N*/ BOOL operator!=(const ImpPolyPolygon3D& rImpPolyPoly3D) const
/*N*/ { return !operator==(rImpPolyPoly3D); }
@@ -99,7 +96,7 @@ namespace binfilter {
/*N*/ ImpPolygon3D::ImpPolygon3D(const ImpPolygon3D& rImpPoly3D)
/*N*/ {
/*N*/ ((ImpPolygon3D&)rImpPoly3D).CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ pPointAry = NULL;
/*N*/ bDeleteOldAry = FALSE;
/*N*/ bClosed = rImpPoly3D.bClosed;
@@ -108,7 +105,7 @@ namespace binfilter {
/*N*/ nPoints = 0;
/*N*/ nRefCount = 1;
/*N*/ Resize(rImpPoly3D.nSize);
-/*N*/
+/*N*/
/*N*/ // Kopieren
/*N*/ nPoints = rImpPoly3D.nPoints;
/*N*/ memcpy(pPointAry, rImpPoly3D.pPointAry, nSize*sizeof(Vector3D));
@@ -123,7 +120,7 @@ namespace binfilter {
/*N*/ ImpPolygon3D::~ImpPolygon3D()
/*N*/ {
/*N*/ delete[] (char*)pPointAry;
-/*N*/
+/*N*/
/*N*/ if(bDeleteOldAry)
/*N*/ delete[] (char*)pOldPointAry;
/*N*/ }
@@ -161,12 +158,12 @@ namespace binfilter {
/*N*/ {
/*N*/ if(nNewSize == nSize)
/*N*/ return;
-/*N*/
+/*N*/
/*N*/ UINT16 nOldSize = nSize;
-/*N*/
+/*N*/
/*N*/ CheckPointDelete();
/*N*/ pOldPointAry = pPointAry;
-/*N*/
+/*N*/
/*N*/ // Neue Groesse auf vielfaches von nResize runden, sofern Objekt
/*N*/ // nicht neu angelegt wurde (nSize != 0)
/*N*/ if(nSize && nNewSize > nSize)
@@ -174,12 +171,12 @@ namespace binfilter {
/*N*/ DBG_ASSERT(nResize, "Resize-Versuch trotz nResize = 0 !");
/*N*/ nNewSize = nSize + ((nNewSize-nSize-1) / nResize + 1) * nResize;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ // Punkt-Array erzeugen
/*N*/ nSize = nNewSize;
/*N*/ pPointAry = (Vector3D*)new char[nSize * sizeof(Vector3D)];
/*N*/ memset(pPointAry, 0, nSize * sizeof(Vector3D));
-/*N*/
+/*N*/
/*N*/ // Eventuell umkopieren
/*N*/ if(nOldSize)
/*N*/ {
@@ -190,14 +187,14 @@ namespace binfilter {
/*N*/ else
/*N*/ {
/*N*/ memcpy(pPointAry, pOldPointAry, nSize*sizeof(Vector3D));
-/*N*/
+/*N*/
/*N*/ // Anzahl der gueltigen Punkte anpassen
/*N*/ if(nPoints > nSize)
/*N*/ nPoints = nSize;
/*N*/ }
/*N*/ if(bDeletePoints)
/*N*/ delete[] (char*)pOldPointAry;
-/*N*/ else
+/*N*/ else
/*N*/ bDeleteOldAry = TRUE;
/*N*/ }
/*N*/ }
@@ -218,14 +215,14 @@ namespace binfilter {
/*N*/ void ImpPolygon3D::Remove(UINT16 nPos, UINT16 nCount)
/*N*/ {
/*N*/ CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ if(nPos + nCount <= nPoints)
/*N*/ {
/*N*/ UINT16 nMove = nPoints - nPos - nCount;
/*N*/ if(nMove)
/*N*/ memmove(&pPointAry[nPos], &pPointAry[nPos+nCount],
/*N*/ nMove * sizeof(Vector3D));
-/*N*/
+/*N*/
/*N*/ nPoints -= nCount;
/*N*/ memset(&pPointAry[nPoints], 0, nCount * sizeof(Vector3D));
/*N*/ }
@@ -264,7 +261,7 @@ namespace binfilter {
/*N*/ {
/*N*/ UINT16 nSize(rPoly.GetSize());
/*N*/ pImpPolygon3D = new ImpPolygon3D(nSize);
-/*N*/
+/*N*/
/*N*/ if(fScale != 1.0)
/*N*/ {
/*?*/ for(UINT16 a=0; a<nSize; a++)
@@ -283,9 +280,9 @@ namespace binfilter {
/*N*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
/*N*/ }
/*N*/ }
-/*N*/
+/*N*/
/*N*/ pImpPolygon3D->nPoints = nSize;
-/*N*/
+/*N*/
/*N*/ CheckClosed();
/*N*/ }
@@ -300,7 +297,7 @@ namespace binfilter {
/*N*/ {
/*N*/ UINT16 nSize(rXPoly.GetPointCount());
/*N*/ pImpPolygon3D = new ImpPolygon3D(nSize);
-/*N*/
+/*N*/
/*N*/ if(fScale != 1.0)
/*N*/ {
/*?*/ for(UINT16 a=0; a<nSize; a++)
@@ -319,9 +316,9 @@ namespace binfilter {
/*N*/ pImpPolygon3D->pPointAry[a].Z() = 0.0;
/*N*/ }
/*N*/ }
-/*N*/
+/*N*/
/*N*/ pImpPolygon3D->nPoints = nSize;
-/*N*/
+/*N*/
/*N*/ CheckClosed();
/*N*/ }
@@ -422,7 +419,7 @@ namespace binfilter {
/*N*/ double fRetval = 0.0;
/*N*/ Vector3D *pLast = &pImpPolygon3D->pPointAry[
/*N*/ IsClosed() ? pImpPolygon3D->nPoints - 1 : 0];
-/*N*/
+/*N*/
/*N*/ for(UINT16 a=IsClosed() ? 0 : 1;a<pImpPolygon3D->nPoints;a++)
/*N*/ {
/*N*/ Vector3D *pCandidate = &pImpPolygon3D->pPointAry[a];
@@ -430,7 +427,7 @@ namespace binfilter {
/*N*/ fRetval += aVec.GetLength();
/*N*/ pLast = pCandidate;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return fRetval;
/*N*/ }
@@ -444,10 +441,10 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ if(pImpPolygon3D->nSize < nPoints)
/*?*/ pImpPolygon3D->Resize(nPoints);
-/*N*/
+/*N*/
/*N*/ if(nPoints < pImpPolygon3D->nPoints)
/*N*/ {
/*N*/ UINT16 nSize = pImpPolygon3D->nPoints - nPoints;
@@ -498,16 +495,16 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ if(nPos >= pImpPolygon3D->nSize)
/*N*/ {
/*N*/ DBG_ASSERT(pImpPolygon3D->nResize, "Ungueltiger Index bei Arrayzugriff auf Polygon3D");
/*N*/ pImpPolygon3D->Resize(nPos + 1, FALSE);
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if(nPos >= pImpPolygon3D->nPoints)
/*N*/ pImpPolygon3D->nPoints = nPos + 1;
-/*N*/
+/*N*/
/*N*/ return pImpPolygon3D->pPointAry[nPos];
/*N*/ }
@@ -520,16 +517,16 @@ namespace binfilter {
/*N*/ Polygon3D& Polygon3D::operator=(const Polygon3D& rPoly3D)
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ rPoly3D.pImpPolygon3D->nRefCount++;
-/*N*/
+/*N*/
/*N*/ if(pImpPolygon3D->nRefCount > 1)
/*N*/ pImpPolygon3D->nRefCount--;
/*N*/ else
/*N*/ delete pImpPolygon3D;
-/*N*/
+/*N*/
/*N*/ pImpPolygon3D = rPoly3D.pImpPolygon3D;
-/*N*/
+/*N*/
/*N*/ return *this;
/*N*/ }
@@ -542,18 +539,18 @@ namespace binfilter {
/*N*/ BOOL Polygon3D::operator==(const Polygon3D& rPoly3D) const
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ if(rPoly3D.pImpPolygon3D == pImpPolygon3D)
/*N*/ return TRUE;
-/*N*/
+/*N*/
/*N*/ if(pImpPolygon3D->nPoints != rPoly3D.pImpPolygon3D->nPoints)
/*N*/ return FALSE;
-/*N*/
+/*N*/
/*N*/ // point-to point compare necessary
/*N*/ for(UINT16 a=0;a<pImpPolygon3D->nPoints;a++)
/*N*/ if(pImpPolygon3D->pPointAry[a] != rPoly3D.pImpPolygon3D->pPointAry[a])
/*N*/ return FALSE;
-/*N*/
+/*N*/
/*N*/ return TRUE;
/*N*/ }
@@ -574,13 +571,13 @@ namespace binfilter {
/*N*/ {
/*N*/ DBG_CHKOBJ(&rPoly3D, Polygon3D, NULL);
/*N*/ UINT16 nPntCnt;
-/*N*/
+/*N*/
/*N*/ rPoly3D.pImpPolygon3D->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ // Anzahl der Punkte einlesen und Array erzeugen
/*N*/ rIStream >> nPntCnt;
/*N*/ rPoly3D.pImpPolygon3D->nPoints = nPntCnt;
-/*N*/
+/*N*/
/*N*/ if(rPoly3D.pImpPolygon3D->nRefCount != 1)
/*N*/ {
/*?*/ if(rPoly3D.pImpPolygon3D->nRefCount)
@@ -589,23 +586,23 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*N*/ rPoly3D.pImpPolygon3D->Resize(nPntCnt);
-/*N*/
+/*N*/
/*N*/ Vector3D* pPoint = rPoly3D.pImpPolygon3D->pPointAry;
-/*N*/
+/*N*/
/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
/*N*/ rIStream >> *pPoint++;
-/*N*/
+/*N*/
/*N*/ // auf geschlossenheit pruefen
/*N*/ if(*rPoly3D.pImpPolygon3D->pPointAry == *(pPoint-1))
/*N*/ {
/*N*/ rPoly3D.pImpPolygon3D->bClosed = TRUE;
/*N*/ rPoly3D.pImpPolygon3D->nPoints = nPntCnt-1;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ INT16 nTmp;
/*N*/ rIStream >> nTmp; // war mal nConvexPoint
/*N*/ rIStream >> nTmp; // alt: rPoly3D.nOuterPoly;
-/*N*/
+/*N*/
/*N*/ return rIStream;
/*N*/ }
@@ -618,12 +615,12 @@ namespace binfilter {
/*N*/ SvStream& operator<<(SvStream& rOStream, const Polygon3D& rPoly3D)
/*N*/ {
/*N*/ DBG_CHKOBJ(&rPoly3D, Polygon3D, NULL);
-/*N*/
+/*N*/
/*N*/ rPoly3D.pImpPolygon3D->CheckPointDelete();
-/*N*/
+/*N*/
/*N*/ Vector3D* pPoint = rPoly3D.pImpPolygon3D->pPointAry;
/*N*/ UINT16 nPntCnt = rPoly3D.GetPointCount();
-/*N*/
+/*N*/
/*N*/ if(rPoly3D.pImpPolygon3D->bClosed)
/*N*/ {
/*N*/ nPntCnt++;
@@ -634,20 +631,20 @@ namespace binfilter {
/*N*/ {
/*N*/ rOStream << nPntCnt;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ for (UINT16 i = 0; i < nPntCnt; i++)
/*N*/ rOStream << *pPoint++;
-/*N*/
+/*N*/
/*N*/ if(rPoly3D.pImpPolygon3D->bClosed)
/*N*/ {
/*N*/ // ersten Punkt nochmal, um polygon auf geschlossen zu zwingen
/*N*/ pPoint = rPoly3D.pImpPolygon3D->pPointAry;
/*N*/ rOStream << *pPoint;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ rOStream << (INT16)0; // war mal nConvexPoint
/*N*/ rOStream << (INT16)-1; // alt: rPoly3D.nOuterPoly;
-/*N*/
+/*N*/
/*N*/ return rOStream;
/*N*/ }
@@ -720,42 +717,42 @@ namespace binfilter {
/*N*/ Vector3D Polygon3D::GetNormal() const
/*N*/ {
/*N*/ Vector3D aNormal(0.0, 0.0, -1.0);
-/*N*/
+/*N*/
/*N*/ if(pImpPolygon3D->nPoints > 2)
/*N*/ {
/*N*/ // HighestEdge bestimmen
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
/*N*/ UINT16 nHighest = GetHighestEdge();
/*N*/ const Vector3D &rHighest = (*this)[nHighest];
-/*N*/
+/*N*/
/*N*/ // Vorgaenger bestimmen
/*N*/ UINT16 nPrev(nHighest);
/*N*/ do {
/*N*/ nPrev = (nPrev == 0) ? nPntCnt-1 : nPrev-1;
/*N*/ } while((*this)[nPrev] == rHighest && nPrev != nHighest);
/*N*/ const Vector3D &rPrev = (*this)[nPrev];
-/*N*/
+/*N*/
/*N*/ // Nachfolger bestimmen
/*N*/ UINT16 nNext(nHighest);
/*N*/ do {
/*N*/ nNext = (nNext == nPntCnt-1) ? 0 : nNext+1;
/*N*/ } while((*this)[nNext] == rHighest && nNext != nHighest);
/*N*/ const Vector3D &rNext = (*this)[nNext];
-/*N*/
+/*N*/
/*N*/ // Fehlerfaelle abfangen
/*N*/ if(rHighest == rPrev || rHighest == rNext || rPrev == rNext)
/*N*/ return aNormal;
-/*N*/
+/*N*/
/*N*/ // Normale bilden
/*N*/ aNormal = (rPrev - rHighest)|(rNext - rHighest);
-/*N*/
+/*N*/
/*N*/ // get length
/*N*/ double fLen = aNormal.GetLength();
-/*N*/
+/*N*/
/*N*/ // correct length
/*N*/ if(fabs(fLen) < SMALL_DVALUE)
/*N*/ fLen = 0.0;
-/*N*/
+/*N*/
/*N*/ if(0.0 != fLen)
/*N*/ {
/*N*/ // use own normalize here since we already know the vector length
@@ -787,12 +784,12 @@ namespace binfilter {
/*N*/ {
/*N*/ Vector3D aMiddle;
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
-/*N*/
+/*N*/
/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
/*N*/ aMiddle += pImpPolygon3D->pPointAry[i];
-/*N*/
+/*N*/
/*N*/ aMiddle /= (double)nPntCnt;
-/*N*/
+/*N*/
/*N*/ return aMiddle;
/*N*/ }
@@ -806,12 +803,12 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
/*N*/ UINT16 nCnt = nPntCnt / 2;
/*N*/ Vector3D* pBeg = pImpPolygon3D->pPointAry;
/*N*/ Vector3D* pEnd = pBeg + nPntCnt - 1;
-/*N*/
+/*N*/
/*N*/ for(UINT16 i = 0; i < nCnt; i++)
/*N*/ {
/*N*/ Vector3D aTmp = *pBeg;
@@ -830,10 +827,10 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ Vector3D* pPoint = pImpPolygon3D->pPointAry;
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
-/*N*/
+/*N*/
/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
/*N*/ *pPoint++ *= rTfMatrix;
/*N*/ }
@@ -849,32 +846,32 @@ namespace binfilter {
/*N*/ {
/*N*/ pImpPolygon3D->CheckPointDelete();
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
-/*N*/
+/*N*/
/*N*/ if(nPntCnt)
/*N*/ {
/*N*/ Vector3D* pPoint = pImpPolygon3D->pPointAry;
/*N*/ Vector3D aP0 = *pPoint;
-/*N*/
+/*N*/
/*N*/ pPoint += nPntCnt;
-/*N*/
+/*N*/
/*N*/ while(*--pPoint == aP0 && nPntCnt > 3)
/*N*/ {
/*N*/ nPntCnt--;
/*N*/ pImpPolygon3D->bClosed = TRUE;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ for(UINT16 i = nPntCnt-1; i > 0 && nPntCnt > 3; i--)
/*N*/ {
/*N*/ if(*pPoint == *(pPoint-1))
-/*N*/ {
+/*N*/ {
/*N*/ pImpPolygon3D->Remove(i, 1);
/*N*/ nPntCnt--;
/*N*/ }
/*N*/ pPoint--;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ SetPointCount(nPntCnt);
/*N*/ }
/*N*/ else
@@ -909,20 +906,20 @@ namespace binfilter {
/*N*/ BOOL bInside(FALSE);
/*N*/ UINT16 nNumPoint(GetPointCount());
/*N*/ Vector3D* pPoints = pImpPolygon3D->pPointAry;
-/*N*/
+/*N*/
/*N*/ for(UINT16 a=0;a<nNumPoint;a++)
/*N*/ {
/*N*/ if(bWithBorder
/*N*/ && (fabs(pPoints[a].X() - rPnt.X()) < SMALL_DVALUE)
/*N*/ && (fabs(pPoints[a].Y() - rPnt.Y()) < SMALL_DVALUE))
/*N*/ return TRUE;
-/*N*/
+/*N*/
/*N*/ UINT16 nPrev((!a) ? nNumPoint-1 : a-1);
-/*N*/
+/*N*/
/*N*/ if((pPoints[nPrev].Y() - rPnt.Y() > -SMALL_DVALUE) != (pPoints[a].Y() - rPnt.Y() > -SMALL_DVALUE))
/*N*/ {
/*N*/ BOOL bXFlagOld(pPoints[nPrev].X() - rPnt.X() > -SMALL_DVALUE);
-/*N*/
+/*N*/
/*N*/ if(bXFlagOld == (pPoints[a].X() - rPnt.X() > -SMALL_DVALUE))
/*N*/ {
/*N*/ if(bXFlagOld)
@@ -930,17 +927,17 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*N*/ {
-/*N*/ double fCmp =
+/*N*/ double fCmp =
/*N*/ pPoints[a].X() - (pPoints[a].Y() - rPnt.Y()) *
/*N*/ (pPoints[nPrev].X() - pPoints[a].X()) /
/*N*/ (pPoints[nPrev].Y() - pPoints[a].Y());
-/*N*/
+/*N*/
/*N*/ if((bWithBorder && fCmp > rPnt.X()) || (!bWithBorder && fCmp - rPnt.X() > -SMALL_DVALUE))
/*N*/ bInside = !bInside;
/*N*/ }
/*N*/ }
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return bInside;
/*N*/ }
@@ -958,7 +955,7 @@ namespace binfilter {
/*N*/ nSize++;
/*N*/ Polygon aPolygon(nSize);
/*N*/ Vector3D* pVec3D = pImpPolygon3D->pPointAry;
-/*N*/
+/*N*/
/*N*/ if (pVec3D)
/*N*/ {
/*N*/ UINT16 i;
@@ -993,11 +990,11 @@ namespace binfilter {
/*N*/ {
/*N*/ Volume3D aRetval;
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
-/*N*/
+/*N*/
/*N*/ aRetval.Reset();
/*N*/ for(UINT16 i = 0; i < nPntCnt; i++)
/*N*/ aRetval.Union((*this)[i]);
-/*N*/
+/*N*/
/*N*/ return aRetval;
/*N*/ }
@@ -1012,12 +1009,12 @@ namespace binfilter {
/*N*/ {
/*N*/ double fRetval = 0.0;
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
-/*N*/
+/*N*/
/*N*/ if(nPntCnt > 2)
/*N*/ {
/*N*/ const Vector3D& rFirst = (*this)[0];
/*N*/ Vector3D aLastVector = (*this)[1] - rFirst;
-/*N*/
+/*N*/
/*N*/ for (UINT16 i = 2; i < nPntCnt; i++)
/*N*/ {
/*N*/ const Vector3D& rPoint = (*this)[i];
@@ -1075,17 +1072,17 @@ namespace binfilter {
/*N*/ {
/*N*/ UINT16 nPntCnt = pImpPolygon3D->nPoints;
/*N*/ BOOL bRetval(TRUE);
-/*N*/
+/*N*/
/*N*/ if(nIndex < nPntCnt)
/*N*/ {
/*N*/ const Vector3D& rMid = (*this)[nIndex];
/*N*/ const Vector3D& rPre = (*this)[(nIndex == 0) ? nPntCnt-1 : nIndex-1];
/*N*/ const Vector3D& rPos = (*this)[(nIndex == nPntCnt-1) ? 0 : nIndex+1];
-/*N*/
+/*N*/
/*N*/ Vector3D aNormal = (rPre - rMid)|(rPos - rMid);
/*N*/ bRetval = (aNormal.Z() > 0.0) ? TRUE : FALSE;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return bRetval;
/*N*/ }
@@ -1094,26 +1091,26 @@ namespace binfilter {
|* get position on polypos, with clipping to start/end
|*
\************************************************************************/
-
+
/*N*/ Vector3D Polygon3D::GetPosition(double fPos) const
/*N*/ {
/*N*/ Vector3D aRetval((*this)[0]);
-/*N*/
+/*N*/
/*N*/ if(fPos <= 0.0 || pImpPolygon3D->nPoints < 2)
/*N*/ return aRetval;
-/*N*/
+/*N*/
/*N*/ double fLen = GetLength();
-/*N*/
+/*N*/
/*N*/ if(fPos >= fLen)
/*N*/ {
/*N*/ aRetval = (*this)[pImpPolygon3D->nPoints - 1];
/*N*/ return aRetval;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ UINT16 nPos(0);
/*N*/ Vector3D aPart((*this)[0] - (*this)[1]);
/*N*/ double fPartLen = aPart.GetLength();
-/*N*/
+/*N*/
/*N*/ while(fPos > fPartLen)
/*N*/ {
/*N*/ fPos -= fPartLen;
@@ -1121,9 +1118,9 @@ namespace binfilter {
/*N*/ aPart = Vector3D((*this)[nPos] - (*this)[nPos+1]);
/*N*/ fPartLen = aPart.GetLength();
/*N*/ }
-/*N*/
+/*N*/
/*N*/ aRetval.CalcInBetween((*this)[nPos], (*this)[nPos+1], fPos / fPartLen);
-/*N*/
+/*N*/
/*N*/ return aRetval;
/*N*/ }
@@ -1135,21 +1132,21 @@ namespace binfilter {
/*N*/ if(GetPointCount() && nNum && (sal_uInt32)GetPointCount() != nNum)
/*N*/ {
/*N*/ Polygon3D aDestPoly((sal_uInt16)nNum);
-/*N*/
+/*N*/
/*N*/ // length of step in dest poly
/*N*/ double fStep = GetLength() / (double)(IsClosed() ? nNum : nNum - 1);
-/*N*/
+/*N*/
/*N*/ // actual positions for run
/*N*/ double fDestPos = 0.0;
/*N*/ double fSrcPos = 0.0;
-/*N*/
+/*N*/
/*N*/ // actual indices for run
/*N*/ sal_uInt32 nSrcPos = 0;
/*N*/ sal_uInt32 nSrcPosNext = (nSrcPos+1 == (sal_uInt32)GetPointCount()) ? 0 : nSrcPos + 1;
-/*N*/
+/*N*/
/*N*/ // length of next source step
/*N*/ double fNextSrcLen = ((*this)[(sal_uInt16)nSrcPos] - (*this)[(sal_uInt16)nSrcPosNext]).GetLength();
-/*N*/
+/*N*/
/*N*/ for(sal_uInt32 b = 0; b < nNum; b++)
/*N*/ {
/*N*/ // calc fDestPos in source
@@ -1160,23 +1157,23 @@ namespace binfilter {
/*N*/ nSrcPosNext = (nSrcPos+1 == (sal_uInt32)GetPointCount()) ? 0 : nSrcPos + 1;
/*N*/ fNextSrcLen = ((*this)[(sal_uInt16)nSrcPos] - (*this)[(sal_uInt16)nSrcPosNext]).GetLength();
/*N*/ }
-/*N*/
+/*N*/
/*N*/ // fDestPos is between fSrcPos and (fSrcPos + fNextSrcLen)
/*N*/ double fLenA = (fDestPos - fSrcPos) / fNextSrcLen;
/*N*/ Vector3D aOld1 = (*this)[(sal_uInt16)nSrcPos];
/*N*/ Vector3D aOld2 = (*this)[(sal_uInt16)nSrcPosNext];
/*N*/ Vector3D aNewPoint;
/*N*/ aNewPoint.CalcInBetween(aOld1, aOld2, fLenA);
-/*N*/
+/*N*/
/*N*/ aDestPoly[(sal_uInt16)b] = aNewPoint;
-/*N*/
+/*N*/
/*N*/ // next step
/*N*/ fDestPos += fStep;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if(aDestPoly.GetPointCount() >= 3)
/*N*/ aDestPoly.SetClosed(IsClosed());
-/*N*/
+/*N*/
/*N*/ return aDestPoly;
/*N*/ }
/*N*/ else
@@ -1198,13 +1195,8 @@ namespace binfilter {
/*N*/ {
/*N*/ nRefCount = 1;
/*N*/ // Einzelne Elemente duplizieren
-/*N*/ Polygon3D* pPoly3D = aPoly3DList.First();
-/*N*/
-/*N*/ while ( pPoly3D )
-/*N*/ {
-/*N*/ aPoly3DList.Replace(new Polygon3D(*(aPoly3DList.GetCurObject())));
-/*N*/ pPoly3D = aPoly3DList.Next();
-/*N*/ }
+ for( size_t i = 0, n = aPoly3DList.size(); i < n; ++i )
+ aPoly3DList[ i ] = new Polygon3D( *(aPoly3DList[ i ]) );
/*N*/ }
/*************************************************************************
@@ -1215,13 +1207,9 @@ namespace binfilter {
/*N*/ ImpPolyPolygon3D::~ImpPolyPolygon3D()
/*N*/ {
-/*N*/ Polygon3D* pPoly3D = aPoly3DList.First();
-/*N*/
-/*N*/ while( pPoly3D )
-/*N*/ {
-/*N*/ delete pPoly3D;
-/*N*/ pPoly3D = aPoly3DList.Next();
-/*N*/ }
+ for( size_t i = 0, n = aPoly3DList.size(); i < n; ++i )
+ delete aPoly3DList[ i ];
+ aPoly3DList.clear();
/*N*/ }
/*************************************************************************
@@ -1232,17 +1220,17 @@ namespace binfilter {
/*N*/ BOOL ImpPolyPolygon3D::operator==(const ImpPolyPolygon3D& rImpPolyPoly3D) const
/*N*/ {
-/*N*/ UINT16 nCnt = (UINT16) aPoly3DList.Count();
+/*N*/ size_t nCnt = aPoly3DList.size();
/*N*/ const Polygon3DList& rCmpList = rImpPolyPoly3D.aPoly3DList;
-/*N*/
-/*N*/ if ( nCnt != (UINT16) rCmpList.Count() )
+/*N*/
+/*N*/ if ( nCnt != rCmpList.size() )
/*N*/ return FALSE;
-/*N*/
+/*N*/
/*N*/ BOOL bEqual = TRUE;
-/*N*/
-/*N*/ for ( UINT16 i = 0; i < nCnt && bEqual; i++ )
-/*N*/ bEqual = ( *aPoly3DList.GetObject(i) == *rCmpList.GetObject(i) );
-/*N*/
+/*N*/
+ for ( size_t i = 0; i < nCnt && bEqual; ++i )
+ bEqual = ( *aPoly3DList[ i ] == *rCmpList[ i ] );
+/*N*/
/*N*/ return bEqual;
/*N*/ }
@@ -1256,10 +1244,10 @@ namespace binfilter {
|*
\************************************************************************/
-/*N*/ PolyPolygon3D::PolyPolygon3D(UINT16 nInitSize, UINT16 nResize)
+/*N*/ PolyPolygon3D::PolyPolygon3D(UINT16 /*nInitSize */, UINT16 /* nResize */)
/*N*/ {
/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
-/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D(nInitSize, nResize);
+/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D();
/*N*/ }
@@ -1273,7 +1261,7 @@ namespace binfilter {
/*N*/ {
/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(new Polygon3D(rPoly3D));
+/*N*/ pImpPolyPolygon3D->aPoly3DList.push_back( new Polygon3D(rPoly3D) );
/*N*/ }
/*************************************************************************
@@ -1300,10 +1288,9 @@ namespace binfilter {
/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
/*N*/ UINT16 nCnt = rPolyPoly.Count();
-/*N*/
+/*N*/
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(
-/*N*/ new Polygon3D(rPolyPoly.GetObject(i), fScale), LIST_APPEND);
+/*N*/ pImpPolyPolygon3D->aPoly3DList.push_back( new Polygon3D(rPolyPoly.GetObject(i), fScale ));
/*N*/ }
/*************************************************************************
@@ -1317,10 +1304,9 @@ namespace binfilter {
/*N*/ DBG_CTOR(PolyPolygon3D, NULL);
/*N*/ pImpPolyPolygon3D = new ImpPolyPolygon3D;
/*N*/ UINT16 nCnt = rXPolyPoly.Count();
-/*N*/
+/*N*/
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(
-/*N*/ new Polygon3D(rXPolyPoly.GetObject(i), fScale), LIST_APPEND);
+/*N*/ pImpPolyPolygon3D->aPoly3DList.push_back( new Polygon3D(rXPolyPoly.GetObject(i), fScale) );
/*N*/ }
/*************************************************************************
@@ -1339,7 +1325,7 @@ namespace binfilter {
/*N*/ PolyPolygon3D::~PolyPolygon3D()
/*N*/ {
/*N*/ DBG_DTOR(PolyPolygon3D, NULL);
-/*N*/
+/*N*/
/*N*/ if( pImpPolyPolygon3D->nRefCount > 1 ) pImpPolyPolygon3D->nRefCount--;
/*N*/ else delete pImpPolyPolygon3D;
/*N*/ }
@@ -1383,7 +1369,14 @@ namespace binfilter {
/*N*/ void PolyPolygon3D::Insert(const Polygon3D& rPoly3D, UINT16 nPos)
/*N*/ {
/*N*/ CheckReference();
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(new Polygon3D(rPoly3D), nPos);
+ if ( nPos < pImpPolyPolygon3D->aPoly3DList.size() )
+ {
+ Polygon3DList::iterator it = pImpPolyPolygon3D->aPoly3DList.begin();
+ ::std::advance( it, nPos );
+ pImpPolyPolygon3D->aPoly3DList.insert( it, new Polygon3D(rPoly3D) );
+ }
+ else
+ pImpPolyPolygon3D->aPoly3DList.push_back( new Polygon3D(rPoly3D) );
/*N*/ }
/*************************************************************************
@@ -1396,12 +1389,18 @@ namespace binfilter {
/*N*/ {
/*N*/ CheckReference();
/*N*/ UINT16 nCnt = rPolyPoly3D.Count();
-/*N*/
+/*N*/
/*N*/ for ( UINT16 i = 0; i < nCnt; i++)
/*N*/ {
-/*N*/ Polygon3D* pPoly3D = new Polygon3D(rPolyPoly3D[i]);
-/*N*/ pImpPolyPolygon3D->aPoly3DList. Insert(pPoly3D, nPos);
-/*N*/
+ if ( nPos < pImpPolyPolygon3D->aPoly3DList.size() )
+ {
+ Polygon3DList::iterator it = pImpPolyPolygon3D->aPoly3DList.begin();
+ ::std::advance( it, nPos );
+ pImpPolyPolygon3D->aPoly3DList.insert( it, new Polygon3D(rPolyPoly3D[i]) );
+ }
+ else
+ pImpPolyPolygon3D->aPoly3DList.push_back( new Polygon3D(rPolyPoly3D[i]) );
+
/*N*/ if ( nPos != POLYPOLY3D_APPEND )
/*N*/ nPos++;
/*N*/ }
@@ -1430,13 +1429,16 @@ namespace binfilter {
/*N*/ const Polygon3D& PolyPolygon3D::GetObject(UINT16 nPos) const
/*N*/ {
-/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.GetObject(nPos);
-/*N*/
-/*N*/ if ( pPoly3D == NULL )
-/*N*/ { // Wenn noch kein Polygon an der Position vorhanden, neu erzeugen
-/*N*/ pPoly3D = new Polygon3D;
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, nPos);
-/*N*/ }
+/*N*/ Polygon3D* pPoly3D;
+ if ( nPos < pImpPolyPolygon3D->aPoly3DList.size() )
+ {
+ pPoly3D = pImpPolyPolygon3D->aPoly3DList[ nPos ];
+ }
+ else
+ {
+ pPoly3D = new Polygon3D;
+ pImpPolyPolygon3D->aPoly3DList.push_back( pPoly3D );
+ }
/*N*/ return *pPoly3D;
/*N*/ }
@@ -1455,14 +1457,9 @@ namespace binfilter {
/*N*/ }
/*N*/ else
/*N*/ {
-/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.First();
-/*N*/
-/*N*/ while( pPoly3D )
-/*N*/ {
-/*N*/ delete pPoly3D;
-/*N*/ pPoly3D = pImpPolyPolygon3D->aPoly3DList.Next();
-/*N*/ }
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Clear();
+ for ( size_t i = 0, n = pImpPolyPolygon3D->aPoly3DList.size(); i < n; ++i )
+ delete pImpPolyPolygon3D->aPoly3DList[ i ];
+ pImpPolyPolygon3D->aPoly3DList.clear();
/*N*/ }
/*N*/ }
@@ -1474,7 +1471,7 @@ namespace binfilter {
/*N*/ UINT16 PolyPolygon3D::Count() const
/*N*/ {
-/*N*/ return (UINT16)(pImpPolyPolygon3D->aPoly3DList.Count());
+/*N*/ return (UINT16)(pImpPolyPolygon3D->aPoly3DList.size());
/*N*/ }
/*************************************************************************
@@ -1486,13 +1483,16 @@ namespace binfilter {
/*N*/ Polygon3D& PolyPolygon3D::operator[](UINT16 nPos)
/*N*/ {
/*N*/ CheckReference();
-/*N*/ Polygon3D* pPoly3D = pImpPolyPolygon3D->aPoly3DList.GetObject(nPos);
-/*N*/
-/*N*/ if ( pPoly3D == NULL )
-/*N*/ { // Wenn noch kein Polygon an der Position vorhanden, neu erzeugen
-/*N*/ pPoly3D = new Polygon3D;
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, nPos);
-/*N*/ }
+/*N*/ Polygon3D* pPoly3D;
+ if ( nPos < pImpPolyPolygon3D->aPoly3DList.size() )
+ {
+ pPoly3D = pImpPolyPolygon3D->aPoly3DList[ nPos ];
+ }
+ else
+ {
+ pPoly3D = new Polygon3D;
+ pImpPolyPolygon3D->aPoly3DList.push_back( pPoly3D );
+ }
/*N*/ return *pPoly3D;
/*N*/ }
@@ -1505,10 +1505,10 @@ namespace binfilter {
/*N*/ PolyPolygon3D& PolyPolygon3D::operator=(const PolyPolygon3D& rPolyPoly3D)
/*N*/ {
/*N*/ rPolyPoly3D.pImpPolyPolygon3D->nRefCount++;
-/*N*/
+/*N*/
/*N*/ if( pImpPolyPolygon3D->nRefCount > 1 ) pImpPolyPolygon3D->nRefCount--;
/*N*/ else delete pImpPolyPolygon3D;
-/*N*/
+/*N*/
/*N*/ pImpPolyPolygon3D = rPolyPoly3D.pImpPolyPolygon3D;
/*N*/ return *this;
/*N*/ }
@@ -1544,9 +1544,9 @@ namespace binfilter {
/*N*/ {
/*N*/ CheckReference();
/*N*/ UINT16 nCnt = Count();
-/*N*/
+/*N*/
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->Transform(rTfMatrix);
+/*N*/ pImpPolyPolygon3D->aPoly3DList[ i ]->Transform(rTfMatrix);
/*N*/ }
/*************************************************************************
@@ -1562,35 +1562,35 @@ namespace binfilter {
/*N*/ void PolyPolygon3D::SetDirections(const Vector3D& rNormal)
/*N*/ {
/*N*/ CheckReference();
-/*N*/
+/*N*/
/*N*/ UINT16 nCnt = Count();
/*N*/ UINT16 nPoly;
/*N*/ short nFirstPoly = -1;
-/*N*/
+/*N*/
/*N*/ if(nCnt)
/*N*/ {
/*N*/ for ( nPoly = 0; nPoly < nCnt; nPoly++ )
/*N*/ {
-/*N*/ Polygon3D& rPoly3D = *pImpPolyPolygon3D->aPoly3DList.GetObject(nPoly);
+/*N*/ Polygon3D& rPoly3D = *pImpPolyPolygon3D->aPoly3DList[ nPoly ];
/*N*/ BOOL bFlip = !rPoly3D.IsClockwise(rNormal);
/*N*/ short nDepth = 0;
/*N*/ const Vector3D& rPos = rPoly3D[0];
-/*N*/
+/*N*/
/*N*/ // bestimmen, wie tief das aktuelle Polygon in den anderen
/*N*/ // verschachtelt ist
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
/*N*/ {
/*N*/ if ( i != nPoly &&
-/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->IsInside(rPos) )
+/*N*/ pImpPolyPolygon3D->aPoly3DList[ i ]->IsInside(rPos) )
/*N*/ nDepth++;
/*N*/ }
/*N*/ // ungerade nDepth-Werte bedeuten: das Polygon ist ein "Loch"
/*N*/ // in der aeusseren Kontur
/*N*/ BOOL bHole = ((nDepth & 0x0001) == 1);
-/*N*/
+/*N*/
/*N*/ if ( (bFlip && !bHole) || (!bFlip && bHole) )
/*N*/ rPoly3D.FlipDirection();
-/*N*/
+/*N*/
/*N*/ // Den Index des (geometrisch) aeussersten Polygons merken
/*N*/ if ( nDepth == 0 && nFirstPoly == -1 )
/*N*/ nFirstPoly = (short) nPoly;
@@ -1598,8 +1598,11 @@ namespace binfilter {
/*N*/ // liegt das aeussere Polygon nicht am Anfang, wird es dahin verschoben
/*N*/ if ( nFirstPoly > 0 )
/*N*/ {
-/*N*/ Polygon3D* pOuter = pImpPolyPolygon3D->aPoly3DList.Remove(nFirstPoly);
-/*N*/ pImpPolyPolygon3D->aPoly3DList.Insert(pOuter, (ULONG) 0);
+ Polygon3DList::iterator it = pImpPolyPolygon3D->aPoly3DList.begin();
+ ::std::advance( it, nFirstPoly );
+ Polygon3D* pOuter = *it;
+ pImpPolyPolygon3D->aPoly3DList.erase( it );
+ pImpPolyPolygon3D->aPoly3DList.insert( pImpPolyPolygon3D->aPoly3DList.begin(), pOuter);
/*N*/ }
/*N*/ }
/*N*/ }
@@ -1614,10 +1617,10 @@ namespace binfilter {
/*N*/ void PolyPolygon3D::RemoveDoublePoints()
/*N*/ {
/*N*/ CheckReference();
-/*N*/ UINT16 nCnt = Count();
-/*N*/
-/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->RemoveDoublePoints();
+/*N*/ size_t nCnt = Count();
+/*N*/
+/*N*/ for ( size_t i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList[ i ]->RemoveDoublePoints();
/*N*/ }
/*************************************************************************
@@ -1637,12 +1640,12 @@ namespace binfilter {
/*N*/ const Polygon3D& rOrig = rPolyOrig[a];
/*N*/ Polygon3D& rPoly = (*this)[a];
/*N*/ UINT16 nPntCnt = rOrig.GetPointCount();
-/*N*/
+/*N*/
/*N*/ if(nPntCnt == rPoly.GetPointCount() && nPntCnt > 2)
/*N*/ {
/*N*/ UINT16 nNumDiff(0);
/*N*/ UINT16 nDoneStart(0xffff);
-/*N*/
+/*N*/
/*N*/ // Testen auf Anzahl Aenderungen
/*N*/ UINT16 b;
/*N*/ for(b=0;b<nPntCnt;b++)
@@ -1660,12 +1663,12 @@ namespace binfilter {
/*N*/ }
/*N*/ }
/*N*/ }
-/*N*/
+/*N*/
/*N*/ if(nNumDiff == nPntCnt)
/*N*/ {
/*N*/ // Komplett umgedreht, alles auf einen Punkt
/*N*/ Vector3D aMiddle = rPoly.GetMiddle();
-/*N*/
+/*N*/
/*N*/ for(b=0;b<nPntCnt;b++)
/*N*/ {
/*N*/ rPoly[b] = aMiddle;
@@ -1678,17 +1681,17 @@ namespace binfilter {
/*N*/ UINT16 nDoneEnd(nDoneStart);
/*N*/ UINT16 nStartLoop;
/*N*/ BOOL bInLoop(FALSE);
-/*N*/
+/*N*/
/*N*/ // einen step mehr in der Schleife, um Loops abzuschliessen
/*N*/ BOOL bFirstStep(TRUE);
-/*N*/
+/*N*/
/*N*/ while(nDoneEnd != nDoneStart || bFirstStep)
/*N*/ {
/*N*/ bFirstStep = FALSE;
-/*N*/
+/*N*/
/*N*/ // nCandidate ist Kandidat fuer Test
/*N*/ UINT16 nCandidate = (nDoneEnd == nPntCnt-1) ? 0 : nDoneEnd+1;
-/*N*/
+/*N*/
/*N*/ if(rOrig.GetPointOrientation(nCandidate) == rPoly.GetPointOrientation(nCandidate))
/*N*/ {
/*N*/ // Orientierung ist gleich
@@ -1698,17 +1701,17 @@ namespace binfilter {
/*N*/ Vector3D aMiddle;
/*N*/ UINT16 nCounter(0);
/*N*/ UINT16 nStart(nStartLoop);
-/*N*/
+/*N*/
/*N*/ while(nStart != nCandidate)
/*N*/ {
/*N*/ aMiddle += rPoly[nStart];
/*N*/ nCounter++;
/*N*/ nStart = (nStart == nPntCnt-1) ? 0 : nStart+1;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ // Mittelwert bilden
/*N*/ aMiddle /= (double)nCounter;
-/*N*/
+/*N*/
/*N*/ // Punkte umsetzen
/*N*/ nStart = nStartLoop;
/*N*/ while(nStart != nCandidate)
@@ -1716,7 +1719,7 @@ namespace binfilter {
/*N*/ rPoly[nStart] = aMiddle;
/*N*/ nStart = (nStart == nPntCnt-1) ? 0 : nStart+1;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ // Loop beenden
/*N*/ bInLoop = FALSE;
/*N*/ }
@@ -1731,7 +1734,7 @@ namespace binfilter {
/*N*/ bInLoop = TRUE;
/*N*/ }
/*N*/ }
-/*N*/
+/*N*/
/*N*/ // Weitergehen
/*N*/ nDoneEnd = nCandidate;
/*N*/ }
@@ -1754,7 +1757,7 @@ namespace binfilter {
|* Remove all completely overlapping polygons
|*
\************************************************************************/
-
+
/*************************************************************************
|*
@@ -1765,43 +1768,43 @@ namespace binfilter {
/*N*/ SvStream& operator>>(SvStream& rIStream, PolyPolygon3D& rPolyPoly3D)
/*N*/ {
/*N*/ DBG_CHKOBJ(&rPolyPoly3D, PolyPolygon3D, NULL);
-/*N*/
+/*N*/
/*N*/ Polygon3D* pPoly3D;
-/*N*/
+/*N*/
/*N*/ // Anzahl der Polygone einlesen
/*N*/ UINT16 nPolyCount;
/*N*/ rIStream >> nPolyCount;
-/*N*/
+/*N*/
/*N*/ BOOL bTruncated = FALSE;
/*N*/ // Gesamtanzahl der Punkte mitzaehlen
/*N*/ ULONG nAllPointCount = 0;
-/*N*/
+/*N*/
/*N*/ if ( rPolyPoly3D.pImpPolyPolygon3D->nRefCount > 1 )
/*?*/ rPolyPoly3D.pImpPolyPolygon3D->nRefCount--;
/*N*/ else
/*N*/ delete rPolyPoly3D.pImpPolyPolygon3D;
-/*N*/
-/*N*/ rPolyPoly3D.pImpPolyPolygon3D = new ImpPolyPolygon3D(nPolyCount);
-/*N*/
+/*N*/
+/*N*/ rPolyPoly3D.pImpPolyPolygon3D = new ImpPolyPolygon3D();
+/*N*/
/*N*/ while ( nPolyCount > 0 )
/*N*/ {
/*N*/ pPoly3D = new Polygon3D;
/*N*/ rIStream >> *pPoly3D;
/*N*/ nAllPointCount += pPoly3D->GetPointCount();
-/*N*/
+/*N*/
/*N*/ if ( !bTruncated )
/*N*/ {
/*N*/ if ( nAllPointCount > POLY3D_MAXPOINTS )
-/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
+/*N*/ {DBG_BF_ASSERT(0, "STRIP"); //STRIP001
/*N*/ }
-/*N*/ rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.Insert(pPoly3D, LIST_APPEND);
+/*N*/ rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.push_back( pPoly3D );
/*N*/ }
/*N*/ else
/*?*/ delete pPoly3D;
-/*N*/
+/*N*/
/*N*/ nPolyCount--;
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return rIStream;
/*N*/ }
@@ -1814,25 +1817,20 @@ namespace binfilter {
/*N*/ SvStream& operator<<(SvStream& rOStream, const PolyPolygon3D& rPolyPoly3D)
/*N*/ {
/*N*/ DBG_CHKOBJ(&rPolyPoly3D, PolyPolygon3D, NULL);
-/*N*/
+/*N*/
/*N*/ // Anzahl der Polygone rausschreiben
/*N*/ rOStream << rPolyPoly3D.Count();
-/*N*/
+/*N*/
/*N*/ // Die einzelnen Polygone ausgeben
-/*N*/ Polygon3D* pPoly3D = rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.First();
-/*N*/
-/*N*/ while( pPoly3D )
-/*N*/ {
-/*N*/ rOStream << *pPoly3D;
-/*N*/ pPoly3D = rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.Next();
-/*N*/ }
-/*N*/
+ for ( size_t i = 0, n = rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList.size(); i < n; ++i )
+ rOStream << *rPolyPoly3D.pImpPolyPolygon3D->aPoly3DList[ i ];
+/*N*/
/*N*/ return rOStream;
/*N*/ }
/*N*/ Vector3D PolyPolygon3D::GetNormal() const
/*N*/ {
-/*N*/ if(pImpPolyPolygon3D->aPoly3DList.Count())
+/*N*/ if( pImpPolyPolygon3D->aPoly3DList.size() )
/*N*/ return (*this)[0].GetNormal();
/*N*/ return Vector3D(0.0, 0.0, -1.0);
/*N*/ }
@@ -1846,15 +1844,15 @@ namespace binfilter {
/*N*/ void PolyPolygon3D::FlipDirections()
/*N*/ {
/*N*/ CheckReference();
-/*N*/ UINT16 nCnt = Count();
-/*N*/
-/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ pImpPolyPolygon3D->aPoly3DList.GetObject(i)->FlipDirection();
+/*N*/ size_t nCnt = Count();
+/*N*/
+/*N*/ for ( size_t i = 0; i < nCnt; i++ )
+/*N*/ pImpPolyPolygon3D->aPoly3DList[ i ]->FlipDirection();
/*N*/ }
/*N*/ Vector3D PolyPolygon3D::GetMiddle() const
/*N*/ {
-/*N*/ if(pImpPolyPolygon3D->aPoly3DList.Count())
+/*N*/ if( pImpPolyPolygon3D->aPoly3DList.size() )
/*N*/ return (*this)[0].GetMiddle();
/*N*/ return Vector3D();
/*N*/ }
@@ -1862,10 +1860,10 @@ namespace binfilter {
/*N*/ BOOL PolyPolygon3D::IsClosed() const
/*N*/ {
/*N*/ BOOL bClosed = TRUE;
-/*N*/ UINT16 nCnt = Count();
-/*N*/
-/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
-/*N*/ if(!pImpPolyPolygon3D->aPoly3DList.GetObject(i)->IsClosed())
+/*N*/ size_t nCnt = Count();
+/*N*/
+/*N*/ for ( size_t i = 0; i < nCnt; i++ )
+/*N*/ if( !pImpPolyPolygon3D->aPoly3DList[ i ]->IsClosed() )
/*N*/ bClosed = FALSE;
/*N*/ return bClosed;
/*N*/ }
@@ -1880,10 +1878,10 @@ namespace binfilter {
/*N*/ {
/*N*/ PolyPolygon aPolyPolygon;
/*N*/ UINT16 nCnt = Count();
-/*N*/
+/*N*/
/*N*/ for(UINT16 i=0; i<nCnt;i++)
/*N*/ aPolyPolygon.Insert((*this)[i].GetPolygon());
-/*N*/
+/*N*/
/*N*/ return(aPolyPolygon);
/*N*/ }
@@ -1898,14 +1896,14 @@ namespace binfilter {
/*N*/ UINT16 nCnt = Count();
/*N*/ Volume3D aRetval;
/*N*/ Volume3D aSubVolume;
-/*N*/
+/*N*/
/*N*/ aRetval.Reset();
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
/*N*/ {
/*N*/ aSubVolume = (*this)[i].GetPolySize();
/*N*/ aRetval.Union(aSubVolume);
/*N*/ }
-/*N*/
+/*N*/
/*N*/ return aRetval;
/*N*/ }
@@ -1919,7 +1917,7 @@ namespace binfilter {
/*N*/ {
/*N*/ UINT16 nCnt = Count();
/*N*/ double fRetval = 0.0;
-/*N*/
+/*N*/
/*N*/ // Einzelflaechen aufsummieren
/*N*/ Vector3D aNormal = GetNormal();
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
@@ -1946,10 +1944,10 @@ namespace binfilter {
/*N*/ {
/*N*/ UINT16 nCnt = Count();
/*N*/ double fRetval = 0.0;
-/*N*/
+/*N*/
/*N*/ for ( UINT16 i = 0; i < nCnt; i++ )
/*N*/ fRetval += (*this)[i].GetLength();
-/*N*/
+/*N*/
/*N*/ return fRetval;
/*N*/ }
More information about the Libreoffice-commits
mailing list