예제 #1
0
 /// <summary>
 /// Sets the standard line brush.
 /// </summary>
 /// <param name="lineBrush">
 /// The line brush to be used as the standard.
 /// </param>
 private void SetLines(Brush lineBrush)
 {
     // Standard calls for black lines and black text
     this.line = MilBrush.GetLinePresent(MilBrush.Black);
     if (lineBrush != null)
     {
         this.line = new Style(typeof(Shape))
         {
             BasedOn = this.line
         };
         this.line.Setters.Add(new Setter(Shape.StrokeProperty, lineBrush));
     }
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MilSymbolBase"/> class.
        /// </summary>
        /// <param name="symbolCode">
        /// The symbol code for this symbol.
        /// </param>
        /// <param name="lineBrush">
        /// An optional line brush for outlining the symbol.
        /// </param>
        /// <param name="fillBrush">
        /// An optional fill brush for filling the symbol's background.
        /// </param>
        public MilSymbolBase(string symbolCode, Brush lineBrush, Brush fillBrush)
        {
            if (symbolCode == null)
            {
                this.empty = true;
                return;
            }

            string stencil = CodeToStencil(symbolCode);

            if (MilAppendix.NoTemplate(stencil))
            {
                this.empty = true;
                return;
            }

            this.DataContext = this;

            // Will need to treat weather and tactical graphics carefully
            int schemeKey = CodingScheme.GetCode(symbolCode);

            if (schemeKey == CodingScheme.Weather)
            {
                // These symbols can change color - so we bind to Line and Fill
                if (symbolCode.StartsWith("WAS-WSTS"))
                {
                    if (lineBrush == null)
                    {
                        lineBrush = MilBrush.Rust;
                    }

                    if (fillBrush == null)
                    {
                        fillBrush = MilBrush.Rust;
                    }

                    this.SetLines(lineBrush);
                    this.SetLineFills(lineBrush, fillBrush);
                }

                this.Template = SymbolData.GetControlTemplate(stencil); // gets the template - the main thing
                this.empty    = this.Template == null;
                if (!this.empty)
                {
                    this.SetLimits(symbolCode);
                }

                return;
            }

            // If the standard identity (StandardIdentity) is some type of pending, we'll need the
            // anticipated (dashhed) outline for the frame.
            this.needDashed = SymbolData.IsDashed(symbolCode);

            // There are occasions when we need a line style that matches affiliation and present
            int  dimensionKey = CategoryBattleDimension.GetCode(symbolCode);
            bool needUnframed =
                schemeKey == CodingScheme.TacticalGraphics ||
                dimensionKey == CategoryBattleDimension.BdOther ||
                (schemeKey == CodingScheme.Warfighting &&
                 dimensionKey == CategoryBattleDimension.BdSubsurface);

            if (needUnframed)
            {
                this.unframedLine = MilBrush.GetLinePresent(MilBrush.FindColorScheme(symbolCode));
                this.SetUnframedLines(lineBrush);
            }

            this.SetLines(lineBrush);

            // Get a brush style if user didn't specify
            if (fillBrush == null)
            {
                fillBrush = MilBrush.FindColorScheme(symbolCode);
            }

            if (needUnframed)
            {
                this.SetUnframedLineFills(fillBrush);
            }

            this.SetLineFills(lineBrush, fillBrush);

            this.Template = SymbolData.GetControlTemplate(stencil); // gets the template - the main thing
            this.empty    = this.Template == null;
            if (!this.empty)
            {
                this.SetLimits(symbolCode);
            }
        }