Exemple #1
0
        /// <summary>
        /// The containers may not be in the same place that the links think they are.  So this method goes through all the container positions
        /// that all the links point to, and figures out which containers are closest to those positions
        /// </summary>
        private static Dictionary<Point3D, ClosestExistingResult[]> BuildExternalLinksExisting_ContainerPoints(ContainerInput[] containers, int maxIntermediateLinks)
        {
            Dictionary<Point3D, ClosestExistingResult[]> retVal = new Dictionary<Point3D, ClosestExistingResult[]>();		// can't use SortedList, because point isn't sortable (probably doesn't have IComparable)

            Point3D[] allPartPoints = containers.Select(o => o.Position).ToArray();

            foreach (ContainerInput container in containers.Where(o => o.ExternalLinks != null && o.ExternalLinks.Length > 0))
            {
                // Get a unique list of referenced parts
                foreach (var exist in container.ExternalLinks)
                {
                    if (!retVal.ContainsKey(exist.FromContainerPosition))
                    {
                        retVal.Add(exist.FromContainerPosition, GetClosestExisting(exist.FromContainerPosition, allPartPoints, maxIntermediateLinks));
                    }
                }
            }

            // Exit Function
            return retVal;
        }
Exemple #2
0
 private static List<INeuron>[] BuildExternalLinksRandom_FindReadable(ContainerInput[] containers)
 {
     return containers.
         Select(o => o.Container.Neruons_Readonly.
             Concat(o.Container.Neruons_ReadWrite).
             ToList()).
         ToArray();
 }