21 #include "gui_writer.h" |
21 #include "gui_writer.h" |
22 #include "gui_reader.h" |
22 #include "gui_reader.h" |
23 #include <limits> |
23 #include <limits> |
24 #include <cmath> |
24 #include <cmath> |
25 #include <gtkmm.h> |
25 #include <gtkmm.h> |
26 |
26 #include<lemon/graph_to_eps.h> |
27 const double i_d=20; |
27 |
|
28 const int i_d=20; |
28 const double a_d=0.05; |
29 const double a_d=0.05; |
29 const double p_d=40000; |
30 const double p_d=40000; |
30 |
31 |
31 MapStorage::MapStorage(NoteBookTab& tab) : mytab(tab), modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d), background_set(false) |
32 MapStorage::MapStorage(NoteBookTab& tab) : mytab(tab), modified(false), file_name(""), arrow_pos_read_ok(false), iterations(i_d), attraction(a_d), propulsation(p_d), background_set(false) |
32 { |
33 { |
587 |
588 |
588 void MapStorage::setBackgroundScaling(double scaling) |
589 void MapStorage::setBackgroundScaling(double scaling) |
589 { |
590 { |
590 background_scaling = scaling; |
591 background_scaling = scaling; |
591 } |
592 } |
|
593 |
|
594 void MapStorage::exportGraphToEPS(std::vector<bool> options, std::string filename) |
|
595 { |
|
596 Graph::NodeMap<int> _nodeColors(graph, 0); |
|
597 Graph::EdgeMap<int> _edgeColors(graph, 0); |
|
598 Graph::NodeMap<double> _nodeSizes(graph, 6.0); |
|
599 Graph::EdgeMap<double> _edgeWidths(graph, 1.0); |
|
600 bool _drawArrows=options[ARROWS]; |
|
601 bool _enableParallel=options[PAR]; |
|
602 |
|
603 std::string emptyString=""; |
|
604 Graph::NodeMap<std::string> _nodeTextMap(graph,emptyString); |
|
605 |
|
606 //_nodeTextMap=(Graph::NodeMap<void> *)&emptyStringMap; |
|
607 |
|
608 if(options[N_MAPS]) |
|
609 { |
|
610 if(active_nodemaps[N_RADIUS]!="") |
|
611 { |
|
612 _nodeSizes=*(nodemap_storage[active_nodemaps[N_RADIUS]]); |
|
613 } |
|
614 if(active_nodemaps[N_COLOR]!="") |
|
615 { |
|
616 for(NodeIt ni(graph);ni!=INVALID;++ni) |
|
617 { |
|
618 _nodeColors[ni]=(int)((*(nodemap_storage[active_nodemaps[N_COLOR]]))[ni]); |
|
619 } |
|
620 } |
|
621 if(active_nodemaps[N_TEXT]!="") |
|
622 { |
|
623 for(NodeIt ni(graph);ni!=INVALID;++ni) |
|
624 { |
|
625 std::ostringstream o; |
|
626 o << ((*(nodemap_storage[active_nodemaps[N_TEXT]]))[ni]); |
|
627 _nodeTextMap[ni]=o.str(); |
|
628 } |
|
629 } |
|
630 } |
|
631 if(options[E_MAPS]) |
|
632 { |
|
633 if(active_edgemaps[E_WIDTH]!="") |
|
634 { |
|
635 _edgeWidths=*(edgemap_storage[active_edgemaps[E_WIDTH]]); |
|
636 } |
|
637 if(active_edgemaps[E_COLOR]!="") |
|
638 { |
|
639 for(EdgeIt ei(graph);ei!=INVALID;++ei) |
|
640 { |
|
641 _edgeColors[ei]=(int)((*(edgemap_storage[active_edgemaps[E_COLOR]]))[ei]); |
|
642 } |
|
643 } |
|
644 } |
|
645 |
|
646 Palette palette; |
|
647 Palette paletteW(true); |
|
648 |
|
649 graphToEps(graph,filename). |
|
650 title("Sample .eps figure (fits to A4)"). |
|
651 copyright("(C) 2006 LEMON Project"). |
|
652 absoluteNodeSizes().absoluteEdgeWidths(). |
|
653 nodeScale(2).nodeSizes(_nodeSizes). |
|
654 coords(coords). |
|
655 nodeColors(composeMap(paletteW,_nodeColors)). |
|
656 edgeColors(composeMap(palette,_edgeColors)). |
|
657 edgeWidthScale(0.3).edgeWidths(_edgeWidths). |
|
658 nodeTexts(_nodeTextMap).nodeTextSize(7). |
|
659 enableParallel(_enableParallel).parEdgeDist(4). |
|
660 drawArrows(_drawArrows).arrowWidth(7).arrowLength(7). |
|
661 run(); |
|
662 |
|
663 } |