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