lemon/graph_to_eps.h
changeset 1913 49fe71fce7fb
parent 1909 2d806130e700
child 1930 92b70deed0c5
equal deleted inserted replaced
15:05dbf2eb22cd 16:77c09294d8e3
   232 
   232 
   233   bool _showNodePsText;
   233   bool _showNodePsText;
   234   ConstMap<typename Graph::Node,bool > _nodePsTexts;  
   234   ConstMap<typename Graph::Node,bool > _nodePsTexts;  
   235   char *_nodePsTextsPreamble;
   235   char *_nodePsTextsPreamble;
   236   
   236   
   237   bool _u;
   237   bool _undirected;
       
   238 
   238   bool _pleaseRemoveOsStream;
   239   bool _pleaseRemoveOsStream;
   239 
   240 
   240   bool _scaleToA4;
   241   bool _scaleToA4;
   241 
   242 
   242   std::string _title;
   243   std::string _title;
   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)
   327 
   328 
   328   using T::_showNodePsText;
   329   using T::_showNodePsText;
   329   using T::_nodePsTexts;  
   330   using T::_nodePsTexts;  
   330   using T::_nodePsTextsPreamble;
   331   using T::_nodePsTextsPreamble;
   331   
   332   
   332   using T::_u;
   333   using T::_undirected;
       
   334 
   333   using T::_pleaseRemoveOsStream;
   335   using T::_pleaseRemoveOsStream;
   334 
   336 
   335   using T::_scaleToA4;
   337   using T::_scaleToA4;
   336 
   338 
   337   using T::_title;
   339   using T::_title;
   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;