diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pgf/base/source/FMMMLayout_script.h |
Initial commit
Diffstat (limited to 'graphics/pgf/base/source/FMMMLayout_script.h')
-rw-r--r-- | graphics/pgf/base/source/FMMMLayout_script.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/graphics/pgf/base/source/FMMMLayout_script.h b/graphics/pgf/base/source/FMMMLayout_script.h new file mode 100644 index 0000000000..bdaf26bf67 --- /dev/null +++ b/graphics/pgf/base/source/FMMMLayout_script.h @@ -0,0 +1,44 @@ +#include <pgf/gd/ogdf/c/InterfaceFromOGDF.h> +#include <ogdf/energybased/FMMMLayout.h> + +struct FMMMLayout_script : + scripting::declarations, + scripting::ogdf_runner +{ + void run () { + using namespace ogdf; + FMMMLayout layout; + + layout.newInitialPlacement(false); + layout.qualityVersusSpeed(FMMMLayout::qvsGorgeousAndEfficient); + + parameters->configure_option ("FMMMLayout.unitEdgeLength", + &FMMMLayout::unitEdgeLength, layout); + parameters->configure_option ("FMMMLayout.randSeed", + &FMMMLayout::randSeed, layout); + + layout.call (graph_attributes); + } + + void declare (scripting::script s) { + using namespace scripting; + using namespace ogdf; + s.declare (key ("FMMMLayout") + .precondition ("connected") + .algorithm (this) + .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout")); + + s.declare (key ("FMMMLayout.randSeed") + .type ("number") + .initial ("42") + .alias ("random seed") + .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout")); + + s.declare (key ("FMMMLayout.unitEdgeLength") + .type ("length") + .initial ("1cm") + .alias_function ("function (o) return o['node pre sep'] + o['node post sep'] end") + .documentation_in ("pgf.gd.doc.ogdf.energybased.FMMMLayout")); + } + +}; |