summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/source/SpringEmbedderFRExact_script.h
blob: 4e9fbfb3f17629b679ac0641887f94d1f7eba213 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h>
#include <ogdf/energybased/SpringEmbedderFRExact.h>

struct SpringEmbedderFRExact_script :
  scripting::declarations,
  scripting::ogdf_runner
{
  void run () {
    using namespace ogdf;
    SpringEmbedderFRExact layout;

    parameters->configure_option ("SpringEmbedderFRExact.iterations",
                                  &SpringEmbedderFRExact::iterations, layout);
    parameters->configure_option ("SpringEmbedderFRExact.noise",
                                  &SpringEmbedderFRExact::noise, layout);
    parameters->configure_option ("SpringEmbedderFRExact.idealEdgeLength",
                                  &SpringEmbedderFRExact::idealEdgeLength, layout);
    parameters->configure_option ("SpringEmbedderFRExact.convTolerance",
                                  &SpringEmbedderFRExact::convTolerance, layout);

    char* s = 0;
    
    if (parameters->option("SpringEmbedderFRExact.coolingFunction", s)) {
      if (strcmp(s, "factor") == 0)
	layout.coolingFunction(SpringEmbedderFRExact::cfFactor);
      else if (strcmp(s, "logarithmic") == 0)
	layout.coolingFunction(SpringEmbedderFRExact::cfLogarithmic);

      free(s);
    }
    
    layout.call (graph_attributes);
  }
  
  void declare (scripting::script s) {
    using namespace scripting;
    using namespace ogdf;

    s.declare (key ("SpringEmbedderFRExact")
               .precondition ("connected")
               .algorithm (this)
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));

    s.declare (key ("SpringEmbedderFRExact.iterations")
               .type ("number")
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
                    
    s.declare (key ("SpringEmbedderFRExact.noise")
               .type ("boolean")
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
                    
    s.declare (key ("SpringEmbedderFRExact.coolingFunction")
               .type ("string")
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
                    
    s.declare (key ("SpringEmbedderFRExact.idealEdgeLength")
               .type ("number")
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
                    
    s.declare (key ("SpringEmbedderFRExact.convTolerance")
               .type ("number")
               .documentation_in ("pgf.gd.doc.ogdf.energybased.SpringEmbedderFRExact"));
                    
  }
  
};