Changeset 1604:4d037c2b66aa in lemon0.x for lemon/graph_to_eps.h
 Timestamp:
 07/28/05 21:05:45 (16 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@2109
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/graph_to_eps.h
r1588 r1604 235 235 ConstMap<typename Graph::Node,Color > _nodeTextColors; 236 236 237 bool _autoNodeScale; 238 bool _autoEdgeWidthScale; 239 237 240 ///Constructor 238 241 … … 259 262 _undir(false), 260 263 _pleaseRemoveOsStream(_pros), _scaleToA4(false), 261 _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)) 264 _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), 265 _autoNodeScale(false), 266 _autoEdgeWidthScale(false) 262 267 {} 263 268 }; … … 325 330 using T::_nodeTextColorType; 326 331 using T::_nodeTextColors; 332 333 using T::_autoNodeScale; 334 using T::_autoEdgeWidthScale; 335 327 336 // dradnats ++C eht yb deriuqer si ti eveileb t'naC 328 337 … … 552 561 ///Sets a global scale factor for node sizes 553 562 554 ///Sets a global scale factor for node sizes 555 /// 563 ///Sets a global scale factor for node sizes. 564 /// 565 /// If nodeSizes() is not given, this function simply sets the node 566 /// sizes to \c d. If nodeSizes() is given, but 567 /// autoNodeScale() is not, then the node size given by 568 /// nodeSizes() will be multiplied by the value \c d. 569 /// If both nodeSizes() and autoNodeScale() are used, then the 570 /// node sizes will be scaled in such a way that the greatest size will be 571 /// equal to \c d. 556 572 GraphToEps<T> &nodeScale(double d) {_nodeScale=d;return *this;} 573 ///Turns on/off the automatic node width scaling. 574 575 ///Turns on/off the automatic node width scaling. 576 /// 577 ///\sa nodeScale() 578 /// 579 GraphToEps<T> &autoNodeScale(bool b=true) { 580 _autoNodeScale=b;return *this; 581 } 557 582 ///Sets a global scale factor for edge widths 558 583 559 ///Sets a global scale factor for edge widths 560 /// 584 /// Sets a global scale factor for edge widths. 585 /// 586 /// If edgeWidths() is not given, this function simply sets the edge 587 /// widths to \c d. If edgeWidths() is given, but 588 /// autoEdgeWidthScale() is not, then the edge withs given by 589 /// edgeWidths() will be multiplied by the value \c d. 590 /// If both edgeWidths() and autoEdgeWidthScale() are used, then the 591 /// edge withs will be scaled in such a way that the greatest width will be 592 /// equal to \c d. 561 593 GraphToEps<T> &edgeWidthScale(double d) {_edgeWidthScale=d;return *this;} 594 ///Turns on/off the automatic edge width scaling. 595 596 ///Turns on/off the automatic edge width scaling. 597 /// 598 ///\sa edgeWidthScale() 599 /// 600 GraphToEps<T> &autoEdgeWidthScale(bool b=true) { 601 _autoEdgeWidthScale=b;return *this; 602 } 562 603 ///Sets a global scale factor for the whole picture 563 604 564 605 ///Sets a global scale factor for the whole picture 565 606 /// 607 566 608 GraphToEps<T> &scale(double d) {_scale=d;return *this;} 567 609 ///Sets the width of the border around the picture … … 715 757 os << "%%CreationDate: " << cbuf; 716 758 } 759 760 if (_autoEdgeWidthScale) { 761 double max_w=0; 762 for(EdgeIt e(g);e!=INVALID;++e) 763 max_w=std::max(double(_edgeWidths[e]),max_w); 764 ///\todo better 'epsilon' would be nice here. 765 if(max_w>1e9) { 766 _edgeWidthScale/=max_w; 767 } 768 } 769 770 if (_autoNodeScale) { 771 double max_s=0; 772 for(NodeIt n(g);n!=INVALID;++n) 773 max_s=std::max(double(_nodeSizes[n]),max_s); 774 ///\todo better 'epsilon' would be nice here. 775 if(max_s>1e9) { 776 _nodeScale/=max_s; 777 } 778 } 779 780 717 781 BoundingBox<double> bb; 718 782 ///\bug: Chech whether the graph is empty. … … 726 790 bb = BoundingBox<double>(xy<double>(0,0)); 727 791 } 792 728 793 if(_scaleToA4) 729 794 os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n";
Note: See TracChangeset
for help on using the changeset viewer.