lemon/graph_to_eps.h
changeset 1909 2d806130e700
parent 1907 9f9eeb4d5c69
child 1910 f95eea8c34b0
equal deleted inserted replaced
14:ebec631b2e08 15:05dbf2eb22cd
   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 _undir;
   237   bool _u;
   238   bool _pleaseRemoveOsStream;
   238   bool _pleaseRemoveOsStream;
   239 
   239 
   240   bool _scaleToA4;
   240   bool _scaleToA4;
   241 
   241 
   242   std::string _title;
   242   std::string _title;
   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)
   327 
   327 
   328   using T::_showNodePsText;
   328   using T::_showNodePsText;
   329   using T::_nodePsTexts;  
   329   using T::_nodePsTexts;  
   330   using T::_nodePsTextsPreamble;
   330   using T::_nodePsTextsPreamble;
   331   
   331   
   332   using T::_undir;
   332   using T::_u;
   333   using T::_pleaseRemoveOsStream;
   333   using T::_pleaseRemoveOsStream;
   334 
   334 
   335   using T::_scaleToA4;
   335   using T::_scaleToA4;
   336 
   336 
   337   using T::_title;
   337   using T::_title;
   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;