Exemplo n.º 1
0
        public static bool HasFrame(SymbolSetType symbolSet, string entityCode = "")
        {
            bool hasFrame = false;

            switch (symbolSet)
            {
            case SymbolSetType.Control_Measures:
            case SymbolSetType.Atmospheric:
            case SymbolSetType.Oceanographic:
            case SymbolSetType.Meteorological_Space:
            case SymbolSetType.Special_Cases:
                hasFrame = false;
                break;

            case SymbolSetType.Sea_Surface:
                if (entityCode == "150000")     // exception case - ownship
                {
                    hasFrame = false;
                }
                else
                {
                    hasFrame = true;
                }
                break;

            default:
                hasFrame = true;
                break;
            }

            return(hasFrame);
        }
        // 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());
        }
Exemplo n.º 3
0
        // Center/Main Icon Modifiers: { # = 1 | 2 }, format =
        // Appendices\{SymbolSetTypeName}\Mod{#}\{SymbolSetType} + {ModifierCode} + {#}
        public static string GetModfierIconNameWithFolder(SymbolSetType symbolSet, int modifierNumber, int modifierCodeInt)
        {
            StringBuilder sb = new StringBuilder();

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

            string sSubFolderName = "mod" + modifierNumber.ToString();

            string currentAppendixHome = GetIconFolderName(symbolSet);

            sb.Append(currentAppendixHome);

            sb.Append(sSubFolderName);
            sb.Append(System.IO.Path.DirectorySeparatorChar);

            string modifierIcon = GetModfierIconName(symbolSet, modifierNumber, modifierCodeInt);

            sb.Append(modifierIcon);

            sb.Append(ImageSuffix);

            return(sb.ToString());
        }
        public List <string> GetDistinctModifierNames(SymbolSetType symbolSet, int modfierNumber = 1)
        {
            Initialize();

            List <string> distinctResultStrings = new List <string>();

            if (ModifierTable == null)
            {
                return(distinctResultStrings); // nothing
            }
            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            string modifierToSearch = modfierNumber.ToString();

            var results = (from row in ModifierTable.AsEnumerable()
                           where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                  & (row.Field <string>("ModifierNumber") == modifierToSearch))
                           select row.Field <string>("Name")).Distinct();

            foreach (var result in results)
            {
                distinctResultStrings.Add(result);
            }

            return(distinctResultStrings);
        }
Exemplo n.º 5
0
        public static string GetWellFormedName(SymbolSetType symbolSet, string entityPart,
                                               string entityTypePart, string entitySubTypePart)
        {
            string symbolSetName = symbolSet.ToString().Replace("_", " ");

            StringBuilder nameBuilder = new StringBuilder();

            if (!string.IsNullOrEmpty(symbolSetName) && symbolSetName.Length > 0)
            {
                nameBuilder.Append(symbolSetName);
            }

            if (!string.IsNullOrEmpty(entityPart) && entityPart.Length > 0)
            {
                nameBuilder.Append(TypeUtilities.NameSeparator);
                nameBuilder.Append(entityPart);
            }

            if (!string.IsNullOrEmpty(entityTypePart) && entityTypePart.Length > 0)
            {
                nameBuilder.Append(TypeUtilities.NameSeparator);
                nameBuilder.Append(entityTypePart);
            }

            if (!string.IsNullOrEmpty(entitySubTypePart) && entitySubTypePart.Length > 0)
            {
                nameBuilder.Append(TypeUtilities.NameSeparator);
                nameBuilder.Append(entitySubTypePart);
            }

            return(nameBuilder.ToString());
        }
Exemplo n.º 6
0
        public static string GetModfierIconName(SymbolSetType symbolSet, int modifierNumber, int modifierCodeInt)
        {
            StringBuilder sb = new StringBuilder();

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

            string sModifierNumber = modifierNumber.ToString();

            string modifierCode = modifierCodeInt.ToString();

            // this one has to be 2 chars:
            if (modifierCode.Length < 2)
            {
                modifierCode = modifierCode.PadLeft(2, '0');
            }

            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            string modifierIcon = symbolSetString + modifierCode + sModifierNumber;

            sb.Append(modifierIcon);

            return(sb.ToString());
        }
