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