COIN-OR::LEMON - Graph Library

Changeset 1930:92b70deed0c5 in lemon-0.x for lemon


Ignore:
Timestamp:
01/30/06 10:37:41 (18 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2505
Message:

Solve bug #23: Floating versus Integer Coordinates

  • BoundingBox? values rounds to integer
  • The generated .eps rescales if the bounding box were too small otherwise.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_to_eps.h

    r1910 r1930  
    852852    if(_scaleToA4)
    853853      os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
    854     else os << "%%BoundingBox: "
    855             << bb.left()   * _scale - _xBorder << ' '
    856             << bb.bottom() * _scale - _yBorder << ' '
    857             << bb.right()  * _scale + _xBorder << ' '
    858             << bb.top()    * _scale + _yBorder << '\n';
     854    else {
     855      //Rescale so that BoundingBox won't be neither to big nor too small.
     856      while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10;
     857      while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10;
     858   
     859      os << "%%BoundingBox: "
     860         << int(floor(bb.left()   * _scale - _xBorder)) << ' '
     861         << int(floor(bb.bottom() * _scale - _yBorder)) << ' '
     862         << int(ceil(bb.right()  * _scale + _xBorder)) << ' '
     863         << int(ceil(bb.top()    * _scale + _yBorder)) << '\n';
     864    }
    859865   
    860866    os << "%%EndComments\n";
Note: See TracChangeset for help on using the changeset viewer.