equal
deleted
inserted
replaced
132 |
132 |
133 bool _absoluteNodeSizes; |
133 bool _absoluteNodeSizes; |
134 bool _absoluteEdgeWidths; |
134 bool _absoluteEdgeWidths; |
135 |
135 |
136 bool _negY; |
136 bool _negY; |
|
137 |
|
138 bool _preScale; |
137 ///Constructor |
139 ///Constructor |
138 |
140 |
139 ///Constructor |
141 ///Constructor |
140 ///\param _g is a reference to the graph to be printed |
142 ///\param _g is a reference to the graph to be printed |
141 ///\param _os is a reference to the output stream. |
143 ///\param _os is a reference to the output stream. |
161 _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK), |
163 _nodeTextColorType(SAME_COL), _nodeTextColors(BLACK), |
162 _autoNodeScale(false), |
164 _autoNodeScale(false), |
163 _autoEdgeWidthScale(false), |
165 _autoEdgeWidthScale(false), |
164 _absoluteNodeSizes(false), |
166 _absoluteNodeSizes(false), |
165 _absoluteEdgeWidths(false), |
167 _absoluteEdgeWidths(false), |
166 _negY(false) |
168 _negY(false), |
|
169 _preScale(true) |
167 {} |
170 {} |
168 }; |
171 }; |
169 |
172 |
170 ///Helper class to implement the named parameters of \ref graphToEps() |
173 ///Helper class to implement the named parameters of \ref graphToEps() |
171 |
174 |
237 using T::_absoluteNodeSizes; |
240 using T::_absoluteNodeSizes; |
238 using T::_absoluteEdgeWidths; |
241 using T::_absoluteEdgeWidths; |
239 |
242 |
240 |
243 |
241 using T::_negY; |
244 using T::_negY; |
|
245 using T::_preScale; |
242 |
246 |
243 // dradnats ++C eht yb deriuqer si ti eveileb t'naC |
247 // dradnats ++C eht yb deriuqer si ti eveileb t'naC |
244 |
248 |
245 typedef typename T::Graph Graph; |
249 typedef typename T::Graph Graph; |
246 typedef typename Graph::Node Node; |
250 typedef typename Graph::Node Node; |
519 /// |
523 /// |
520 GraphToEps<T> &negateY(bool b=true) { |
524 GraphToEps<T> &negateY(bool b=true) { |
521 _negY=b;return *this; |
525 _negY=b;return *this; |
522 } |
526 } |
523 |
527 |
|
528 ///Turns on/off prescaling |
|
529 |
|
530 ///Turns on/off prescaling |
|
531 /// |
|
532 ///\todo More docs. |
|
533 /// |
|
534 GraphToEps<T> &preScale(bool b=true) { |
|
535 _preScale=b;return *this; |
|
536 } |
|
537 |
524 ///Sets a global scale factor for edge widths |
538 ///Sets a global scale factor for edge widths |
525 |
539 |
526 /// Sets a global scale factor for edge widths. |
540 /// Sets a global scale factor for edge widths. |
527 /// |
541 /// |
528 /// If edgeWidths() is not given, this function simply sets the edge |
542 /// If edgeWidths() is not given, this function simply sets the edge |
774 } |
788 } |
775 |
789 |
776 if(_scaleToA4) |
790 if(_scaleToA4) |
777 os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n"; |
791 os <<"%%BoundingBox: 0 0 596 842\n%%DocumentPaperSizes: a4\n"; |
778 else { |
792 else { |
779 //Rescale so that BoundingBox won't be neither to big nor too small. |
793 if(_preScale) { |
780 while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10; |
794 //Rescale so that BoundingBox won't be neither to big nor too small. |
781 while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10; |
795 while(bb.height()*_scale>1000||bb.width()*_scale>1000) _scale/=10; |
782 |
796 while(bb.height()*_scale<100||bb.width()*_scale<100) _scale*=10; |
|
797 } |
|
798 |
783 os << "%%BoundingBox: " |
799 os << "%%BoundingBox: " |
784 << int(floor(bb.left() * _scale - _xBorder)) << ' ' |
800 << int(floor(bb.left() * _scale - _xBorder)) << ' ' |
785 << int(floor(bb.bottom() * _scale - _yBorder)) << ' ' |
801 << int(floor(bb.bottom() * _scale - _yBorder)) << ' ' |
786 << int(ceil(bb.right() * _scale + _xBorder)) << ' ' |
802 << int(ceil(bb.right() * _scale + _xBorder)) << ' ' |
787 << int(ceil(bb.top() * _scale + _yBorder)) << '\n'; |
803 << int(ceil(bb.top() * _scale + _yBorder)) << '\n'; |