b3dpolygontools.cxx (09dbbe93) b3dpolygontools.cxx (5aaf853b)
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

--- 393 unchanged lines hidden (view full) ---

402 // prepare current edge's start
403 B3DPoint aCurrentPoint(rCandidate.getB3DPoint(0));
404 const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
405
406 // prepare DotDashArray iteration and the line/gap switching bool
407 sal_uInt32 nDotDashIndex(0);
408 bool bIsLine(true);
409 double fDotDashMovingLength(rDotDashArray[0]);
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

--- 393 unchanged lines hidden (view full) ---

402 // prepare current edge's start
403 B3DPoint aCurrentPoint(rCandidate.getB3DPoint(0));
404 const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1);
405
406 // prepare DotDashArray iteration and the line/gap switching bool
407 sal_uInt32 nDotDashIndex(0);
408 bool bIsLine(true);
409 double fDotDashMovingLength(rDotDashArray[0]);
410 B3DPolygon aSnippet;
410 B3DPolygon aSnippet;
411
411
412 // iterate over all edges
412 // iterate over all edges
413 for(sal_uInt32 a(0); a < nEdgeCount; a++)
414 {
415 // update current edge
413 for(sal_uInt32 a(0); a < nEdgeCount; a++)
414 {
415 // update current edge
416 double fLastDotDashMovingLength(0.0);
416 double fLastDotDashMovingLength(0.0);
417 const sal_uInt32 nNextIndex((a + 1) % nPointCount);
417 const sal_uInt32 nNextIndex((a + 1) % nPointCount);
418 const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex));
419 const double fEdgeLength(B3DVector(aNextPoint - aCurrentPoint).getLength());
418 const B3DPoint aNextPoint(rCandidate.getB3DPoint(nNextIndex));
419 const double fEdgeLength(B3DVector(aNextPoint - aCurrentPoint).getLength());
420
420
421 while(fTools::less(fDotDashMovingLength, fEdgeLength))
422 {
423 // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
424 const bool bHandleLine(bIsLine && pLineTarget);
425 const bool bHandleGap(!bIsLine && pGapTarget);
426
427 if(bHandleLine || bHandleGap)
421 if(!fTools::equalZero(fEdgeLength))
422 {
423 while(fTools::less(fDotDashMovingLength, fEdgeLength))
428 {
424 {
429 if(!aSnippet.count())
430 {
431 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fLastDotDashMovingLength / fEdgeLength));
432 }
425 // new split is inside edge, create and append snippet [fLastDotDashMovingLength, fDotDashMovingLength]
426 const bool bHandleLine(bIsLine && pLineTarget);
427 const bool bHandleGap(!bIsLine && pGapTarget);
428
429 if(bHandleLine || bHandleGap)
430 {
431 if(!aSnippet.count())
432 {
433 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fLastDotDashMovingLength / fEdgeLength));
434 }
433
435
434 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fDotDashMovingLength / fEdgeLength));
436 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fDotDashMovingLength / fEdgeLength));
435
437
436 if(bHandleLine)
437 {
438 pLineTarget->append(aSnippet);
439 }
440 else
441 {
442 pGapTarget->append(aSnippet);
443 }
438 if(bHandleLine)
439 {
440 pLineTarget->append(aSnippet);
441 }
442 else
443 {
444 pGapTarget->append(aSnippet);
445 }
444
446
445 aSnippet.clear();
446 }
447
448 // prepare next DotDashArray step and flip line/gap flag
449 fLastDotDashMovingLength = fDotDashMovingLength;
450 fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount];
451 bIsLine = !bIsLine;
452 }
447 aSnippet.clear();
448 }
453
449
454 // append snippet [fLastDotDashMovingLength, fEdgeLength]
455 const bool bHandleLine(bIsLine && pLineTarget);
456 const bool bHandleGap(!bIsLine && pGapTarget);
457
458 if(bHandleLine || bHandleGap)
459 {
460 if(!aSnippet.count())
461 {
462 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fLastDotDashMovingLength / fEdgeLength));
463 }
450 // prepare next DotDashArray step and flip line/gap flag
451 fLastDotDashMovingLength = fDotDashMovingLength;
452 fDotDashMovingLength += rDotDashArray[(++nDotDashIndex) % nDotDashCount];
453 bIsLine = !bIsLine;
454 }
464
455
465 aSnippet.append(aNextPoint);
466 }
467
468 // prepare move to next edge
469 fDotDashMovingLength -= fEdgeLength;
470
471 // prepare next edge step (end point gets new start point)
456 // append snippet [fLastDotDashMovingLength, fEdgeLength]
457 const bool bHandleLine(bIsLine && pLineTarget);
458 const bool bHandleGap(!bIsLine && pGapTarget);
459
460 if(bHandleLine || bHandleGap)
461 {
462 if(!aSnippet.count())
463 {
464 aSnippet.append(interpolate(aCurrentPoint, aNextPoint, fLastDotDashMovingLength / fEdgeLength));
465 }
466
467 aSnippet.append(aNextPoint);
468 }
469
470 // prepare move to next edge
471 fDotDashMovingLength -= fEdgeLength;
472 }
473
474 // prepare next edge step (end point gets new start point)
472 aCurrentPoint = aNextPoint;
473 }
474
475 // append last intermediate results (if exists)
476 if(aSnippet.count())
477 {
478 if(bIsLine && pLineTarget)
479 {

--- 780 unchanged lines hidden ---
475 aCurrentPoint = aNextPoint;
476 }
477
478 // append last intermediate results (if exists)
479 if(aSnippet.count())
480 {
481 if(bIsLine && pLineTarget)
482 {

--- 780 unchanged lines hidden ---