private void FSDJumpCallback(FSDJumpEvent obj) { _nodes.Clear(); UpdateStarsystemMap?.Invoke(null); }
private void CheckNodeObjects(SystemObject obj) { var currentParent = ExtractParents(obj); if (currentParent.Ring.HasValue) { var parentnode = _nodes.Where(m => m.BodyId == currentParent.Ring).FirstOrDefault(); var childnode = _nodes.Where(m => m.BodyId == obj.Id).FirstOrDefault(); if (parentnode == null) { parentnode = new RingNode(currentParent.Ring.Value); _nodes.Add(parentnode); } if (childnode == null) { childnode = SystemNode.CreateNodeFromObject(obj); _nodes.Add(childnode); } parentnode.ChildList.Add(childnode); childnode.ParentList.Add(parentnode); UpdateStarsystemMap?.Invoke(childnode); return; } if (currentParent.Planet.HasValue) { var parentnode = _nodes.Where(m => m.BodyId == currentParent.Planet).FirstOrDefault(); var childnode = _nodes.Where(m => m.BodyId == obj.Id).FirstOrDefault(); if (parentnode == null) { parentnode = new PlanetNode(currentParent.Planet.Value); _nodes.Add(parentnode); } if (childnode == null) { childnode = SystemNode.CreateNodeFromObject(obj); _nodes.Add(childnode); } parentnode.ChildList.Add(childnode); childnode.ParentList.Add(parentnode); UpdateStarsystemMap?.Invoke(childnode); return; } if (currentParent.Star.HasValue) { var parentnode = _nodes.Where(m => m.BodyId == currentParent.Star).FirstOrDefault(); var childnode = _nodes.Where(m => m.BodyId == obj.Id).FirstOrDefault(); if (parentnode == null) { parentnode = new StarNode(currentParent.Star.Value); _nodes.Add(parentnode); } if (childnode == null) { childnode = SystemNode.CreateNodeFromObject(obj); _nodes.Add(childnode); } parentnode.ChildList.Add(childnode); childnode.ParentList.Add(parentnode); UpdateStarsystemMap?.Invoke(childnode); return; } if (currentParent.Null.HasValue) { var parentnode = _nodes.Where(m => m.BodyId == currentParent.Null).FirstOrDefault(); var childnode = _nodes.Where(m => m.BodyId == obj.Id).FirstOrDefault(); if (parentnode == null) { parentnode = new BarycenterNode(currentParent.Null.Value); _nodes.Add(parentnode); } if (childnode == null) { childnode = SystemNode.CreateNodeFromObject(obj); _nodes.Add(childnode); } parentnode.ChildList.Add(childnode); childnode.ParentList.Add(parentnode); UpdateStarsystemMap?.Invoke(childnode); return; } }