Exemplo n.º 1
0
        /// <summary>
        /// Checks to see if the symbol requires a dashed outline.
        /// </summary>
        /// <param name="symbolCode">
        /// The symbol code to check.
        /// </param>
        /// <returns>
        /// A boolean to indicate whether the outline should be dashed.
        /// </returns>
        internal static bool IsDashed(string symbolCode)
        {
            if (!Check(ref symbolCode))
            {
                return(false);
            }

            switch (StandardIdentity.GetCode(symbolCode))
            {
            case StandardIdentity.Pending:
            case StandardIdentity.AssumedFriend:
            case StandardIdentity.Suspect:
            case StandardIdentity.ExercisePending:
            case StandardIdentity.ExerciseAssumedFriend:
            {
                return(true);
            }

            default:
                if (StatusOperationalCapacity.GetCode(symbolCode) == StatusOperationalCapacity.AnticipatedPlanned)
                {
                    return(true);
                }

                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Generates a static tooltip for a given symbol code.
        /// </summary>
        /// <param name="symbolCode">The symbol code which needs the tooltip.</param>
        /// <returns>A string representing a tooltip.</returns>
        private static string GenerateTooltip(string symbolCode)
        {
            var desc = new StringBuilder(MilAppendix.Description(symbolCode));

            desc.AppendLine("Affiliation: " + StandardIdentity.GetName(symbolCode));
            desc.AppendLine("Condition: " + StatusOperationalCapacity.GetName(symbolCode));
            desc.AppendLine("Order of battle: " + OrderOfBattle.GetName(symbolCode));
            desc.AppendLine("Country: " + Countries.GetName(symbolCode));
            desc.Append("Modifier: " + CombinedModifierCode.GetName(symbolCode));
            return(desc.ToString(0, desc.Length));
        }
Exemplo n.º 3
0
        public void StatusOperationalCapacityTest()
        {
            char gc = StatusOperationalCapacity.GetCode(string.Empty);

            Assert.AreEqual(gc, (char)0);
            gc = StatusOperationalCapacity.GetCode(null);
            Assert.AreEqual(gc, (char)0);
            gc = StatusOperationalCapacity.GetCode("qqqqqqqqqqqqqqq");
            Assert.AreEqual(gc, 'Q');
            string str = StatusOperationalCapacity.GetName(string.Empty);

            Assert.AreEqual(str, string.Empty);
            str = StatusOperationalCapacity.GetName(null);
            Assert.AreEqual(str, string.Empty);
            str = StatusOperationalCapacity.GetName("qqqqqqqqqqqqqqq");
            Assert.AreEqual(str, string.Empty);
            str = StatusOperationalCapacity.GetName("qqpAqqqqqqqqqqn");
            Assert.AreEqual(str, "Anticipated/Planned");
        }
Exemplo n.º 4
0
        /// <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);
            }
        }