コード例 #1
0
 public void ClearLinks()
 {
     PrimarySources.Clear();
     SecondarySources.Clear();
     PrimaryTargets.Clear();
     SecondaryTargets.Clear();
 }
コード例 #2
0
 protected virtual void OnTracksChanged(params QueryField [] fields)
 {
     HandleTracksChanged(this, new TrackEventArgs(fields));
     foreach (PrimarySource psource in PrimarySources.ToArray())
     {
         psource.NotifyTracksChanged(fields);
     }
 }
コード例 #3
0
            private void MatchSources()
            {
                // Check every source in the secondary collection.
                var nodes = PrimarySources;

                for (var node = nodes.First; node != null;)
                {
                    // Get the source at this node, and the pixel it falls in.
                    var current    = node.Value;
                    var coordinate = current.EquatorialCoordinate;
                    var pixel      = Comparer.GetPixel(coordinate);
                    var nodeList   = GetCandidateMatches(pixel);

                    // Find the source that is closest to the candidate source.
                    var matchedNode = GetNearestSourceNode(current, nodeList);

                    // Did we get a match?
                    if (matchedNode is null)
                    {
                        // No matches here, go to the next node.
                        node = node.Next;
                        continue;
                    }

                    // Add the match.
                    var match = matchedNode.Value;
                    PrimaryMatchedSources.Add(current);
                    SecondaryMatchedSources.Add(match);

                    // Remove the matched source from the pixel collection so it cannot be matched again.
                    var position = Comparer.GetPixel(match.EquatorialCoordinate);
                    nodeList = SourceDictionary[position];
                    nodeList.Remove(matchedNode);

                    // Remove the matched source from the primary list (so we end up with all unmatched sources afterwards).
                    SecondarySources.Remove(matchedNode);

                    // Remove this node from the secondary list and update the position.
                    var temp = node;
                    node = node.Next;
                    PrimarySources.Remove(temp);
                    continue;
                }
            }