Beispiel #1
0
 public override FrameworkElement CreateGlyph(CircuitGlyph symbol)
 {
     Tracer.Assert(this == symbol.Circuit);
     if (this.IsValidDisplay())
     {
         return(symbol.CreateDisplayGlyph(symbol));
     }
     else
     {
         return(symbol.CreateRectangularGlyph());
     }
 }
Beispiel #2
0
 public override FrameworkElement CreateGlyph(CircuitGlyph symbol)
 {
     return(symbol.CreateRectangularGlyph());
 }
Beispiel #3
0
        public override FrameworkElement CreateGlyph(CircuitGlyph symbol)
        {
            Tracer.Assert(this == symbol.Circuit);
            string skin;

            switch (this.GateType)
            {
            case GateType.Clock:
                skin = SymbolShape.Clock;
                break;

            case GateType.Odd:
            case GateType.Even:
            case GateType.Probe:
                Tracer.Fail();
                return(null);

            case GateType.Led:
                if (this.InputCount == 1)
                {
                    skin = SymbolShape.Led;
                }
                else
                {
                    Tracer.Assert(this.InputCount == 8);
                    skin = SymbolShape.SevenSegment;
                }
                break;

            default:
                if (Settings.User.GateShape == GateShape.Rectangular)
                {
                    return(symbol.CreateRectangularGlyph());
                }
                else
                {
                    switch (this.GateType)
                    {
                    case GateType.Not:
                        skin = SymbolShape.ShapedNot;
                        break;

                    case GateType.Or:
                        skin = SymbolShape.ShapedOr;
                        break;

                    case GateType.And:
                        skin = SymbolShape.ShapedAnd;
                        break;

                    case GateType.Xor:
                        skin = SymbolShape.ShapedXor;
                        break;

                    case GateType.TriState1:
                        skin = SymbolShape.ShapedTriState1;
                        break;

                    case GateType.TriState2:
                        skin = SymbolShape.ShapedTriState2;
                        break;

                    default:
                        Tracer.Fail();
                        return(null);
                    }
                    return(symbol.CreateShapedGlyph(skin));
                }
            }
            return(symbol.CreateSimpleGlyph(skin, symbol));
        }