summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/source/SiftingHeuristic_script.h
blob: 653432f52b5d128e0945ddbde9bee039e30b6262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
#include <ogdf/layered/SiftingHeuristic.h>

struct SiftingHeuristic_script :
  scripting::declarations,
  scripting::factory<ogdf::SiftingHeuristic>
{
  
  ogdf::SiftingHeuristic* make (scripting::run_parameters* parameters) {
    using namespace ogdf;
    
    SiftingHeuristic* h = new SiftingHeuristic;

    char* strategy = 0;
    
    if (parameters->option("SiftingHeuristic.strategy", strategy)) {
      if (strcmp(strategy, "left_to_right") == 0)
	h->strategy(SiftingHeuristic::left_to_right);
      else if (strcmp(strategy, "desc_degree") == 0)
	h->strategy(SiftingHeuristic::desc_degree);
      else if (strcmp(strategy, "random") == 0)
	h->strategy(SiftingHeuristic::random);

      free(strategy);
    }
    return h;
  }
  
  void declare (scripting::script s) {
    using namespace scripting;
    s.declare (key ("SiftingHeuristic")
	       .documentation_in ("pgf.gd.doc.ogdf.layered.SiftingHeuristic")
	       .set_module ("TwoLayerCrossMin", this));

    s.declare (key ("SiftingHeuristic.strategy")
	       .type ("string")
	       .documentation_in ("pgf.gd.doc.ogdf.layered.SiftingHeuristic"));
  }
};