xref: /AOO41X/main/basegfx/source/polygon/b2dpolypolygon.cxx (revision ddde725d65c83fe3ba1186d46f6e3e08f12ba47e)
109dbbe93SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
309dbbe93SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
409dbbe93SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
509dbbe93SAndrew Rist  * distributed with this work for additional information
609dbbe93SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
709dbbe93SAndrew Rist  * to you under the Apache License, Version 2.0 (the
809dbbe93SAndrew Rist  * "License"); you may not use this file except in compliance
909dbbe93SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
1109dbbe93SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
1309dbbe93SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1409dbbe93SAndrew Rist  * software distributed under the License is distributed on an
1509dbbe93SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1609dbbe93SAndrew Rist  * KIND, either express or implied.  See the License for the
1709dbbe93SAndrew Rist  * specific language governing permissions and limitations
1809dbbe93SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
2009dbbe93SAndrew Rist  *************************************************************/
2109dbbe93SAndrew Rist 
2209dbbe93SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_basegfx.hxx"
26cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
27cdf0e10cSrcweir #include <osl/diagnose.h>
28cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
29cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
30cdf0e10cSrcweir #include <rtl/instance.hxx>
31cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <functional>
34cdf0e10cSrcweir #include <vector>
35cdf0e10cSrcweir #include <algorithm>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class ImplB2DPolyPolygon
40cdf0e10cSrcweir {
41*ddde725dSArmin Le Grand 	basegfx::B2DPolygonVector                   maPolygons;
42cdf0e10cSrcweir 
43cdf0e10cSrcweir public:
ImplB2DPolyPolygon()44cdf0e10cSrcweir 	ImplB2DPolyPolygon() : maPolygons()
45cdf0e10cSrcweir     {
46cdf0e10cSrcweir     }
47cdf0e10cSrcweir 
ImplB2DPolyPolygon(const basegfx::B2DPolygon & rToBeCopied)48cdf0e10cSrcweir 	ImplB2DPolyPolygon(const basegfx::B2DPolygon& rToBeCopied) :
49cdf0e10cSrcweir         maPolygons(1,rToBeCopied)
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir 	}
52cdf0e10cSrcweir 
operator ==(const ImplB2DPolyPolygon & rPolygonList) const53cdf0e10cSrcweir 	bool operator==(const ImplB2DPolyPolygon& rPolygonList) const
54cdf0e10cSrcweir 	{
55cdf0e10cSrcweir 		// same polygon count?
56cdf0e10cSrcweir 		if(maPolygons.size() != rPolygonList.maPolygons.size())
57cdf0e10cSrcweir 			return false;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 		// compare polygon content
60cdf0e10cSrcweir 		if(!(maPolygons == rPolygonList.maPolygons))
61cdf0e10cSrcweir 			return false;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 		return true;
64cdf0e10cSrcweir 	}
65cdf0e10cSrcweir 
getB2DPolygon(sal_uInt32 nIndex) const66cdf0e10cSrcweir 	const basegfx::B2DPolygon& getB2DPolygon(sal_uInt32 nIndex) const
67cdf0e10cSrcweir 	{
68cdf0e10cSrcweir 		return maPolygons[nIndex];
69cdf0e10cSrcweir 	}
70cdf0e10cSrcweir 
setB2DPolygon(sal_uInt32 nIndex,const basegfx::B2DPolygon & rPolygon)71cdf0e10cSrcweir 	void setB2DPolygon(sal_uInt32 nIndex, const basegfx::B2DPolygon& rPolygon)
72cdf0e10cSrcweir 	{
73cdf0e10cSrcweir 		maPolygons[nIndex] = rPolygon;
74cdf0e10cSrcweir 	}
75cdf0e10cSrcweir 
insert(sal_uInt32 nIndex,const basegfx::B2DPolygon & rPolygon,sal_uInt32 nCount)76cdf0e10cSrcweir 	void insert(sal_uInt32 nIndex, const basegfx::B2DPolygon& rPolygon, sal_uInt32 nCount)
77cdf0e10cSrcweir 	{
78cdf0e10cSrcweir 		if(nCount)
79cdf0e10cSrcweir 		{
80cdf0e10cSrcweir 			// add nCount copies of rPolygon
81*ddde725dSArmin Le Grand 			basegfx::B2DPolygonVector::iterator aIndex(maPolygons.begin());
82cdf0e10cSrcweir 			aIndex += nIndex;
83cdf0e10cSrcweir 			maPolygons.insert(aIndex, nCount, rPolygon);
84cdf0e10cSrcweir 		}
85cdf0e10cSrcweir 	}
86cdf0e10cSrcweir 
insert(sal_uInt32 nIndex,const basegfx::B2DPolyPolygon & rPolyPolygon)87cdf0e10cSrcweir 	void insert(sal_uInt32 nIndex, const basegfx::B2DPolyPolygon& rPolyPolygon)
88cdf0e10cSrcweir 	{
89cdf0e10cSrcweir 		const sal_uInt32 nCount = rPolyPolygon.count();
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 		if(nCount)
92cdf0e10cSrcweir 		{
93cdf0e10cSrcweir 			// add nCount polygons from rPolyPolygon
94cdf0e10cSrcweir 			maPolygons.reserve(maPolygons.size() + nCount);
95*ddde725dSArmin Le Grand 			basegfx::B2DPolygonVector::iterator aIndex(maPolygons.begin());
96cdf0e10cSrcweir 			aIndex += nIndex;
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 			for(sal_uInt32 a(0L); a < nCount; a++)
99cdf0e10cSrcweir 			{
100cdf0e10cSrcweir 				aIndex = maPolygons.insert(aIndex, rPolyPolygon.getB2DPolygon(a));
101cdf0e10cSrcweir 				aIndex++;
102cdf0e10cSrcweir 			}
103cdf0e10cSrcweir 		}
104cdf0e10cSrcweir 	}
105cdf0e10cSrcweir 
remove(sal_uInt32 nIndex,sal_uInt32 nCount)106cdf0e10cSrcweir 	void remove(sal_uInt32 nIndex, sal_uInt32 nCount)
107cdf0e10cSrcweir 	{
108cdf0e10cSrcweir 		if(nCount)
109cdf0e10cSrcweir 		{
110cdf0e10cSrcweir 			// remove polygon data
111*ddde725dSArmin Le Grand 			basegfx::B2DPolygonVector::iterator aStart(maPolygons.begin());
112cdf0e10cSrcweir 			aStart += nIndex;
113*ddde725dSArmin Le Grand 			const basegfx::B2DPolygonVector::iterator aEnd(aStart + nCount);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 			maPolygons.erase(aStart, aEnd);
116cdf0e10cSrcweir 		}
117cdf0e10cSrcweir 	}
118cdf0e10cSrcweir 
count() const119cdf0e10cSrcweir 	sal_uInt32 count() const
120cdf0e10cSrcweir 	{
121cdf0e10cSrcweir 		return maPolygons.size();
122cdf0e10cSrcweir 	}
123cdf0e10cSrcweir 
setClosed(bool bNew)124cdf0e10cSrcweir 	void setClosed(bool bNew)
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
127cdf0e10cSrcweir 		{
128cdf0e10cSrcweir 			maPolygons[a].setClosed(bNew);
129cdf0e10cSrcweir 		}
130cdf0e10cSrcweir 	}
131cdf0e10cSrcweir 
flip()132cdf0e10cSrcweir 	void flip()
133cdf0e10cSrcweir 	{
134cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
135cdf0e10cSrcweir                        maPolygons.end(),
136cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::flip ));
137cdf0e10cSrcweir 	}
138cdf0e10cSrcweir 
removeDoublePoints()139cdf0e10cSrcweir 	void removeDoublePoints()
140cdf0e10cSrcweir 	{
141cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
142cdf0e10cSrcweir                        maPolygons.end(),
143cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::removeDoublePoints ));
144cdf0e10cSrcweir 	}
145cdf0e10cSrcweir 
transform(const basegfx::B2DHomMatrix & rMatrix)146cdf0e10cSrcweir 	void transform(const basegfx::B2DHomMatrix& rMatrix)
147cdf0e10cSrcweir 	{
148cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
149cdf0e10cSrcweir 		{
150cdf0e10cSrcweir 			maPolygons[a].transform(rMatrix);
151cdf0e10cSrcweir 		}
152cdf0e10cSrcweir 	}
153cdf0e10cSrcweir 
makeUnique()154cdf0e10cSrcweir     void makeUnique()
155cdf0e10cSrcweir     {
156cdf0e10cSrcweir         std::for_each( maPolygons.begin(),
157cdf0e10cSrcweir                        maPolygons.end(),
158cdf0e10cSrcweir                        std::mem_fun_ref( &basegfx::B2DPolygon::makeUnique ));
159cdf0e10cSrcweir     }
160cdf0e10cSrcweir 
begin() const161cdf0e10cSrcweir     const basegfx::B2DPolygon* begin() const
162cdf0e10cSrcweir     {
163cdf0e10cSrcweir         if(maPolygons.empty())
164cdf0e10cSrcweir             return 0;
165cdf0e10cSrcweir         else
166cdf0e10cSrcweir             return &maPolygons.front();
167cdf0e10cSrcweir     }
168cdf0e10cSrcweir 
end() const169cdf0e10cSrcweir     const basegfx::B2DPolygon* end() const
170cdf0e10cSrcweir     {
171cdf0e10cSrcweir         if(maPolygons.empty())
172cdf0e10cSrcweir             return 0;
173cdf0e10cSrcweir         else
174cdf0e10cSrcweir             return (&maPolygons.back())+1;
175cdf0e10cSrcweir     }
176cdf0e10cSrcweir 
begin()177cdf0e10cSrcweir     basegfx::B2DPolygon* begin()
178cdf0e10cSrcweir     {
179cdf0e10cSrcweir         if(maPolygons.empty())
180cdf0e10cSrcweir             return 0;
181cdf0e10cSrcweir         else
182cdf0e10cSrcweir             return &maPolygons.front();
183cdf0e10cSrcweir     }
184cdf0e10cSrcweir 
end()185cdf0e10cSrcweir     basegfx::B2DPolygon* end()
186cdf0e10cSrcweir     {
187cdf0e10cSrcweir         if(maPolygons.empty())
188cdf0e10cSrcweir             return 0;
189cdf0e10cSrcweir         else
190cdf0e10cSrcweir             return &(maPolygons.back())+1;
191cdf0e10cSrcweir     }
192cdf0e10cSrcweir };
193cdf0e10cSrcweir 
194cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
195cdf0e10cSrcweir 
196cdf0e10cSrcweir namespace basegfx
197cdf0e10cSrcweir {
198cdf0e10cSrcweir     namespace { struct DefaultPolyPolygon: public rtl::Static<B2DPolyPolygon::ImplType,
199cdf0e10cSrcweir                                                               DefaultPolyPolygon> {}; }
200cdf0e10cSrcweir 
B2DPolyPolygon()201cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon() :
202cdf0e10cSrcweir         mpPolyPolygon(DefaultPolyPolygon::get())
203cdf0e10cSrcweir 	{
204cdf0e10cSrcweir 	}
205cdf0e10cSrcweir 
B2DPolyPolygon(const B2DPolyPolygon & rPolyPolygon)206cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon) :
207cdf0e10cSrcweir         mpPolyPolygon(rPolyPolygon.mpPolyPolygon)
208cdf0e10cSrcweir 	{
209cdf0e10cSrcweir 	}
210cdf0e10cSrcweir 
B2DPolyPolygon(const B2DPolygon & rPolygon)211cdf0e10cSrcweir 	B2DPolyPolygon::B2DPolyPolygon(const B2DPolygon& rPolygon) :
212cdf0e10cSrcweir         mpPolyPolygon( ImplB2DPolyPolygon(rPolygon) )
213cdf0e10cSrcweir 	{
214cdf0e10cSrcweir 	}
215cdf0e10cSrcweir 
~B2DPolyPolygon()216cdf0e10cSrcweir 	B2DPolyPolygon::~B2DPolyPolygon()
217cdf0e10cSrcweir 	{
218cdf0e10cSrcweir 	}
219cdf0e10cSrcweir 
operator =(const B2DPolyPolygon & rPolyPolygon)220cdf0e10cSrcweir 	B2DPolyPolygon& B2DPolyPolygon::operator=(const B2DPolyPolygon& rPolyPolygon)
221cdf0e10cSrcweir 	{
222cdf0e10cSrcweir 		mpPolyPolygon = rPolyPolygon.mpPolyPolygon;
223cdf0e10cSrcweir 		return *this;
224cdf0e10cSrcweir 	}
225cdf0e10cSrcweir 
makeUnique()226cdf0e10cSrcweir     void B2DPolyPolygon::makeUnique()
227cdf0e10cSrcweir     {
228cdf0e10cSrcweir         mpPolyPolygon.make_unique();
229cdf0e10cSrcweir         mpPolyPolygon->makeUnique();
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir 
operator ==(const B2DPolyPolygon & rPolyPolygon) const232cdf0e10cSrcweir 	bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const
233cdf0e10cSrcweir 	{
234cdf0e10cSrcweir 		if(mpPolyPolygon.same_object(rPolyPolygon.mpPolyPolygon))
235cdf0e10cSrcweir 			return true;
236cdf0e10cSrcweir 
237cdf0e10cSrcweir 		return ((*mpPolyPolygon) == (*rPolyPolygon.mpPolyPolygon));
238cdf0e10cSrcweir 	}
239cdf0e10cSrcweir 
operator !=(const B2DPolyPolygon & rPolyPolygon) const240cdf0e10cSrcweir 	bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const
241cdf0e10cSrcweir 	{
242cdf0e10cSrcweir         return !((*this) == rPolyPolygon);
243cdf0e10cSrcweir 	}
244cdf0e10cSrcweir 
count() const245cdf0e10cSrcweir 	sal_uInt32 B2DPolyPolygon::count() const
246cdf0e10cSrcweir 	{
247cdf0e10cSrcweir 		return mpPolyPolygon->count();
248cdf0e10cSrcweir 	}
249cdf0e10cSrcweir 
getB2DPolygon(sal_uInt32 nIndex) const250cdf0e10cSrcweir 	B2DPolygon B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
251cdf0e10cSrcweir 	{
252cdf0e10cSrcweir 		OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 		return mpPolyPolygon->getB2DPolygon(nIndex);
255cdf0e10cSrcweir 	}
256cdf0e10cSrcweir 
setB2DPolygon(sal_uInt32 nIndex,const B2DPolygon & rPolygon)257cdf0e10cSrcweir 	void B2DPolyPolygon::setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon)
258cdf0e10cSrcweir 	{
259cdf0e10cSrcweir 		OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 		if(getB2DPolygon(nIndex) != rPolygon)
262cdf0e10cSrcweir 			mpPolyPolygon->setB2DPolygon(nIndex, rPolygon);
263cdf0e10cSrcweir 	}
264cdf0e10cSrcweir 
areControlPointsUsed() const265cdf0e10cSrcweir 	bool B2DPolyPolygon::areControlPointsUsed() const
266cdf0e10cSrcweir 	{
267cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
268cdf0e10cSrcweir 		{
269cdf0e10cSrcweir 			const B2DPolygon& rPolygon = mpPolyPolygon->getB2DPolygon(a);
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 			if(rPolygon.areControlPointsUsed())
272cdf0e10cSrcweir 			{
273cdf0e10cSrcweir 				return true;
274cdf0e10cSrcweir 			}
275cdf0e10cSrcweir 		}
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 		return false;
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 
insert(sal_uInt32 nIndex,const B2DPolygon & rPolygon,sal_uInt32 nCount)280cdf0e10cSrcweir 	void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount)
281cdf0e10cSrcweir 	{
282cdf0e10cSrcweir 		OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)");
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 		if(nCount)
285cdf0e10cSrcweir 			mpPolyPolygon->insert(nIndex, rPolygon, nCount);
286cdf0e10cSrcweir 	}
287cdf0e10cSrcweir 
append(const B2DPolygon & rPolygon,sal_uInt32 nCount)288cdf0e10cSrcweir 	void B2DPolyPolygon::append(const B2DPolygon& rPolygon, sal_uInt32 nCount)
289cdf0e10cSrcweir 	{
290cdf0e10cSrcweir 		if(nCount)
291cdf0e10cSrcweir 			mpPolyPolygon->insert(mpPolyPolygon->count(), rPolygon, nCount);
292cdf0e10cSrcweir 	}
293cdf0e10cSrcweir 
getDefaultAdaptiveSubdivision() const294cdf0e10cSrcweir     B2DPolyPolygon B2DPolyPolygon::getDefaultAdaptiveSubdivision() const
295cdf0e10cSrcweir 	{
296cdf0e10cSrcweir 		B2DPolyPolygon aRetval;
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
299cdf0e10cSrcweir 		{
300cdf0e10cSrcweir 			aRetval.append(mpPolyPolygon->getB2DPolygon(a).getDefaultAdaptiveSubdivision());
301cdf0e10cSrcweir 		}
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 		return aRetval;
304cdf0e10cSrcweir 	}
305cdf0e10cSrcweir 
getB2DRange() const306cdf0e10cSrcweir     B2DRange B2DPolyPolygon::getB2DRange() const
307cdf0e10cSrcweir     {
308cdf0e10cSrcweir 		B2DRange aRetval;
309cdf0e10cSrcweir 
310cdf0e10cSrcweir 		for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++)
311cdf0e10cSrcweir 		{
312cdf0e10cSrcweir 			aRetval.expand(mpPolyPolygon->getB2DPolygon(a).getB2DRange());
313cdf0e10cSrcweir 		}
314cdf0e10cSrcweir 
315cdf0e10cSrcweir 		return aRetval;
316cdf0e10cSrcweir     }
317cdf0e10cSrcweir 
insert(sal_uInt32 nIndex,const B2DPolyPolygon & rPolyPolygon)318cdf0e10cSrcweir 	void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon)
319cdf0e10cSrcweir 	{
320cdf0e10cSrcweir 		OSL_ENSURE(nIndex <= mpPolyPolygon->count(), "B2DPolyPolygon Insert outside range (!)");
321cdf0e10cSrcweir 
322cdf0e10cSrcweir 		if(rPolyPolygon.count())
323cdf0e10cSrcweir 			mpPolyPolygon->insert(nIndex, rPolyPolygon);
324cdf0e10cSrcweir 	}
325cdf0e10cSrcweir 
append(const B2DPolyPolygon & rPolyPolygon)326cdf0e10cSrcweir 	void B2DPolyPolygon::append(const B2DPolyPolygon& rPolyPolygon)
327cdf0e10cSrcweir 	{
328cdf0e10cSrcweir 		if(rPolyPolygon.count())
329cdf0e10cSrcweir 			mpPolyPolygon->insert(mpPolyPolygon->count(), rPolyPolygon);
330cdf0e10cSrcweir 	}
331cdf0e10cSrcweir 
remove(sal_uInt32 nIndex,sal_uInt32 nCount)332cdf0e10cSrcweir 	void B2DPolyPolygon::remove(sal_uInt32 nIndex, sal_uInt32 nCount)
333cdf0e10cSrcweir 	{
334cdf0e10cSrcweir 		OSL_ENSURE(nIndex + nCount <= mpPolyPolygon->count(), "B2DPolyPolygon Remove outside range (!)");
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 		if(nCount)
337cdf0e10cSrcweir 			mpPolyPolygon->remove(nIndex, nCount);
338cdf0e10cSrcweir 	}
339cdf0e10cSrcweir 
clear()340cdf0e10cSrcweir 	void B2DPolyPolygon::clear()
341cdf0e10cSrcweir 	{
342cdf0e10cSrcweir 		mpPolyPolygon = DefaultPolyPolygon::get();
343cdf0e10cSrcweir 	}
344cdf0e10cSrcweir 
isClosed() const345cdf0e10cSrcweir 	bool B2DPolyPolygon::isClosed() const
346cdf0e10cSrcweir 	{
347cdf0e10cSrcweir 		bool bRetval(true);
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 		// PolyPOlygon is closed when all contained Polygons are closed or
350cdf0e10cSrcweir 		// no Polygon exists.
351cdf0e10cSrcweir 		for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++)
352cdf0e10cSrcweir 		{
353cdf0e10cSrcweir 			if(!(mpPolyPolygon->getB2DPolygon(a)).isClosed())
354cdf0e10cSrcweir 			{
355cdf0e10cSrcweir 				bRetval = false;
356cdf0e10cSrcweir 			}
357cdf0e10cSrcweir 		}
358cdf0e10cSrcweir 
359cdf0e10cSrcweir 		return bRetval;
360cdf0e10cSrcweir 	}
361cdf0e10cSrcweir 
setClosed(bool bNew)362cdf0e10cSrcweir 	void B2DPolyPolygon::setClosed(bool bNew)
363cdf0e10cSrcweir 	{
364cdf0e10cSrcweir 		if(bNew != isClosed())
365cdf0e10cSrcweir 			mpPolyPolygon->setClosed(bNew);
366cdf0e10cSrcweir 	}
367cdf0e10cSrcweir 
flip()368cdf0e10cSrcweir 	void B2DPolyPolygon::flip()
369cdf0e10cSrcweir 	{
370cdf0e10cSrcweir 		if(mpPolyPolygon->count())
371cdf0e10cSrcweir 		{
372cdf0e10cSrcweir 			mpPolyPolygon->flip();
373cdf0e10cSrcweir 		}
374cdf0e10cSrcweir 	}
375cdf0e10cSrcweir 
hasDoublePoints() const376cdf0e10cSrcweir 	bool B2DPolyPolygon::hasDoublePoints() const
377cdf0e10cSrcweir 	{
378cdf0e10cSrcweir 		bool bRetval(false);
379cdf0e10cSrcweir 
380cdf0e10cSrcweir 		for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++)
381cdf0e10cSrcweir 		{
382cdf0e10cSrcweir 			if((mpPolyPolygon->getB2DPolygon(a)).hasDoublePoints())
383cdf0e10cSrcweir 			{
384cdf0e10cSrcweir 				bRetval = true;
385cdf0e10cSrcweir 			}
386cdf0e10cSrcweir 		}
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 		return bRetval;
389cdf0e10cSrcweir 	}
390cdf0e10cSrcweir 
removeDoublePoints()391cdf0e10cSrcweir 	void B2DPolyPolygon::removeDoublePoints()
392cdf0e10cSrcweir 	{
393cdf0e10cSrcweir 		if(hasDoublePoints())
394cdf0e10cSrcweir 			mpPolyPolygon->removeDoublePoints();
395cdf0e10cSrcweir 	}
396cdf0e10cSrcweir 
transform(const B2DHomMatrix & rMatrix)397cdf0e10cSrcweir 	void B2DPolyPolygon::transform(const B2DHomMatrix& rMatrix)
398cdf0e10cSrcweir 	{
399cdf0e10cSrcweir 		if(mpPolyPolygon->count() && !rMatrix.isIdentity())
400cdf0e10cSrcweir 		{
401cdf0e10cSrcweir 			mpPolyPolygon->transform(rMatrix);
402cdf0e10cSrcweir 		}
403cdf0e10cSrcweir 	}
404cdf0e10cSrcweir 
begin() const405cdf0e10cSrcweir     const B2DPolygon* B2DPolyPolygon::begin() const
406cdf0e10cSrcweir     {
407cdf0e10cSrcweir         return mpPolyPolygon->begin();
408cdf0e10cSrcweir     }
409cdf0e10cSrcweir 
end() const410cdf0e10cSrcweir     const B2DPolygon* B2DPolyPolygon::end() const
411cdf0e10cSrcweir     {
412cdf0e10cSrcweir         return mpPolyPolygon->end();
413cdf0e10cSrcweir     }
414cdf0e10cSrcweir 
begin()415cdf0e10cSrcweir     B2DPolygon* B2DPolyPolygon::begin()
416cdf0e10cSrcweir     {
417cdf0e10cSrcweir         return mpPolyPolygon->begin();
418cdf0e10cSrcweir     }
419cdf0e10cSrcweir 
end()420cdf0e10cSrcweir     B2DPolygon* B2DPolyPolygon::end()
421cdf0e10cSrcweir     {
422cdf0e10cSrcweir         return mpPolyPolygon->end();
423cdf0e10cSrcweir     }
424cdf0e10cSrcweir } // end of namespace basegfx
425cdf0e10cSrcweir 
426cdf0e10cSrcweir // eof
427