xref: /AOO41X/main/basegfx/source/polygon/b2dpolypolygon.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 <basegfx/polygon/b2dpolypolygon.hxx>
31*cdf0e10cSrcweir #include <osl/diagnose.h>
32*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
33*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
34*cdf0e10cSrcweir #include <rtl/instance.hxx>
35*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir #include <functional>
38*cdf0e10cSrcweir #include <vector>
39*cdf0e10cSrcweir #include <algorithm>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class ImplB2DPolyPolygon
44*cdf0e10cSrcweir {
45*cdf0e10cSrcweir 	typedef ::std::vector< basegfx::B2DPolygon >	PolygonVector;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 	PolygonVector									maPolygons;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir public:
50*cdf0e10cSrcweir 	ImplB2DPolyPolygon() : maPolygons()
51*cdf0e10cSrcweir     {
52*cdf0e10cSrcweir     }
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 	ImplB2DPolyPolygon(const basegfx::B2DPolygon& rToBeCopied) :
55*cdf0e10cSrcweir         maPolygons(1,rToBeCopied)
56*cdf0e10cSrcweir 	{
57*cdf0e10cSrcweir 	}
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	bool operator==(const ImplB2DPolyPolygon& rPolygonList) const
60*cdf0e10cSrcweir 	{
61*cdf0e10cSrcweir 		// same polygon count?
62*cdf0e10cSrcweir 		if(maPolygons.size() != rPolygonList.maPolygons.size())
63*cdf0e10cSrcweir 			return false;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 		// compare polygon content
66*cdf0e10cSrcweir 		if(!(maPolygons == rPolygonList.maPolygons))
67*cdf0e10cSrcweir 			return false;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 		return true;
70*cdf0e10cSrcweir 	}
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir 	const basegfx::B2DPolygon& getB2DPolygon(sal_uInt32 nIndex) const
73*cdf0e10cSrcweir 	{
74*cdf0e10cSrcweir 		return maPolygons[nIndex];
75*cdf0e10cSrcweir 	}
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 	void setB2DPolygon(sal_uInt32 nIndex, const basegfx::B2DPolygon& rPolygon)
78*cdf0e10cSrcweir 	{
79*cdf0e10cSrcweir 		maPolygons[nIndex] = rPolygon;
80*cdf0e10cSrcweir 	}
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir 	void insert(sal_uInt32 nIndex, const basegfx::B2DPolygon& rPolygon, sal_uInt32 nCount)
83*cdf0e10cSrcweir 	{
84*cdf0e10cSrcweir 		if(nCount)
85*cdf0e10cSrcweir 		{
86*cdf0e10cSrcweir 			// add nCount copies of rPolygon
87*cdf0e10cSrcweir 			PolygonVector::iterator aIndex(maPolygons.begin());
88*cdf0e10cSrcweir 			aIndex += nIndex;
89*cdf0e10cSrcweir 			maPolygons.insert(aIndex, nCount, rPolygon);
90*cdf0e10cSrcweir 		}
91*cdf0e10cSrcweir 	}
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir 	void insert(sal_uInt32 nIndex, const basegfx::B2DPolyPolygon& rPolyPolygon)
94*cdf0e10cSrcweir 	{
95*cdf0e10cSrcweir 		const sal_uInt32 nCount = rPolyPolygon.count();
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir 		if(nCount)
98*cdf0e10cSrcweir 		{
99*cdf0e10cSrcweir 			// add nCount polygons from rPolyPolygon
100*cdf0e10cSrcweir 			maPolygons.reserve(maPolygons.size() + nCount);
101*cdf0e10cSrcweir 			PolygonVector::iterator aIndex(maPolygons.begin());
102*cdf0e10cSrcweir 			aIndex += nIndex;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 			for(sal_uInt32 a(0L); a < nCount; a++)
105*cdf0e10cSrcweir 			{
106*cdf0e10cSrcweir 				aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a));
107*cdf0e10cSrcweir 				aIndex++;
108*cdf0e10cSrcweir 			}
109*cdf0e10cSrcweir 		}
110*cdf0e10cSrcweir 	}
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
113*cdf0e10cSrcweir 	{
114*cdf0e10cSrcweir 		if(nCount)
115*cdf0e10cSrcweir 		{
116*cdf0e10cSrcweir 			// remove polygon data
117*cdf0e10cSrcweir 			PolygonVector::iterator aStart(maPolygons.begin());
118*cdf0e10cSrcweir 			aStart += nIndex;
119*cdf0e10cSrcweir 			const PolygonVector::iterator aEnd(aStart + nCount);
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 			maPolygons.erase(aStart, aEnd);
122*cdf0e10cSrcweir 		}
123*cdf0e10cSrcweir 	}
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	sal_uInt32 count() const
126*cdf0e10cSrcweir 	{
127*cdf0e10cSrcweir 		return maPolygons.size();
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	void setClosed(bool bNew)
131*cdf0e10cSrcweir 	{
132*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
133*cdf0e10cSrcweir 		{
134*cdf0e10cSrcweir 			maPolygons[a].setClosed(bNew);
135*cdf0e10cSrcweir 		}
136*cdf0e10cSrcweir 	}
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	void flip()
139*cdf0e10cSrcweir 	{
140*cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
141*cdf0e10cSrcweir                        maPolygons.end(),
142*cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::flip ));
143*cdf0e10cSrcweir 	}
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	void removeDoublePoints()
146*cdf0e10cSrcweir 	{
147*cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
148*cdf0e10cSrcweir                        maPolygons.end(),
149*cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::removeDoublePoints ));
150*cdf0e10cSrcweir 	}
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	void transform(const basegfx::B2DHomMatrix& rMatrix)
153*cdf0e10cSrcweir 	{
154*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
155*cdf0e10cSrcweir 		{
156*cdf0e10cSrcweir 			maPolygons[a].transform(rMatrix);
157*cdf0e10cSrcweir 		}
158*cdf0e10cSrcweir 	}
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir     void makeUnique()
161*cdf0e10cSrcweir     {
162*cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
163*cdf0e10cSrcweir                        maPolygons.end(),
164*cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
165*cdf0e10cSrcweir     }
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir     const basegfx::B2DPolygon* begin() const
168*cdf0e10cSrcweir     {
169*cdf0e10cSrcweir         if(maPolygons.empty())
170*cdf0e10cSrcweir             return 0;
171*cdf0e10cSrcweir         else
172*cdf0e10cSrcweir             return &maPolygons.front();
173*cdf0e10cSrcweir     }
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir     const basegfx::B2DPolygon* end() const
176*cdf0e10cSrcweir     {
177*cdf0e10cSrcweir         if(maPolygons.empty())
178*cdf0e10cSrcweir             return 0;
179*cdf0e10cSrcweir         else
180*cdf0e10cSrcweir             return (&maPolygons.back())+1;
181*cdf0e10cSrcweir     }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir     basegfx::B2DPolygon* begin()
184*cdf0e10cSrcweir     {
185*cdf0e10cSrcweir         if(maPolygons.empty())
186*cdf0e10cSrcweir             return 0;
187*cdf0e10cSrcweir         else
188*cdf0e10cSrcweir             return &maPolygons.front();
189*cdf0e10cSrcweir     }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir     basegfx::B2DPolygon* end()
192*cdf0e10cSrcweir     {
193*cdf0e10cSrcweir         if(maPolygons.empty())
194*cdf0e10cSrcweir             return 0;
195*cdf0e10cSrcweir         else
196*cdf0e10cSrcweir             return &(maPolygons.back())+1;
197*cdf0e10cSrcweir     }
198*cdf0e10cSrcweir };
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir namespace basegfx
203*cdf0e10cSrcweir {
204*cdf0e10cSrcweir     namespace { struct DefaultPolyPolygon: public rtl::Static<B2DPolyPolygon::ImplType,
205*cdf0e10cSrcweir                                                               DefaultPolyPolygon> {}; }
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon() :
208*cdf0e10cSrcweir         mpPolyPolygon(DefaultPolyPolygon::get())
209*cdf0e10cSrcweir 	{
210*cdf0e10cSrcweir 	}
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon) :
213*cdf0e10cSrcweir         mpPolyPolygon(rPolyPolygon.mpPolyPolygon)
214*cdf0e10cSrcweir 	{
215*cdf0e10cSrcweir 	}
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon(const B2DPolygon& rPolygon) :
218*cdf0e10cSrcweir         mpPolyPolygon( ImplB2DPolyPolygon(rPolygon) )
219*cdf0e10cSrcweir 	{
220*cdf0e10cSrcweir 	}
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	B2DPolyPolygon::~B2DPolyPolygon()
223*cdf0e10cSrcweir 	{
224*cdf0e10cSrcweir 	}
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 	B2DPolyPolygon& B2DPolyPolygon::operator=(const B2DPolyPolygon& rPolyPolygon)
227*cdf0e10cSrcweir 	{
228*cdf0e10cSrcweir 		mpPolyPolygon = rPolyPolygon.mpPolyPolygon;
229*cdf0e10cSrcweir 		return *this;
230*cdf0e10cSrcweir 	}
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir     void B2DPolyPolygon::makeUnique()
233*cdf0e10cSrcweir     {
234*cdf0e10cSrcweir         mpPolyPolygon.make_unique();
235*cdf0e10cSrcweir         mpPolyPolygon->makeUnique();
236*cdf0e10cSrcweir     }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir 	bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const
239*cdf0e10cSrcweir 	{
240*cdf0e10cSrcweir 		if(mpPolyPolygon.same_object(rPolyPolygon.mpPolyPolygon))
241*cdf0e10cSrcweir 			return true;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 		return ((*mpPolyPolygon) == (*rPolyPolygon.mpPolyPolygon));
244*cdf0e10cSrcweir 	}
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 	bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const
247*cdf0e10cSrcweir 	{
248*cdf0e10cSrcweir         return !((*this) == rPolyPolygon);
249*cdf0e10cSrcweir 	}
250*cdf0e10cSrcweir 
251*cdf0e10cSrcweir 	sal_uInt32 B2DPolyPolygon::count() const
252*cdf0e10cSrcweir 	{
253*cdf0e10cSrcweir 		return mpPolyPolygon->count();
254*cdf0e10cSrcweir 	}
255*cdf0e10cSrcweir 
256*cdf0e10cSrcweir 	B2DPolygon B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
257*cdf0e10cSrcweir 	{
258*cdf0e10cSrcweir 		OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 		return mpPolyPolygon->getB2DPolygon(nIndex);
261*cdf0e10cSrcweir 	}
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 	void B2DPolyPolygon::setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon)
264*cdf0e10cSrcweir 	{
265*cdf0e10cSrcweir 		OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir 		if(getB2DPolygon(nIndex) != rPolygon)
268*cdf0e10cSrcweir 			mpPolyPolygon->setB2DPolygon(nIndex, rPolygon);
269*cdf0e10cSrcweir 	}
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	bool B2DPolyPolygon::areControlPointsUsed() const
272*cdf0e10cSrcweir 	{
273*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
274*cdf0e10cSrcweir 		{
275*cdf0e10cSrcweir 			const B2DPolygon& rPolygon = mpPolyPolygon->getB2DPolygon(a);
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 			if(rPolygon.areControlPointsUsed())
278*cdf0e10cSrcweir 			{
279*cdf0e10cSrcweir 				return true;
280*cdf0e10cSrcweir 			}
281*cdf0e10cSrcweir 		}
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 		return false;
284*cdf0e10cSrcweir 	}
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir 	void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount)
287*cdf0e10cSrcweir 	{
288*cdf0e10cSrcweir 		OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)");
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		if(nCount)
291*cdf0e10cSrcweir 			mpPolyPolygon->insert(nIndex, rPolygon, nCount);
292*cdf0e10cSrcweir 	}
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 	void B2DPolyPolygon::append(const B2DPolygon& rPolygon, sal_uInt32 nCount)
295*cdf0e10cSrcweir 	{
296*cdf0e10cSrcweir 		if(nCount)
297*cdf0e10cSrcweir 			mpPolyPolygon->insert(mpPolyPolygon->count(), rPolygon, nCount);
298*cdf0e10cSrcweir 	}
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir     B2DPolyPolygon B2DPolyPolygon::getDefaultAdaptiveSubdivision() const
301*cdf0e10cSrcweir 	{
302*cdf0e10cSrcweir 		B2DPolyPolygon aRetval;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
305*cdf0e10cSrcweir 		{
306*cdf0e10cSrcweir 			aRetval.append(mpPolyPolygon->getB2DPolygon(a).getDefaultAdaptiveSubdivision());
307*cdf0e10cSrcweir 		}
308*cdf0e10cSrcweir 
309*cdf0e10cSrcweir 		return aRetval;
310*cdf0e10cSrcweir 	}
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir     B2DRange B2DPolyPolygon::getB2DRange() const
313*cdf0e10cSrcweir     {
314*cdf0e10cSrcweir 		B2DRange aRetval;
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
317*cdf0e10cSrcweir 		{
318*cdf0e10cSrcweir 			aRetval.expand(mpPolyPolygon->getB2DPolygon(a).getB2DRange());
319*cdf0e10cSrcweir 		}
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 		return aRetval;
322*cdf0e10cSrcweir     }
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 	void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon)
325*cdf0e10cSrcweir 	{
326*cdf0e10cSrcweir 		OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)");
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir 		if(rPolyPolygon.count())
329*cdf0e10cSrcweir 			mpPolyPolygon->insert(nIndex, rPolyPolygon);
330*cdf0e10cSrcweir 	}
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 	void B2DPolyPolygon::append(const B2DPolyPolygon& rPolyPolygon)
333*cdf0e10cSrcweir 	{
334*cdf0e10cSrcweir 		if(rPolyPolygon.count())
335*cdf0e10cSrcweir 			mpPolyPolygon->insert(mpPolyPolygon->count(), rPolyPolygon);
336*cdf0e10cSrcweir 	}
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir 	void B2DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B2DPolyPolygon Remove outside range (!)");
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 		if(nCount)
343*cdf0e10cSrcweir 			mpPolyPolygon->remove(nIndex, nCount);
344*cdf0e10cSrcweir 	}
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 	void B2DPolyPolygon::clear()
347*cdf0e10cSrcweir 	{
348*cdf0e10cSrcweir 		mpPolyPolygon = DefaultPolyPolygon::get();
349*cdf0e10cSrcweir 	}
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	bool B2DPolyPolygon::isClosed() const
352*cdf0e10cSrcweir 	{
353*cdf0e10cSrcweir 		bool bRetval(true);
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 		// PolyPOlygon is closed when all contained Polygons are closed or
356*cdf0e10cSrcweir 		// no Polygon exists.
357*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++)
358*cdf0e10cSrcweir 		{
359*cdf0e10cSrcweir 			if(!(mpPolyPolygon->getB2DPolygon(a)).isClosed())
360*cdf0e10cSrcweir 			{
361*cdf0e10cSrcweir 				bRetval = false;
362*cdf0e10cSrcweir 			}
363*cdf0e10cSrcweir 		}
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 		return bRetval;
366*cdf0e10cSrcweir 	}
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 	void B2DPolyPolygon::setClosed(bool bNew)
369*cdf0e10cSrcweir 	{
370*cdf0e10cSrcweir 		if(bNew != isClosed())
371*cdf0e10cSrcweir 			mpPolyPolygon->setClosed(bNew);
372*cdf0e10cSrcweir 	}
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir 	void B2DPolyPolygon::flip()
375*cdf0e10cSrcweir 	{
376*cdf0e10cSrcweir 		if(mpPolyPolygon->count())
377*cdf0e10cSrcweir 		{
378*cdf0e10cSrcweir 			mpPolyPolygon->flip();
379*cdf0e10cSrcweir 		}
380*cdf0e10cSrcweir 	}
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 	bool B2DPolyPolygon::hasDoublePoints() const
383*cdf0e10cSrcweir 	{
384*cdf0e10cSrcweir 		bool bRetval(false);
385*cdf0e10cSrcweir 
386*cdf0e10cSrcweir 		for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++)
387*cdf0e10cSrcweir 		{
388*cdf0e10cSrcweir 			if((mpPolyPolygon->getB2DPolygon(a)).hasDoublePoints())
389*cdf0e10cSrcweir 			{
390*cdf0e10cSrcweir 				bRetval = true;
391*cdf0e10cSrcweir 			}
392*cdf0e10cSrcweir 		}
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 		return bRetval;
395*cdf0e10cSrcweir 	}
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 	void B2DPolyPolygon::removeDoublePoints()
398*cdf0e10cSrcweir 	{
399*cdf0e10cSrcweir 		if(hasDoublePoints())
400*cdf0e10cSrcweir 			mpPolyPolygon->removeDoublePoints();
401*cdf0e10cSrcweir 	}
402*cdf0e10cSrcweir 
403*cdf0e10cSrcweir 	void B2DPolyPolygon::transform(const B2DHomMatrix& rMatrix)
404*cdf0e10cSrcweir 	{
405*cdf0e10cSrcweir 		if(mpPolyPolygon->count() && !rMatrix.isIdentity())
406*cdf0e10cSrcweir 		{
407*cdf0e10cSrcweir 			mpPolyPolygon->transform(rMatrix);
408*cdf0e10cSrcweir 		}
409*cdf0e10cSrcweir 	}
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir     const B2DPolygon* B2DPolyPolygon::begin() const
412*cdf0e10cSrcweir     {
413*cdf0e10cSrcweir         return mpPolyPolygon->begin();
414*cdf0e10cSrcweir     }
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir     const B2DPolygon* B2DPolyPolygon::end() const
417*cdf0e10cSrcweir     {
418*cdf0e10cSrcweir         return mpPolyPolygon->end();
419*cdf0e10cSrcweir     }
420*cdf0e10cSrcweir 
421*cdf0e10cSrcweir     B2DPolygon* B2DPolyPolygon::begin()
422*cdf0e10cSrcweir     {
423*cdf0e10cSrcweir         return mpPolyPolygon->begin();
424*cdf0e10cSrcweir     }
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir     B2DPolygon* B2DPolyPolygon::end()
427*cdf0e10cSrcweir     {
428*cdf0e10cSrcweir         return mpPolyPolygon->end();
429*cdf0e10cSrcweir     }
430*cdf0e10cSrcweir } // end of namespace basegfx
431*cdf0e10cSrcweir 
432*cdf0e10cSrcweir // eof
433