public void Init()
 {
     model           = new Model();
     testModel       = model.Repo.CreateModel("testModel", "RobotsMetamodel");
     model.ModelName = testModel.Name;
     testNodeType    = testModel.Metamodel.FindElement("FinalNode") as Repo.INode;
     testEdgeType    = testModel.Metamodel.FindElement("Link") as Repo.IEdge;
 }
Example #2
0
        private void InitModel(string modelName)
        {
            Repo.IModel model = this.repo.Model(modelName);
            if (model == null)
            {
                return;
            }

            foreach (var node in model.Nodes)
            {
                this.CreateNode(node);
            }

            foreach (var edge in model.Edges)
            {
                /* var isViolation = Constraints.CheckEdge(edge, this.repo, modelName); */

                var sourceNode = edge.From as Repo.INode;
                var targetNode = edge.To as Repo.INode;
                if (sourceNode == null || targetNode == null)
                {
                    // Editor does not support edges linked to edges. Yet.
                    continue;
                }

                if (this.dataGraph.Vertices.Count(v => v.Node == sourceNode) == 0 ||
                    this.dataGraph.Vertices.Count(v => v.Node == targetNode) == 0)
                {
                    // Link to an attribute node. TODO: It's ugly.
                    continue;
                }

                var source = this.dataGraph.Vertices.First(v => v.Node == sourceNode);
                var target = this.dataGraph.Vertices.First(v => v.Node == targetNode);

                var newEdge = new DataEdge(source, target, false)
                {
                    EdgeType = DataEdge.EdgeTypeEnum.Association
                };
                this.dataGraph.AddEdge(newEdge);
                this.DrawNewEdge(source.Node, target.Node);
            }

            this.DrawGraph();
        }
Example #3
0
 public ConstraintsWindow(Repo.IRepo repo, Repo.IModel model)
 {
     this.InitializeComponent();
     this.info = new RepoInfo(repo, model.Name);
 }