示例#1
0
        private static void MyAdHocTest()
        {
            /////////////////////////////////////////////////////
            // TODO: move this test code to a Unit Test Project
            /////////////////////////////////////////////////////

            SymbolIdCode sidcSpecialLandUnit = new SymbolIdCode("10121195");
            string       wfnSpecialLandUnit  = Utilities.GetWellFormedName(sidcSpecialLandUnit);


            SymbolIdCode sidc = new SymbolIdCode();

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

            sidc.Affiliation = StandardIdentityAffiliationType.Hostile;

            SymbolIdCode sidc2 = new SymbolIdCode();

            sidc2.Affiliation = StandardIdentityAffiliationType.Hostile;

            if (sidc == sidc2)
            {
                System.Diagnostics.Trace.WriteLine("pass");
            }

            sidc.Affiliation = StandardIdentityAffiliationType.Friend;

            sidc2.SymbolSet  = SymbolSetType.Control_Measures;
            sidc2.EntityCode = "110100";

            if (sidc != sidc2)
            {
                System.Diagnostics.Trace.WriteLine("pass");
            }

            string wfn = Utilities.GetWellFormedName(sidc2);

            sidc.SymbolSet   = SymbolSetType.Air;
            sidc.EntityCode  = "110131";
            sidc.ModifierOne = "01";
            sidc.ModifierTwo = "02";

            string wfn2 = Utilities.GetWellFormedName(sidc);

            MilitarySymbol ms1 = new MilitarySymbol();

            ms1.Id = SymbolIdCode.DefaultSymbolIdCode;

            MilitarySymbol ms2 = new MilitarySymbol();

            ms2.Id = new SymbolIdCode();

            if (ms1 == ms2)
            {
                System.Diagnostics.Trace.WriteLine("pass");
            }

            ms2.Id.HeadquartersTaskForceDummy = HeadquartersTaskForceDummyType.Feint_Dummy;
            if (ms1 != ms2)
            {
                System.Diagnostics.Trace.WriteLine("pass");
            }

            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);
        }