private void insertIntoFeatureTypeDictionary(IFMEOFeature pFeature) { string currFeatureType = pFeature.FeatureType; // First, we check for where to put the feature inside m_featureTypeDictionary // Check to see if an entry for currFeatureType already exists if (!m_featureTypeDictionary.ContainsKey(currFeatureType)) { // We must create a new entry to the m_featureTypeDictionary IFMEOFeatureVectorOnDisk newVectorOnDisk = m_fmeSession.CreateFeatureVectorOnDisk(m_kMaxFeatureInMemory); // Add the new entry to the dictionary m_featureTypeDictionary.Add(currFeatureType, newVectorOnDisk); } // Now, we put the feature into the proper IFMEOFeatureVectorOnDisk IFMEOFeatureVectorOnDisk currVectorOnDisk = m_featureTypeDictionary[currFeatureType]; currVectorOnDisk.Append(pFeature); }
private void updateFeatureTypeTab() { // Clear the current entries in the featureTypeView featureTypeView.Items.Clear(); IEnumerator <KeyValuePair <string, IFMEOFeatureVectorOnDisk> > iterator = m_featureTypeDictionary.GetEnumerator(); while (iterator.MoveNext()) { string currFeatureType = iterator.Current.Key; IFMEOFeatureVectorOnDisk currVectorOnDisk = m_featureTypeDictionary[currFeatureType]; // Create a new subItem list - it will be a row of data containing // the feature type and its associated count string[] subItemList = { currFeatureType, currVectorOnDisk.Count.ToString() }; ListViewItem newItem = new ListViewItem(subItemList, -1); // Add the item to featureTypeView featureTypeView.Items.Add(newItem); } }
private void disposeFeatureTypeDictionaryEntries() { IEnumerator <KeyValuePair <string, IFMEOFeatureVectorOnDisk> > iterator = m_featureTypeDictionary.GetEnumerator(); // Iterate through each entry m_featureTypeDictionary, and clear each // IFMEOFeatureVectorOnDisk while (iterator.MoveNext()) { string currFeatureType = iterator.Current.Key; IFMEOFeatureVectorOnDisk currVectorOnDisk = iterator.Current.Value; // Calling Clear of IFMEOFeatureVectorOnDisk should also dispose each of the // features that it contains currVectorOnDisk.Clear(); currVectorOnDisk.Dispose(); currVectorOnDisk = null; } // Finally, call Clear of m_featureTypeDictionary m_featureTypeDictionary.Clear(); }