boxclipper.cxx (09dbbe93) | boxclipper.cxx (1f882ec4) |
---|---|
1/************************************************************** 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 --- 161 unchanged lines hidden (view full) --- 170 171 aRandomIntersections.appendElement( aRandomRange, ORIENTATION_NEGATIVE ); 172 } 173#else 174 const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"; 175 B2DPolyPolygon randomPoly; 176 tools::importFromSvgD( 177 randomPoly, | 1/************************************************************** 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 --- 161 unchanged lines hidden (view full) --- 170 171 aRandomIntersections.appendElement( aRandomRange, ORIENTATION_NEGATIVE ); 172 } 173#else 174 const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"; 175 B2DPolyPolygon randomPoly; 176 tools::importFromSvgD( 177 randomPoly, |
178 rtl::OUString::createFromAscii(randomSvg)); | 178 rtl::OUString::createFromAscii(randomSvg), false, 0); |
179 std::for_each(randomPoly.begin(), 180 randomPoly.end(), 181 boost::bind( 182 &B2DPolyRange::appendElement, 183 boost::ref(aRandomIntersections), 184 boost::bind( 185 &B2DPolygon::getB2DRange, 186 _1), --- 51 unchanged lines hidden (view full) --- 238 return aRes; 239 } 240 241 void verifyPoly(const char* sName, const char* sSvg, const B2DPolyRange& toTest) 242 { 243 B2DPolyPolygon aTmp1; 244 CPPUNIT_ASSERT_MESSAGE(sName, 245 tools::importFromSvgD( | 179 std::for_each(randomPoly.begin(), 180 randomPoly.end(), 181 boost::bind( 182 &B2DPolyRange::appendElement, 183 boost::ref(aRandomIntersections), 184 boost::bind( 185 &B2DPolygon::getB2DRange, 186 _1), --- 51 unchanged lines hidden (view full) --- 238 return aRes; 239 } 240 241 void verifyPoly(const char* sName, const char* sSvg, const B2DPolyRange& toTest) 242 { 243 B2DPolyPolygon aTmp1; 244 CPPUNIT_ASSERT_MESSAGE(sName, 245 tools::importFromSvgD( |
246 aTmp1, 247 rtl::OUString::createFromAscii(sSvg))); | 246 aTmp1, rtl::OUString::createFromAscii(sSvg), false, 0)); |
248 249 const rtl::OUString aSvg= | 247 248 const rtl::OUString aSvg= |
250 tools::exportToSvgD(toTest.solveCrossovers()); | 249 tools::exportToSvgD(toTest.solveCrossovers(), , true, true, false); |
251 B2DPolyPolygon aTmp2; 252 CPPUNIT_ASSERT_MESSAGE(sName, 253 tools::importFromSvgD( | 250 B2DPolyPolygon aTmp2; 251 CPPUNIT_ASSERT_MESSAGE(sName, 252 tools::importFromSvgD( |
254 aTmp2, 255 aSvg)); | 253 aTmp2, aSvg, false, 0)); |
256 257 CPPUNIT_ASSERT_MESSAGE( 258 sName, 259 normalizePoly(aTmp2) == normalizePoly(aTmp1)); 260 } 261 262 void verifyPoly() 263 { --- 34 unchanged lines hidden (view full) --- 298 299 void dumpSvg(const char* pName, 300 const ::basegfx::B2DPolyPolygon& rPoly) 301 { 302 (void)pName; (void)rPoly; 303#if defined(VERBOSE) 304 fprintf(stderr, "%s - svg:d=\"%s\"\n", 305 pName, rtl::OUStringToOString( | 254 255 CPPUNIT_ASSERT_MESSAGE( 256 sName, 257 normalizePoly(aTmp2) == normalizePoly(aTmp1)); 258 } 259 260 void verifyPoly() 261 { --- 34 unchanged lines hidden (view full) --- 296 297 void dumpSvg(const char* pName, 298 const ::basegfx::B2DPolyPolygon& rPoly) 299 { 300 (void)pName; (void)rPoly; 301#if defined(VERBOSE) 302 fprintf(stderr, "%s - svg:d=\"%s\"\n", 303 pName, rtl::OUStringToOString( |
306 basegfx::tools::exportToSvgD(rPoly), | 304 basegfx::tools::exportToSvgD(rPoly, , true, true, false), |
307 RTL_TEXTENCODING_UTF8).getStr() ); 308#endif 309 } 310 311 void getPolyPolygon() 312 { 313 dumpSvg("disjunct",aDisjunctRanges.solveCrossovers()); 314 dumpSvg("equal",aEqualRanges.solveCrossovers()); --- 27 unchanged lines hidden (view full) --- 342 343 genericClip.append(aRect); 344 } 345 346#if defined(VERBOSE) 347 fprintf(stderr, "%s input - svg:d=\"%s\"\n", 348 pName, rtl::OUStringToOString( 349 basegfx::tools::exportToSvgD( | 305 RTL_TEXTENCODING_UTF8).getStr() ); 306#endif 307 } 308 309 void getPolyPolygon() 310 { 311 dumpSvg("disjunct",aDisjunctRanges.solveCrossovers()); 312 dumpSvg("equal",aEqualRanges.solveCrossovers()); --- 27 unchanged lines hidden (view full) --- 340 341 genericClip.append(aRect); 342 } 343 344#if defined(VERBOSE) 345 fprintf(stderr, "%s input - svg:d=\"%s\"\n", 346 pName, rtl::OUStringToOString( 347 basegfx::tools::exportToSvgD( |
350 genericClip), | 348 genericClip, , true, true, false), |
351 RTL_TEXTENCODING_UTF8).getStr() ); 352#endif 353 354 const B2DPolyPolygon boxClipResult=rRange.solveCrossovers(); 355 const rtl::OUString boxClipSvg( 356 basegfx::tools::exportToSvgD( | 349 RTL_TEXTENCODING_UTF8).getStr() ); 350#endif 351 352 const B2DPolyPolygon boxClipResult=rRange.solveCrossovers(); 353 const rtl::OUString boxClipSvg( 354 basegfx::tools::exportToSvgD( |
357 normalizePoly( 358 boxClipResult))); | 355 normalizePoly(boxClipResult)), true, true, false); |
359#if defined(VERBOSE) 360 fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", 361 pName, rtl::OUStringToOString( 362 boxClipSvg, 363 RTL_TEXTENCODING_UTF8).getStr() ); 364#endif 365 366 genericClip = tools::solveCrossovers(genericClip); 367 const rtl::OUString genericClipSvg( 368 basegfx::tools::exportToSvgD( | 356#if defined(VERBOSE) 357 fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", 358 pName, rtl::OUStringToOString( 359 boxClipSvg, 360 RTL_TEXTENCODING_UTF8).getStr() ); 361#endif 362 363 genericClip = tools::solveCrossovers(genericClip); 364 const rtl::OUString genericClipSvg( 365 basegfx::tools::exportToSvgD( |
369 normalizePoly( 370 genericClip))); | 366 normalizePoly(genericClip)), true, true, false); |
371#if defined(VERBOSE) 372 fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", 373 pName, rtl::OUStringToOString( 374 genericClipSvg, 375 RTL_TEXTENCODING_UTF8).getStr() ); 376#endif 377 378 CPPUNIT_ASSERT_MESSAGE(pName, --- 39 unchanged lines hidden --- | 367#if defined(VERBOSE) 368 fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", 369 pName, rtl::OUStringToOString( 370 genericClipSvg, 371 RTL_TEXTENCODING_UTF8).getStr() ); 372#endif 373 374 CPPUNIT_ASSERT_MESSAGE(pName, --- 39 unchanged lines hidden --- |