| ... | ... |
@@ -667,61 +667,73 @@ |
| 667 | 667 |
///this function calls the algorithm itself, i.e. in this case |
| 668 | 668 |
///it draws the graph. |
| 669 | 669 |
void run() {
|
| 670 | 670 |
const double EPSILON=1e-9; |
| 671 | 671 |
if(dontPrint) return; |
| 672 | 672 |
|
| 673 | 673 |
_graph_to_eps_bits::_NegY<typename T::CoordsMapType> |
| 674 | 674 |
mycoords(_coords,_negY); |
| 675 | 675 |
|
| 676 | 676 |
os << "%!PS-Adobe-2.0 EPSF-2.0\n"; |
| 677 | 677 |
if(_title.size()>0) os << "%%Title: " << _title << '\n'; |
| 678 | 678 |
if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n'; |
| 679 | 679 |
os << "%%Creator: LEMON, graphToEps()\n"; |
| 680 | 680 |
|
| 681 | 681 |
{
|
| 682 | 682 |
#ifndef WIN32 |
| 683 | 683 |
timeval tv; |
| 684 | 684 |
gettimeofday(&tv, 0); |
| 685 | 685 |
|
| 686 | 686 |
char cbuf[26]; |
| 687 | 687 |
ctime_r(&tv.tv_sec,cbuf); |
| 688 | 688 |
os << "%%CreationDate: " << cbuf; |
| 689 | 689 |
#else |
| 690 | 690 |
SYSTEMTIME time; |
| 691 |
GetSystemTime(&time); |
|
| 692 |
#if defined(_MSC_VER) && (_MSC_VER < 1500) |
|
| 693 |
LPWSTR buf1, buf2, buf3; |
|
| 694 |
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
| 695 |
L"ddd MMM dd", buf1, 11) && |
|
| 696 |
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
| 697 |
L"HH':'mm':'ss", buf2, 9) && |
|
| 698 |
GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
| 699 |
L"yyyy", buf3, 5)) {
|
|
| 700 |
os << "%%CreationDate: " << buf1 << ' ' |
|
| 701 |
<< buf2 << ' ' << buf3 << std::endl; |
|
| 702 |
} |
|
| 703 |
#else |
|
| 691 | 704 |
char buf1[11], buf2[9], buf3[5]; |
| 692 |
|
|
| 693 |
GetSystemTime(&time); |
|
| 694 | 705 |
if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
| 695 | 706 |
"ddd MMM dd", buf1, 11) && |
| 696 | 707 |
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, |
| 697 | 708 |
"HH':'mm':'ss", buf2, 9) && |
| 698 | 709 |
GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
| 699 | 710 |
"yyyy", buf3, 5)) {
|
| 700 | 711 |
os << "%%CreationDate: " << buf1 << ' ' |
| 701 | 712 |
<< buf2 << ' ' << buf3 << std::endl; |
| 702 | 713 |
} |
| 703 | 714 |
#endif |
| 715 |
#endif |
|
| 704 | 716 |
} |
| 705 | 717 |
|
| 706 | 718 |
if (_autoArcWidthScale) {
|
| 707 | 719 |
double max_w=0; |
| 708 | 720 |
for(ArcIt e(g);e!=INVALID;++e) |
| 709 | 721 |
max_w=std::max(double(_arcWidths[e]),max_w); |
| 710 | 722 |
if(max_w>EPSILON) {
|
| 711 | 723 |
_arcWidthScale/=max_w; |
| 712 | 724 |
} |
| 713 | 725 |
} |
| 714 | 726 |
|
| 715 | 727 |
if (_autoNodeScale) {
|
| 716 | 728 |
double max_s=0; |
| 717 | 729 |
for(NodeIt n(g);n!=INVALID;++n) |
| 718 | 730 |
max_s=std::max(double(_nodeSizes[n]),max_s); |
| 719 | 731 |
if(max_s>EPSILON) {
|
| 720 | 732 |
_nodeScale/=max_s; |
| 721 | 733 |
} |
| 722 | 734 |
} |
| 723 | 735 |
|
| 724 | 736 |
double diag_len = 1; |
| 725 | 737 |
if(!(_absoluteNodeSizes&&_absoluteArcWidths)) {
|
| 726 | 738 |
dim2::Box<double> bb; |
| 727 | 739 |
for(NodeIt n(g);n!=INVALID;++n) bb.add(mycoords[n]); |
0 comments (0 inline)