void resetSymbolState() { currentEntityName = string.Empty; currentEntityTypeName = string.Empty; currentEntitySubTypeName = string.Empty; currentModifier1Name = string.Empty; currentModifier2Name = string.Empty; currentEchelonMobilityName = string.Empty; currentHqTfFdName = string.Empty; StandardIdentityAffiliationType affil = currentSymbol.Id.Affiliation; currentSymbol.Id = SymbolIdCode.DefaultSymbolIdCode; currentSymbol.Id.Affiliation = affil; currentSymbol.GraphicLayers.Clear(); this.cbLayers.Text = string.Empty; this.cbLayers.Items.Clear(); // blank image pbPreview.Image = null; // or set to "No Image" graphic: // Bitmap noImage = new Bitmap(GetType(), "NoImage.png"); }
// Frame Icon // StandardIdentityAffiliationType + SymbolSetType // IMPORTANT: StandardIdentityAffiliationType must be in // { Unknown, Space, Air,Land_Unit, Land_Installation, // Sea_Surface, Subsurface, Activity } // See: TypeUtilities.SymbolSetToFrameType for mapping // ex. 0520 public static string GetFrameIconNameWithFolder( StandardIdentityRealExerciseSimType realExerciseSim, StandardIdentityAffiliationType affiliation, SymbolSetType symbolSet) { StringBuilder sb = new StringBuilder(); // TODO: exercise/sim frames - // StandardIdentityRealExerciseSimType (just add "Sim" "Exercise") sb.Append("Frames"); sb.Append(System.IO.Path.DirectorySeparatorChar); string affiliationString = TypeUtilities.EnumHelper.getEnumValAsString(affiliation, 2); sb.Append(affiliationString); // map the actual symbolSet to the supported/availble frame SymbolSetType mappedSymbolSet = TypeUtilities.SymbolSetToFrameMapping[symbolSet]; string mappedSymbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(mappedSymbolSet, 2); sb.Append(mappedSymbolSetString); sb.Append(ImageSuffix); return(sb.ToString()); }
// Frame Icon // StandardIdentityAffiliationType + SymbolSetType // IMPORTANT: StandardIdentityAffiliationType must be in // { Unknown, Space, Air,Land_Unit, Land_Installation, // Sea_Surface, Subsurface, Activity } // See: TypeUtilities.SymbolSetToFrameType for mapping // ex. 0520 public static string GetFrameIconNameWithFolder( StandardIdentityRealExerciseSimType realExerciseSim, StandardIdentityAffiliationType affiliation, SymbolSetType symbolSet, StatusType status) { StringBuilder sb = new StringBuilder(); sb.Append("Frames"); sb.Append(System.IO.Path.DirectorySeparatorChar); if (realExerciseSim == StandardIdentityRealExerciseSimType.Reality) { sb.Append("0_"); } else if (realExerciseSim == StandardIdentityRealExerciseSimType.Exercise) { sb.Append("Exercise"); sb.Append(System.IO.Path.DirectorySeparatorChar); sb.Append("1_"); } else if (realExerciseSim == StandardIdentityRealExerciseSimType.Simulation) { sb.Append("Sim"); sb.Append(System.IO.Path.DirectorySeparatorChar); sb.Append("2_"); } string affiliationString = TypeUtilities.EnumHelper.getEnumValAsString(affiliation, 1); sb.Append(affiliationString); // map the actual symbolSet to the supported/available frame SymbolSetType mappedSymbolSet = TypeUtilities.SymbolSetToFrameMapping[symbolSet]; string mappedSymbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(mappedSymbolSet, 2); sb.Append(mappedSymbolSetString); string status_suffix = "_0"; // normal case // Planned / Present Status (but only for standard/non-anticipated frames) if (status == StatusType.Planned_Anticipated_Suspect) { if ((affiliation == StandardIdentityAffiliationType.Friend) || (affiliation == StandardIdentityAffiliationType.Hostile) || (affiliation == StandardIdentityAffiliationType.Neutral) || (affiliation == StandardIdentityAffiliationType.Unknown)) { status_suffix = "_1"; } } sb.Append(status_suffix); sb.Append(ImageSuffix); return(sb.ToString()); }
// same as ImageFilesHome + GetMainIconNameWithFolder public static string GetMainIconNameWithFullPath(ref MilitarySymbol milSymbol) { StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string mainIconNameWithoutImageFilesHome = GetMainIconNameWithFolder(ref milSymbol); sb.Append(mainIconNameWithoutImageFilesHome); string mainIconNameFullPath = sb.ToString(); // WORKAROUND/TRICKY: some center icon symbols that need to touch fram have _0, _1, _2, _3 suffix instead of base version // Method: Find the frame suffix from the affiliation & add _0, _1, _2, _3 accordingly // Also test for 2 other exceptional cases while we are at it if (!System.IO.File.Exists(mainIconNameFullPath)) { StandardIdentityAffiliationType mappedAffiliation = milSymbol.Id.Affiliation; if (milSymbol.Id.StandardIdentity == StandardIdentityRealExerciseSimType.Exercise) { // Exceptional case for these 2 (has a friend frame) if ((mappedAffiliation == StandardIdentityAffiliationType.Suspect_Joker) || (mappedAffiliation == StandardIdentityAffiliationType.Hostile)) { mappedAffiliation = StandardIdentityAffiliationType.Friend; } } string newFrameSuffix = TypeUtilities.AffiliationFrameToSuffixName[mappedAffiliation] + ImageSuffix; // more exceptional cases: if (milSymbol.Id.SymbolSet == SymbolSetType.Control_Measures) { // use ".a" instead - 6 symbols newFrameSuffix = ".a" + ImageSuffix; } else if (milSymbol.Id.SymbolSet == SymbolSetType.Atmospheric) { // use ".0" instead - only 1 symbol 45140200.0 newFrameSuffix = ".0" + ImageSuffix; } string subMainIconName = mainIconNameFullPath; subMainIconName = subMainIconName.Replace(ImageSuffix, newFrameSuffix); if (System.IO.File.Exists(subMainIconName)) // if the other file/version exists, use that one { mainIconNameFullPath = subMainIconName; } } return(mainIconNameFullPath); }
public static string GetFrameIconNameWithFullPath( StandardIdentityRealExerciseSimType realExerciseSim, StandardIdentityAffiliationType affiliation, SymbolSetType symbolSet) { StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string frameIconNameWithoutImageFilesHome = GetFrameIconNameWithFolder(realExerciseSim, affiliation, symbolSet); sb.Append(frameIconNameWithoutImageFilesHome); return(sb.ToString()); }
// Headquarters(HQ)/Task Force(TF)/Feint/Dummy(FD) HQ/TF/FD Amplifier Icon // = StandardIdentityAffiliationType + SymbolSetType + HeadquartersTaskForceDummyType // Uses SIDC positions 4-6 and position 8 // ex. Friend(3), Land_Unit (10), Feint_Dummy (1) = 3101 // --> 3 (Friend) + Land_Unit (10) + 1 (Feint_Dummy) // public static string GetHqTfFdIconNameWithFolder( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, HeadquartersTaskForceDummyType hqTfFd) { if (hqTfFd == HeadquartersTaskForceDummyType.NoHQTFDummyModifier) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append("HQTFFD"); sb.Append(System.IO.Path.DirectorySeparatorChar); StandardIdentityAffiliationType mappedAffiliation = TypeUtilities.AffiliationToAffiliationFrameMapping[affiliation]; string affiliationValueString = TypeUtilities.EnumHelper.getEnumValAsString(mappedAffiliation, 1); sb.Append(affiliationValueString); // map the actual symbolSet to the supported/availble frame SymbolSetType mappedSymbolSet = TypeUtilities.SymbolSetToFrameMapping[symbolSet]; // Exceptional cases for this one if ((symbolSet == SymbolSetType.Activities) || (symbolSet == SymbolSetType.NotSet) || (symbolSet == SymbolSetType.Unknown)) { mappedSymbolSet = SymbolSetType.Land_Unit; } string mappedSymbolSetValueString = TypeUtilities.EnumHelper.getEnumValAsString(mappedSymbolSet, 2); sb.Append(mappedSymbolSetValueString); string hqTfFdValueString = TypeUtilities.EnumHelper.getEnumValAsString(hqTfFd, 1); sb.Append(hqTfFdValueString); sb.Append(ImageSuffix); return(sb.ToString()); }
// Echelon/Mobility/Towed Array Amplifier Icon // = StandardIdentityAffiliationType + EchelonMobilityType // "Amplifier (Echelon): Uses SIDC positions 4 and 9-10." // ex. Friend, Team Crew = 311 // --> 3 (Friend) + 11 (Echelon = Team/Crew) // public static string GetEchelonIconNameWithFolder( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, EchelonMobilityType echelonMobility) { if (echelonMobility == EchelonMobilityType.NoEchelonMobility) { return(string.Empty); } StringBuilder sb = new StringBuilder(); if (echelonMobility < EchelonMobilityType.Wheeled_Limited_Cross_Country) { sb.Append("Echelon"); } else { sb.Append("Amplifier"); } sb.Append(System.IO.Path.DirectorySeparatorChar); StandardIdentityAffiliationType mappedAffiliation = TypeUtilities.AffiliationToAffiliationFrameMapping[affiliation]; string affiliationString = TypeUtilities.EnumHelper.getEnumValAsString(mappedAffiliation, 1); sb.Append(affiliationString); // IMPORTANT NOTE: // Only Land Symbol Sets (Unit, Civilian, Equipment, Installation) // have echelon symbols so they only match/line up with those frames string echelonString = TypeUtilities.EnumHelper.getEnumValAsString(echelonMobility, 2); sb.Append(echelonString); sb.Append(ImageSuffix); return(sb.ToString()); }
// OperationalCondition Amplifier Icon // = StandardIdentityAffiliationType + SymbolSetType + StatusType // Uses SIDC positions 3-7 + "2" // ex. Friend(03), Land_Unit (10), Damaged (3) = 031012 // --> 03 (Friend) + Land_Unit (10) + 1 (Damaged) + "2" (2nd format) // public static string GetOperationalConditionNameWithFolder( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, StatusType status) { if ((status == StatusType.NotSet) || (status == StatusType.Present) || (status == StatusType.Planned_Anticipated_Suspect)) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append("OCA"); sb.Append(System.IO.Path.DirectorySeparatorChar); StandardIdentityAffiliationType mappedAffiliation = TypeUtilities.AffiliationToAffiliationFrameMapping[affiliation]; // TRICKY: used 2 digits for some reason string affiliationValueString = TypeUtilities.EnumHelper.getEnumValAsString(mappedAffiliation, 2); sb.Append(affiliationValueString); // map the actual symbolSet to the supported/availble frame SymbolSetType mappedSymbolSet = TypeUtilities.SymbolSetToFrameMapping[symbolSet]; string mappedSymbolSetValueString = TypeUtilities.EnumHelper.getEnumValAsString(mappedSymbolSet, 2); sb.Append(mappedSymbolSetValueString); string opConditionString = TypeUtilities.EnumHelper.getEnumValAsString(status, 1); sb.Append(opConditionString); sb.Append("2"); sb.Append(ImageSuffix); return(sb.ToString()); }
// same as ImageFilesHome + GetEchelonIconNameWithFolder public static string GetEchelonIconNameWithFullPath( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, EchelonMobilityType echelonMobility) { if (echelonMobility == EchelonMobilityType.NoEchelonMobility) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string echelonIconNameWithoutImageFilesHome = GetEchelonIconNameWithFolder(symbolSet, affiliation, echelonMobility); sb.Append(echelonIconNameWithoutImageFilesHome); return(sb.ToString()); }
// same as ImageFilesHome + GetHqTfFdIconNameWithFolder public static string GetHqTfFdIconNameWithFullPath( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, HeadquartersTaskForceDummyType hqTfFd) { if (hqTfFd == HeadquartersTaskForceDummyType.NoHQTFDummyModifier) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string hqTfFdIconNameWithoutImageFilesHome = GetHqTfFdIconNameWithFolder(symbolSet, affiliation, hqTfFd); sb.Append(hqTfFdIconNameWithoutImageFilesHome); return(sb.ToString()); }
public MilitarySymbol CreateSymbolFromStringProperties( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, string symbolSetString, string entityCode, string geoType, string entityPart, string entityTypePart, string entitySubTypePart) { MilitarySymbol retSymbol = new MilitarySymbol(); SymbolIdCode sidc = new SymbolIdCode(); sidc.Affiliation = affiliation; sidc.SymbolSetAsString = symbolSetString; sidc.FullEntityCode = entityCode; sidc.Name = GetWellFormedName(symbolSet, entityPart, entityTypePart, entitySubTypePart); retSymbol.Id = sidc; retSymbol.Shape = (ShapeType)TypeUtilities.EnumHelper.getEnumFromString(typeof(ShapeType), geoType); return(retSymbol); }
public static string GetFrameIconNameWithFullPath( StandardIdentityRealExerciseSimType realExerciseSim, StandardIdentityAffiliationType affiliation, SymbolSetType symbolSet, StatusType status) { if (affiliation >= StandardIdentityAffiliationType.Dont_Display_Frame) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string frameIconNameWithoutImageFilesHome = GetFrameIconNameWithFolder(realExerciseSim, affiliation, symbolSet, status); sb.Append(frameIconNameWithoutImageFilesHome); return(sb.ToString()); }
public MilitarySymbol CreateSymbolFromStringProperties( // SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, string symbolSetString, string entityCode, string geoType, string entityName, string entityTypeName, string entitySubTypeName, string centralIconTypeString) { if ((string.IsNullOrEmpty(symbolSetString) || symbolSetString.Length != 2)) { System.Diagnostics.Trace.WriteLine("CreateSymbolFromStringProperties - Bad Symbol Set Code"); return(null); } if ((string.IsNullOrEmpty(entityCode) || entityCode.Length != 6)) { System.Diagnostics.Trace.WriteLine("CreateSymbolFromStringProperties - Bad Entity Code"); return(null); } MilitarySymbol retSymbol = new MilitarySymbol(); SymbolIdCode sidc = new SymbolIdCode(); sidc.Affiliation = affiliation; sidc.SymbolSetAsString = symbolSetString; sidc.EntityCode = entityCode; SymbolSetType symbolSet = (SymbolSetType) TypeUtilities.EnumHelper.getEnumFromHashCodeString(typeof(SymbolSetType), symbolSetString); string symbolSetName = TypeUtilities.EnumHelper.getStringFromEnum(symbolSet); retSymbol.Id = sidc; retSymbol.Shape = (ShapeType)TypeUtilities.EnumHelper.getEnumFromString(typeof(ShapeType), geoType); retSymbol.CentralIconFormat = (CentralIconType)TypeUtilities.EnumHelper.getEnumFromString(typeof(CentralIconType), centralIconTypeString); return(retSymbol); }
// same as ImageFilesHome + GetOperationalConditionIconNameWithFolder public static string GetOperationalConditionNameWithFullPath( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, StatusType status) { if ((status == StatusType.NotSet) || (status == StatusType.Present) || (status == StatusType.Planned_Anticipated_Suspect)) { return(string.Empty); } StringBuilder sb = new StringBuilder(); sb.Append(ImageFilesHome); string opConditionNameWithoutImageFilesHome = GetOperationalConditionNameWithFolder(symbolSet, affiliation, status); sb.Append(opConditionNameWithoutImageFilesHome); return(sb.ToString()); }
// Echelon/Mobility/Towed Array Amplifier Icon // = StandardIdentityAffiliationType + EchelonMobilityType // "Amplifier (Echelon): Uses SIDC positions 4 and 9-10." // ex. Friend, Team Crew = 311 // --> 3 (Friend) + 11 (Echelon = Team/Crew) // public static string GetEchelonIconNameWithFolder( SymbolSetType symbolSet, StandardIdentityAffiliationType affiliation, EchelonMobilityType echelonMobility) { if (echelonMobility == EchelonMobilityType.NoEchelonMobility) { return(string.Empty); } StringBuilder sb = new StringBuilder(); if (echelonMobility < EchelonMobilityType.Wheeled_Limited_Cross_Country) { sb.Append("Echelon"); } else { sb.Append("Amplifier"); } sb.Append(System.IO.Path.DirectorySeparatorChar); StandardIdentityAffiliationType mappedAffiliation = TypeUtilities.AffiliationToAffiliationFrameMapping[affiliation]; string affiliationString = TypeUtilities.EnumHelper.getEnumValAsString(mappedAffiliation, 1); sb.Append(affiliationString); sb.Append(TypeUtilities.EnumHelper.getEnumValAsString(echelonMobility, 2)); sb.Append(ImageSuffix); return(sb.ToString()); }
void setSymbolState(string valueSelected = "") { // TODO: Figure out a way to set this consistent naming scheme better string symbolSetName = currentSymbol.Id.SymbolSet.ToString().Replace("_", " "); if (string.IsNullOrEmpty(valueSelected)) { // this is a special state (i.e. hack) to simulate a button press, to force // into the next state, when the previous panel is empty } else if (currentPane == PaneSequenceType.AffiliationPane) { string affiliationSelectedString = valueSelected; StandardIdentityAffiliationType affiliationSelection = (StandardIdentityAffiliationType) TypeUtilities.EnumHelper.getEnumFromString( typeof(StandardIdentityAffiliationType), affiliationSelectedString); currentSymbol.Id.Affiliation = affiliationSelection; currentPane = PaneSequenceType.SymbolSetPane; } else if (currentPane == PaneSequenceType.SymbolSetPane) { string symbolSetSelectedString = valueSelected; SymbolSetType symbolSetSelection = (SymbolSetType) TypeUtilities.EnumHelper.getEnumFromString( typeof(SymbolSetType), symbolSetSelectedString); currentSymbol.Id.SymbolSet = symbolSetSelection; currentPane = PaneSequenceType.EntityPane; } else if (currentPane == PaneSequenceType.EntityPane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntityName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.EntityTypePane; } } else if (currentPane == PaneSequenceType.EntityTypePane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntityTypeName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName, currentEntityTypeName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.EntitySubTypePane; } } else if (currentPane == PaneSequenceType.EntitySubTypePane) { if (valueSelected == NOT_SET) { currentPane = PaneSequenceType.Modifier1Pane; } else { currentEntitySubTypeName = valueSelected; string entityCode = symbolLookup.GetEntityCode(currentSymbol.Id.SymbolSet, currentEntityName, currentEntityTypeName, currentEntitySubTypeName); currentSymbol.Id.EntityCode = entityCode; currentPane = PaneSequenceType.Modifier1Pane; } } else if (currentPane == PaneSequenceType.Modifier1Pane) { string currentModifier1Name = valueSelected; string modifier1Code = symbolLookup.GetModifierCodeFromName( currentSymbol.Id.SymbolSet, 1, currentModifier1Name); currentSymbol.Id.ModifierOne = modifier1Code; currentPane = PaneSequenceType.Modifier2Pane; } else if (currentPane == PaneSequenceType.Modifier2Pane) { string currentModifier2Name = valueSelected; string modifier2Code = symbolLookup.GetModifierCodeFromName( currentSymbol.Id.SymbolSet, 2, currentModifier2Name); currentSymbol.Id.ModifierTwo = modifier2Code; currentPane = PaneSequenceType.EchelonMobilityPane; } else if (currentPane == PaneSequenceType.EchelonMobilityPane) { string currentEchelonMobilityName = valueSelected; EchelonMobilityType echelonMobilitySelection = (EchelonMobilityType) TypeUtilities.EnumHelper.getEnumFromString( typeof(EchelonMobilityType), currentEchelonMobilityName); currentSymbol.Id.EchelonMobility = echelonMobilitySelection; currentPane = PaneSequenceType.HqTfFdPane; } else if (currentPane == PaneSequenceType.HqTfFdPane) { string currentHqTfFdName = valueSelected; HeadquartersTaskForceDummyType hqTfFdSelection = (HeadquartersTaskForceDummyType) TypeUtilities.EnumHelper.getEnumFromString( typeof(HeadquartersTaskForceDummyType), currentHqTfFdName); currentSymbol.Id.HeadquartersTaskForceDummy = hqTfFdSelection; currentPane = PaneSequenceType.StatusPane; } else if (currentPane == PaneSequenceType.StatusPane) { string currentStatusName = valueSelected; StatusType statusSelection = (StatusType)TypeUtilities.EnumHelper.getEnumFromString( typeof(StatusType), currentStatusName); currentSymbol.Id.Status = statusSelection; currentPane = PaneSequenceType.StartOver; } else if (currentPane == PaneSequenceType.StartOver) { // Reset the other values resetSymbolState(); // Go back when we are done currentPane = PaneSequenceType.SymbolSetPane; } setTagLabel(); updatePictureBox(); // Go To Next Pane SetPaneState(); }
/// <summary> /// Creates a symbol by looking up the SymbolSet + {any} Entity Name /// And then it sets the Affiliation if provided /// - this is just a simple/basic test /// </summary> public MilitarySymbol CreateSymbolByEntityName(string entityName, SymbolSetType symbolSet = SymbolSetType.NotSet, StandardIdentityAffiliationType affiliation = StandardIdentityAffiliationType.Unknown) { Initialize(); if (EntityTable == null) { return(null); } var results = from row in EntityTable.AsEnumerable() where ((row.Field <string>("EntitySubType").Contains(entityName) | (row.Field <string>("EntityType").Contains(entityName) | (row.Field <string>("Entity").Contains(entityName))))) select row; int resultCount = results.Count(); if (resultCount < 1) { System.Diagnostics.Trace.WriteLine("Entity Name not found: " + entityName); return(null); } if (symbolSet != SymbolSetType.NotSet) { // filter results if this is set string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2); results = from row in results where (row.Field <string>("SymbolSet") == symbolSetToSearch) select row; } resultCount = results.Count(); if (resultCount < 1) { System.Diagnostics.Trace.WriteLine("Entity Name not found: " + entityName + " in SymbolSet: " + symbolSet); return(null); } MilitarySymbol retSymbol = null; foreach (DataRow row in results) { string symbolSetString = row["SymbolSet"] as string; string entityCode = row["Code"] as string; string geoType = row["GeometryType"] as string; string entityNameFromLookup = row["Entity"] as string; string entityTypeNameFromLookup = row["EntityType"] as string; string entitySubTypeNameFromLookup = row["EntitySubType"] as string; string centralIconTypeString = row["IconType"] as string; retSymbol = CreateSymbolFromStringProperties( affiliation, symbolSetString, entityCode, geoType, entityNameFromLookup, entityTypeNameFromLookup, entitySubTypeNameFromLookup, centralIconTypeString); // TODO: figure out what to do if we get more than 1 result break; } return(retSymbol); }
/// <summary> /// Search based on the one or more attributes supplied /// Default param (symbolSet == NotSet) returns all symbols with affiliation set to Unknown /// </summary> public List <MilitarySymbol> GetMilitarySymbols(SymbolSetType symbolSet = SymbolSetType.NotSet, StandardIdentityAffiliationType affiliation = StandardIdentityAffiliationType.Unknown, string entityNameString = "", string entityTypeNameString = "", string entitySubTypeNameString = "", bool exactEntityMatchOnly = false) { Initialize(); List <MilitarySymbol> symbolList = new List <MilitarySymbol>(); if (EntityTable == null) { return(symbolList); // nothing } string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2); var results = from row in EntityTable.AsEnumerable() where (row.Field <string>("SymbolSet") == symbolSetToSearch) select row; if (symbolSet == SymbolSetType.NotSet) { results = from row in EntityTable.AsEnumerable() select row; } // Check that search returned something int resultCount = results.Count(); if (resultCount < 1) { System.Diagnostics.Trace.WriteLine("WARNING: Empty result of EntityTable search: " + symbolSetToSearch); // TODO: add search params to the debug output return(symbolList); // empty list } //////////////////////////////////////////////////////////////// // Filters for Entity, EntityType, EntitySubType if these are suppied // TRICKY: exactEntityMatchOnly if we only want the 1 that matches exactly, versus all of the // type, subtype matches if (exactEntityMatchOnly) { results = from row in results where ((row.Field <string>("Entity") == entityNameString) & (row.Field <string>("EntityType") == entityTypeNameString) & (row.Field <string>("EntitySubType") == entitySubTypeNameString)) select row; } else if (!string.IsNullOrEmpty(entityNameString)) { // filter results if this is set results = from row in results where (row.Field <string>("Entity") == entityNameString) select row; if (!string.IsNullOrEmpty(entityTypeNameString)) { // filter results if this is set results = from row in results where (row.Field <string>("EntityType") == entityTypeNameString) select row; if (!string.IsNullOrEmpty(entitySubTypeNameString)) { // filter results if this is set results = from row in results where (row.Field <string>("EntitySubType") == entitySubTypeNameString) select row; } } } // Check that search returned something resultCount = results.Count(); if (resultCount < 1) { System.Diagnostics.Trace.WriteLine("WARNING: Empty result of search"); // TODO: add search params to the debug output return(symbolList); // empty list } foreach (DataRow row in results) { string symbolSetString = row["SymbolSet"] as string; string entityCode = row["Code"] as string; string geoType = row["GeometryType"] as string; string entityName = row["Entity"] as string; string entityTypeName = row["EntityType"] as string; string entitySubTypeName = row["EntitySubType"] as string; string centralIconTypeString = row["IconType"] as string; MilitarySymbol createSymbol = CreateSymbolFromStringProperties( affiliation, symbolSetString, entityCode, geoType, entityName, entityTypeName, entitySubTypeName, centralIconTypeString); if (createSymbol != null) { symbolList.Add(createSymbol); } } return(symbolList); }