Exemplo n.º 7
0
        private static void PrintModifierSimple(SymbolSetType symbolSet, int modifierNumber, int modifierCode, string modifierName)
        {
            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            string sModifierCode = modifierCode.ToString();

            // this one has to be 2 chars:
            if (sModifierCode.Length < 2)
            {
                sModifierCode = sModifierCode.PadLeft(2, '0');
            }

            string fullModifierName = symbolSet.ToString() + TypeUtilities.NameSeparator +
                                      "Modifier " + modifierNumber.ToString() + TypeUtilities.NameSeparator +
                                      modifierName;

            string modifierIconName = MilitarySymbolToGraphicLayersMaker.GetModfierIconName(
                symbolSet, modifierNumber, modifierCode);

            string modifierIconNameWithFolder = MilitarySymbolToGraphicLayersMaker.GetModfierIconNameWithFolder(
                symbolSet, modifierNumber, modifierCode);

            string nameAsTags = fullModifierName.Replace(TypeUtilities.NameSeparator, ";");

            string tags = nameAsTags + ";" + modifierIconNameWithFolder + ";" +
                          fullModifierName + ";" + modifierIconName;

            Console.WriteLine(modifierCode + "," + symbolSet + "," + symbolSetString
                              + "," + modifierNumber.ToString() + "," + sModifierCode
                              + "," + modifierIconNameWithFolder
                              + "," + fullModifierName
                              + "," + modifierIconName
                              + "," + tags);
        }
Exemplo n.º 8
0
        // 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());
        }
        /// <summary>
        /// Returns all symbols within a symbol set (affiliation will be set to Unknown)
        /// </summary>
        /// <param name="symbolSet">(symbolSet == NotSet) returns all symbols</param>
        /// <returns></returns>
        public static List <MilitarySymbol> GetMilitarySymbols(SymbolSetType symbolSet = SymbolSetType.NotSet)
        {
            SymbolLookup milSymbolLookup = GetSymbolLookup();

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

            return(matchingSymbols);
        }
        public bool GetEntityNamesFromCode(SymbolSetType symbolSet, string entityCode,
                                           out string entityName, out string entityTypeName, out string entitySubTypeName)
        {
            Initialize();

            entityName        = string.Empty;
            entityTypeName    = string.Empty;
            entitySubTypeName = string.Empty;

            if ((EntityTable == null) || (symbolSet == SymbolSetType.NotSet) ||
                (entityCode == "000000") || entityCode.Length != 6)
            {
                return(false);
            }

            string entityCodeToSearch = entityCode;

            if (symbolSet == SymbolSetType.Land_Unit)
            {
                // See SymbolIdCode.IsLandUnitSpecialEntity for explanation of this exceptional case
                string entitySubType = entityCode.Substring(4, 2);
                if (TypeUtilities.EntitySubtypeCodeToLandUnitSpecialEntityName.Keys.Contains(entitySubType))
                {
                    entityCodeToSearch = entityCode.Substring(0, 4) + "00";
                }
            }

            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            var results = from row in EntityTable.AsEnumerable()
                          where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                 & (row.Field <string>("Code") == entityCodeToSearch))
                          select row;

            int resultCount = results.Count();

            if (resultCount < 1)
            {
                System.Diagnostics.Trace.WriteLine("Entity Code not found: " + entityCode);
                return(false);
            }

            foreach (DataRow row in results)
            {
                entityName        = row["Entity"] as string;
                entityTypeName    = row["EntityType"] as string;
                entitySubTypeName = row["EntitySubType"] as string;

                // We only care about the 1st result
                break;
            }

            return(true);
        }
        public IntSet Decode(IntSet blocks)
        {
            var result = SymbolSetType.Mutable();

            foreach (int symbol in blocks)
            {
                result.AddAll(Decode(symbol));
            }

            return(result);
        }
        public string GetEntityCode(SymbolSetType symbolSet, string entityNameString,
                                    string entityTypeNameString = "", string entitySubTypeNameString = "")
        {
            Initialize();

            if (EntityTable == null)
            {
                return(string.Empty);
            }

            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            var results = from row in EntityTable.AsEnumerable()
                          where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                 & (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;
            }

            int resultCount = results.Count();

            if (resultCount < 1)
            {
                System.Diagnostics.Trace.WriteLine("Entity Name not found: " + entityNameString);
                return(string.Empty);
            }

            string entityCode = string.Empty;

            foreach (DataRow row in results)
            {
                entityCode = row["Code"] as string;

                // We only care about the 1st result
                break;
            }

            return(entityCode);
        }
Exemplo n.º 13
0
        // same as ImageFilesHome + GetModfierIconNameWithFolder
        public static string GetModfierIconNameWithFullPath(SymbolSetType symbolSet, int modifierNumber, int modifierCodeInt)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(ImageFilesHome);

            string modifierIconNameWithoutImageFilesHome = GetModfierIconNameWithFolder(
                symbolSet, modifierNumber, modifierCodeInt);

            sb.Append(modifierIconNameWithoutImageFilesHome);

            return(sb.ToString());
        }
