/*
* Created by Ranorex
* User: rodriqu_dd
* Date: 16/05/2022
* Time: 16:25
*
* To change this template use Tools > Options > Coding > Edit standard headers.
*/
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;
namespace Ranorex_Automation_Helpers.UserCodeCollections
{
///
/// Description of FailureMechanismsHelpers.
///
public class Section
{
public Section()
{
this.CalculationFailureProbPerSection ="-";
this.AssemblyGroup = "";
this.Nvak = Double.NaN;
}
///
/// Label for the combined assessment of the section (Iv, IIv, IIIv, ...)
///
public string AssemblyGroup {get; set;}
///
/// Probability associated to the combined assessment of the section (it exists for some FMs).
///
public string CalculationFailureProbPerSection {get; set;}
///
/// The name of the section (vak).
///
public string Name {get; set;}
///
/// The distance along the reference line at which the setion starts.
///
public double StartDistance {get; set;}
///
/// The distance along the reference line at which the setion ends.
///
public double EndDistance {get; set;}
///
/// The length of the section along the reference line.
///
public double Length {get; set;}
///
/// The value of the parameter NVak, if it exists.
///
public double Nvak {get; set;}
}
public class FailureMechanismResultInformation
{
public FailureMechanismResultInformation()
{
this.SectionList = new List();
this.FailureProbability = "-";
}
///
/// Label of the FM
///
public string Label{get; set;}
public string AssemblyGroup {get; set;}
///
/// The probability assigned to the entire traject assessment, if this value exists.
///
public string FailureProbability {get; set;}
public List SectionList {get; set;}
}
public class TrajectResultInformation
{
public TrajectResultInformation()
{
ListFMsResultInformation = new List();
UpperLimitsSecurityBoundaries = new List();
}
public List ListFMsResultInformation {get; set;}
public List UpperLimitsSecurityBoundaries {get; set;}
public static TrajectResultInformation BuildAssessmenTrajectInformation(string trajectAssessmentInformationString)
{
TrajectResultInformation trajectAssessmentInformation;
if (trajectAssessmentInformationString=="") {
trajectAssessmentInformation = new TrajectResultInformation();
} else {
var error = false;
trajectAssessmentInformation = JsonConvert.DeserializeObject(trajectAssessmentInformationString, new JsonSerializerSettings
{
Error = (s, e) =>
{
error = true;
e.ErrorContext.Handled = true;
}
}
);
if (error==true) {
Report.Log(ReportLevel.Error, "error unserializing json string for trajectAssessmentInformationString: " + trajectAssessmentInformationString);
}
}
return trajectAssessmentInformation;
}
}
}