public void Render(Goal g, KAOSModel model)
        {
            Render (g);

            // Exceptions
            foreach (var e in g.Exceptions ()) {
                if (!shapes.ContainsKey (e.ResolvingGoalIdentifier))
                    Render (e.ResolvingGoal());
                Render (e);
            }

            // Replacements
            foreach (var e in g.Replacements ()) {
                if (!shapes.ContainsKey (e.AnchorGoalIdentifier))
                    Render (e.AnchorGoal ());
                Render (e);
            }

            // Provided
            foreach (var e in g.Provided ()) {
                if (!shapes.ContainsKey (e.ResolvedObstacleIdentifier))
                    Render (e.Obstacle ());
                Render (e);
            }

            // Context refinements
            /*
            foreach (var r in g.ParentRefinements ().Union (g.Refinements ())) {
                if (!shapes.ContainsKey (r.ParentGoalIdentifier)) {
                    Render (r.ParentGoal ());
                }

                foreach (var sg in r.SubGoals ()) {
                    if (!shapes.ContainsKey (sg.Identifier)) {
                        Render (sg);
                    }
                }

                Render (r);
            }
            */
        }
Пример #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 ();
        }