17 */ |
17 */ |
18 |
18 |
19 #ifndef LEMON_GRAPH_TO_EPS_H |
19 #ifndef LEMON_GRAPH_TO_EPS_H |
20 #define LEMON_GRAPH_TO_EPS_H |
20 #define LEMON_GRAPH_TO_EPS_H |
21 |
21 |
22 #include <sys/time.h> |
|
23 |
|
24 #ifdef WIN32 |
|
25 #include <lemon/bits/mingw32_time.h> |
|
26 #endif |
|
27 |
|
28 #include<iostream> |
22 #include<iostream> |
29 #include<fstream> |
23 #include<fstream> |
30 #include<sstream> |
24 #include<sstream> |
31 #include<algorithm> |
25 #include<algorithm> |
32 #include<vector> |
26 #include<vector> |
33 |
27 |
|
28 #ifndef WIN32 |
|
29 #include<sys/time.h> |
34 #include<ctime> |
30 #include<ctime> |
|
31 #else |
|
32 #include<windows.h> |
|
33 #endif |
35 |
34 |
36 #include<lemon/math.h> |
35 #include<lemon/math.h> |
37 #include<lemon/bits/invalid.h> |
36 #include<lemon/bits/invalid.h> |
38 #include<lemon/dim2.h> |
37 #include<lemon/dim2.h> |
39 #include<lemon/maps.h> |
38 #include<lemon/maps.h> |
715 os << "%!PS-Adobe-2.0 EPSF-2.0\n"; |
714 os << "%!PS-Adobe-2.0 EPSF-2.0\n"; |
716 if(_title.size()>0) os << "%%Title: " << _title << '\n'; |
715 if(_title.size()>0) os << "%%Title: " << _title << '\n'; |
717 if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n'; |
716 if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n'; |
718 // << "%%Copyright: XXXX\n" |
717 // << "%%Copyright: XXXX\n" |
719 os << "%%Creator: LEMON, graphToEps()\n"; |
718 os << "%%Creator: LEMON, graphToEps()\n"; |
720 |
719 |
721 { |
720 { |
722 char cbuf[50]; |
721 #ifndef WIN32 |
723 timeval tv; |
722 timeval tv; |
724 gettimeofday(&tv, 0); |
723 gettimeofday(&tv, 0); |
|
724 |
|
725 char cbuf[26]; |
725 ctime_r(&tv.tv_sec,cbuf); |
726 ctime_r(&tv.tv_sec,cbuf); |
726 os << "%%CreationDate: " << cbuf; |
727 os << "%%CreationDate: " << cbuf; |
|
728 #else |
|
729 SYSTEMTIME time; |
|
730 char buf1[11], buf2[9], buf3[5]; |
|
731 |
|
732 GetSystemTime(&time); |
|
733 if (GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
734 "ddd MMM dd", buf1, 11) && |
|
735 GetTimeFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
736 "HH':'mm':'ss", buf2, 9) && |
|
737 GetDateFormat(LOCALE_USER_DEFAULT, 0, &time, |
|
738 "yyyy", buf3, 5)) { |
|
739 os << "%%CreationDate: " << buf1 << ' ' |
|
740 << buf2 << ' ' << buf3 << std::endl; |
|
741 } |
|
742 #endif |
727 } |
743 } |
728 |
744 |
729 if (_autoArcWidthScale) { |
745 if (_autoArcWidthScale) { |
730 double max_w=0; |
746 double max_w=0; |
731 for(ArcIt e(g);e!=INVALID;++e) |
747 for(ArcIt e(g);e!=INVALID;++e) |