gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge bugfix #336 to branch 1.0
0 1 0
merge 1.0
0 files changed with 1 insertions and 1 deletions:
↑ Collapse diff ↑
Show white space 64 line context
... ...
@@ -658,67 +658,67 @@
658 658
public:
659 659
  ~GraphToEps() { }
660 660

	
661 661
  ///Draws the graph.
662 662

	
663 663
  ///Like other functions using
664 664
  ///\ref named-templ-func-param "named template parameters",
665 665
  ///this function calls the algorithm itself, i.e. in this case
666 666
  ///it draws the graph.
667 667
  void run() {
668 668
    const double EPSILON=1e-9;
669 669
    if(dontPrint) return;
670 670

	
671 671
    _graph_to_eps_bits::_NegY<typename T::CoordsMapType>
672 672
      mycoords(_coords,_negY);
673 673

	
674 674
    os << "%!PS-Adobe-2.0 EPSF-2.0\n";
675 675
    if(_title.size()>0) os << "%%Title: " << _title << '\n';
676 676
     if(_copyright.size()>0) os << "%%Copyright: " << _copyright << '\n';
677 677
    os << "%%Creator: LEMON, graphToEps()\n";
678 678

	
679 679
    {
680 680
      os << "%%CreationDate: ";
681 681
#ifndef WIN32
682 682
      timeval tv;
683 683
      gettimeofday(&tv, 0);
684 684

	
685 685
      char cbuf[26];
686 686
      ctime_r(&tv.tv_sec,cbuf);
687 687
      os << cbuf;
688 688
#else
689 689
      os << bits::getWinFormattedDate();
690
      os << std::endl;
690 691
#endif
691 692
    }
692
    os << std::endl;
693 693

	
694 694
    if (_autoArcWidthScale) {
695 695
      double max_w=0;
696 696
      for(ArcIt e(g);e!=INVALID;++e)
697 697
        max_w=std::max(double(_arcWidths[e]),max_w);
698 698
      if(max_w>EPSILON) {
699 699
        _arcWidthScale/=max_w;
700 700
      }
701 701
    }
702 702

	
703 703
    if (_autoNodeScale) {
704 704
      double max_s=0;
705 705
      for(NodeIt n(g);n!=INVALID;++n)
706 706
        max_s=std::max(double(_nodeSizes[n]),max_s);
707 707
      if(max_s>EPSILON) {
708 708
        _nodeScale/=max_s;
709 709
      }
710 710
    }
711 711

	
712 712
    double diag_len = 1;
713 713
    if(!(_absoluteNodeSizes&&_absoluteArcWidths)) {
714 714
      dim2::Box<double> bb;
715 715
      for(NodeIt n(g);n!=INVALID;++n) bb.add(mycoords[n]);
716 716
      if (bb.empty()) {
717 717
        bb = dim2::Box<double>(dim2::Point<double>(0,0));
718 718
      }
719 719
      diag_len = std::sqrt((bb.bottomLeft()-bb.topRight()).normSquare());
720 720
      if(diag_len<EPSILON) diag_len = 1;
721 721
      if(!_absoluteNodeSizes) _nodeScale*=diag_len;
722 722
      if(!_absoluteArcWidths) _arcWidthScale*=diag_len;
723 723
    }
724 724

	
0 comments (0 inline)