public AnatomyLuceneSearch(AnatomyController anatomyController) { this.anatomyController = anatomyController; systems = new AnatomyGroupFacetManager("Systems", "System", group => { group.addCommand(new BreakdownSearchCallbackCommand("Show System Anatomy", true, () => displayAnatomyForFacet(group.AnatomicalName, systems.FacetName))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Region", true, () => breakdownGroup("{0} of the {1}", group, regions))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Structure", true, () => breakdownGroup("{0} of the {1}", group, structures))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Classification", true, () => breakdownGroup("{1} of the {0}", group, classifications))); }, anatomy => { String system = anatomy.Systems.FirstOrDefault(); return(buildGroupFromFacets(String.Format("{0} of the {1}", system, anatomy.Region), IEnumerableUtil <AnatomyFacet> .Iter(new AnatomyFacet("System", system), new AnatomyFacet("Region", anatomy.Region)))); }); regions = new AnatomyGroupFacetManager("Regions", "Region", group => { group.addCommand(new BreakdownSearchCallbackCommand("Show Region Anatomy", true, () => displayAnatomyForFacet(group.AnatomicalName, regions.FacetName))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by System", true, () => breakdownGroup("{1} of the {0}", group, systems))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Classification", true, () => breakdownGroup("{1} of the {0}", group, classifications))); }, anatomy => { String system = anatomy.Systems.FirstOrDefault(); return(buildGroupFromFacets(String.Format("{0} of the {1}", system, anatomy.Region), IEnumerableUtil <AnatomyFacet> .Iter(new AnatomyFacet("System", system), new AnatomyFacet("Region", anatomy.Region)))); }); classifications = new AnatomyGroupFacetManager("Classifications", "Classification", group => { group.addCommand(new BreakdownSearchCallbackCommand("Show Individual Anatomy", true, () => displayAnatomyForFacet(group.AnatomicalName, classifications.FacetName))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Region", true, () => breakdownGroup("{0} of the {1}", group, regions))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Structure", true, () => breakdownGroup("{0} of the {1}", group, structures))); }, anatomy => { return(buildGroupFromFacets(String.Format("{0} of the {1}", anatomy.Classification, anatomy.Region), IEnumerableUtil <AnatomyFacet> .Iter(new AnatomyFacet("Classification", anatomy.Classification), new AnatomyFacet("Region", anatomy.Region)))); }); tags = new AnatomyGroupFacetManager("Tags", "Tag", group => { group.addCommand(new BreakdownSearchCallbackCommand("Show Individual Anatomy", true, () => displayAnatomyForFacet(group.AnatomicalName, tags.FacetName))); }, anatomy => { throw new NotImplementedException(); }); structures = new AnatomyGroupFacetManager("Structures", "Structure", group => { group.addCommand(new BreakdownSearchCallbackCommand("Show Individual Anatomy", true, () => displayAnatomyForFacet(group.AnatomicalName, structures.FacetName))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by System", true, () => breakdownGroup("{1} of the {0}", group, systems))); group.addCommand(new BreakdownSearchCallbackCommand("Breakdown by Classification", true, () => breakdownGroup("{1} of the {0}", group, classifications))); }, anatomy => { String system = anatomy.Systems.FirstOrDefault(); return(buildGroupFromFacets(String.Format("{0} of the {1}", system, anatomy.Structure), IEnumerableUtil <AnatomyFacet> .Iter(new AnatomyFacet("System", system), new AnatomyFacet("Structure", anatomy.Structure)))); }); }
/// <summary> /// Breakdown a group /// </summary> /// <param name="groupTitleFormat">The format for the group title, {0} is the group name and {1} is the breakdown facet name.</param> /// <param name="group">The group to break down.</param> /// <param name="breakdownFacet">The facet to breakdown the group by.</param> private void breakdownGroup(String groupTitleFormat, AnatomyGroup group, AnatomyGroupFacetManager breakdownFacet) { anatomyController.displayAnatomy(String.Format("{0} by {1}", group.AnatomicalName, breakdownFacet.FacetName), breakdownGroupSearch(groupTitleFormat, group.AnatomicalName, group.Facets, breakdownFacet.FacetName, breakdownFacet.Select(i => i.AnatomicalName)), SuggestedDisplaySortMode.Alphabetical); }