Ejemplo n.º 1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if ((destinationType == typeof(System.String)) &&
                (value is Piston))
            {
                Piston _piston = (Piston)value;
                return(_piston.ToString());
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets a cilinder based on given parameters.
 /// </summary>
 /// <param name="_cycle">The type of the cycle for the cylinder.</param>
 /// <param name="_bore_mm">The displacement of the cylinder, in cubic centimeters.</param>
 /// <param name="_stroke_mm">The displacement of the cylinder, in cubic centimeters.</param>
 public static Cylinder FromParameters(Cycle _cycle, double _bore_mm, double _stroke_mm)
 {
     return(new Cylinder(
                _cycle,
                Piston.FromParameters(
                    _bore_mm,
                    Piston.DefaultPiston.Mass_g),
                ConnectingRod.FromParameters(
                    ConnectingRod.DefaultConnectingRod.Mass_g,
                    _stroke_mm * EngineDesigner.Machine.Properties.Settings.Default.DefaultConnectingRodLengthVsStroke), //to je ena taka smiselna dolžina ojnice
                CrankThrow.FromParameters(_stroke_mm / 2d)));
 }
Ejemplo n.º 3
0
        public override bool Equals(object obj)
        {
            if (obj is Piston)
            {
                Piston _piston = (Piston)obj;

                if (this.guid.ToString() == _piston.guid.ToString())
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(base.Equals(obj));
        }
Ejemplo n.º 4
0
        private Cylinder(bool _skipValidation, Cycle _cycle, Piston _piston, ConnectingRod _connectingRod, CrankThrow _crankThrow)
        {
            this.cycle         = _cycle;
            this.piston        = _piston;
            this.connectingRod = _connectingRod;
            this.crankThrow    = _crankThrow;


            if (!_skipValidation)
            {
                this.Validate();
            }
#if IPART_ALWAYS_VALIDATE
            this.Validate();
#endif


            this.piston.Validated        += new IPartDelegate(this.IPart_Validated);
            this.connectingRod.Validated += new IPartDelegate(this.IPart_Validated);
            this.crankThrow.Validated    += new IPartDelegate(this.IPart_Validated);
        }
Ejemplo n.º 5
0
 /// <param name="_cycle">The cylinder's working cycle.</param>
 /// <param name="_piston">The piston unit to be used with this cylinder.</param>
 /// <param name="_connectingRod">The connecting rod unit to be used with this cylinder.</param>
 /// <param name="_crankThrow">The crank throw unit to be used with this cylinder.</param>
 public Cylinder(Cycle _cycle, Piston _piston, ConnectingRod _connectingRod, CrankThrow _crankThrow)
     : this(false, _cycle, _piston, _connectingRod, _crankThrow)
 {
 }