270 _drawArrows(false), _arrowLength(1), _arrowWidth(0.3), |
270 _drawArrows(false), _arrowLength(1), _arrowWidth(0.3), |
271 _showNodes(true), _showEdges(true), |
271 _showNodes(true), _showEdges(true), |
272 _enableParallel(false), _parEdgeDist(1), |
272 _enableParallel(false), _parEdgeDist(1), |
273 _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), |
273 _showNodeText(false), _nodeTexts(false), _nodeTextSize(1), |
274 _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), |
274 _showNodePsText(false), _nodePsTexts(false), _nodePsTextsPreamble(0), |
275 _undir(false), |
275 _u(false), |
276 _pleaseRemoveOsStream(_pros), _scaleToA4(false), |
276 _pleaseRemoveOsStream(_pros), _scaleToA4(false), |
277 _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), |
277 _nodeTextColorType(SAME_COL), _nodeTextColors(Color(0,0,0)), |
278 _autoNodeScale(false), |
278 _autoNodeScale(false), |
279 _autoEdgeWidthScale(false), |
279 _autoEdgeWidthScale(false), |
280 _negY(false) |
280 _negY(false) |
732 } |
732 } |
733 ///Sets whether the the graph is undirected |
733 ///Sets whether the the graph is undirected |
734 |
734 |
735 ///Sets whether the the graph is undirected |
735 ///Sets whether the the graph is undirected |
736 /// |
736 /// |
737 GraphToEps<T> &undir(bool b=true) {_undir=b;return *this;} |
737 GraphToEps<T> &u(bool b=true) {_u=b;return *this;} |
738 ///Sets whether the the graph is directed |
738 ///Sets whether the the graph is directed |
739 |
739 |
740 ///Sets whether the the graph is directed. |
740 ///Sets whether the the graph is directed. |
741 ///Use it to show the undirected edges as a pair of directed ones. |
741 ///Use it to show the undirected edges as a pair of directed ones. |
742 GraphToEps<T> &bidir(bool b=true) {_undir=!b;return *this;} |
742 GraphToEps<T> &bidir(bool b=true) {_u=!b;return *this;} |
743 |
743 |
744 ///Sets the title. |
744 ///Sets the title. |
745 |
745 |
746 ///Sets the title of the generated image, |
746 ///Sets the title of the generated image, |
747 ///namely it inserts a <tt>%%Title:</tt> DSC field to the header of |
747 ///namely it inserts a <tt>%%Title:</tt> DSC field to the header of |
956 if(_showEdges) { |
956 if(_showEdges) { |
957 os << "%Edges:\ngsave\n"; |
957 os << "%Edges:\ngsave\n"; |
958 if(_enableParallel) { |
958 if(_enableParallel) { |
959 std::vector<Edge> el; |
959 std::vector<Edge> el; |
960 for(EdgeIt e(g);e!=INVALID;++e) |
960 for(EdgeIt e(g);e!=INVALID;++e) |
961 if((!_undir||g.source(e)<g.target(e))&&_edgeWidths[e]>0) |
961 if((!_u||g.source(e)<g.target(e))&&_edgeWidths[e]>0) |
962 el.push_back(e); |
962 el.push_back(e); |
963 std::sort(el.begin(),el.end(),edgeLess(g)); |
963 std::sort(el.begin(),el.end(),edgeLess(g)); |
964 |
964 |
965 typename std::vector<Edge>::iterator j; |
965 typename std::vector<Edge>::iterator j; |
966 for(typename std::vector<Edge>::iterator i=el.begin();i!=el.end();i=j) { |
966 for(typename std::vector<Edge>::iterator i=el.begin();i!=el.end();i=j) { |
1044 sw+=_edgeWidths[*e]*_edgeWidthScale/2.0+_parEdgeDist; |
1044 sw+=_edgeWidths[*e]*_edgeWidthScale/2.0+_parEdgeDist; |
1045 } |
1045 } |
1046 } |
1046 } |
1047 } |
1047 } |
1048 else for(EdgeIt e(g);e!=INVALID;++e) |
1048 else for(EdgeIt e(g);e!=INVALID;++e) |
1049 if((!_undir||g.source(e)<g.target(e))&&_edgeWidths[e]>0) |
1049 if((!_u||g.source(e)<g.target(e))&&_edgeWidths[e]>0) |
1050 if(_drawArrows) { |
1050 if(_drawArrows) { |
1051 xy<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]); |
1051 xy<double> d(mycoords[g.target(e)]-mycoords[g.source(e)]); |
1052 double rn=_nodeSizes[g.target(e)]*_nodeScale; |
1052 double rn=_nodeSizes[g.target(e)]*_nodeScale; |
1053 int node_shape=_nodeShapes[g.target(e)]; |
1053 int node_shape=_nodeShapes[g.target(e)]; |
1054 double t1=0,t2=1; |
1054 double t1=0,t2=1; |