public void SetPaneState() { bool changedState = (previousPane != currentPane); bool goingBackwards = (currentPane < previousPane); if (changedState) { System.Diagnostics.Trace.WriteLine("New Pane State: " + currentPane + ", Old State = " + previousPane); if (currentPane == PaneSequenceType.AffiliationPane) { this.labCol1.Text = "Affiliation"; this.labCol2.Visible = false; this.labCol3.Visible = false; currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(StandardIdentityAffiliationType)); currentColRowIndex = 0; enableColumnButtons(1, true); setVisibilityColumnButtons(2, false); setVisibilityColumnButtons(3, false); currentColumn = 1; setColumnValues(); } else if (currentPane == PaneSequenceType.SymbolSetPane) { this.resetSymbolState(); this.labCol2.Text = "Symbol Set"; this.labCol2.Visible = true; this.labCol3.Visible = false; currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(SymbolSetType)); currentColRowIndex = 0; currentColumn = 2; enableColumnButtons(2, true); setColumnValues(); enableColumnButtons(1, false); setVisibilityColumnButtons(3, false); } else if ((currentPane == PaneSequenceType.EntityPane) || (currentPane == PaneSequenceType.EntityTypePane) || (currentPane == PaneSequenceType.EntitySubTypePane)) { this.labCol3.Text = currentPane.ToString().Replace("Pane", ""); // Entity/EntityType/etc. this.labCol3.Visible = true; if (currentPane == PaneSequenceType.EntityPane) { currentColValues = symbolLookup.GetDistinctEntries(this.currentSymbol.Id.SymbolSet); } else if (currentPane == PaneSequenceType.EntityTypePane) { currentColValues = symbolLookup.GetDistinctEntries( this.currentSymbol.Id.SymbolSet, currentEntityName); } else if (currentPane == PaneSequenceType.EntitySubTypePane) { currentColValues = symbolLookup.GetDistinctEntries( this.currentSymbol.Id.SymbolSet, currentEntityName, currentEntityTypeName); } if (currentColValues.Count == 0) { // Advance to the next/previous pane if this is empty if (goingBackwards) { currentPane--; } else { currentPane++; } resetColumn3State(); } else { currentColValues.Insert(0, NOT_SET); // add as first element } currentColRowIndex = 0; // if we are navigating backwards, and there were no entities (e.g. SpaceMet) if (currentPane != PaneSequenceType.SymbolSetPane) { currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } } else if ((currentPane == PaneSequenceType.Modifier1Pane) || (currentPane == PaneSequenceType.Modifier2Pane)) { this.labCol3.Text = currentPane.ToString().Replace("Pane", ""); this.labCol3.Visible = true; if (currentPane == PaneSequenceType.Modifier1Pane) { currentColValues = symbolLookup.GetDistinctModifierNames( this.currentSymbol.Id.SymbolSet, 1); } else if (currentPane == PaneSequenceType.Modifier2Pane) { currentColValues = symbolLookup.GetDistinctModifierNames( this.currentSymbol.Id.SymbolSet, 2); } if (currentColValues.Count == 0) { // Advance to the next/previous pane if this is empty if (goingBackwards) { currentPane--; } else { currentPane++; } resetColumn3State(); } else { currentColValues.Insert(0, NOT_SET); // Add as first element } currentColRowIndex = 0; // if we are navigating backwards, and there were no modifiers (e.g. SpaceMet) if (currentPane != PaneSequenceType.SymbolSetPane) { currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } } //////////////////////////////////////////////////////////////// // // Don't do these if non-framed // else if (currentPane == PaneSequenceType.EchelonMobilityPane) { // Don't do if Non-framed if (!TypeUtilities.HasFrame(this.currentSymbol.Id.SymbolSet)) { if (goingBackwards) { currentPane = PaneSequenceType.EntitySubTypePane; } else { currentPane = PaneSequenceType.StartOver; } resetColumn3State(); } else { this.labCol3.Text = "Echelon/Mobility"; this.labCol3.Visible = true; currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(EchelonMobilityType)); currentColRowIndex = 0; currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } } else if (currentPane == PaneSequenceType.HqTfFdPane) { this.labCol3.Text = "HQ/TF/FD"; this.labCol3.Visible = true; currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(HeadquartersTaskForceDummyType)); currentColRowIndex = 0; currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } else if (currentPane == PaneSequenceType.StatusPane) { // Don't do if non-framed if (!TypeUtilities.HasFrame(this.currentSymbol.Id.SymbolSet)) { if (goingBackwards) { currentPane = PaneSequenceType.EntitySubTypePane; } else { currentPane = PaneSequenceType.StartOver; } resetColumn3State(); } else { this.labCol3.Text = "Op Condition"; this.labCol3.Visible = true; currentColValues = TypeUtilities.EnumHelper.getEnumValuesAsStrings(typeof(StatusType)); currentColRowIndex = 0; currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } } // // End of don't do if non-framed // //////////////////////////////////////////////////////////////// else if (currentPane == PaneSequenceType.StartOver) { this.labCol3.Text = "Finished"; this.labCol3.Visible = true; currentColValues = new List <string>() { "Start Over" }; currentColRowIndex = 0; currentColumn = 3; enableColumnButtons(3, true); setColumnValues(); enableColumnButtons(1, false); enableColumnButtons(2, false); } } previousPane = currentPane; }
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); 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++; } } }
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); }
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); 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 NON-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++; } } }