public static string GetModfierIconName(ref MilitarySymbol milSymbol, int modifierNumber)
        {
            StringBuilder sb = new StringBuilder();

            if (!((modifierNumber == 1) || (modifierNumber == 2)))
            {
                return(string.Empty);
            }

            string sModifierNumber = "1";
            string sModifier       = milSymbol.Id.FirstModifier;

            if (modifierNumber == 2)
            {
                sModifierNumber = "2";
                sModifier       = milSymbol.Id.SecondModifier;
            }

            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(milSymbol.Id.SymbolSet, 2);

            string modifierIcon = symbolSetString + sModifier + sModifierNumber;

            sb.Append(modifierIcon);

            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 symbols have wacky _0, _1, _2, _3 thing instead of base version
            // Method: Find the frame from the affiliation & add _0, _1, _2, _3 accordingly
            if (!System.IO.File.Exists(mainIconNameFullPath))
            {
                string newFrameSuffix =
                    TypeUtilities.AffiliationFrameToSuffixName[milSymbol.Id.Affiliation] + 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);
        }
        // MainIconNameWithFolder
        // Appendices\{SymbolSetTypeName}\SymbolSetType + EntityCode
        // e.g. Appendices\Air\01110000.svg ==> { 01 } + { 110000 }
        public static string GetMainIconNameWithFolder(ref MilitarySymbol milSymbol)
        {
            StringBuilder sb = new StringBuilder();

            string currentAppendixHome = GetIconFolderName(milSymbol.Id.SymbolSet);

            sb.Append(currentAppendixHome);

            string mainIconName = GetMainIconName(ref milSymbol);

            sb.Append(mainIconName);
            sb.Append(ImageSuffix);

            return(sb.ToString());
        }
        public static string GetModfierIconNameWithFolder(ref MilitarySymbol milSymbol, int modifierNumber)
        {
            if (!((modifierNumber == 1) || (modifierNumber == 2)))
            {
                return(string.Empty);
            }

            string sModifierCode = (modifierNumber == 1) ? milSymbol.Id.FirstModifier : milSymbol.Id.SecondModifier;

            int modifierCodeInt = Convert.ToInt32(sModifierCode);

            string modifierIconNameWithFolder = GetModfierIconNameWithFolder(
                milSymbol.Id.SymbolSet, modifierNumber, modifierCodeInt);

            return(modifierIconNameWithFolder);
        }
        // This hack is no longer needed, but keeping code here, for when/in case this needs put back in
        // returns string.Empty to indicate that hack isn't needed
        private static string CheckForSpecialEntitySubtypeHackIcon(ref MilitarySymbol milSymbol)
        {
            string newIconName = string.Empty;

            // HACK (and a big one)
            //
            // TODO: see if there is any other way
            // To support special case: "TABLE D-V.  Land unit icons – special entity subtypes"
            // These are the Land unit–special entity subtypes defined:
            // HEADQUARTERS ELEMENT - 10xxxx95
            // DIVISION AND BELOW SUPPORT - 10xxxx96 (NOTE: None of these exist currently)
            // CORPS SUPPORT - 10xxxx97
            // THEATER/ECHELONS ABOVE CORPS SUPPORT -  - 10xxxx98
            if (!string.IsNullOrEmpty(milSymbol.Id.Name))
            {
                if (milSymbol.Id.Name.Contains(": Headquarters Element") ||
                    milSymbol.Id.Name.Contains(" Support"))
                {
                    // then we *might* need this case
                    string subEntityCode = milSymbol.Id.FullEntityCode.Substring(0, 4) + "00";

                    if (milSymbol.Id.Name.Contains(": Headquarters Element"))
                    {
                        newIconName = GetMainIconName(milSymbol.Id.SymbolSet, subEntityCode);
                        string hackSpecialEntityLayer = ImageFilesHome + @"Appendices\Land\10xxxx95.svg";
                        milSymbol.GraphicLayers.Add(hackSpecialEntityLayer);
                    }
                    // NOTE: There are no Division Support Ones
                    else
                    if (milSymbol.Id.Name.Contains(": Corps Support"))
                    {
                        newIconName = GetMainIconName(milSymbol.Id.SymbolSet, subEntityCode);
                        string hackSpecialEntityLayer = ImageFilesHome + @"Appendices\Land\10xxxx97.svg";
                        milSymbol.GraphicLayers.Add(hackSpecialEntityLayer);
                    }
                    else
                    if (milSymbol.Id.Name.Contains(" Above Corps Support"))
                    {
                        newIconName = GetMainIconName(milSymbol.Id.SymbolSet, subEntityCode);
                        string hackSpecialEntityLayer = ImageFilesHome + @"Appendices\Land\10xxxx98.svg";
                        milSymbol.GraphicLayers.Add(hackSpecialEntityLayer);
                    }
                }
            }

            return(newIconName);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
        private static void MyAdHocTest()
        {
            SymbolIdCode sidc = new SymbolIdCode();

            System.Diagnostics.Trace.WriteLine("SIDC=" + sidc);

            SymbolLookup symbolLookup = new SymbolLookup();

            symbolLookup.Initialize();

            if (!symbolLookup.Initialized)
            {
                System.Diagnostics.Trace.WriteLine("Fail");
            }

            MilitarySymbol ms = symbolLookup.CreateSymbolByEntityName("Fighter/Bomber");

            MilitarySymbolToGraphicLayersMaker.SetMilitarySymbolGraphicLayers(ref ms);

            System.Diagnostics.Trace.WriteLine("MilitarySymbol: " + ms);

            List <MilitarySymbol> matchingSymbols =
                symbolLookup.GetMilitarySymbols(SymbolSetType.Space);

            int matchCount = 0;

            foreach (MilitarySymbol matchSymbol in matchingSymbols)
            {
                matchCount++;
                System.Diagnostics.Trace.WriteLine("Match: " + matchCount
                                                   + ", MilitarySymbol: " + matchSymbol);;
            }

            List <MilitarySymbol> matchingSymbols2 =
                symbolLookup.GetMilitarySymbols(SymbolSetType.Space, StandardIdentityAffiliationType.Friend,
                                                "Military");

            matchCount = 0;
            foreach (MilitarySymbol matchSymbol in matchingSymbols2)
            {
                matchCount++;
                System.Diagnostics.Trace.WriteLine("Match: " + matchCount
                                                   + ", MilitarySymbol: " + matchSymbol);;
            }

            List <string> matchingStrings = symbolLookup.GetDistinctEntries(SymbolSetType.Space);

            matchCount = 0;
            foreach (string distinctMatch in matchingStrings)
            {
                matchCount++;
                System.Diagnostics.Trace.WriteLine("Distinct Match: " + distinctMatch);
            }

            matchingStrings = symbolLookup.GetDistinctEntries(SymbolSetType.Air, "Military",
                                                              "Fixed Wing");

            matchCount = 0;
            foreach (string distinctMatch in matchingStrings)
            {
                matchCount++;
                System.Diagnostics.Trace.WriteLine("Distinct Match: " + distinctMatch);
            }

            matchingStrings = symbolLookup.GetDistinctModifierNames(SymbolSetType.Air, 1);

            matchCount = 0;
            foreach (string distinctMatch in matchingStrings)
            {
                matchCount++;
                System.Diagnostics.Trace.WriteLine("Modifiers: Distinct Match: " + distinctMatch);
            }

            string modifierName = "Government";

            string modifierCode = symbolLookup.GetModifierCodeFromName(SymbolSetType.Air, 1, modifierName);
        }
Beispiel #8
0
        private static void ListSymbolSetSimple(SymbolLookup symbolLookup, SymbolSetType symbolSet)
        {
            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            Console.WriteLine(Environment.NewLine + "SymbolSet: " + symbolSet + " : " + symbolSetString);

            Console.WriteLine("Entities:");

            List <MilitarySymbol> matchingSymbols = symbolLookup.GetMilitarySymbols(symbolSet);

            SymbolIdCode.FormatCodeStringWithCommas = false;

            int matchCount = 0;

            foreach (MilitarySymbol matchSymbol in matchingSymbols)
            {
                matchCount++;

                // Copying so making ref below useless, but had to do this because of use of iterator/ref
                MilitarySymbol currentMilSymbol = matchSymbol;
                string         svgTag           = MilitarySymbolToGraphicLayersMaker.GetMainIconNameWithFolder(ref currentMilSymbol);
                string         idTag            = MilitarySymbolToGraphicLayersMaker.GetMainIconName(ref currentMilSymbol);

                string nameAsTags = matchSymbol.Id.Name.Replace(TypeUtilities.NameSeparator, ";");

                Console.WriteLine(matchCount + "," + symbolSet + "," + symbolSetString
                                  + "," + matchSymbol.Id.Name + ","
//                    + matchSymbol.Id.CodeFirstTen + "," + matchSymbol.Id.CodeSecondTen + ","
                                  + nameAsTags + ";"
                                  + matchSymbol.TagsAsString + svgTag + ";"
                                  + matchSymbol.Id.Name + ";"
                                  + idTag

                                  + "," + svgTag);
            }

            List <string> matchingModifiers = symbolLookup.GetDistinctModifierNames(symbolSet, 1);

            if (matchingModifiers.Count > 0)
            {
                Console.WriteLine(Environment.NewLine + "Modifier 1:");

                matchCount = 0;
                foreach (string match in matchingModifiers)
                {
                    PrintModifierSimple(symbolSet, 1, matchCount, match);
                    matchCount++;
                }
            }

            matchingModifiers = symbolLookup.GetDistinctModifierNames(symbolSet, 2);
            if (matchingModifiers.Count > 0)
            {
                Console.WriteLine(Environment.NewLine + "Modifier 2:");

                matchCount = 0;
                foreach (string match in matchingModifiers)
                {
                    PrintModifierSimple(symbolSet, 2, matchCount, match);

                    matchCount++;
                }
            }
        }
Beispiel #9
0
        private static void ListSymbolSetAsStyleCsv(SymbolLookup symbolLookup, SymbolSetType symbolSet)
        {
            MilitarySymbolToGraphicLayersMaker.ImageFilesHome = IMAGES_HOME;

            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);
            string symbolSetName   = symbolSet.ToString().Replace('_', ' ');

            //Console.WriteLine(Environment.NewLine + "SymbolSet : " + symbolSetName + " : " + symbolSetString);
            //Console.WriteLine(symbolSetName + " : Entities :");

            // filePath, pointSize, styleItemName, styleItemCategory, styleItemTags
            Console.WriteLine("filePath,pointSize,styleItemName,styleItemCategory,styleItemTags,notes");

            List <MilitarySymbol> matchingSymbols = symbolLookup.GetMilitarySymbols(symbolSet);

            SymbolIdCode.FormatCodeStringWithCommas = false;

            StringBuilder sbNotes = new StringBuilder();

            int matchCount = 0;

            foreach (MilitarySymbol matchSymbol in matchingSymbols)
            {
                matchCount++;

                // Copying so making ref below useless, but had to do this because of use of iterator/ref
                MilitarySymbol currentMilSymbol = matchSymbol;

                // IMPORTANT: SKIPPING ALL POINTS CURRENTLY
                if (currentMilSymbol.Shape != ShapeType.Point)
                {
                    System.Diagnostics.Trace.WriteLine("Skipping export of non-point: Name=" + matchSymbol.Id.Name);
                    continue;
                }

                sbNotes.Clear();

                string imageFile = MilitarySymbolToGraphicLayersMaker.GetMainIconNameWithFullPath(ref currentMilSymbol);
                if (IMAGE_FORMAT_IS_EMF)
                {
                    imageFile = imageFile.Replace(".svg", ".emf");
                }

                string svgTag     = MilitarySymbolToGraphicLayersMaker.GetMainIconNameWithFolder(ref currentMilSymbol);
                string idTag      = MilitarySymbolToGraphicLayersMaker.GetMainIconName(ref currentMilSymbol);
                string nameAsTags = matchSymbol.Id.Name.Replace(TypeUtilities.NameSeparator, ";");

                // WORKAROUND: check that files exists & it is not one of the _0,_1,_2,_3,xxxx ones
                if (!System.IO.File.Exists(imageFile))
                {
                    string subIconName = imageFile;
                    subIconName = subIconName.Replace(@".svg", @"_0.svg");
                    if (System.IO.File.Exists(subIconName)) // if the other file exists, use that one
                    {
                        imageFile = subIconName;
                    }
                    else
                    {
                        sbNotes.Append("ImageFile not found: " + svgTag);
                    }
                }

                string styleItemCategory = symbolSetName + TypeUtilities.NameSeparator + "Main Icon";

                string styleItemName = matchSymbol.Id.Name;

                string styleItemTags = nameAsTags + ";" + matchSymbol.TagsAsString + svgTag + ";"
                                       + matchSymbol.Id.Name + ";" + idTag;

                if (styleItemName.Length > MAX_STYLE_LENGTH)
                {
                    sbNotes.Append(" Name > " + MAX_STYLE_LENGTH);
                }
                if (styleItemTags.Length > MAX_STYLE_LENGTH)
                {
                    sbNotes.Append(" Tags > " + MAX_STYLE_LENGTH);
                }

                if (!INCLUDE_NOTES)
                {
                    sbNotes.Clear();
                }

                // filePath, pointSize, styleItemName, styleItemCategory, styleItemTags
                // matchCount + "," +
                Console.WriteLine(imageFile + "," + POINT_SIZE_STRING + "," +
                                  styleItemName + "," + styleItemCategory + "," + styleItemTags + "," + sbNotes.ToString());
            }

            List <string> matchingModifiers = symbolLookup.GetDistinctModifierNames(symbolSet, 1);

            if (matchingModifiers.Count > 0)
            {
                matchCount = 0;
                foreach (string match in matchingModifiers)
                {
                    PrintModifierAsStyleCsv(symbolLookup, symbolSet, 1, matchCount, match);
                    matchCount++;
                }
            }

            matchingModifiers = symbolLookup.GetDistinctModifierNames(symbolSet, 2);
            if (matchingModifiers.Count > 0)
            {
                matchCount = 0;
                foreach (string match in matchingModifiers)
                {
                    PrintModifierAsStyleCsv(symbolLookup, symbolSet, 2, matchCount, match);

                    matchCount++;
                }
            }
        }
        public static bool SetMilitarySymbolGraphicLayers(ref MilitarySymbol milSymbol)
        {
            if (!System.IO.Directory.Exists(ImageFilesHome))
            {
                System.Diagnostics.Trace.WriteLine("--> Images Home *DOES NOT EXIST* : " + ImageFilesHome);
                return(false);
            }

            if ((milSymbol == null) || (milSymbol.Id == null) ||
                (milSymbol.GraphicLayers == null) || (!milSymbol.Id.IsValid))
            {
                return(false);
            }

            milSymbol.GraphicLayers.Clear();

            //////////////////////////////////////////////////////////////////////////
            // Assembly the layers

            // Start with the Frame
            if (TypeUtilities.HasFrame(milSymbol.Id.SymbolSet))
            {
                //sb.Clear();
                //sb.Append(ImageFilesHome);

                string frameIconNameWithFullPath =
                    GetFrameIconNameWithFullPath(
                        milSymbol.Id.StandardIdentity,
                        milSymbol.Id.Affiliation,
                        milSymbol.Id.SymbolSet);

                milSymbol.GraphicLayers.Add(frameIconNameWithFullPath);
            }
            //////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////
            // Main Icon Layer
            string mainIconNameFullPath = GetMainIconNameWithFullPath(ref milSymbol);

            milSymbol.GraphicLayers.Add(mainIconNameFullPath);
            //////////////////////////////////////////////////////////////////////////

            //////////////////////////////////////////////////////////////////////////
            // Skip the remaining if no more layers needed
            //
            // TODO: Verify this logic
            //       Stop here for Control Measures (Lines/Areas for now) &
            //       Symbols *without* frames
            //
            bool skipRemainingLayers = false;

            if ((milSymbol.Shape == ShapeType.Line) || (milSymbol.Shape == ShapeType.Area) ||
                (!TypeUtilities.HasFrame(milSymbol.Id.SymbolSet)))
            {
                skipRemainingLayers = true;
            }

            if (!skipRemainingLayers)
            {
                StringBuilder sb = new StringBuilder();

                // Center/Main Icon Modifiers: { # = 1 | 2 }
                // Appendices\{SymbolSetTypeName}\Mod{#}\{SymbolSetType} + {ModifierCode} + {#}

                // Main Icon Modfier 1
                if (!string.IsNullOrEmpty(milSymbol.Id.FirstModifier) &&
                    (milSymbol.Id.FirstModifier != "00"))    // TODO: find better way of checking that this isn't set/valid
                {
                    sb.Clear();
                    sb.Append(ImageFilesHome);

                    string modifierIconNameWithFolder =
                        GetModfierIconNameWithFolder(ref milSymbol, 1);

                    sb.Append(modifierIconNameWithFolder);
                    milSymbol.GraphicLayers.Add(sb.ToString());
                }

                // Main Icon Modfier 2
                if (!string.IsNullOrEmpty(milSymbol.Id.SecondModifier) &&
                    (milSymbol.Id.SecondModifier != "00"))    // TODO: find better way of checking that this isn't set/valid
                {
                    sb.Clear();
                    sb.Append(ImageFilesHome);

                    string modifierIconNameWithFolder =
                        GetModfierIconNameWithFolder(ref milSymbol, 2);

                    sb.Append(modifierIconNameWithFolder);
                    milSymbol.GraphicLayers.Add(sb.ToString());
                }

                // Echelon/Mobility Modifier
                if (milSymbol.Id.EchelonMobility != EchelonMobilityType.NoEchelonMobility)
                {
                    string echelonIconNameWithFullPath =
                        GetEchelonIconNameWithFullPath(
                            milSymbol.Id.SymbolSet,
                            milSymbol.Id.Affiliation,
                            milSymbol.Id.EchelonMobility);

                    if (echelonIconNameWithFullPath.Length > 0)
                    {
                        milSymbol.GraphicLayers.Add(echelonIconNameWithFullPath);
                    }
                }

                // Headquarters/TF/FD Modifier
                if (milSymbol.Id.HeadquartersTaskForceDummy !=
                    HeadquartersTaskForceDummyType.NoHQTFDummyModifier)
                {
                    string hqTfFdIconNameWithFullPath =
                        GetHqTfFdIconNameWithFullPath(
                            milSymbol.Id.SymbolSet,
                            milSymbol.Id.Affiliation,
                            milSymbol.Id.HeadquartersTaskForceDummy);

                    if (hqTfFdIconNameWithFullPath.Length > 0)
                    {
                        milSymbol.GraphicLayers.Add(hqTfFdIconNameWithFullPath);
                    }
                }

                // Other? ex. "Land unit icons – special entity subtypes"
            } // end skipRemainingLayers

            //TODO: look at the layers to see if any do not exist:
            foreach (string graphicLayer in milSymbol.GraphicLayers)
            {
                if (!System.IO.File.Exists(graphicLayer))
                {
                    System.Diagnostics.Trace.WriteLine("SetMilitarySymbolGraphicLayers: Could not find layer: " + graphicLayer);
                }
            }

            if (milSymbol.GraphicLayers.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public static string GetMainIconName(ref MilitarySymbol milSymbol)
        {
            string mainIcon = GetMainIconName(milSymbol.Id.SymbolSet, milSymbol.Id.FullEntityCode);

            return(mainIcon);
        }
Beispiel #12
0
        /// <summary>
        /// Search based on the one or more attributes supplied
        /// </summary>
        public List <MilitarySymbol> GetMilitarySymbols(SymbolSetType symbolSet,
                                                        StandardIdentityAffiliationType affiliation = StandardIdentityAffiliationType.Unknown,
                                                        string entityNameString        = "", string entityTypeNameString = "",
                                                        string entitySubTypeNameString = "", bool exactEntityMatchOnly   = false)
        {
            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;

            // Check that search returned something
            int 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
            }

            ////////////////////////////////////////////////////////////////
            // 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 entityPart        = row["Entity"] as string;
                string entityTypePart    = row["EntityType"] as string;
                string entitySubTypePart = row["EntitySubType"] as string;

                MilitarySymbol createSymbol = CreateSymbolFromStringProperties(symbolSet,
                                                                               affiliation, symbolSetString, entityCode, geoType,
                                                                               entityPart, entityTypePart, entitySubTypePart);

                symbolList.Add(createSymbol);
            }

            return(symbolList);
        }
Beispiel #13
0
        /// <summary>
        /// Creates a symbol by looking up the SymbolSet + 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)
        {
            if (EntityTable == null)
            {
                return(null);
            }

            var results = from row in EntityTable.AsEnumerable()
                          where ((row.Field <string>("EntitySubType").Contains(entityName)
                                  | (row.Field <string>("EntitySubType").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 entityPart        = row["Entity"] as string;
                string entityTypePart    = row["EntityType"] as string;
                string entitySubTypePart = row["EntitySubType"] as string;

                retSymbol = CreateSymbolFromStringProperties(symbolSet,
                                                             affiliation, symbolSetString, entityCode, geoType,
                                                             entityPart, entityTypePart, entitySubTypePart);

                // TODO: figure out what to do if we get more than 1 result
                break;
            }

            return(retSymbol);
        }