Exemple #1
0
 public DaggerPinLegendElement this[Type t]
 {
     get
     {
         if (_pins.ContainsKey(t))
         {
             return(_pins[t]);
         }
         else
         {
             return(_defaultPin);
         }
     }
     set
     {
         if (t == typeof(object))
         {
             _defaultPin = value;
         }
         else
         {
             _pins.Add(t, value);
         }
     }
 }
Exemple #2
0
        internal DaggerPinLegendElement(DaggerPinLegendElement copyFrom, Color pinColor)
        {
            _noodleColor = pinColor;
            _pinSize     = copyFrom._pinSize;

            _inputPinImageConnected     = CopyAndRecolorBitmap(copyFrom._inputPinImageConnected, Color.Red, copyFrom._pinSize, pinColor);
            _inputPinImageDisconnected  = CopyAndRecolorBitmap(copyFrom._inputPinImageDisconnected, Color.Red, copyFrom._pinSize, pinColor);
            _outputPinImageConnected    = CopyAndRecolorBitmap(copyFrom._outputPinImageConnected, Color.Red, copyFrom._pinSize, pinColor);
            _outputPinImageDisconnected = CopyAndRecolorBitmap(copyFrom._outputPinImageDisconnected, Color.Red, copyFrom._pinSize, pinColor);

            //create the regions
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageDisconnected, _pinOutputDisconnectedTrans, ref _outputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageConnected, _pinOutputConnectedTrans, ref _outputPinRegionConnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageDisconnected, _pinInputDisconnectedTrans, ref _inputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageConnected, _pinInputConnectedTrans, ref _inputPinRegionConnected);
        }
Exemple #3
0
        internal DaggerPinLegendElement(int pinsize, Bitmap InputNotConnected, Bitmap InputConnected, Bitmap OutputNotConnected, Bitmap OutputConnected, Color pinColor, Color transparenceKey)
        {
            _noodleColor = pinColor;
            _pinSize     = pinsize;

            _inputPinImageConnected     = CopyAndRecolorBitmap(InputConnected, transparenceKey, pinsize, pinColor);
            _inputPinImageDisconnected  = CopyAndRecolorBitmap(InputNotConnected, transparenceKey, pinsize, pinColor);
            _outputPinImageConnected    = CopyAndRecolorBitmap(OutputConnected, transparenceKey, pinsize, pinColor);
            _outputPinImageDisconnected = CopyAndRecolorBitmap(OutputNotConnected, transparenceKey, pinsize, pinColor);

            //create the regions
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageDisconnected, _pinOutputDisconnectedTrans, ref _outputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageConnected, _pinOutputConnectedTrans, ref _outputPinRegionConnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageDisconnected, _pinInputDisconnectedTrans, ref _inputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageConnected, _pinInputConnectedTrans, ref _inputPinRegionConnected);
        }
Exemple #4
0
        /// <summary>
        /// Constructor to create default pin images
        /// </summary>
        /// <param name="pinSize"></param>
        /// <param name="color"></param>
        internal DaggerPinLegendElement(int pinSize, Color color)
        {
            _noodleColor = color;
            _pinSize     = pinSize;

            //create default pin images and calculate the regions
            Brush b = new SolidBrush(color);

            _inputPinImageConnected = new Bitmap(pinSize, pinSize);
            Graphics g = Graphics.FromImage(_inputPinImageConnected);

            g.Clear(Color.Red);
            g.FillEllipse(b, 0, 0, pinSize - 1, pinSize - 1);
            g.DrawEllipse(Pens.Black, 0, 0, pinSize - 1, pinSize - 1);
            g.Dispose();

            _inputPinImageDisconnected = new Bitmap(pinSize, pinSize);
            g = Graphics.FromImage(_inputPinImageDisconnected);
            g.Clear(Color.Red);
            g.FillEllipse(b, 0, 0, pinSize - 1, pinSize - 1);
            g.DrawEllipse(Pens.Black, 0, 0, pinSize - 1, pinSize - 1);
            int center = pinSize / 2;

            g.DrawRectangle(Pens.Black, center - 1, center - 1, 2, 2);
            g.Dispose();

            b.Dispose();

            //copy them to the output pin images
            _outputPinImageConnected    = (Bitmap)_inputPinImageConnected.Clone();
            _outputPinImageDisconnected = (Bitmap)_inputPinImageDisconnected.Clone();

            //create the regions
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageDisconnected, _pinOutputDisconnectedTrans, ref _outputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_outputPinImageConnected, _pinOutputConnectedTrans, ref _outputPinRegionConnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageDisconnected, _pinInputDisconnectedTrans, ref _inputPinRegionDisconnected);
            DaggerPinLegendElement.CalculatePinRegion(_inputPinImageConnected, _pinInputConnectedTrans, ref _inputPinRegionConnected);
        }
Exemple #5
0
 public void AddPinType(Type copyType, Type newType, Color pinColor)
 {
     this[newType] = new DaggerPinLegendElement(this[copyType], pinColor);
 }
Exemple #6
0
 public void AddPinType(Type t, Bitmap InputNotConnected, Bitmap InputConnected, Bitmap OutputNotConnected, Bitmap OutputConnected, Color pinColor, Color transparencyKey)
 {
     this[t] = new DaggerPinLegendElement(_pinSize, InputNotConnected, InputConnected, OutputNotConnected, OutputConnected, pinColor, transparencyKey);
 }
Exemple #7
0
 public void AddPinType(Type t, Color color)
 {
     this[t] = new DaggerPinLegendElement(_pinSize, color);
 }
Exemple #8
0
 public DaggerPinLegend(int pinSize)
 {
     _pins       = new Dictionary <Type, DaggerPinLegendElement>();
     _pinSize    = pinSize;
     _defaultPin = new DaggerPinLegendElement(pinSize, Color.LightGray);
 }