| poly2.cxx (09b5452f) | poly2.cxx (aac4b212) |
|---|---|
| 1/************************************************************** | 1/************************************************************** |
| 2 * | 2 * |
| 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at | 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at |
| 10 * | 10 * |
| 11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 * | 12 * |
| 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. | 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. |
| 19 * | 19 * |
| 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_tools.hxx" 26 27#define _SV_POLY2_CXX --- 186 unchanged lines hidden (view full) --- 214} 215 216// ----------------------------------------------------------------------- 217 218void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos ) 219{ 220 DBG_CHKTHIS( PolyPolygon, NULL ); 221 DBG_ASSERT( nPos < Count(), "PolyPolygon::Replace(): nPos >= nSize" ); | 20 *************************************************************/ 21 22 23 24// MARKER(update_precomp.py): autogen include statement, do not remove 25#include "precompiled_tools.hxx" 26 27#define _SV_POLY2_CXX --- 186 unchanged lines hidden (view full) --- 214} 215 216// ----------------------------------------------------------------------- 217 218void PolyPolygon::Replace( const Polygon& rPoly, sal_uInt16 nPos ) 219{ 220 DBG_CHKTHIS( PolyPolygon, NULL ); 221 DBG_ASSERT( nPos < Count(), "PolyPolygon::Replace(): nPos >= nSize" ); |
| 222 if ( nPos >= Count() ) return; // not replaceable | 222 if ( nPos >= Count() ) return; // not replaceable |
| 223 224 if ( mpImplPolyPolygon->mnRefCount > 1 ) 225 { 226 mpImplPolyPolygon->mnRefCount--; 227 mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon ); 228 } 229 230 delete mpImplPolyPolygon->mpPolyAry[nPos]; --- 127 unchanged lines hidden (view full) --- 358 mpImplPolyPolygon->mpPolyAry[ i ]->AdaptiveSubdivide( aPolygon, d ); 359 rResult.Insert( aPolygon ); 360 } 361} 362 363// ----------------------------------------------------------------------- 364 365void PolyPolygon::GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const | 223 224 if ( mpImplPolyPolygon->mnRefCount > 1 ) 225 { 226 mpImplPolyPolygon->mnRefCount--; 227 mpImplPolyPolygon = new ImplPolyPolygon( *mpImplPolyPolygon ); 228 } 229 230 delete mpImplPolyPolygon->mpPolyAry[nPos]; --- 127 unchanged lines hidden (view full) --- 358 mpImplPolyPolygon->mpPolyAry[ i ]->AdaptiveSubdivide( aPolygon, d ); 359 rResult.Insert( aPolygon ); 360 } 361} 362 363// ----------------------------------------------------------------------- 364 365void PolyPolygon::GetIntersection( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const |
| 366{ | 366{ |
| 367 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_INT ); 368} 369 370// ----------------------------------------------------------------------- 371 372void PolyPolygon::GetUnion( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const 373{ 374 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_UNION ); --- 11 unchanged lines hidden (view full) --- 386void PolyPolygon::GetXOR( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const 387{ 388 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_XOR ); 389} 390 391// ----------------------------------------------------------------------- 392 393void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, sal_uIntPtr nOperation ) const | 367 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_INT ); 368} 369 370// ----------------------------------------------------------------------- 371 372void PolyPolygon::GetUnion( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const 373{ 374 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_UNION ); --- 11 unchanged lines hidden (view full) --- 386void PolyPolygon::GetXOR( const PolyPolygon& rPolyPoly, PolyPolygon& rResult ) const 387{ 388 ImplDoOperation( rPolyPoly, rResult, POLY_CLIP_XOR ); 389} 390 391// ----------------------------------------------------------------------- 392 393void PolyPolygon::ImplDoOperation( const PolyPolygon& rPolyPoly, PolyPolygon& rResult, sal_uIntPtr nOperation ) const |
| 394{ | 394{ |
| 395 // Convert to B2DPolyPolygon, temporarily. It might be 396 // advantageous in the future, to have a PolyPolygon adaptor that 397 // just simulates a B2DPolyPolygon here... 398 basegfx::B2DPolyPolygon aMergePolyPolygonA( getB2DPolyPolygon() ); 399 basegfx::B2DPolyPolygon aMergePolyPolygonB( rPolyPoly.getB2DPolyPolygon() ); 400 401 // normalize the two polypolygons before. Force properly oriented | 395 // Convert to B2DPolyPolygon, temporarily. It might be 396 // advantageous in the future, to have a PolyPolygon adaptor that 397 // just simulates a B2DPolyPolygon here... 398 basegfx::B2DPolyPolygon aMergePolyPolygonA( getB2DPolyPolygon() ); 399 basegfx::B2DPolyPolygon aMergePolyPolygonB( rPolyPoly.getB2DPolyPolygon() ); 400 401 // normalize the two polypolygons before. Force properly oriented |
| 402 // polygons. | 402 // polygons. |
| 403 aMergePolyPolygonA = basegfx::tools::prepareForPolygonOperation( aMergePolyPolygonA ); 404 aMergePolyPolygonB = basegfx::tools::prepareForPolygonOperation( aMergePolyPolygonB ); 405 406 switch( nOperation ) 407 { 408 // All code extracted from svx/source/svdraw/svedtv2.cxx 409 // ----------------------------------------------------- 410 --- 455 unchanged lines hidden (view full) --- 866} 867 868// ----------------------------------------------------------------------- 869// constructor to convert from basegfx::B2DPolyPolygon 870PolyPolygon::PolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) 871{ 872 DBG_CTOR( PolyPolygon, NULL ); 873 const sal_uInt16 nCount(sal_uInt16(rPolyPolygon.count())); | 403 aMergePolyPolygonA = basegfx::tools::prepareForPolygonOperation( aMergePolyPolygonA ); 404 aMergePolyPolygonB = basegfx::tools::prepareForPolygonOperation( aMergePolyPolygonB ); 405 406 switch( nOperation ) 407 { 408 // All code extracted from svx/source/svdraw/svedtv2.cxx 409 // ----------------------------------------------------- 410 --- 455 unchanged lines hidden (view full) --- 866} 867 868// ----------------------------------------------------------------------- 869// constructor to convert from basegfx::B2DPolyPolygon 870PolyPolygon::PolyPolygon(const basegfx::B2DPolyPolygon& rPolyPolygon) 871{ 872 DBG_CTOR( PolyPolygon, NULL ); 873 const sal_uInt16 nCount(sal_uInt16(rPolyPolygon.count())); |
| 874 DBG_ASSERT(sal_uInt32(nCount) == rPolyPolygon.count(), | 874 DBG_ASSERT(sal_uInt32(nCount) == rPolyPolygon.count(), |
| 875 "PolyPolygon::PolyPolygon: Too many sub-polygons in given basegfx::B2DPolyPolygon (!)"); 876 877 if ( nCount ) 878 { 879 mpImplPolyPolygon = new ImplPolyPolygon( nCount ); 880 881 for(sal_uInt16 a(0); a < nCount; a++) 882 { 883 basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a))); 884 mpImplPolyPolygon->mpPolyAry[a] = new Polygon( aCandidate ); 885 } 886 } 887 else 888 { 889 mpImplPolyPolygon = new ImplPolyPolygon( 16, 16 ); 890 } 891} 892 | 875 "PolyPolygon::PolyPolygon: Too many sub-polygons in given basegfx::B2DPolyPolygon (!)"); 876 877 if ( nCount ) 878 { 879 mpImplPolyPolygon = new ImplPolyPolygon( nCount ); 880 881 for(sal_uInt16 a(0); a < nCount; a++) 882 { 883 basegfx::B2DPolygon aCandidate(rPolyPolygon.getB2DPolygon(sal_uInt32(a))); 884 mpImplPolyPolygon->mpPolyAry[a] = new Polygon( aCandidate ); 885 } 886 } 887 else 888 { 889 mpImplPolyPolygon = new ImplPolyPolygon( 16, 16 ); 890 } 891} 892 |
| 893// eof | 893/* vim: set noet sw=4 ts=4: */ |