Exemplo n.º 14
0
        public static bool IsWeather(SymbolSetType symbolSet)
        {
            bool isWeather = false;

            switch (symbolSet)
            {
            case SymbolSetType.Atmospheric:
            case SymbolSetType.Oceanographic:
            case SymbolSetType.Meteorological_Space:
                isWeather = true;
                break;
            }

            return(isWeather);
        }
        public CentralIconType GetEntityIconTypeFromCode(SymbolSetType symbolSet, string entityCode)
        {
            Initialize();

            if ((EntityTable == null) || (symbolSet == SymbolSetType.NotSet) ||
                (entityCode == "000000") || entityCode.Length != 6)
            {
                return(CentralIconType.NotSet);
            }

            string entityCodeToSearch = entityCode;

            if (symbolSet == SymbolSetType.Land_Unit)
            {
                // See SymbolIdCode.IsLandUnitSpecialEntity for explanation of this exceptional case
                string entitySubType = entityCode.Substring(4, 2);
                if (TypeUtilities.EntitySubtypeCodeToLandUnitSpecialEntityName.Keys.Contains(entitySubType))
                {
                    entityCodeToSearch = entityCode.Substring(0, 4) + "00";
                }
            }

            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            var results = from row in EntityTable.AsEnumerable()
                          where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                 & (row.Field <string>("Code") == entityCodeToSearch))
                          select row;

            int resultCount = results.Count();

            if (resultCount < 1)
            {
                System.Diagnostics.Trace.WriteLine("Entity Code not found: " + entityCode);
                return(CentralIconType.NotSet);
            }

            CentralIconType iconFormat = CentralIconType.NotSet;

            foreach (DataRow row in results)
            {
                string centralIconTypeString = row["IconType"] as string;
                iconFormat = (CentralIconType)TypeUtilities.EnumHelper.getEnumFromString(typeof(CentralIconType), centralIconTypeString);
                break;
            }

            return(iconFormat);
        }
Exemplo n.º 16
0
        public static string GetMainIconName(SymbolSetType symbolSet, string fullEntityCode)
        {
            if (fullEntityCode.Length != 6)
            {
                return("00000000");
            }

            StringBuilder sb = new StringBuilder();

            string symbolSetString = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            sb.Append(symbolSetString);
            sb.Append(fullEntityCode);

            return(sb.ToString());
        }
Exemplo n.º 17
0
        /// <summary>
        /// Checks if an entity code exists in the table and therefore is valid
        /// </summary>
        public static bool IsEntityCodeValid(SymbolSetType symbolSet, string entityCode)
        {
            SymbolLookup milSymbolLookup = GetSymbolLookup();

            if ((symbolSet == SymbolSetType.Unknown) ||
                (symbolSet == SymbolSetType.NotSet) ||
                (string.IsNullOrWhiteSpace(entityCode)) ||
                (entityCode.Length != 6))
            {
                return(false);
            }

            // if it can't find a shape for the symbol then (presumably) it doesn't exist
            return(milSymbolLookup.GetEntityShapeFromCode(symbolSet, entityCode)
                   != ShapeType.Unknown);
        }
        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());
        }
Exemplo n.º 19
0
        // 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());
        }
Exemplo n.º 20
0
        // 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());
        }
Exemplo n.º 21
0
        // IMPORTANT: If you don't have the expected SVG Files, in the expected folder format
        //            then this class will not do anything.
        // The assumed/expected Folder structure:
        // {ImageFilesHome} <--- SEE DEFINITION BELOW
        //  |- Echelon
        //  |- Frames
        //  |- Headquarters
        //  |- Appendices
        //     |- Air
        //     |- Control Measures
        //     |- Cyberspace
        //     |- Land
        // (etc.)

        public static string GetIconFolderName(SymbolSetType symbolSet)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Appendices");
            sb.Append(System.IO.Path.DirectorySeparatorChar);

            string symbolSetSubFolderName = string.Empty;

            if (TypeUtilities.SymbolSetToFolderName.ContainsKey(symbolSet))
            {
                symbolSetSubFolderName = TypeUtilities.SymbolSetToFolderName[symbolSet];
            }

            sb.Append(symbolSetSubFolderName);
            sb.Append(System.IO.Path.DirectorySeparatorChar);

            return(sb.ToString());
        }
