public static int getSymbolIDByName(IFeatureClass Anno, string name) { IAnnoClass aClas = (IAnnoClass)Anno.Extension; ISymbolCollection2 isc = (ISymbolCollection2)aClas.SymbolCollection; isc.Reset();// very important to call Reset() if not you get no result from Next() ISymbolIdentifier2 sId = (ISymbolIdentifier2)isc.Next(); while (sId != null) { if (sId.Name.ToUpper() == name.ToUpper()) { return(sId.ID); } sId = (ISymbolIdentifier2)isc.Next(); } return(-1); }
public static string getSymbolNameById(IFeatureClass Anno, int id) { IAnnoClass aClas = (IAnnoClass)Anno.Extension; ISymbolCollection2 isc = (ISymbolCollection2)aClas.SymbolCollection; isc.Reset(); ISymbolIdentifier2 sId = (ISymbolIdentifier2)isc.Next(); while (sId != null) { if (sId.ID == id) { return(sId.Name); } sId = (ISymbolIdentifier2)isc.Next(); } return(null); }
private int method_4(ISymbolCollection2 isymbolCollection2_0) { isymbolCollection2_0.Reset(); ISymbolIdentifier2 identifier = isymbolCollection2_0.Next() as ISymbolIdentifier2; IList list = new ArrayList(); while (identifier != null) { list.Add(identifier.ID); identifier = isymbolCollection2_0.Next() as ISymbolIdentifier2; } int num = 0; if (list.Count != 0) { while (list.IndexOf(num) != -1) { num++; } return(num); } return(num); }
public static List <string> getSymbolNames(IFeatureClass Anno) { List <string> names = new List <string>(); IAnnoClass aClas = (IAnnoClass)Anno.Extension; ISymbolCollection2 isc = (ISymbolCollection2)aClas.SymbolCollection; isc.Reset(); ISymbolIdentifier2 sId = (ISymbolIdentifier2)isc.Next(); while (sId != null) { names.Add(sId.Name); sId = (ISymbolIdentifier2)aClas.SymbolCollection.Next(); } names.Sort(); return(names); }