Esempio n. 1
0
        protected void SelectedVertexesUpdated()
        {
            if (TurnOffSelectedItemsUpdate)
            {
                return;
            }

            TurnOffSelectedVertexesUpdate = true;

            ThisDataGrid.SelectedItems.Clear();

            IVertex b = Vertex.Get(@"BaseEdge:\To:");

            if (b != null)
            {
                foreach (IEdge e in Vertex.Get("SelectedEdges:"))
                {
                    IEdge ee = GraphUtil.FindEdgeByToVertex(b, e.To.Get("To:"));
                    if (ee != null)
                    {
                        ThisDataGrid.SelectedItems.Add(ee);
                    }
                }
            }

            TurnOffSelectedVertexesUpdate = false;
        }
Esempio n. 2
0
        public void VertexChange(object sender, VertexChangeEventArgs e)
        {
            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "BaseEdge")) ||
                (sender == Vertex.Get("BaseEdge:") && e.Type == VertexChangeType.ValueChanged) ||
                ((sender == Vertex.Get("BaseEdge:")) && (e.Type == VertexChangeType.EdgeAdded) && ((GeneralUtil.CompareStrings(e.Edge.Meta.Value, "To")))))
            {
                UpdateBaseEdge(); return;
            }

            if (sender == Vertex.Get(@"BaseEdge:\To:") && (e.Type == VertexChangeType.EdgeAdded || e.Type == VertexChangeType.EdgeRemoved))
            {
                UpdateBaseEdge(); return;
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "SelectedEdges")))
            {
                SelectedVertexesUpdated(); return;
            }

            if ((sender == Vertex.Get("SelectedEdges:")) && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
            {
                SelectedVertexesUpdated(); return;
            }

            if (sender is IVertex && GraphUtil.FindEdgeByToVertex(Vertex.GetAll(@"SelectedEdges:\"), (IVertex)sender) != null)
            {
                SelectedVertexesUpdated(); return;
            }

            if (sender == Vertex.Get("ZoomVisualiserContent:") && e.Type == VertexChangeType.ValueChanged)
            {
                ChangeZoomVisualiserContent(); return;
            }

            if (sender == Vertex.Get("VisualiserCircleSize:") && e.Type == VertexChangeType.ValueChanged)
            {
                PaintGraph(); return;
            }

            if (sender == Vertex.Get("NumberOfCircles:") && e.Type == VertexChangeType.ValueChanged)
            {
                PaintGraph(); return;
            }

            if (sender == Vertex.Get("FastMode:") && e.Type == VertexChangeType.ValueChanged)
            {
                PaintGraph(); return;
            }

            if (sender == Vertex.Get("MetaLabels:") && e.Type == VertexChangeType.ValueChanged)
            {
                PaintGraph(); return;
            }

            if (sender == Vertex.Get("ShowInEdges:") && e.Type == VertexChangeType.ValueChanged)
            {
                PaintGraph(); return;
            }
        }
Esempio n. 3
0
        private void SelectedVertexesUpdated_Reccurent(SimpleTreeVisualiserViewItem i, IVertex sv)
        {
            if (GraphUtil.FindEdgeByToVertex(sv, (IVertex)i.Tag) != null)
            {
                i.IsSelected = true;
            }
            else
            {
                i.IsSelected = false;
            }

            foreach (SimpleTreeVisualiserViewItem ii in i.Items)
            {
                SelectedVertexesUpdated_Reccurent(ii, sv);
            }
        }
Esempio n. 4
0
        protected void VertexChange(object sender, VertexChangeEventArgs e)
        {
            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "BaseEdge")) ||
                ((sender == Vertex.Get("BaseEdge:")) && (e.Type == VertexChangeType.EdgeAdded) && ((GeneralUtil.CompareStrings(e.Edge.Meta.Value, "To")))))
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get(@"BaseEdge:\To:") && (e.Type == VertexChangeType.EdgeAdded))
            {
                EdgeAdded(e);
            }

            if (sender == Vertex.Get(@"BaseEdge:\To:") && (e.Type == VertexChangeType.EdgeRemoved))
            {
                EdgeRemoved(e);
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "SelectedEdges")))
            {
                SelectedVertexesUpdated();
            }

            if ((sender == Vertex.Get("SelectedEdges:")) && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
            {
                SelectedVertexesUpdated();
            }

            if (sender is IVertex && GraphUtil.FindEdgeByToVertex(Vertex.GetAll(@"SelectedEdges:\"), (IVertex)sender) != null)
            {
                SelectedVertexesUpdated();
            }

            if (sender == Vertex.Get("ZoomVisualiserContent:") && e.Type == VertexChangeType.ValueChanged)
            {
                ChangeZoomVisualiserContent();
            }
        }
Esempio n. 5
0
        public void SynchronisedVisualiserChange(object sender, VertexChangeEventArgs e)
        {
            if (
                ((sender == selectSynchronisedVisualiser) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "SelectedEdges")))
                ||
                (sender is IVertex && GraphUtil.FindEdgeByToVertex(selectSynchronisedVisualiser.GetAll(@"SelectedEdges:\"), (IVertex)sender) != null && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
                ||
                (sender is IVertex && selectSynchronisedVisualiser.Get(@"SelectedEdges:") == (IVertex)sender && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
                )
            {
                if (baseSynchronisedVertex.Get(@"BaseEdge:\To:") == null)     // if Disposed
                {
                    PlatformClass.RemoveVertexChangeListeners(selectSynchronisedVisualiser, new VertexChange(this.SynchronisedVisualiserChange));
                }
                else
                {
                    IVertex selEdgesFirst = selectSynchronisedVisualiser.Get(@"SelectedEdges:\");

                    if (selEdgesFirst != null)
                    {
                        IVertex firstSelectedVertexEdgeTo = selEdgesFirst.Get("To:");

                        if (firstSelectedVertexEdgeTo != null)
                        {
                            GraphUtil.ReplaceEdge(baseSynchronisedVertex.Get("BaseEdge:"), "To", firstSelectedVertexEdgeTo);
                        }

                        IVertex firstSelectedVertexEdgeMeta = selEdgesFirst.Get("Meta:");

                        if (firstSelectedVertexEdgeMeta != null)
                        {
                            GraphUtil.ReplaceEdge(baseSynchronisedVertex.Get("BaseEdge:"), "Meta", firstSelectedVertexEdgeMeta);
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        protected void SelectedVertexesUpdated()
        {
            if (TurnOffSelectedItemsUpdate)
            {
                return;
            }

            TurnOffSelectedVertexesUpdate = true;

            this.SelectedItems.Clear();

            IVertex b = Vertex.Get("BaseVertex:");

            foreach (IEdge e in Vertex.Get("SelectedVertexes:"))
            {
                IEdge ee = GraphUtil.FindEdgeByToVertex(b, e.To);
                if (ee != null)
                {
                    this.SelectedItems.Add(ee);
                }
            }

            TurnOffSelectedVertexesUpdate = false;
        }
Esempio n. 7
0
        public virtual void DoCreateDiagramLine(DiagramItemBase toItem)
        {
            IVertex toEdge = toItem.Vertex.Get("BaseEdge:");

            IVertex r = m0.MinusZero.Instance.Root;

            IVertex v = m0.MinusZero.Instance.CreateTempVertex();


            foreach (IEdge def in Vertex.GetAll(@"Definition:\DiagramLineDefinition:"))
            {
                bool CreateEdgeOnly = false;

                if (GraphUtil.GetValueAndCompareStrings(def.To.Get("CreateEdgeOnly:"), "True"))
                {
                    CreateEdgeOnly = true;
                }

                foreach (IEdge e in Vertex.GetAll(@"BaseEdge:\To:\" + def.To.Get("EdgeTestQuery:")))
                {
                    bool canAdd = true;

                    if (def.To.Get("ToDiagramItemTestQuery:") != null && toItem.Vertex.Get((string)def.To.Get("ToDiagramItemTestQuery:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (e.To.Get(@"$EdgeTarget:") != null &&
                        !GeneralUtil.CompareStrings(e.To.Get(@"$EdgeTarget:").Value, "Vertex") && // Vertexes do not have $Is:Vertex
                        toEdge.Get(@"To:\$Is:" + (string)e.To.Get(@"$EdgeTarget:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (CreateEdgeOnly == false &&
                        e.To.Get(@"$VertexTarget:") != null &&
                        toEdge.Get(@"To:\$Is:" + (string)e.To.Get(@"$VertexTarget:").Value) == null)
                    {
                        canAdd = false;
                    }

                    if (canAdd)
                    {
                        AddNewLineOption(v, def, e);
                    }
                }

                if (GeneralUtil.CompareStrings(def.To.Value, "Edge"))// Vertex\Edge
                {
                    foreach (IEdge e in r.Get(@"System\Meta\Base\Vertex"))
                    {
                        AddNewLineOption(v, def, e);
                    }
                }

                if (GeneralUtil.CompareStrings(def.To.Get("EdgeTestQuery:"), "$EdgeTarget")) // $EdgeTarget is not present as there is no inheritance from Vertex
                {
                    AddNewLineOption(v, def, GraphUtil.FindEdgeByToVertex(r.Get(@"System\Meta\Base\Vertex"), "$EdgeTarget"));
                }
            }

            if (v.Count() == 0)
            {
                MinusZero.Instance.DefaultShow.ShowInfo("There is no diagram line definition matching selected source and target items.");
            }

            IVertex info = m0.MinusZero.Instance.CreateTempVertex();

            info.Value = "choose diagram line:";


            Point mousePosition = UIWpf.GetMousePosition();

            IVertex a = MinusZero.Instance.DefaultShow.SelectDialog(info, v, mousePosition);

            if (a != null)
            {
                IVertex test = VertexOperations.TestIfNewEdgeValid(Vertex.Get(@"BaseEdge:\To:"), a.Get("OptionEdge:"), toEdge.Get("To:"));

                if (test == null)
                {
                    bool?ForceShowEditForm = null;      // ForceShowEditForm

                    if (a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:") != null)
                    {
                        if (GeneralUtil.CompareStrings(a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:"), "True"))
                        {
                            ForceShowEditForm = true;
                        }

                        if (GeneralUtil.CompareStrings(a.Get(@"OptionDiagramLineDefinition:\ForceShowEditForm:"), "False"))
                        {
                            ForceShowEditForm = false;
                        }
                    }

                    bool CreateEdgeOnly = false;     // CreateEdgeOnly

                    if (GraphUtil.GetValueAndCompareStrings(a.Get(@"OptionDiagramLineDefinition:\CreateEdgeOnly:"), "True"))
                    {
                        CreateEdgeOnly = true;
                    }


                    CanAutomaticallyAddEdges = false;     // for VertexChange
                    IEdge edge = VertexOperations.AddEdgeOrVertexByMeta(Vertex.Get(@"BaseEdge:\To:"), a.Get("OptionEdge:"), toEdge.Get("To:"), mousePosition, CreateEdgeOnly, ForceShowEditForm);
                    CanAutomaticallyAddEdges = true;

                    AddDiagramLineVertex(edge, a.Get(@"OptionDiagramLineDefinition:"), toItem);
                }
                else
                {
                    MinusZero.Instance.DefaultShow.ShowInfo("Adding new diagram line  \"" + a.Value + "\" is not possible.\n\n" + test.Value);
                }
            }
        }
Esempio n. 8
0
        protected override void VertexChange(object sender, VertexChangeEventArgs e)
        {
            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "BaseEdge")) ||
                (sender == Vertex.Get("BaseEdge:") && e.Type == VertexChangeType.ValueChanged) ||
                ((sender == Vertex.Get("BaseEdge:")) && (e.Type == VertexChangeType.EdgeAdded) && ((GeneralUtil.CompareStrings(e.Edge.Meta.Value, "To")))))
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get(@"BaseEdge:\To:") && (e.Type == VertexChangeType.EdgeAdded || e.Type == VertexChangeType.EdgeRemoved))
            {
                UpdateBaseEdge();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "ToShowEdgesMeta")))
            {
                UpdateBaseEdge();
            }

            //if (sender == Vertex.Get(@"ToShowEdgesMeta:") && (e.Type == VertexChangeType.EdgeAdded || e.Type == VertexChangeType.EdgeRemoved))
            //  UpdateBaseEdge();
            // there is update loop with this, so commenting out and leaving only what is above

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "SelectedEdges")))
            {
                SelectedVertexesUpdated();
            }

            if ((sender == Vertex.Get("SelectedEdges:")) && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
            {
                SelectedVertexesUpdated();
            }

            if (sender is IVertex && GraphUtil.FindEdgeByToVertex(Vertex.GetAll(@"SelectedEdges:\"), (IVertex)sender) != null)
            {
                SelectedVertexesUpdated();
            }

            if (sender == Vertex.Get("IsMetaRightAlign:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if (sender == Vertex.Get("IsAllVisualisersEdit:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if (sender == Vertex.Get("ZoomVisualiserContent:") && e.Type == VertexChangeType.ValueChanged)
            {
                ChangeZoomVisualiserContent();
            }

            if (sender == Vertex.Get("FilterQuery:") && e.Type == VertexChangeType.ValueChanged)
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get("ExpertMode:") && e.Type == VertexChangeType.ValueChanged)
            {
                UpdateBaseEdge();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "FilterQuery")))
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get("ShowHeader:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if (sender == Vertex.Get("AlternatingRows:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "ShowHeader")))
            {
                ResetView();
            }
        }
Esempio n. 9
0
        protected virtual void VertexChange(object sender, VertexChangeEventArgs e)
        {
            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "BaseEdge")) ||
                (sender == Vertex.Get("BaseEdge:") && e.Type == VertexChangeType.ValueChanged) ||
                ((sender == Vertex.Get("BaseEdge:")) && (e.Type == VertexChangeType.EdgeAdded) && ((GeneralUtil.CompareStrings(e.Edge.Meta.Value, "To")))))
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get(@"BaseEdge:\To:") && (e.Type == VertexChangeType.EdgeAdded || e.Type == VertexChangeType.EdgeRemoved))
            {
                UpdateBaseEdge();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "SelectedEdges")))
            {
                SelectedVertexesUpdated();
            }

            if ((sender == Vertex.Get("SelectedEdges:")) && ((e.Type == VertexChangeType.EdgeAdded) || (e.Type == VertexChangeType.EdgeRemoved)))
            {
                SelectedVertexesUpdated();
            }

            if (sender is IVertex && GraphUtil.FindEdgeByToVertex(Vertex.GetAll(@"SelectedEdges:\"), (IVertex)sender) != null)
            {
                SelectedVertexesUpdated();
            }

            if (sender == Vertex.Get("IsMetaRightAlign:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if (sender == Vertex.Get("IsAllVisualisersEdit:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if (sender == Vertex.Get("ZoomVisualiserContent:") && e.Type == VertexChangeType.ValueChanged)
            {
                ChangeZoomVisualiserContent();
            }

            if (sender == Vertex.Get("FilterQuery:") && e.Type == VertexChangeType.ValueChanged)
            {
                UpdateBaseEdge();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "FilterQuery")))
            {
                UpdateBaseEdge();
            }

            if (sender == Vertex.Get("ShowMeta:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "ShowMeta")))
            {
                ResetView();
            }

            if (sender == Vertex.Get("ShowHeader:") && e.Type == VertexChangeType.ValueChanged)
            {
                ResetView();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "ShowHeader")))
            {
                ResetView();
            }

            if ((sender == Vertex) && (e.Type == VertexChangeType.EdgeAdded) && (GeneralUtil.CompareStrings(e.Edge.Meta.Value, "GridStyle")))
            {
                ResetView();
            }
        }