Changeset 280 for trunk/libdjvu/GMapAreas.cpp
 Timestamp:
 Jan 3, 2010, 7:13:32 PM (11 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/libdjvu/GMapAreas.cpp
r206 r280 54 54 //C + 55 55 // 56 // $Id: GMapAreas.cpp,v 1.1 0 2007/03/25 20:48:31 leonbExp $57 // $Name: release_3_5_ 19$56 // $Id: GMapAreas.cpp,v 1.11 2008/08/05 20:50:35 bpearlmutter Exp $ 57 // $Name: release_3_5_22 $ 58 58 59 59 #ifdef HAVE_CONFIG_H … … 464 464 465 465 if (xmax<grect.xmin  xmin>grect.xmax  466 ymax<grect.ymin  ymin>grect.ymax) return false; 466 ymax<grect.ymin  ymin>grect.ymax) 467 return false; 467 468 468 469 return 469 x1>=grect.xmin && x1<=grect.xmax && y1>=grect.ymin && y1<=grect.ymax470 x2>=grect.xmin && x2<=grect.xmax && y2>=grect.ymin && y2<=grect.ymax471 472 473 474 470 (x1>=grect.xmin && x1<=grect.xmax && y1>=grect.ymin && y1<=grect.ymax)  471 (x2>=grect.xmin && x2<=grect.xmax && y2>=grect.ymin && y2<=grect.ymax)  472 do_segments_intersect(grect.xmin, grect.ymin, grect.xmax, grect.ymax, 473 x1, y1, x2, y2)  474 do_segments_intersect(grect.xmax, grect.ymin, grect.xmin, grect.ymax, 475 x1, y1, x2, y2); 475 476 } 476 477 … … 515 516 GMapPoly::check_data(void) 516 517 { 517 if ( open && points<2  !open && points<3)518 if ((open && points<2)  (!open && points<3)) 518 519 return error_too_few_points; 519 520 for(int i=0;i<sides;i++) 520 {521 for(int j=i+2;j<sides;j++)522 521 { 523 if (i != (j+1)%points ) 524 { 525 if (do_segments_intersect(xx[i], yy[i], xx[i+1], yy[i+1], 522 for(int j=i+2;j<sides;j++) 523 { 524 if (i != (j+1)%points ) 525 if (do_segments_intersect(xx[i], yy[i], xx[i+1], yy[i+1], 526 526 xx[j], yy[j], xx[(j+1)%points], yy[(j+1)%points])) 527 { 528 return error_intersect; 529 } 530 } 527 return error_intersect; 528 } 531 529 } 532 }533 530 return ""; 534 531 } … … 537 534 GMapPoly::optimize_data(void) 538 535 { 539 540 541 542 {536 // Removing segments of length zero 537 int i; 538 for(i=0;i<sides;i++) 539 { 543 540 while(xx[i]==xx[(i+1)%points] && yy[i]==yy[(i+1)%points]) 544 545 for(int k=(i+1)%points;k<points1;k++)546 {547 xx[k]=xx[k+1]; yy[k]=yy[k+1];548 }549 points; sides;550 if (!points) return;551 552 }553 554 555 {556 while(( open && i+1<sides !open) &&541 { 542 for(int k=(i+1)%points;k<points1;k++) 543 { 544 xx[k]=xx[k+1]; yy[k]=yy[k+1]; 545 } 546 points; sides; 547 if (!points) return; 548 } 549 } 550 // Concatenating consequitive parallel segments 551 for(i=0;i<sides;i++) 552 { 553 while(((open && i+1<sides)  !open) && 557 554 are_segments_parallel(xx[i], yy[i], 558 555 xx[(i+1)%points], yy[(i+1)%points], 559 556 xx[(i+1)%points], yy[(i+1)%points], 560 557 xx[(i+2)%points], yy[(i+2)%points])) 561 562 for(int k=(i+1)%points;k<points1;k++)563 {564 xx[k]=xx[k+1]; yy[k]=yy[k+1];565 }566 points; sides;567 if (!points) return;568 569 }558 { 559 for(int k=(i+1)%points;k<points1;k++) 560 { 561 xx[k]=xx[k+1]; yy[k]=yy[k+1]; 562 } 563 points; sides; 564 if (!points) return; 565 } 566 } 570 567 } 571 568 … … 575 572 if (open) 576 573 return false; 577 574 578 575 int xfar=get_xmax()+(get_xmax()get_xmin()); 579 576 580 577 int intersections=0; 581 578 for(int i=0;i<points;i++) … … 595 592 } 596 593 } 597 if ( res1<0 && res2>0  res1>0 && res2<0)594 if ((res1<0 && res2>0)  (res1>0 && res2<0)) 598 595 { 599 596 int x1=xx[i%points], y1=yy[i%points];
Note: See TracChangeset
for help on using the changeset viewer.