Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            string modelFilename     = "";

            options.Add ("o|output=", "File to use to store dot model",
                         v => modelFilename = v );

            Init (args);

            var exporter = new DotExport (model,
                                          !string.IsNullOrEmpty (modelFilename) ? new StreamWriter (modelFilename) : Console.Out);

            exporter.ExportModel ();
            exporter.Close ();
        }
Exemplo n.º 2
0
        public static string GetExceptionDiagramSource(Goal g)
        {
            var sw = new StringWriter ();
            var exporter = new DotExport (g.model, sw, ranksep:2.5f, nodesep:2.5f, margin:0);
            exporter.ExportGoal (g, true);

            foreach (var r in g.Exceptions ()) {
                exporter.ExportGoal (r.ResolvingGoal());
                exporter.ExportException (r);
            }

            foreach (var r in g.model.Exceptions().Where (x => x.ResolvingGoalIdentifier == g.Identifier)) {
                exporter.ExportGoal (r.ResolvingGoal());
                exporter.ExportException (r);
            }

            exporter.Close ();

            return sw.ToString ();
        }
Exemplo n.º 3
0
        public static string GetPartialGoalDiagram(Goal g)
        {
            var sw = new StringWriter ();
            var exporter = new DotExport (g.model, sw);
            exporter.ExportGoal (g, true);

            foreach (var r in g.ParentRefinements ()) {
                foreach (var g2 in r.SubGoals ().Where (c => c != g)) {
                    exporter.ExportGoal (g2);
                }
                exporter.ExportGoal (r.ParentGoal ());
                exporter.ExportRefinement (r.ParentGoal (), r);
            }

            foreach (var r in g.Refinements()) {
                foreach (var g2 in r.SubGoals ()) {
                    exporter.ExportGoal (g2);
                }
                exporter.ExportRefinement (g, r);
            }

            foreach (var r in g.AgentAssignments()) {
                foreach (var g2 in r.Agents ()) {
                    exporter.ExportAgent (g2);
                }
                exporter.ExportAssignment (g, r);
            }

            foreach (var r in g.Obstructions()) {
                exporter.ExportObstacle (r.Obstacle ());
                exporter.ExportObstruction (g, r);
            }

            foreach (var r in g.Resolutions ()) {
                exporter.ExportObstacle (r.Obstacle ());
                exporter.ExportResolution (r.Obstacle (), r);
            }

            exporter.Close ();

            return GetImage (sw.ToString (), LayoutAlgorithm.Dot);
        }