diff -r 2cac5b936a2b -r af2ed974ab68 mapstorage.cc --- a/mapstorage.cc Tue Feb 20 17:45:44 2007 +0000 +++ b/mapstorage.cc Tue Feb 27 17:18:19 2007 +0000 @@ -23,8 +23,9 @@ #include #include #include +#include -const double i_d=20; +const int i_d=20; const double a_d=0.05; const double p_d=40000; @@ -589,3 +590,74 @@ { background_scaling = scaling; } + +void MapStorage::exportGraphToEPS(std::vector options, std::string filename) +{ + Graph::NodeMap _nodeColors(graph, 0); + Graph::EdgeMap _edgeColors(graph, 0); + Graph::NodeMap _nodeSizes(graph, 6.0); + Graph::EdgeMap _edgeWidths(graph, 1.0); + bool _drawArrows=options[ARROWS]; + bool _enableParallel=options[PAR]; + + std::string emptyString=""; + Graph::NodeMap _nodeTextMap(graph,emptyString); + + //_nodeTextMap=(Graph::NodeMap *)&emptyStringMap; + + if(options[N_MAPS]) + { + if(active_nodemaps[N_RADIUS]!="") + { + _nodeSizes=*(nodemap_storage[active_nodemaps[N_RADIUS]]); + } + if(active_nodemaps[N_COLOR]!="") + { + for(NodeIt ni(graph);ni!=INVALID;++ni) + { + _nodeColors[ni]=(int)((*(nodemap_storage[active_nodemaps[N_COLOR]]))[ni]); + } + } + if(active_nodemaps[N_TEXT]!="") + { + for(NodeIt ni(graph);ni!=INVALID;++ni) + { + std::ostringstream o; + o << ((*(nodemap_storage[active_nodemaps[N_TEXT]]))[ni]); + _nodeTextMap[ni]=o.str(); + } + } + } + if(options[E_MAPS]) + { + if(active_edgemaps[E_WIDTH]!="") + { + _edgeWidths=*(edgemap_storage[active_edgemaps[E_WIDTH]]); + } + if(active_edgemaps[E_COLOR]!="") + { + for(EdgeIt ei(graph);ei!=INVALID;++ei) + { + _edgeColors[ei]=(int)((*(edgemap_storage[active_edgemaps[E_COLOR]]))[ei]); + } + } + } + + Palette palette; + Palette paletteW(true); + + graphToEps(graph,filename). + title("Sample .eps figure (fits to A4)"). + copyright("(C) 2006 LEMON Project"). + absoluteNodeSizes().absoluteEdgeWidths(). + nodeScale(2).nodeSizes(_nodeSizes). + coords(coords). + nodeColors(composeMap(paletteW,_nodeColors)). + edgeColors(composeMap(palette,_edgeColors)). + edgeWidthScale(0.3).edgeWidths(_edgeWidths). + nodeTexts(_nodeTextMap).nodeTextSize(7). + enableParallel(_enableParallel).parEdgeDist(4). + drawArrows(_drawArrows).arrowWidth(7).arrowLength(7). + run(); + +}