private void updatePictureBox() { if (!currentSymbol.Id.IsValid) { return; } MilitarySymbolToGraphicLayersMaker.SetMilitarySymbolGraphicLayers(ref currentSymbol); // Debug in case drawing layers crazed: // System.Diagnostics.Trace.WriteLine("MilitarySymbol State After SetMilitarySymbolGraphicLayers : "); // System.Diagnostics.Trace.WriteLine(this.currentSymbol); if (currentSymbol.GraphicLayers.Count == 0) { System.Diagnostics.Trace.WriteLine("WARNING: No Graphic Layers to Draw"); return; } SvgSymbol.ImageSize = new Size(pbPreview.Width, pbPreview.Height); pbPreview.Image = SvgSymbol.GetBitmap(currentSymbol.GraphicLayers); // Set the Combo Box with the layers cbLayers.Items.Clear(); int layerNumber = 0; foreach (string graphicLayer in currentSymbol.GraphicLayers) { layerNumber++; string simpleLayer = layerNumber.ToString() + ":" + graphicLayer.Replace(MilitarySymbolToGraphicLayersMaker.ImageFilesHome, " "); if (!System.IO.File.Exists(graphicLayer)) { simpleLayer = "[MISSING]:" + simpleLayer; } cbLayers.Items.Add(simpleLayer); } cbLayers.SelectedIndex = 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); }