Changeset 1108:253b66e7e41d in lemon-0.x for src/lemon/graph_to_eps.h
- Timestamp:
- 01/30/05 00:22:02 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1507
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/graph_to_eps.h
r1107 r1108 17 17 #ifndef LEMON_GRAPH_TO_EPS_H 18 18 #define LEMON_GRAPH_TO_EPS_H 19 20 #include <sys/time.h> 21 #include <time.h> 19 22 20 23 #include<iostream> … … 120 123 121 124 bool _scaleToA4; 125 126 std::string _title; 127 std::string _copyright; 122 128 123 129 ///Constructor … … 154 160 ///\todo Follow PostScript's DSC. 155 161 /// Use own dictionary. 156 ///\todo Provide a way to set %%Title: and %%Copyright:. Set %%CreationDate:157 162 ///\todo Useful new features. 158 163 /// - Linestyles: dotted, dashed etc. … … 450 455 GraphToEps<T> &bidir(bool b=true) {_undir=!b;return *this;} 451 456 457 ///Sets the title. 458 459 ///Sets the title of the generated image, 460 ///namely it inserts a <tt>%%Title:</tt> DSC field to the header of 461 ///the EPS file. 462 GraphToEps<T> &title(const std::string &t) {_title=t;return *this;} 463 ///Sets the copyright statement. 464 465 ///Sets the copyright statement of the generated image, 466 ///namely it inserts a <tt>%%Copyright:</tt> DSC field to the header of 467 ///the EPS file. 468 ///\todo Multiline copyright notice could be supported. 469 GraphToEps<T> ©right(const std::string &t) {_copyright=t;return *this;} 470 452 471 protected: 453 472 bool isInsideNode(xy<double> p, double r,int t) … … 477 496 478 497 os << "%!PS-Adobe-2.0 EPSF-2.0\n"; 479 os << "%%Title: LEMON GraphToEps figure\n" ///\todo setTitle() is needed 498 if(_title.size()>0) os << "%%Title: " << _title << '\n'; 499 if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n'; 480 500 // << "%%Copyright: XXXX\n" 481 << "%%Creator: LEMON GraphToEps function\n" 482 // << "%%CreationDate: XXXXXXX\n" 483 ; 501 os << "%%Creator: LEMON GraphToEps function\n"; 502 503 { 504 char cbuf[50]; 505 timeval tv; 506 gettimeofday(&tv, 0); 507 ctime_r(&tv.tv_sec,cbuf); 508 os << "%%CreationDate: " << cbuf; 509 } 484 510 ///\todo: Chech whether the graph is empty. 485 511 BoundingBox<double> bb; … … 490 516 bb+=-p+_coords[n]; 491 517 } 492 if(!_scaleToA4) os << "%%BoundingBox: " 493 << bb.left()* _scale-_xBorder << ' ' 494 << bb.bottom()*_scale-_yBorder << ' ' 495 << bb.right()* _scale+_xBorder << ' ' 496 << bb.top()* _scale+_yBorder << '\n'; 497 518 if(_scaleToA4) 519 os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n"; 520 else os << "%%BoundingBox: " 521 << bb.left()* _scale-_xBorder << ' ' 522 << bb.bottom()*_scale-_yBorder << ' ' 523 << bb.right()* _scale+_xBorder << ' ' 524 << bb.top()* _scale+_yBorder << '\n'; 525 498 526 os << "%%EndComments\n"; 499 527
Note: See TracChangeset
for help on using the changeset viewer.