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); } } }
//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); } } }
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); }
public void OnBackClick(object parameter) { if (_previousRoot == null) return; CreateOneLevelGraph(_previousRoot); _previousRoot = _previousRoot.Parent; }
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")); }
public ObjectTypeVertex(string title, object tag, ObjectTypeVertex parent) { this._title = title; this._tag = tag; this._parent = parent; }