public override void UpdateContent() { fRootItem.Items.Clear(); var unkTax = fDataMap.Model.CreateItem(fRootItem, "Unknown Taxonomy", 0.0d); Dictionary <string, SpeciesItem> species = new Dictionary <string, SpeciesItem>(); IList <Inhabitant> records = fModel.QueryInhabitants(); foreach (Inhabitant rec in records) { Species spc = fModel.GetRecord <Species>(rec.SpeciesId); if (spc == null) { continue; } SpeciesType speciesType = fModel.GetSpeciesType(rec.SpeciesId); ItemType itemType = ALCore.GetItemType(speciesType); int quantity = fModel.QueryInhabitantsCount(rec.Id, itemType); if (quantity != 0) { string name = string.Format("{0} ({1})", spc.ScientificName, spc.Name); SpeciesItem item; if (!species.TryGetValue(name, out item)) { item = new SpeciesItem(name, spc.BioFamily, quantity); species.Add(name, item); } else { item.Quantity += quantity; } } } foreach (var pair in species) { var item = pair.Value; var row = SearchFamily(item.Family); if (row == null) { fDataMap.Model.CreateItem(unkTax, item.Name, item.Quantity); } else { var taxItem = GetTaxonomyItem(row); fDataMap.Model.CreateItem(taxItem, item.Name, item.Quantity); } } fDataMap.UpdateView(); }
private void UpdateTreeMap() { fDataMap.Model.Items.Clear(); if (fBase == null) { fDataMap.Invalidate(); return; } string hint = fPlugin.LangMan.LS(CLS.LSID_Hint); GDMTree tree = fBase.Context.Tree; List <GDMIndividualRecord> prepared = new List <GDMIndividualRecord>(); List <GDMRecord> groupRecords = new List <GDMRecord>(); try { int groupNum = 0; int num = tree.RecordsCount; for (int i = 0; i < num; i++) { GDMRecord rec = tree[i]; if (rec.RecordType == GDMRecordType.rtIndividual) { GDMIndividualRecord iRec = rec as GDMIndividualRecord; if (prepared.IndexOf(iRec) < 0) { groupNum++; groupRecords.Clear(); TreeTools.WalkTree(tree, iRec, TreeTools.TreeWalkMode.twmAll, groupRecords); int groupSize = groupRecords.Count; float quality = 0.0f; for (int j = 0; j < groupSize; j++) { iRec = (GDMIndividualRecord)groupRecords[j]; prepared.Add(iRec); quality += iRec.GetCertaintyAssessment(); } quality /= groupSize; string name = string.Format(hint, groupNum, groupSize, quality.ToString("0.00")); CreateItem(null, name, groupSize, quality); } } } } finally { groupRecords.Clear(); } fDataMap.UpdateView(); }
private void UpdateTreeMap() { fDataMap.Model.Clear(); DiskItem item = tscmbDisk.SelectedItem as DiskItem; if (item != null) { DriveInfo di = item.Tag as DriveInfo; DirectoryInfo rootDir = di.RootDirectory; WalkDirectoryTree(rootDir, di.TotalSize - di.TotalFreeSpace, di.TotalFreeSpace); } fDataMap.UpdateView(); }