public static SortedAnatomyClickResults findAnatomy(Ray3 ray) { float distance = 0.0f; SortedAnatomyClickResults results = new SortedAnatomyClickResults(); foreach (AnatomyIdentifier anatomy in anatomyList) { if (anatomy.ShowInClickSearch && anatomy.CurrentAlpha > 0.0f && anatomy.checkCollision(ray, ref distance)) { results.add(new AnatomyClickResult(anatomy, distance)); } } results.sort(); return(results); }
private IEnumerable <Anatomy> currentClickGroupSelectionFor(SortedAnatomyClickResults matches) { if (showPremiumAnatomy) { Anatomy groupSelection = null; AnatomyGroup precursor; switch (PickingMode) { case AnatomyPickingMode.Group: //Start with group and go to individual try { groupSelection = currentTopLevelMode.buildGroupSelectionFor(matches.Closest); } catch (Exception) { } //Ignore any exceptions. if (groupSelection != null) { yield return(groupSelection); } if (matches.Closest.IndividualSelectionPrecursor != null && luceneSearch.tryGetGroup(matches.Closest.IndividualSelectionPrecursor, out precursor)) { yield return(precursor); } yield return(matches.Closest); break; case AnatomyPickingMode.Individual: //Go from individual to group yield return(matches.Closest); if (matches.Closest.IndividualSelectionPrecursor != null && luceneSearch.tryGetGroup(matches.Closest.IndividualSelectionPrecursor, out precursor)) { yield return(precursor); } try { groupSelection = currentTopLevelMode.buildGroupSelectionFor(matches.Closest); } catch (Exception) { } //Ignore any exceptions. if (groupSelection != null) { yield return(groupSelection); } break; } } else { AnatomyGroup groupSelection; luceneSearch.tryGetGroup(matches.Closest.Systems.FirstOrDefault(), out groupSelection); yield return(groupSelection); } }