public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if ((destinationType == typeof(System.String)) && (value is ConnectingRod)) { ConnectingRod _connectingRod = (ConnectingRod)value; return(_connectingRod.ToString()); } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <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))); }
public override bool Equals(object obj) { if (obj is ConnectingRod) { ConnectingRod _connectingRod = (ConnectingRod)obj; if (this.guid.ToString() == _connectingRod.guid.ToString()) { return(true); } else { return(false); } } return(base.Equals(obj)); }
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); }
/// <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) { }