Exemplo n.º 22
0
        // 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());
        }
        public string GetModifierCodeFromName(SymbolSetType symbolSet, int modifierNumber,
                                              string modifierNameString)
        {
            Initialize();

            if (ModifierTable == null)
            {
                return(string.Empty);
            }

            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            // assmumes that the names will be unique within a symbol set
            // if not, we will also need the modifier number as an input
            string modifierToSearch = modifierNumber.ToString();

            var results = from row in ModifierTable.AsEnumerable()
                          where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                 & (row.Field <string>("Name") == modifierNameString)
                                 & (row.Field <string>("ModifierNumber") == modifierToSearch))
                          select row;

            int resultCount = results.Count();

            if (resultCount < 1)
            {
                System.Diagnostics.Trace.WriteLine("Modifier Name not found: " + modifierNameString);
                return(string.Empty);
            }

            string modifierCode = string.Empty;

            foreach (DataRow row in results)
            {
                modifierCode = row["Code"] as string;

                // We only care about the 1st result
                break;
            }

            return(modifierCode);
        }
Exemplo n.º 24
0
        public static bool HasFrame(SymbolSetType symbolSet)
        {
            bool hasFrame = false;

            switch (symbolSet)
            {
            case SymbolSetType.Control_Measures:
            case SymbolSetType.Atmospheric:
            case SymbolSetType.Oceanographic:
            case SymbolSetType.Meteorological_Space:
                hasFrame = false;
                break;

            default:
                hasFrame = true;
                break;
            }

            return(hasFrame);
        }
Exemplo n.º 25
0
        public static bool HasFrameModifiers(SymbolSetType symbolSet)
        {
            bool hasFrameModifiers = false;

            switch (symbolSet)
            {
            case SymbolSetType.Land_Unit:
            case SymbolSetType.Land_Civilian_Unit_Organization:
            case SymbolSetType.Land_Equipment:
            case SymbolSetType.Land_Installation:
                hasFrameModifiers = true;
                break;

            default:
                hasFrameModifiers = false;
                break;
            }

            return(hasFrameModifiers);
        }
Exemplo n.º 26
0
        // 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());
        }
Exemplo n.º 27
0
        // 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());
        }
Exemplo n.º 28
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);
        }
        public string GetModifierCategoryFromName(SymbolSetType symbolSet, string modifierNameString,
                                                  int modfierNumber = 1)
        {
            Initialize();

            if (ModifierTable == null)
            {
                return(string.Empty);
            }

            string symbolSetToSearch = TypeUtilities.EnumHelper.getEnumValAsString(symbolSet, 2);

            string modifierToSearch = modfierNumber.ToString();

            var results = from row in ModifierTable.AsEnumerable()
                          where ((row.Field <string>("SymbolSet") == symbolSetToSearch)
                                 & (row.Field <string>("Name") == modifierNameString)
                                 & (row.Field <string>("ModifierNumber") == modifierToSearch))
                          select row;

            int resultCount = results.Count();

            if (resultCount < 1)
            {
                System.Diagnostics.Trace.WriteLine("Modifier Name not found: " + modifierNameString);
                return(string.Empty);
            }

            string modifierCategory = string.Empty;

            foreach (DataRow row in results)
            {
                modifierCategory = row["Category"] as string;

                // We only care about the 1st result
                break;
            }

            return(modifierCategory);
        }
Exemplo n.º 30
0
        static void ProcessAll(string symbolSetAsString)
        {
            SymbolSetType symbolSet = SymbolSetType.NotSet;

            if (symbolSetAsString.Length == 2)
            {
                symbolSet = (SymbolSetType)TypeUtilities.EnumHelper.getEnumFromHashCodeString(typeof(SymbolSetType), symbolSetAsString);
            }

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

            if (matchingSymbols.Count == 0)
            {
                Console.WriteLine("No Symbols found for Set: " + symbolSetAsString);
            }

            foreach (MilitarySymbol matchSymbol in matchingSymbols)
            {
                Console.Write("SimpleCode=" + matchSymbol.Id.HumanReadableCode());
                Console.Write(", Name=" + matchSymbol.Id.Name);
                Console.WriteLine(", Tags=" + matchSymbol.TagsAsString);

                // Unknown
                ExportSymbolId(matchSymbol.Id);

                // Export each affiliation if it has a frame
                if (TypeUtilities.HasFrame(matchSymbol.Id.SymbolSet))
                {
                    matchSymbol.Id.Affiliation = StandardIdentityAffiliationType.Friend;
                    ExportSymbolId(matchSymbol.Id);

                    matchSymbol.Id.Affiliation = StandardIdentityAffiliationType.Hostile;
                    ExportSymbolId(matchSymbol.Id);

                    matchSymbol.Id.Affiliation = StandardIdentityAffiliationType.Neutral;
                    ExportSymbolId(matchSymbol.Id);
                }
            }
        }