示例#1
0
 public ObjectTypeVertex(string title, object tag, ObjectTypeVertex parent)
 {
     this._title = title;
     this._tag = tag;
     this._parent = parent;
 }
示例#2
0
        private void CreateRootGraphInternal(CelestialObjectType type, ObjectTypesGraph graph)
        {
            //ObjectTypeVertex parent = new ObjectTypeVertex(string.Format("{0} ({1})", type.Description, type.ShortCode));
            ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type, _previousRoot);
            graph.AddVertex(parent);

            if (type.Subtypes.Count > 0)
            {
                foreach (CelestialObjectType subtype in type.Subtypes)
                {
                    ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent);
                    graph.AddVertex(child);
                    graph.AddEdge(new ObjectTypeEdge(parent, child));

                    //CreateGraphInternal(subtype, graph);
                }
            }
        }
示例#3
0
        //private void CreateRootGraphInternal(CelestialObjectType type, ObjectTypesGraph graph, ObjectTypeVertex parentVertex)
        //{
        //    //ObjectTypeVertex parent = new ObjectTypeVertex(string.Format("{0} ({1})", type.Description, type.ShortCode));
        //    ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type, parentVertex);
        //    graph.AddVertex(parent);
        //    if (type.Subtypes.Count > 0)
        //    {
        //        foreach (CelestialObjectType subtype in type.Subtypes)
        //        {
        //            ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent);
        //            graph.AddVertex(child);
        //            graph.AddEdge(new ObjectTypeEdge(parent, child));
        //            //CreateGraphInternal(subtype, graph);
        //        }
        //    }
        //}
        private void CreateGraphInternal(CelestialObjectType type, ObjectTypesGraph graph)
        {
            ObjectTypeVertex parent = new ObjectTypeVertex(type.Description, type);
            graph.AddVertex(parent);

            if (type.Subtypes.Count > 0)
            {
                foreach (CelestialObjectType subtype in type.Subtypes)
                {
                    ObjectTypeVertex child = new ObjectTypeVertex(subtype.Description, subtype, parent);
                    graph.AddVertex(child);
                    graph.AddEdge(new ObjectTypeEdge(parent, child));

                    CreateGraphInternal(subtype, graph);
                }
            }
        }
示例#4
0
        public void OnVertexClick(VertexClickCommandParameters parameters)
        {
            CelestialObjectType oType = parameters.Target.Tag as CelestialObjectType;

            if (oType == null)
                return;

            if (oType.Subtypes == null || oType.Subtypes.Count == 0)
                return;

            _previousRoot = parameters.Target.Parent;
            //CreateOneLevelGraph(parameters.Target, _previousRoot);
            CreateOneLevelGraph(parameters.Target);
        }
示例#5
0
        public void OnBackClick(object parameter)
        {
            if (_previousRoot == null)
                return;

            CreateOneLevelGraph(_previousRoot);
            _previousRoot = _previousRoot.Parent;
        }
示例#6
0
        public void CreateOneLevelGraph(ObjectTypeVertex root)
        {
            var graphTemp = new ObjectTypesGraph();
            CelestialObjectType objectType = root.Tag as CelestialObjectType;

            CreateRootGraphInternal(objectType, graphTemp);
            _currentGraph = graphTemp;

            NotifyPropertyChanged(this, new PropertyChangedEventArgs("CurrentGraph"));
        }