1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_basegfx.hxx" 30*cdf0e10cSrcweir #include <osl/diagnose.h> 31*cdf0e10cSrcweir #include <basegfx/polygon/b3dpolypolygon.hxx> 32*cdf0e10cSrcweir #include <basegfx/polygon/b3dpolygon.hxx> 33*cdf0e10cSrcweir #include <rtl/instance.hxx> 34*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 35*cdf0e10cSrcweir #include <basegfx/matrix/b3dhommatrix.hxx> 36*cdf0e10cSrcweir #include <functional> 37*cdf0e10cSrcweir #include <vector> 38*cdf0e10cSrcweir #include <algorithm> 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir class ImplB3DPolyPolygon 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir typedef ::std::vector< ::basegfx::B3DPolygon > PolygonVector; 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir PolygonVector maPolygons; 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir public: 49*cdf0e10cSrcweir ImplB3DPolyPolygon() : maPolygons() 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir } 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir ImplB3DPolyPolygon(const ::basegfx::B3DPolygon& rToBeCopied) : 54*cdf0e10cSrcweir maPolygons(1,rToBeCopied) 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir bool operator==(const ImplB3DPolyPolygon& rPolygonList) const 59*cdf0e10cSrcweir { 60*cdf0e10cSrcweir // same polygon count? 61*cdf0e10cSrcweir if(maPolygons.size() != rPolygonList.maPolygons.size()) 62*cdf0e10cSrcweir return false; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir // compare polygon content 65*cdf0e10cSrcweir if(maPolygons != rPolygonList.maPolygons) 66*cdf0e10cSrcweir return false; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir return true; 69*cdf0e10cSrcweir } 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir const ::basegfx::B3DPolygon& getB3DPolygon(sal_uInt32 nIndex) const 72*cdf0e10cSrcweir { 73*cdf0e10cSrcweir return maPolygons[nIndex]; 74*cdf0e10cSrcweir } 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir void setB3DPolygon(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rPolygon) 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir maPolygons[nIndex] = rPolygon; 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir void insert(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rPolygon, sal_uInt32 nCount) 82*cdf0e10cSrcweir { 83*cdf0e10cSrcweir if(nCount) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir // add nCount copies of rPolygon 86*cdf0e10cSrcweir PolygonVector::iterator aIndex(maPolygons.begin()); 87*cdf0e10cSrcweir aIndex += nIndex; 88*cdf0e10cSrcweir maPolygons.insert(aIndex, nCount, rPolygon); 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir void insert(sal_uInt32 nIndex, const ::basegfx::B3DPolyPolygon& rPolyPolygon) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir const sal_uInt32 nCount = rPolyPolygon.count(); 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir if(nCount) 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir // add nCount polygons from rPolyPolygon 99*cdf0e10cSrcweir maPolygons.reserve(maPolygons.size() + nCount); 100*cdf0e10cSrcweir PolygonVector::iterator aIndex(maPolygons.begin()); 101*cdf0e10cSrcweir aIndex += nIndex; 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < nCount; a++) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir maPolygons.insert(aIndex, rPolyPolygon.getB3DPolygon(a)); 106*cdf0e10cSrcweir aIndex++; 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir void remove(sal_uInt32 nIndex, sal_uInt32 nCount) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir if(nCount) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir // remove polygon data 116*cdf0e10cSrcweir PolygonVector::iterator aStart(maPolygons.begin()); 117*cdf0e10cSrcweir aStart += nIndex; 118*cdf0e10cSrcweir const PolygonVector::iterator aEnd(aStart + nCount); 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir maPolygons.erase(aStart, aEnd); 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir sal_uInt32 count() const 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir return maPolygons.size(); 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir void setClosed(bool bNew) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir maPolygons[a].setClosed(bNew); 134*cdf0e10cSrcweir } 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir void flip() 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir std::for_each( maPolygons.begin(), 140*cdf0e10cSrcweir maPolygons.end(), 141*cdf0e10cSrcweir std::mem_fun_ref( &::basegfx::B3DPolygon::flip )); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir void removeDoublePoints() 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir std::for_each( maPolygons.begin(), 147*cdf0e10cSrcweir maPolygons.end(), 148*cdf0e10cSrcweir std::mem_fun_ref( &::basegfx::B3DPolygon::removeDoublePoints )); 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir void transform(const ::basegfx::B3DHomMatrix& rMatrix) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir maPolygons[a].transform(rMatrix); 156*cdf0e10cSrcweir } 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir void clearBColors() 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir maPolygons[a].clearBColors(); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir void transformNormals(const ::basegfx::B3DHomMatrix& rMatrix) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir maPolygons[a].transformNormals(rMatrix); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir void clearNormals() 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir maPolygons[a].clearNormals(); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir 183*cdf0e10cSrcweir void transformTextureCoordiantes(const ::basegfx::B2DHomMatrix& rMatrix) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir maPolygons[a].transformTextureCoordiantes(rMatrix); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir void clearTextureCoordinates() 192*cdf0e10cSrcweir { 193*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < maPolygons.size(); a++) 194*cdf0e10cSrcweir { 195*cdf0e10cSrcweir maPolygons[a].clearTextureCoordinates(); 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir void makeUnique() 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir std::for_each( maPolygons.begin(), 202*cdf0e10cSrcweir maPolygons.end(), 203*cdf0e10cSrcweir std::mem_fun_ref( &::basegfx::B3DPolygon::makeUnique )); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir }; 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir namespace basegfx 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir namespace { struct DefaultPolyPolygon : public rtl::Static<B3DPolyPolygon::ImplType, 212*cdf0e10cSrcweir DefaultPolyPolygon> {}; } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir B3DPolyPolygon::B3DPolyPolygon() : 215*cdf0e10cSrcweir mpPolyPolygon(DefaultPolyPolygon::get()) 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir B3DPolyPolygon::B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon) : 220*cdf0e10cSrcweir mpPolyPolygon(rPolyPolygon.mpPolyPolygon) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir } 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir B3DPolyPolygon::B3DPolyPolygon(const B3DPolygon& rPolygon) : 225*cdf0e10cSrcweir mpPolyPolygon( ImplB3DPolyPolygon(rPolygon) ) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir B3DPolyPolygon::~B3DPolyPolygon() 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir B3DPolyPolygon& B3DPolyPolygon::operator=(const B3DPolyPolygon& rPolyPolygon) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir mpPolyPolygon = rPolyPolygon.mpPolyPolygon; 236*cdf0e10cSrcweir return *this; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir void B3DPolyPolygon::makeUnique() 240*cdf0e10cSrcweir { 241*cdf0e10cSrcweir mpPolyPolygon.make_unique(); 242*cdf0e10cSrcweir mpPolyPolygon->makeUnique(); 243*cdf0e10cSrcweir } 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir bool B3DPolyPolygon::operator==(const B3DPolyPolygon& rPolyPolygon) const 246*cdf0e10cSrcweir { 247*cdf0e10cSrcweir if(mpPolyPolygon.same_object(rPolyPolygon.mpPolyPolygon)) 248*cdf0e10cSrcweir return true; 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir return ((*mpPolyPolygon) == (*rPolyPolygon.mpPolyPolygon)); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir bool B3DPolyPolygon::operator!=(const B3DPolyPolygon& rPolyPolygon) const 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir return !(*this == rPolyPolygon); 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir sal_uInt32 B3DPolyPolygon::count() const 259*cdf0e10cSrcweir { 260*cdf0e10cSrcweir return mpPolyPolygon->count(); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir B3DPolygon B3DPolyPolygon::getB3DPolygon(sal_uInt32 nIndex) const 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)"); 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir return mpPolyPolygon->getB3DPolygon(nIndex); 268*cdf0e10cSrcweir } 269*cdf0e10cSrcweir 270*cdf0e10cSrcweir void B3DPolyPolygon::setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon) 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B3DPolyPolygon access outside range (!)"); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir if(getB3DPolygon(nIndex) != rPolygon) 275*cdf0e10cSrcweir mpPolyPolygon->setB3DPolygon(nIndex, rPolygon); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir 278*cdf0e10cSrcweir bool B3DPolyPolygon::areBColorsUsed() const 279*cdf0e10cSrcweir { 280*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++) 281*cdf0e10cSrcweir { 282*cdf0e10cSrcweir if((mpPolyPolygon->getB3DPolygon(a)).areBColorsUsed()) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir return true; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir return false; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir void B3DPolyPolygon::clearBColors() 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir if(areBColorsUsed()) 294*cdf0e10cSrcweir mpPolyPolygon->clearBColors(); 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir void B3DPolyPolygon::transformNormals(const B3DHomMatrix& rMatrix) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir if(!rMatrix.isIdentity()) 300*cdf0e10cSrcweir mpPolyPolygon->transformNormals(rMatrix); 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir bool B3DPolyPolygon::areNormalsUsed() const 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++) 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir if((mpPolyPolygon->getB3DPolygon(a)).areNormalsUsed()) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir return true; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir return false; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir void B3DPolyPolygon::clearNormals() 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir if(areNormalsUsed()) 319*cdf0e10cSrcweir mpPolyPolygon->clearNormals(); 320*cdf0e10cSrcweir } 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir void B3DPolyPolygon::transformTextureCoordiantes(const B2DHomMatrix& rMatrix) 323*cdf0e10cSrcweir { 324*cdf0e10cSrcweir if(!rMatrix.isIdentity()) 325*cdf0e10cSrcweir mpPolyPolygon->transformTextureCoordiantes(rMatrix); 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir bool B3DPolyPolygon::areTextureCoordinatesUsed() const 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir if((mpPolyPolygon->getB3DPolygon(a)).areTextureCoordinatesUsed()) 333*cdf0e10cSrcweir { 334*cdf0e10cSrcweir return true; 335*cdf0e10cSrcweir } 336*cdf0e10cSrcweir } 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir return false; 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir void B3DPolyPolygon::clearTextureCoordinates() 342*cdf0e10cSrcweir { 343*cdf0e10cSrcweir if(areTextureCoordinatesUsed()) 344*cdf0e10cSrcweir mpPolyPolygon->clearTextureCoordinates(); 345*cdf0e10cSrcweir } 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)"); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir if(nCount) 352*cdf0e10cSrcweir mpPolyPolygon->insert(nIndex, rPolygon, nCount); 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir void B3DPolyPolygon::append(const B3DPolygon& rPolygon, sal_uInt32 nCount) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir if(nCount) 358*cdf0e10cSrcweir mpPolyPolygon->insert(mpPolyPolygon->count(), rPolygon, nCount); 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir void B3DPolyPolygon::insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B3DPolyPolygon Insert outside range (!)"); 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir if(rPolyPolygon.count()) 366*cdf0e10cSrcweir mpPolyPolygon->insert(nIndex, rPolyPolygon); 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir 369*cdf0e10cSrcweir void B3DPolyPolygon::append(const B3DPolyPolygon& rPolyPolygon) 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir if(rPolyPolygon.count()) 372*cdf0e10cSrcweir mpPolyPolygon->insert(mpPolyPolygon->count(), rPolyPolygon); 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir void B3DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B3DPolyPolygon Remove outside range (!)"); 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir if(nCount) 380*cdf0e10cSrcweir mpPolyPolygon->remove(nIndex, nCount); 381*cdf0e10cSrcweir } 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir void B3DPolyPolygon::clear() 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir mpPolyPolygon = DefaultPolyPolygon::get(); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir bool B3DPolyPolygon::isClosed() const 389*cdf0e10cSrcweir { 390*cdf0e10cSrcweir bool bRetval(true); 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir // PolyPOlygon is closed when all contained Polygons are closed or 393*cdf0e10cSrcweir // no Polygon exists. 394*cdf0e10cSrcweir for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir if(!(mpPolyPolygon->getB3DPolygon(a)).isClosed()) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir bRetval = false; 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir return bRetval; 403*cdf0e10cSrcweir } 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir void B3DPolyPolygon::setClosed(bool bNew) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir if(bNew != isClosed()) 408*cdf0e10cSrcweir mpPolyPolygon->setClosed(bNew); 409*cdf0e10cSrcweir } 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir void B3DPolyPolygon::flip() 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir mpPolyPolygon->flip(); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir bool B3DPolyPolygon::hasDoublePoints() const 417*cdf0e10cSrcweir { 418*cdf0e10cSrcweir bool bRetval(false); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++) 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir if((mpPolyPolygon->getB3DPolygon(a)).hasDoublePoints()) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir bRetval = true; 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir return bRetval; 429*cdf0e10cSrcweir } 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir void B3DPolyPolygon::removeDoublePoints() 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir if(hasDoublePoints()) 434*cdf0e10cSrcweir mpPolyPolygon->removeDoublePoints(); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir 437*cdf0e10cSrcweir void B3DPolyPolygon::transform(const B3DHomMatrix& rMatrix) 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir if(mpPolyPolygon->count() && !rMatrix.isIdentity()) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir mpPolyPolygon->transform(rMatrix); 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir } // end of namespace basegfx 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir // eof 447