Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit e4440ea9 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

Merge pull request #516 in VECTO/vecto-sim from...

Merge pull request #516 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-579-vecto-gui-crashes-null-reference to master

* commit '99023f22':
  declarationdataadapter: write wheels dimenstion string to axle data
  add validation of tyre dimension (declaration mode)
  check if a wheel dimension is selected
parents 2b226a27 99023f22
Branches
Tags
No related merge requests found
......@@ -64,7 +64,7 @@ Public Class VehicleAxleDialog
.RollResistanceCoefficient = TbRRC.Text.ToDouble(0),
.TyreTestLoad = TbFzISO.Text.ToDouble(0).SI(Of Newton)(),
.TwinTyres = CbTwinT.Checked,
.WheelsDimension = CbWheels.SelectedItem.ToString(),
.WheelsDimension = If(IsNothing(CbWheels.SelectedItem), "", CbWheels.SelectedItem.ToString()),
.Inertia = TbI_wheels.Text.ToDouble(0).SI(Of KilogramSquareMeter)()
}
......
......@@ -133,7 +133,8 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
TwinTyres = DeclarationData.Trailer.TwinTyres,
RollResistanceCoefficient = DeclarationData.Trailer.RollResistanceCoefficient,
TyreTestLoad = DeclarationData.Trailer.TyreTestLoad.SI<Newton>(),
Inertia = trailerWheel.Inertia
Inertia = trailerWheel.Inertia,
WheelsDimension = trailerWheel.WheelType
}));
}
retVal.AxleData = axleData;
......
......@@ -29,6 +29,7 @@
* Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
*/
using System;
using System.ComponentModel.DataAnnotations;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
......@@ -36,6 +37,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data;
namespace TUGraz.VectoCore.Models.Declaration
{
[CustomValidation(typeof(Axle), "ValidateAxleData")]
public class Axle : SimulationComponentData
{
public string WheelsDimension { get; internal set; }
......@@ -55,5 +57,18 @@ namespace TUGraz.VectoCore.Models.Declaration
public bool TwinTyres { get; internal set; }
public AxleType AxleType { get; internal set; }
public static ValidationResult ValidateAxleData(Axle axle, ValidationContext validationContext)
{
var execMode = GetExecutionMode(validationContext);
if (execMode == ExecutionMode.Engineering)
return ValidationResult.Success;
try {
DeclarationData.Wheels.Lookup(axle.WheelsDimension);
} catch (Exception) {
return new ValidationResult(string.Format("Unknown Tyre dimenstion '{0}'", axle.WheelsDimension));
}
return ValidationResult.Success;
}
}
}
......@@ -419,7 +419,7 @@ namespace TUGraz.VectoCore.OutputData.XML
private string CreateIdString(string id)
{
var regexp = new Regex("[^a-zA-Z0-9_-]");
var regexp = new Regex("[^a-zA-Z0-9_.-]");
return regexp.Replace(id, "");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment