/// <summary> /// Always generates the entire symbol. /// The symbol code should not change very often. /// </summary> private void GenerateSymbol() { try { // Only draw after we have the symbol code, if drawing via method call if (this.suppressRefresh) { return; } string symbolCode = this.SymbolCode; // Reinitialize this.IsDirty = true; // set a dirty flag to indicate the symbol needs updating this.bounds = Rect.Empty; this.BaseRect = Rect.Empty; this.Children.Clear(); // tried to cheap this one out - but that doesn't work well this.elements.Clear(); // Get the base symbol from "the" resource dictionary var baseSymbol = new MilSymbolBase(symbolCode, this.LineBrush, this.FillBrush); if (baseSymbol.Empty) { return; } this.AddChild("Base", baseSymbol); var styles = MilLabels.GetStyles(this.LabelStyle); // There is only label decoration for weather codes int schemeKey = CodingScheme.GetCode(symbolCode); if (schemeKey == CodingScheme.Weather || schemeKey == CodingScheme.TacticalGraphics) { this.GenerateLabels(styles); return; } // Add in the echelon marking. // "high" is the maximum height from the decoration this.high = Echelon.Generate(this, symbolCode); // Draw headquarters, feint dummy, task force, and installation. // "high" is the maximum height from the decoration this.high = MilHats.Generate(this, symbolCode); // Take care of any Joker, Faker, or Exercise character this.AddChild( "JFE", MilLabels.GenerateJokerFakerExercise(symbolCode, this.labels, styles[MilLabels.BigLabels])); // Add the black ribbon on the base symbol for space this.AddChild("Space", MilSymbolBase.GenerateSpace(symbolCode)); // Indicate whether the entity is damaged or destroyed this.AddChild("OC", StatusOperationalCapacity.Generate(symbolCode)); // Add the mobility to the base of the symbol this.AddChild("Mobility", DrawMobility.GenerateMobility(symbolCode)); // We have to (re)generate the labels because the symbol code extent may be different this.GenerateLabels(styles); } catch (Exception ex) { Log.WriteMessage(LogLevel.Error, "Unable to construct military symbol", ex); } }